@font-face {
  font-family: "Noto Serif SC";
  src: url("../fonts/noto-serif-sc.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f5f2eb;
  --sheet: #fffdf8;
  --ink: #1e1a16;
  --ink-soft: #5c5348;
  --rule: #d9d0c2;
  --green: #2f4a3a;
  --green-wash: #e4ebe4;
  --board: #cbb892;
  --board-edge: #a88b62;
  --focus: #2f4a3a;
  --measure: 38rem;
  --wide: 72rem;
}

* { box-sizing: border-box; }

html {
  font-size: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 8% -8%, rgba(255, 253, 248, 0.95), transparent 46%),
    radial-gradient(ellipse at 100% 0%, rgba(47, 74, 58, 0.045), transparent 42%);
  font-family: "Noto Serif SC", "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "PMingLiU", "SimSun", serif;
  font-weight: 450;
  font-size: 1.125rem;
  line-height: 1.95;
  text-autospace: normal;
  line-break: strict;
  font-synthesis: none;
}

@media (max-width: 640px) {
  body { font-size: 1.0625rem; }
}

::selection {
  background: #d5e0d4;
  color: var(--ink);
}

a {
  color: inherit;
  text-underline-offset: 0.28em;
}

a:focus-visible,
.bookspine:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--sheet);
  color: var(--ink);
  padding: 0.4rem 0.7rem;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 5;
}

.wrap {
  width: min(var(--wide), calc(100% - 2.4rem));
  margin-inline: auto;
}

@media (max-width: 640px) {
  .wrap { width: min(var(--wide), calc(100% - 1.5rem)); }
}

.mast {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1.35rem 0 0;
}

.brand {
  font-size: 0.98rem;
  text-decoration: none;
  letter-spacing: 0;
}

.brand:hover { color: var(--green); }

.domain {
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-variant-numeric: oldstyle-nums;
}

.home-head,
.book {
  width: min(var(--measure), 100%);
}

.home-head { padding-top: 2.6rem; }

h1 {
  margin: 0;
  font-weight: 640;
  font-size: clamp(2.5rem, 7vw, 4.15rem);
  line-height: 1.18;
  letter-spacing: 0;
  text-wrap: balance;
}

h1[lang="en"] {
  font-size: clamp(2.05rem, 5.4vw, 3.15rem);
  line-height: 1.16;
  letter-spacing: -0.02em;
}

.ornament {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.15rem 0 1.35rem;
}

.ornament::before,
.ornament::after {
  content: "";
  height: 1px;
  width: 4.2rem;
  background: var(--rule);
}

.ornament span {
  width: 0.38rem;
  height: 0.38rem;
  background: var(--green);
  transform: rotate(45deg);
}

.lede,
.prose p,
.bay-copy p,
.shelf-note,
.shelf-footnote,
.nook p,
.unnamed p,
.footer p,
.cross,
.byline,
.byline-sub {
  text-wrap: pretty;
}

.lede {
  margin: 0 0 1rem;
  font-size: 1.18rem;
  line-height: 1.85;
}

.home-head p,
.bay-copy p,
.shelf-note,
.shelf-footnote,
.nook p,
.unnamed p {
  margin: 0 0 0.95rem;
  color: var(--ink);
}

.home-head p { color: var(--ink); }

.kicker {
  margin: 0 0 0.45rem;
  color: var(--green);
  font-size: 0.92rem;
}

.bay {
  margin-top: 2.8rem;
  display: grid;
  grid-template-columns: auto minmax(16rem, 34rem);
  justify-content: start;
  gap: 1.6rem 3.2rem;
  align-items: end;
}

@media (max-width: 860px) {
  .bay { grid-template-columns: 1fr; gap: 1.4rem; }
}

.bay-copy h2,
.case h2,
.nook h2,
.unnamed h2 {
  margin: 0 0 0.7rem;
  font-size: 1.35rem;
  font-weight: 620;
  line-height: 1.4;
}

.enter {
  margin: 1.1rem 0 0;
}

.enter a,
.return a,
.cross a,
.prose a {
  text-decoration-line: underline;
  text-decoration-color: var(--green);
  text-decoration-thickness: 1px;
}

.case { margin-top: 3.2rem; }

.shelf-note { max-width: var(--measure); color: var(--ink-soft); }

.shelf {
  margin: 1.35rem 0 2.4rem;
}

