/* Palette and type come from the book covers: cover navy, cover gold, ribbon colours, Playfair with Source Han Serif, Cabin with Source Han Sans. */
:root {
  --navy: #0A1F34;
  --house: #163A62;
  --tint: #E9EFF6;
  --gold: #C8A56A;
  --gold-deep: #B08D57;
  --ribbon-green: #1F4C45;
  --ribbon-red: #592A32;
  --node: #D9573A;
  --paper: #FFFFFF;
  --muted: #47586B;
  --gutter: clamp(16px, 4vw, 48px);
  --spine-w: clamp(44px, 6.2vw, 86px);
  --spine-h: clamp(340px, 42vw, 540px);
  --display: "AM Display", "AM Serif SC", "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", serif;
  --text: "AM Text", "AM Sans SC", "Source Han Sans SC", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
:lang(zh-Hans) {
  /* Latin only from the Latin faces here, so that Chinese quotes and dashes keep their full width. */
  --display: "AM Display Latin", "AM Serif SC", "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", serif;
  --text: "AM Text Latin", "AM Sans SC", "Source Han Sans SC", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

@font-face { font-family: "AM Display"; src: url(/fonts/display.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "AM Text"; src: url(/fonts/text.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "AM Text"; src: url(/fonts/text-semibold.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "AM Display Latin"; src: url(/fonts/display.woff2) format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0020-007E; }
@font-face { font-family: "AM Text Latin"; src: url(/fonts/text.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0020-007E; }
@font-face { font-family: "AM Text Latin"; src: url(/fonts/text-semibold.woff2) format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0020-007E; }
@font-face { font-family: "AM Serif SC"; src: url(/fonts/serif-sc.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "AM Sans SC"; src: url(/fonts/sans-sc.woff2) format("woff2"); font-weight: 400 600; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--navy); font-family: var(--text); font-size: 17px; line-height: 1.6; }
:lang(zh-Hans) body, body:lang(zh-Hans) { line-height: 1.8; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; }
p { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--node); outline-offset: 3px; }

/* Hero: the shelf */
.hero { background: var(--tint); overflow: hidden; }
.hero-inner {
  max-width: 1320px; margin: 0 auto; padding: 24px var(--gutter) 0;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: auto 1fr;
  column-gap: 48px; min-height: min(760px, 92vh);
}
.topbar { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: flex-start; }
.logo { display: block; }
.logo img { width: 60px; }
.switch { font-weight: 600; padding: 4px 0; }
.hero-text { align-self: center; padding: 40px 0 56px; }
h1 { font-size: clamp(38px, 5.2vw, 72px); line-height: 1.06; letter-spacing: -0.005em; text-wrap: balance; color: var(--navy); }
:lang(zh-Hans) h1 { font-size: clamp(34px, 4vw, 54px); line-height: 1.25; letter-spacing: 0; }
.lede { margin-top: 24px; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.5; color: var(--house); max-width: 30em; }

.shelf { align-self: end; display: flex; justify-content: flex-end; align-items: flex-end; gap: clamp(10px, 2vw, 28px); padding-top: 16px; }
.shelf-set { display: flex; align-items: flex-end; gap: 3px; }
.spine {
  position: relative; display: flex; flex-direction: column; align-items: center;
  width: var(--spine-w); height: var(--spine-h); padding: clamp(14px, 1.8vw, 26px) 4px clamp(10px, 1.2vw, 18px);
  background: var(--navy); color: var(--gold); text-decoration: none;
  border-top: 2px solid var(--gold-deep);
  transition: transform .18s ease-out;
  animation: rise .7s cubic-bezier(.2, .7, .2, 1) backwards;
}
.spine:hover, .spine:focus-visible { transform: translateY(-14px); }
.spine:focus-visible { outline-offset: -5px; }
.shelf-set:first-child .spine:nth-child(2) { animation-delay: .07s; }
.shelf-set:first-child .spine:nth-child(3) { animation-delay: .14s; }
.shelf-set:last-child .spine:nth-child(1) { animation-delay: .24s; }
.shelf-set:last-child .spine:nth-child(2) { animation-delay: .31s; }
.shelf-set:last-child .spine:nth-child(3) { animation-delay: .38s; }
@keyframes rise { from { transform: translateY(100%); } }

/* Vol. 2 and 3 carry the same ribbon colours as their covers; Vol. 3's title is white, as on its cover. */
.spine-v2::before, .spine-v3::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: clamp(6px, .8vw, 10px); }
.spine-v2::before { background: var(--ribbon-green); }
.spine-v3::before { background: var(--ribbon-red); }
.spine-v3 .spine-title { color: #FFFFFF; }

.spine-vol { font-family: var(--display); font-size: clamp(20px, 2.4vw, 32px); line-height: 1; margin-bottom: clamp(10px, 1.4vw, 20px); }
.spine-title {
  flex: 1 1 auto; min-height: 0; writing-mode: vertical-rl; font-family: var(--display);
  font-size: clamp(14px, 1.65vw, 22px); line-height: 1.2; text-align: start;
}
:lang(zh-Hans) .spine-title { text-orientation: upright; font-size: clamp(16px, 2vw, 26px); letter-spacing: .06em; line-height: 1; }
.spine-author {
  flex: none; white-space: nowrap; writing-mode: vertical-rl; font-size: clamp(11px, 1vw, 13px); line-height: 1.2; font-weight: 600; margin-top: 10px; color: var(--gold);
}
:lang(zh-Hans) .spine-author { text-orientation: upright; letter-spacing: .12em; font-size: clamp(12px, 1.1vw, 14px); }

/* Dashed spines are books that are not printed yet. */
.spine-ghost {
  height: calc(var(--spine-h) * .86); background: transparent; color: var(--house);
  border: 1.5px dashed var(--house); border-bottom: 0;
}
.spine-ghost .spine-author { color: var(--house); }
.board { height: clamp(10px, 1.2vw, 16px); background: var(--navy); position: relative; }

/* Catalogue */
.series { max-width: 1320px; margin: 0 auto; padding: clamp(64px, 8vw, 112px) var(--gutter) 0; }
.series-head { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px 48px; align-items: end; }
.series-head p { color: var(--muted); max-width: 34em; }
h2 { font-size: clamp(28px, 3.3vw, 44px); line-height: 1.14; text-wrap: balance; }
:lang(zh-Hans) h2 { line-height: 1.3; }

.vols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(28px, 4vw, 56px); margin-top: clamp(32px, 4vw, 56px); }
.vol { scroll-margin-top: 24px; }
.vol img { width: 100%; box-shadow: 0 18px 32px -18px rgba(10, 31, 52, .55); }
.vol-edition { margin-top: 24px; font-weight: 600; font-size: 15px; color: var(--house); }
.vol h3 { margin-top: 6px; font-size: clamp(20px, 1.8vw, 24px); line-height: 1.24; text-wrap: pretty; }
.vol-sub { margin-top: 10px; font-size: 16px; line-height: 1.45; }
.vol-pos { margin-top: 10px; font-size: 16px; line-height: 1.5; color: var(--muted); }
.vol-details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 16px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid #C9D6E4; font-size: 15px; line-height: 1.5; }
.vol-details dt { color: var(--muted); }
.vol-details dd { margin: 0; }

.forths { margin-top: clamp(28px, 3vw, 44px); }
.forth {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr) minmax(0, 2fr); gap: 6px 48px; align-items: baseline;
  padding: 22px 0; border-top: 1.5px dashed var(--house); scroll-margin-top: 24px;
}
.forth:last-child { border-bottom: 1.5px dashed var(--house); }
.forth h3 { font-size: clamp(22px, 2.1vw, 28px); line-height: 1.2; }
.forth-cond { color: var(--muted); font-size: 15px; text-align: right; }

.author { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px 48px; padding-bottom: clamp(64px, 8vw, 112px); }
.author p { max-width: 36em; grid-column: 2; grid-row: 1; }
:lang(zh-Hans) .author h2, .author h2 { grid-column: 1; }

/* Colophon */
.colophon { background: var(--navy); color: var(--paper); }
.colophon-inner { max-width: 1320px; margin: 0 auto; padding: clamp(48px, 6vw, 80px) var(--gutter) 32px; }
.colophon h2 { color: var(--gold); }
.colophon dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 32px; margin: 28px 0 0; }
.colophon dt { color: var(--gold); font-weight: 600; }
.colophon dd { margin: 0; }
.colophon a { color: var(--paper); }
.legal { margin-top: 48px; font-size: 14px; color: #B9C6D4; }

.missing main { max-width: 640px; margin: 0 auto; padding: 96px var(--gutter); }
.missing h1 { font-size: clamp(28px, 4vw, 40px); }
.missing h1:lang(zh-Hans) { margin-top: 48px; font-size: clamp(28px, 4vw, 40px); }
.missing p { margin-top: 12px; }

@media (max-width: 860px) {
  :root { --spine-w: clamp(46px, 9vw, 78px); --spine-h: clamp(340px, 58vw, 480px); }
  .hero-inner { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .hero-text { padding: 32px 0 32px; }
  .shelf { justify-content: flex-start; }
  .series-head, .author { grid-template-columns: minmax(0, 1fr); }
  .author p { grid-column: 1; grid-row: auto; }
  .vols { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .vol img { max-width: 300px; }
  .forth { grid-template-columns: minmax(0, 1fr); }
  .forth-cond { text-align: left; }
}
@media (max-width: 420px) {
  :root { --spine-w: min(52px, calc((100vw - 2 * var(--gutter) - 12px) / 6)); --spine-h: 340px; }
  .shelf { gap: 8px; }
  .shelf-set { gap: 2px; }
  .spine-author { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spine { animation: none; transition: none; }
  .spine:hover, .spine:focus-visible { transform: none; }
}