.shelf-row {
  display: flex;
  align-items: flex-end;
  gap: 0.42rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding: 0.35rem 0.15rem 0.55rem;
  -webkit-overflow-scrolling: touch;
}

.shelf-board {
  height: 0.72rem;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(#e4d3b0, var(--board) 42%, var(--board-edge));
  box-shadow: 0 9px 16px rgba(70, 48, 22, 0.1);
}

.bookspine {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  flex: 0 0 auto;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
  transition: transform 180ms ease;
}

.bookspine:hover { transform: translateY(-8px); }

.bookspine-face {
  width: var(--w, 52px);
  min-height: var(--h, 210px);
  padding: 0.95rem 0 0.8rem;
  display: grid;
  place-items: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
  color: var(--ink-on, #f4efe4);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.1) 16%, rgba(0, 0, 0, 0.04) 48%, rgba(255, 255, 255, 0.07) 84%, rgba(0, 0, 0, 0.22)),
    var(--cloth);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
  font-size: 0.98rem;
  line-height: 1;
}

.bookspine-face.sideways {
  text-orientation: sideways;
  letter-spacing: 0.03em;
  font-size: 0.78rem;
  --w: 46px;
  --h: 248px;
}

.spine-set {
  flex-direction: column;
  align-items: center;
}

.spine-set .bookspine-face { --w: 40px; }

.set-faces {
  display: flex;
  align-items: flex-end;
  gap: 3px;
}

.set-label {
  writing-mode: horizontal-tb;
  margin-bottom: 0.28rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.2;
}

.owl-slot {
  width: 128px;
  flex: 0 0 auto;
  align-self: flex-end;
  margin-inline: 0.7rem 0.15rem;
  margin-bottom: -1px;
  scroll-snap-align: start;
}

.owl-slot img {
  display: block;
  width: 100%;
  height: auto;
}

.scroll-hint {
  display: none;
  margin: -1.2rem 0 1.6rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

@media (max-width: 720px) {
  .scroll-hint { display: block; }
}

.shelf-footnote {
  max-width: var(--measure);
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.nook {
  margin-top: 1rem;
  padding: 1.35rem 1.2rem 1.5rem;
  background: linear-gradient(180deg, rgba(47, 74, 58, 0.05), rgba(36, 30, 24, 0.03));
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  max-width: 44rem;
}

.nook-shelf {
  width: 8.5rem;
  margin-top: 0.9rem;
}

.static-spine {
  width: 48px;
  min-height: 196px;
  display: grid;
  place-items: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
  color: #f4efe4;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.28), rgba(255, 255, 255, 0.05) 30%, rgba(0, 0, 0, 0.18)),
    #3a3834;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  font-size: 0.95rem;
}

.unnamed { margin-top: 2.6rem; max-width: var(--measure); }

.unnamed-shelf { max-width: 26rem; }

.blank-row {
  display: flex;
  align-items: flex-end;
  gap: 0.32rem;
  padding: 0 0.15rem;
}

.blank {
  width: var(--bw, 22px);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.22) 22%, rgba(0, 0, 0, 0.05)),
    var(--bc, #e4d9c8);
  box-shadow: inset 0 0 0 1px rgba(60, 48, 32, 0.12);
}

.footer {
  width: min(var(--wide), calc(100% - 2.4rem));
  margin: 3.5rem auto 0;
  padding: 1.2rem 0 2.4rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .footer { width: min(var(--wide), calc(100% - 1.5rem)); }
}

.footer p { margin: 0; }

.return { margin: 1.6rem 0 1.1rem; font-size: 0.98rem; }

.byline {
  margin: 0.75rem 0 0;
  font-size: 1.12rem;
}

.byline-sub {
  margin: 0.15rem 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

.byline.hedge,
.byline-sub.hedge { color: var(--ink-soft); }

.plate {
  margin: 1.55rem 0 1.35rem;
}

.plate img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--sheet);
  border: 1px solid #e6dfd2;
}

.plate figcaption {
  margin-top: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.7;
}

.prose p {
  margin: 0 0 1rem;
}

.prose p:first-child {
  font-size: 1.12em;
}

.cross { margin: 1.6rem 0 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .bookspine { transition: none; }
  .bookspine:hover { transform: none; }
}

@media print {
  body { background: white; }
  .scroll-hint, .domain { display: none; }
  a { text-decoration: none; }
  .bookspine:hover { transform: none; }
}
