/* ==========================================================================
   中国语言地图集 · 数字图集
   A small editorial cartography system: warm paper, ink, vermilion,
   serif display type, survey marks and map-sheet frames.
   ========================================================================== */

@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;
}
@font-face {
  font-family: "Noto Sans SC";
  src: url("fonts/noto-sans-sc.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Saira";
  src: url("fonts/saira-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f2ecdf;
  --paper-2: #eae2d2;
  --card: #f9f5eb;
  --ink: #1a1813;
  --ink-2: #3d372d;
  --muted: #6a6153;
  --faint: #8b8170;
  --line: rgba(26, 24, 19, 0.14);
  --line-strong: rgba(26, 24, 19, 0.34);
  --accent: #b23a24;
  --ochre: #9c6f1b;
  --jade: #2d6653;
  --night: #131210;
  --night-2: #1a1814;
  --night-line: rgba(242, 236, 223, 0.15);
  --cream: #f2ecdf;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --latin: "Saira", "Arial Narrow", sans-serif;
  --max: 1560px;
  --pad: clamp(20px, 4vw, 58px);
  --ease: cubic-bezier(0.22, 0.68, 0.2, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

body.is-viewer-open { overflow: hidden; }

img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
h1, h2, h3, h4, p, dl, dd, dt { margin: 0; }
em { font-style: normal; }
svg { display: block; }

::selection {
  background: var(--accent);
  color: var(--paper);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 2000;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  transform: translateY(-160%);
  transition: transform 0.2s;
}
.skip-link:focus { transform: translateY(0); }

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.28);
  font-family: var(--latin);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.04em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--latin);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  height: 78px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
  background: rgba(242, 236, 223, 0.86);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  flex-shrink: 0;
}

.brand-seal {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--accent);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(242, 236, 223, 0.28);
}

.brand-type { display: flex; flex-direction: column; gap: 1px; }
.brand-type strong {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.35;
}
.brand-type small {
  font-family: var(--latin);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.19em;
  color: var(--muted);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 42px);
  margin-left: auto;
}

.site-nav a {
  position: relative;
  padding: 8px 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--ink-2);
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 3px;
  height: 1px;
  background: var(--accent);
  transition: right 0.35s var(--ease);
}
.site-nav a:hover::after { right: 0; }

.header-tools { display: flex; align-items: center; gap: 16px; }

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  transition: border-color 0.2s, background 0.2s;
}
.icon-button:hover { border-color: var(--ink); background: rgba(255, 255, 255, 0.3); }
.icon-button svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.5; }

.header-count {
  padding-left: 16px;
  border-left: 1px solid var(--line);
  font-family: var(--latin);
  font-size: 12px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}
.header-count em { color: var(--muted); font-size: 9px; letter-spacing: 0.16em; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  align-items: center;
  gap: clamp(20px, 4vw, 64px);
  max-width: var(--max);
  min-height: calc(100svh - 78px);
  margin: 0 auto;
  padding: clamp(44px, 6vw, 92px) var(--pad) clamp(54px, 7vw, 104px);
}

.hero-grid {
  position: absolute;
  inset: 0 var(--pad);
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 92px 92px;
  opacity: 0.55;
  -webkit-mask-image: radial-gradient(ellipse 78% 72% at 55% 48%, #000 8%, transparent 76%);
  mask-image: radial-gradient(ellipse 78% 72% at 55% 48%, #000 8%, transparent 76%);
  pointer-events: none;
}

.hero-coord {
  position: absolute;
  font-family: var(--latin);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--faint);
  writing-mode: vertical-rl;
}
.hero-coord-a { top: 16%; left: 6px; }
.hero-coord-b { bottom: 15%; right: 7px; }

.hero-figure {
  position: absolute;
  right: -0.03em;
  bottom: -0.1em;
  z-index: 0;
  font-family: var(--latin);
  font-size: clamp(200px, 30vw, 510px);
  font-weight: 300;
  line-height: 0.72;
  letter-spacing: -0.06em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(26, 24, 19, 0.1);
  pointer-events: none;
  user-select: none;
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 760px;
  padding-top: 10px;
}

.hero-copy .eyebrow { animation: rise 0.8s var(--ease) both; }

.hero h1 {
  margin-top: 22px;
  font-family: var(--serif);
  font-size: clamp(64px, 8.5vw, 146px);
  font-weight: 700;
  letter-spacing: 0.015em;
  line-height: 0.98;
  text-wrap: balance;
  animation: rise 0.9s 0.05s var(--ease) both;
}
.hero h1 span { display: block; }
.hero-title-indent { padding-left: 0.72em; }

.hero-en {
  margin-top: 17px;
  font-family: var(--latin);
  font-size: clamp(9px, 0.72vw, 11px);
  font-weight: 500;
  letter-spacing: 0.42em;
  color: var(--muted);
  animation: rise 0.9s 0.1s var(--ease) both;
}

.hero-lede {
  max-width: 530px;
  margin-top: clamp(24px, 3vw, 38px);
  font-size: clamp(14px, 1.1vw, 16px);
  line-height: 1.95;
  color: var(--ink-2);
  animation: rise 0.9s 0.15s var(--ease) both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
  animation: rise 0.9s 0.2s var(--ease) both;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 50px;
  padding: 0 23px;
  border: 1px solid var(--ink);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1;
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.25s;
}
.button svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.5; transition: transform 0.25s; }
.button:hover svg { transform: translateX(3px); }
.button:active { transform: translateY(1px); }

.button-primary { background: var(--ink); color: var(--paper); }
.button-primary:hover { background: var(--accent); border-color: var(--accent); }

.button-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.button-ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.hero-stats {
  display: flex;
  gap: clamp(24px, 4vw, 48px);
  margin-top: clamp(32px, 4.5vw, 54px);
  padding-top: 18px;
  border-top: 1px solid var(--line);
  animation: rise 0.9s 0.25s var(--ease) both;
}
.hero-stats div { display: flex; flex-direction: column; gap: 2px; }
.hero-stats dt {
  font-family: var(--latin);
  font-size: clamp(22px, 2.2vw, 32px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
}
.hero-stats dt em { font-size: 0.42em; color: var(--muted); letter-spacing: 0.06em; }
.hero-stats dd { font-size: 10px; letter-spacing: 0.12em; color: var(--muted); }

/* Hero map plates */

.hero-plates {
  position: relative;
  z-index: 1;
  height: min(64vh, 620px);
  min-height: 420px;
  animation: reveal 1.1s 0.15s var(--ease) both;
}

.plate {
  position: absolute;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px -30px rgba(26, 24, 19, 0.45);
}

.plate-back {
  top: 4%;
  left: 0;
  width: 52%;
  padding: 7px;
  transform: rotate(-7.5deg);
  opacity: 0.92;
}
.plate-back img {
  display: block;
  width: 100%;
  height: auto;
  filter: saturate(0.82) contrast(0.97);
}
.plate-tag {
  display: block;
  padding: 7px 3px 1px;
  font-family: var(--latin);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.plate-main {
  top: 13%;
  right: 0;
  width: 86%;
  padding: clamp(7px, 0.7vw, 11px);
  text-align: left;
  transform: rotate(1.3deg);
  transition: transform 0.5s var(--ease), box-shadow 0.5s;
  cursor: zoom-in;
}
.plate-main:hover {
  transform: rotate(0deg) translateY(-6px);
  box-shadow: 0 34px 70px -32px rgba(26, 24, 19, 0.5);
}
.plate-sheet {
  display: block;
  overflow: hidden;
  background: #e8e0d0;
  border: 1px solid var(--line);
  aspect-ratio: 1800 / 1341;
}
.plate-sheet img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}
.plate-main:hover .plate-sheet img { transform: scale(1.018); }

.plate-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 3px 3px;
}
.plate-caption > span { font-family: var(--serif); font-size: 14px; font-weight: 600; letter-spacing: 0.03em; }
.plate-caption b { margin-right: 8px; font-family: var(--latin); font-size: 11px; font-weight: 600; color: var(--accent); letter-spacing: 0.08em; }
.plate-caption em { font-size: 10px; letter-spacing: 0.1em; color: var(--muted); }

.plate-seal {
  position: absolute;
  left: 3%;
  bottom: 5%;
  display: grid;
  place-items: center;
  width: clamp(54px, 5vw, 76px);
  height: clamp(54px, 5vw, 76px);
  background: var(--accent);
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(14px, 1.35vw, 19px);
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  transform: rotate(-6deg);
  box-shadow: inset 0 0 0 1px rgba(242, 236, 223, 0.3);
}

.plate-note {
  position: absolute;
  right: 1%;
  bottom: -3%;
  font-family: var(--latin);
  font-size: 8px;
  line-height: 1.7;
  letter-spacing: 0.14em;
  text-align: right;
  color: var(--faint);
}

.scroll-cue {
  position: absolute;
  left: var(--pad);
  bottom: 20px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--latin);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--muted);
}
.scroll-cue svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.3; animation: bob 2.2s ease-in-out infinite; }

/* Index ribbon */

.index-ribbon {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 var(--pad);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(249, 245, 235, 0.44);
  height: 58px;
  overflow: hidden;
}
.ribbon-label {
  flex-shrink: 0;
  font-family: var(--latin);
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--faint);
}
.ribbon-track {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ribbon-track::-webkit-scrollbar { display: none; }
.ribbon-item {
  position: relative;
  flex-shrink: 0;
  padding: 8px 12px;
  font-family: var(--latin);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  transition: color 0.2s;
}
.ribbon-item::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 2px;
  height: 2px;
  background: var(--line-strong);
  border-radius: 50%;
}
.ribbon-item:hover { color: var(--accent); }
.ribbon-item[data-chapter="A"] { color: var(--accent); }
.ribbon-item[data-chapter="B"] { color: var(--ochre); }
.ribbon-item[data-chapter="C"] { color: var(--jade); }

/* --------------------------------------------------------------------------
   Preface
   -------------------------------------------------------------------------- */

.preface {
  position: relative;
  display: grid;
  grid-template-columns: 76px minmax(0, 1.35fr) minmax(280px, 0.8fr);
  gap: clamp(24px, 5vw, 82px);
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(72px, 10vw, 150px) var(--pad);
  border-bottom: 1px solid var(--line);
}

.section-mark {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
  color: var(--accent);
  writing-mode: vertical-rl;
  letter-spacing: 0.2em;
}

.preface-copy h2 {
  max-width: 780px;
  margin-top: 18px;
  font-family: var(--serif);
  font-size: clamp(34px, 4.6vw, 64px);
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: 0.01em;
}
.preface-copy > p {
  max-width: 660px;
  margin-top: 24px;
  font-size: 14px;
  line-height: 2.05;
  color: var(--ink-2);
}
.preface-copy > p + p { margin-top: 14px; color: var(--muted); }

.chapter-index { align-self: end; border-top: 1px solid var(--ink); }
.chapter-index .eyebrow { margin: 12px 0 8px; }
.chapter-index a {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  transition: padding 0.3s var(--ease), background 0.3s;
}
.chapter-index a:hover { padding-left: 8px; background: rgba(255, 255, 255, 0.26); }
.chapter-index b {
  font-family: var(--latin);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}
.chapter-index a:nth-of-type(1) b { color: var(--accent); }
.chapter-index a:nth-of-type(2) b { color: var(--ochre); }
.chapter-index a:nth-of-type(3) b { color: var(--jade); }
.chapter-index span { font-family: var(--serif); font-size: 16px; font-weight: 600; line-height: 1.5; }
.chapter-index small { display: block; font-family: var(--latin); font-size: 8px; font-weight: 400; letter-spacing: 0.16em; color: var(--muted); }
.chapter-index em { font-family: var(--latin); font-size: 11px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Collection
   -------------------------------------------------------------------------- */

.collection {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(56px, 8vw, 120px) var(--pad) clamp(60px, 7vw, 100px);
}

.collection-head {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: end;
  gap: clamp(28px, 6vw, 100px);
  padding-top: 25px;
  border-top: 1px solid var(--ink);
}

.collection-title h2 {
  margin-top: 12px;
  font-family: var(--serif);
  font-size: clamp(38px, 5.2vw, 72px);
  font-weight: 600;
  line-height: 1.15;
}
.collection-title > p:last-child {
  max-width: 460px;
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.9;
  color: var(--muted);
}

.filter-panel { min-width: 0; }

.search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: rgba(249, 245, 235, 0.55);
  transition: border-color 0.2s, background 0.2s;
}
.search-field:focus-within { border-color: var(--ink); background: var(--card); }
.search-field svg { width: 18px; height: 18px; flex-shrink: 0; stroke: var(--muted); stroke-width: 1.5; }
.search-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  letter-spacing: 0.03em;
}
.search-field input::placeholder { color: var(--faint); }
.search-field kbd { flex-shrink: 0; }

.chapter-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.chip b { font-family: var(--latin); font-size: 10px; font-weight: 600; }
.chip span { font-family: var(--latin); font-size: 9px; color: var(--faint); }
.chip[data-chapter="A"] b { color: var(--accent); }
.chip[data-chapter="B"] b { color: var(--ochre); }
.chip[data-chapter="C"] b { color: var(--jade); }
.chip:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.3); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip.is-active span { color: rgba(242, 236, 223, 0.62); }
.chip.is-active b { color: var(--paper); }

.collection-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 30px 0 0;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
  font-family: var(--latin);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.sort-note span { display: inline-block; margin-left: 4px; color: var(--accent); }

.chapter { margin-top: clamp(46px, 6vw, 78px); }
.chapter[hidden] { display: none; }

.chapter-head {
  display: grid;
  grid-template-columns: clamp(86px, 9vw, 132px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 42px);
  align-items: start;
  padding-top: 20px;
  border-top: 1px solid var(--ink);
}
.chapter[data-chapter="A"] { --chapter-accent: var(--accent); }
.chapter[data-chapter="B"] { --chapter-accent: var(--ochre); }
.chapter[data-chapter="C"] { --chapter-accent: var(--jade); }
.chapter-head .chapter-letter {
  font-family: var(--latin);
  font-size: clamp(74px, 8.5vw, 126px);
  font-weight: 300;
  line-height: 0.76;
  letter-spacing: -0.03em;
  color: transparent;
  -webkit-text-stroke: 1px var(--chapter-accent, var(--ink));
  opacity: 0.78;
}
.chapter-name .eyebrow { color: var(--chapter-accent, var(--muted)); }
.chapter-name h3 {
  margin-top: 7px;
  font-family: var(--serif);
  font-size: clamp(30px, 3.5vw, 46px);
  font-weight: 600;
  line-height: 1.2;
}
.chapter-name > p:last-child {
  max-width: 620px;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
}

.map-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: clamp(26px, 3vw, 38px) clamp(14px, 1.6vw, 24px);
  margin-top: 30px;
}

/* The justified gallery sets an exact pixel width per card in app.js.
   The width below is the no-JS fallback. */
.map-card { flex: 0 0 auto; width: calc(25% - 18px); min-width: 0; }
.map-card.is-hidden { display: none; }

.card-hit { display: block; }

.card-sheet {
  position: relative;
  display: block;
  padding: 8px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(26, 24, 19, 0.04);
  aspect-ratio: var(--sheet-ratio, 1.343);
  transition: border-color 0.3s, transform 0.4s var(--ease), box-shadow 0.4s;
}
.card-hit:hover .card-sheet {
  border-color: var(--ink);
  transform: translateY(-4px);
  box-shadow: 0 18px 34px -26px rgba(26, 24, 19, 0.55);
}
.card-sheet img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #e6ddcd;
  filter: saturate(0.94) contrast(1.01);
  transition: transform 0.65s var(--ease);
}
.card-hit:hover .card-sheet img { transform: scale(1.022); }

.card-code {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 3px 7px;
  background: rgba(249, 245, 235, 0.94);
  border: 1px solid var(--line);
  font-family: var(--latin);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.4;
  color: var(--chapter-accent, var(--ink));
  backdrop-filter: blur(4px);
}

.card-open {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 10px;
  letter-spacing: 0.1em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.35s var(--ease);
}
.card-open svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 1.6; }
.card-hit:hover .card-open,
.card-hit:focus-visible .card-open { opacity: 1; transform: translateY(0); }

.card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px 2px 0;
}
.card-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-family: var(--serif);
  font-size: clamp(16px, 1.3vw, 20px);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
}
.card-regions {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.card-no {
  padding-top: 5px;
  font-family: var(--latin);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.empty-state {
  margin-top: 50px;
  padding: 80px 24px;
  border: 1px dashed var(--line-strong);
  text-align: center;
  background: rgba(249, 245, 235, 0.36);
}
.empty-state > span { font-family: var(--latin); font-size: 46px; line-height: 1; color: var(--faint); }
.empty-state h3 { margin-top: 14px; font-family: var(--serif); font-size: 26px; font-weight: 600; }
.empty-state p { margin: 8px auto 24px; max-width: 400px; font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Guide + about
   -------------------------------------------------------------------------- */

.guide {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: clamp(24px, 5vw, 82px);
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(60px, 8vw, 110px) var(--pad);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.guide-head h2 { margin-top: 10px; font-family: var(--serif); font-size: clamp(34px, 4vw, 56px); font-weight: 600; line-height: 1.2; }
.guide-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 42px);
  grid-column: 2;
  margin-top: 34px;
}
.guide article { padding-top: 16px; border-top: 1px solid var(--ink); }
.guide-no { font-family: var(--latin); font-size: 10px; letter-spacing: 0.12em; color: var(--accent); }
.guide article h3 { margin-top: 10px; font-family: var(--serif); font-size: 23px; font-weight: 600; }
.guide article p { margin-top: 8px; font-size: 12px; line-height: 1.85; color: var(--muted); }

.about {
  display: grid;
  grid-template-columns: minmax(220px, 0.55fr) minmax(0, 1.45fr);
  gap: clamp(30px, 6vw, 100px);
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(64px, 9vw, 130px) var(--pad);
}
.about-side h2 { margin-top: 10px; font-family: var(--serif); font-size: clamp(32px, 4vw, 52px); font-weight: 600; line-height: 1.2; }
.about-copy { max-width: 780px; }
.about-copy > p { font-size: 14px; line-height: 2; color: var(--ink-2); }
.about-copy > p + p { margin-top: 14px; color: var(--muted); }
.about-copy a { border-bottom: 1px solid var(--line-strong); transition: color 0.2s, border-color 0.2s; }
.about-copy a:hover { color: var(--accent); border-color: var(--accent); }

.colophon {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 38px;
  margin-top: 34px;
  border-top: 1px solid var(--ink);
}
.colophon div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.colophon dt { font-family: var(--latin); font-size: 9px; letter-spacing: 0.14em; color: var(--faint); padding-top: 3px; }
.colophon dd { font-size: 12px; color: var(--ink-2); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  padding: clamp(48px, 7vw, 88px) var(--pad) 26px;
  background: var(--ink);
  color: var(--paper);
}
.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 40px;
  align-items: end;
  max-width: var(--max);
  margin: 0 auto;
  padding-bottom: 50px;
  border-bottom: 1px solid rgba(242, 236, 223, 0.18);
}
.footer-wordmark { font-family: var(--serif); font-size: clamp(38px, 5vw, 70px); font-weight: 600; line-height: 1.12; letter-spacing: 0.04em; }
.footer-meta { display: flex; flex-direction: column; gap: 6px; font-family: var(--latin); font-size: 9px; letter-spacing: 0.18em; color: rgba(242, 236, 223, 0.56); }
.footer-top-link { display: inline-flex; align-items: center; gap: 10px; padding: 12px 0; font-size: 11px; letter-spacing: 0.12em; color: rgba(242, 236, 223, 0.76); border-bottom: 1px solid rgba(242, 236, 223, 0.28); }
.footer-top-link:hover { color: var(--paper); border-color: var(--paper); }
.footer-top-link span { font-family: var(--latin); }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: var(--max);
  margin: 0 auto;
  padding-top: 22px;
  font-family: var(--latin);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: rgba(242, 236, 223, 0.42);
}

.noscript {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 1001;
  width: min(560px, calc(100vw - 40px));
  padding: 14px 18px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  line-height: 1.7;
}
.noscript a { border-bottom: 1px solid currentColor; }

/* --------------------------------------------------------------------------
   404
   -------------------------------------------------------------------------- */

.notfound {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: clamp(36px, 7vw, 120px);
  max-width: var(--max);
  min-height: calc(100svh - 78px - 180px);
  margin: 0 auto;
  padding: clamp(60px, 9vw, 130px) var(--pad);
}
.notfound h1 {
  margin-top: 18px;
  font-family: var(--serif);
  font-size: clamp(44px, 6.5vw, 96px);
  font-weight: 700;
  line-height: 1.15;
}
.notfound-copy > p {
  max-width: 440px;
  margin: 24px 0 30px;
  font-size: 14px;
  line-height: 2;
  color: var(--muted);
}
.notfound-plate {
  position: relative;
  aspect-ratio: 1.343;
  border: 1px solid var(--line-strong);
  background-color: rgba(249, 245, 235, 0.5);
  box-shadow: inset 0 0 0 8px var(--paper), inset 0 0 0 9px var(--line);
  overflow: hidden;
}
.notfound-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 14.285% 14.285%;
  opacity: 0.7;
}
.notfound-code {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--latin);
  font-size: clamp(130px, 18vw, 260px);
  font-weight: 300;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--line-strong);
}
.notfound-note {
  position: absolute;
  left: 22px;
  bottom: 18px;
  font-family: var(--latin);
  font-size: 9px;
  line-height: 1.7;
  letter-spacing: 0.16em;
  color: var(--faint);
}

@media (max-width: 820px) {
  .notfound { grid-template-columns: 1fr; min-height: 0; }
  .notfound-plate { order: -1; max-width: 520px; }
}

/* --------------------------------------------------------------------------
   Viewer
   -------------------------------------------------------------------------- */

body.is-viewer-open { padding-right: var(--scrollbar, 0); }

.viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) 52px 96px;
  background: var(--night);
  color: var(--cream);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.viewer[hidden] { display: none; }
.viewer.is-open { opacity: 1; }

.viewer-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  height: 2px;
  background: rgba(242, 236, 223, 0.12);
}
.viewer-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.35s var(--ease);
}

.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(12px, 1.5vw, 22px);
  border-bottom: 1px solid var(--night-line);
  background: rgba(19, 18, 16, 0.94);
}
.viewer-ident { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.viewer-code { font-family: var(--latin); font-size: 20px; font-weight: 500; letter-spacing: 0.03em; color: var(--accent); }
.viewer-mini-title { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--serif); font-size: 13px; font-weight: 600; color: rgba(242, 236, 223, 0.82); }
.viewer-slash { font-family: var(--latin); font-size: 12px; color: rgba(242, 236, 223, 0.28); }
.viewer-chapter { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; letter-spacing: 0.12em; color: rgba(242, 236, 223, 0.58); }

.viewer-actions { display: flex; align-items: center; gap: 2px; }
.viewer-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 10px;
  color: rgba(242, 236, 223, 0.68);
  font-size: 11px;
  letter-spacing: 0.06em;
  transition: background 0.2s, color 0.2s;
}
.viewer-action:hover { background: rgba(242, 236, 223, 0.08); color: var(--cream); }
.viewer-action svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.4; }
.viewer-action[aria-pressed="true"] { color: var(--cream); background: rgba(242, 236, 223, 0.07); }
.viewer-close { border-left: 1px solid var(--night-line); margin-left: 6px; padding-left: 14px; }

.viewer-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0;
  min-height: 0;
  transition: grid-template-columns 0.3s var(--ease);
}
.viewer.is-info-open .viewer-body { grid-template-columns: minmax(0, 1fr) 310px; }

.viewer-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at center, rgba(242, 236, 223, 0.045) 0%, transparent 62%),
    repeating-linear-gradient(0deg, transparent 0 71px, rgba(242, 236, 223, 0.026) 71px 72px),
    repeating-linear-gradient(90deg, transparent 0 71px, rgba(242, 236, 223, 0.026) 71px 72px),
    #12110f;
  touch-action: none;
  cursor: grab;
}
.viewer-stage.is-dragging { cursor: grabbing; }

.viewer-canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-origin: center center;
  will-change: transform;
}
.viewer-canvas.is-animating { transition: transform 0.25s var(--ease); }
.viewer-canvas img {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  max-width: none;
  max-height: none;
  object-fit: contain;
  background: #0c0b0a;
  border: 1px solid rgba(242, 236, 223, 0.12);
  box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.75);
  opacity: 0;
  pointer-events: none;
  user-select: none;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
}
.viewer-canvas.is-animating img {
  transition: width 0.25s var(--ease), height 0.25s var(--ease), opacity 0.3s ease;
}
.viewer-canvas img.is-loaded { opacity: 1; }

.viewer-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-family: var(--latin);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(242, 236, 223, 0.45);
  pointer-events: none;
  transition: opacity 0.25s;
}
.viewer-loading.is-hidden { opacity: 0; }
.spinner {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(242, 236, 223, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.viewer-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(242, 236, 223, 0.72);
  background: rgba(19, 18, 16, 0.82);
}
.viewer-error a { border-bottom: 1px solid currentColor; color: var(--cream); }

.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(242, 236, 223, 0.18);
  border-radius: 50%;
  background: rgba(19, 18, 16, 0.55);
  color: rgba(242, 236, 223, 0.72);
  transform: translateY(-50%);
  backdrop-filter: blur(8px);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.viewer-nav:hover { background: rgba(242, 236, 223, 0.1); color: var(--cream); border-color: rgba(242, 236, 223, 0.36); }
.viewer-nav svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.5; }
.viewer-prev { left: clamp(8px, 1.5vw, 22px); }
.viewer-next { right: clamp(8px, 1.5vw, 22px); }
.viewer-nav:disabled { opacity: 0.2; pointer-events: none; }

.viewer-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 2;
  padding: 6px 14px;
  background: rgba(19, 18, 16, 0.72);
  border: 1px solid rgba(242, 236, 223, 0.12);
  font-family: var(--latin);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: rgba(242, 236, 223, 0.52);
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity 0.4s;
}
.viewer-hint.is-hidden { opacity: 0; }

.viewer-info {
  min-height: 0;
  overflow: auto;
  padding: 27px 24px 40px;
  background: var(--night-2);
  border-left: 1px solid var(--night-line);
  transition: opacity 0.2s, transform 0.3s var(--ease);
}
.viewer:not(.is-info-open) .viewer-info { opacity: 0; visibility: hidden; pointer-events: none; }
.viewer-info .eyebrow { color: rgba(242, 236, 223, 0.42); }
.viewer-info h2 { margin-top: 12px; font-family: var(--serif); font-size: 27px; font-weight: 600; line-height: 1.45; }
.viewer-desc { margin-top: 14px; font-size: 12px; line-height: 1.95; color: rgba(242, 236, 223, 0.62); }
.viewer-meta { margin-top: 28px; border-top: 1px solid var(--night-line); }
.viewer-meta div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--night-line); }
.viewer-meta dt { font-family: var(--latin); font-size: 8px; letter-spacing: 0.13em; color: rgba(242, 236, 223, 0.36); padding-top: 2px; }
.viewer-meta dd { font-size: 11px; line-height: 1.65; color: rgba(242, 236, 223, 0.78); }
.viewer-source { margin-top: 22px; font-size: 10px; line-height: 1.8; color: rgba(242, 236, 223, 0.38); }
.viewer-mirror { margin-top: 6px; }
.viewer-mirror a {
  display: inline-block;
  border-bottom: 1px solid rgba(242, 236, 223, 0.28);
  font-size: 10px;
  line-height: 1.8;
  color: rgba(242, 236, 223, 0.62);
  transition: color 0.2s, border-color 0.2s;
}
.viewer-mirror a:hover { color: var(--cream); border-color: var(--cream); }

.viewer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(12px, 1.5vw, 22px);
  border-top: 1px solid var(--night-line);
  background: rgba(19, 18, 16, 0.94);
}
.zoom-tools { display: flex; align-items: center; border: 1px solid var(--night-line); }
.zoom-tools button {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 30px;
  padding: 0 8px;
  color: rgba(242, 236, 223, 0.7);
  font-family: var(--latin);
  font-size: 12px;
  transition: background 0.2s, color 0.2s;
}
.zoom-tools button:hover { background: rgba(242, 236, 223, 0.08); color: var(--cream); }
.zoom-tools button + button { border-left: 1px solid var(--night-line); }
.zoom-tools .one-to-one { font-size: 9px; letter-spacing: 0.06em; }
.tool-hints { display: flex; gap: 20px; font-family: var(--latin); font-size: 9px; letter-spacing: 0.08em; color: rgba(242, 236, 223, 0.34); }
.tool-hints span { display: flex; align-items: center; gap: 4px; }
.viewer kbd { border-color: rgba(242, 236, 223, 0.2); background: rgba(242, 236, 223, 0.04); color: rgba(242, 236, 223, 0.5); }
.viewer-counter { font-family: var(--latin); font-size: 10px; letter-spacing: 0.14em; color: rgba(242, 236, 223, 0.46); white-space: nowrap; }

.viewer-rail {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px clamp(12px, 1.5vw, 22px) 16px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #181612;
  border-top: 1px solid var(--night-line);
  scrollbar-width: thin;
  scrollbar-color: rgba(242, 236, 223, 0.24) transparent;
}
.viewer-rail::-webkit-scrollbar { height: 4px; }
.viewer-rail::-webkit-scrollbar-thumb { background: rgba(242, 236, 223, 0.24); }
.rail-item {
  position: relative;
  flex: 0 0 auto;
  width: 92px;
  height: 64px;
  padding: 0;
  background: #0d0c0b;
  border: 1px solid rgba(242, 236, 223, 0.12);
  opacity: 0.48;
  transition: opacity 0.2s, border-color 0.2s, transform 0.2s;
}
.rail-item:hover { opacity: 0.86; }
.rail-item.is-active { opacity: 1; border-color: var(--cream); transform: translateY(-2px); }
.rail-item img { width: 100%; height: 100%; object-fit: contain; display: block; background: #0d0c0b; }
.rail-item span {
  position: absolute;
  left: 4px;
  top: 4px;
  padding: 1px 4px;
  background: rgba(19, 18, 16, 0.78);
  font-family: var(--latin);
  font-size: 8px;
  letter-spacing: 0.04em;
  color: var(--cream);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 118px;
  z-index: 1200;
  padding: 10px 18px;
  transform: translateX(-50%);
  background: var(--cream);
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5);
}
.toast[hidden] { display: none; }

/* Off states */

.is-hidden { display: none !important; }

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes reveal {
  from { opacity: 0; transform: translateY(22px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .map-card { width: calc(33.333% - 16px); }
  .hero-plates { height: min(58vh, 560px); min-height: 380px; }
  .plate-back { width: 50%; }
}

@media (max-width: 1080px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-top: clamp(48px, 8vw, 80px);
    gap: 42px;
  }
  .hero-copy { max-width: 820px; }
  .hero h1 { font-size: clamp(58px, 11vw, 118px); }
  .hero-plates { height: min(62vw, 540px); min-height: 360px; width: min(100%, 760px); margin-left: auto; }
  .plate-back { left: 2%; }
  .plate-main { width: 82%; }
  .plate-note { right: 3%; bottom: -2%; }
  .scroll-cue { display: none; }
  .hero-coord { display: none; }

  .preface { grid-template-columns: 48px minmax(0, 1fr); }
  .chapter-index { grid-column: 2; margin-top: 10px; max-width: 640px; }
  .section-mark { font-size: 22px; }

  .collection-head { grid-template-columns: 1fr; gap: 28px; }
  .filter-panel { max-width: 760px; }
  .guide { grid-template-columns: 48px 1fr; }
  .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .viewer.is-info-open .viewer-body { grid-template-columns: minmax(0, 1fr) 280px; }
}

@media (max-width: 820px) {
  .site-header { height: 68px; }
  .site-nav { display: none; }
  .header-count { display: none; }
  .header-tools { margin-left: auto; }

  .hero { padding-top: 38px; }
  .hero-figure { font-size: 56vw; opacity: 0.7; }
  .hero-plates { min-height: 310px; height: 58vw; }
  .plate-seal { display: none; }

  .preface { grid-template-columns: 1fr; gap: 30px; }
  .section-mark { writing-mode: horizontal-tb; font-size: 20px; }
  .chapter-index { grid-column: 1; }
  .preface-copy h2 { font-size: clamp(32px, 7vw, 46px); }

  .map-card { width: calc(50% - 12px); }
  .chapter-head { grid-template-columns: 66px minmax(0, 1fr); }
  .chapter-head .chapter-letter { font-size: 68px; }

  .guide { grid-template-columns: 1fr; gap: 10px; }
  .guide-grid { grid-column: 1; }

  .about { grid-template-columns: 1fr; gap: 10px; }
  .colophon { grid-template-columns: 1fr; }

  .footer-top { grid-template-columns: 1fr auto; }
  .footer-meta { display: none; }

  .viewer { grid-template-rows: 54px minmax(0, 1fr) 48px 84px; }
  .viewer.is-info-open .viewer-body { grid-template-columns: minmax(0, 1fr); }
  .viewer-info {
    position: absolute;
    top: 54px;
    right: 0;
    bottom: 132px;
    z-index: 6;
    width: min(86vw, 340px);
    transform: translateX(101%);
    opacity: 1 !important;
    pointer-events: auto !important;
    box-shadow: -20px 0 50px rgba(0, 0, 0, 0.4);
  }
  .viewer.is-info-open .viewer-info { transform: translateX(0); }
  .viewer:not(.is-info-open) .viewer-info { pointer-events: none !important; }
  .viewer-nav { width: 38px; height: 38px; }
  .viewer-prev { left: 8px; }
  .viewer-next { right: 8px; }
  .viewer-hint { display: none; }
  .tool-hints { display: none; }
  .rail-item { width: 76px; height: 52px; }
  .viewer-bar { padding: 0 10px; }
  .viewer-action { padding: 0 8px; }
  .viewer-action span { display: none; }
  .viewer-close span { display: inline; }
  .viewer-tools { padding: 0 10px; }
  .footer-top-link { align-self: start; }
}

@media (max-width: 580px) {
  .brand-type strong { font-size: 15px; }
  .brand-type small { font-size: 7px; }
  .header-tools .icon-button { width: 36px; height: 36px; }

  .hero h1 { font-size: clamp(48px, 15.5vw, 76px); line-height: 1.02; }
  .hero-title-indent { padding-left: 0.38em; }
  .hero-lede { font-size: 13.5px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .button { width: 100%; }
  .hero-stats { gap: 22px; justify-content: space-between; }
  .hero-stats dt { font-size: 23px; }
  .hero-stats dd { font-size: 9px; letter-spacing: 0.06em; }
  .hero-plates { margin-top: 6px; min-height: 250px; height: 60vw; }
  .plate-back { display: none; }
  .plate-main { width: 100%; top: 2%; }
  .plate-caption { padding-top: 8px; }
  .plate-caption em { display: none; }
  .plate-note { display: none; }

  .index-ribbon { gap: 8px; height: 50px; }
  .ribbon-label { display: none; }
  .ribbon-item { padding: 8px 9px; font-size: 9px; }

  .collection { padding-top: 56px; }
  .collection-title h2 { font-size: 40px; }
  .chapter-chips { display: grid; grid-template-columns: 1fr 1fr; }
  .chip { justify-content: center; }
  .chip[data-chapter="all"] { grid-column: span 2; }
  .collection-status { font-size: 9px; }
  .sort-note { display: none; }

  .map-card { width: 100%; }
  .chapter-head { grid-template-columns: 52px minmax(0, 1fr); gap: 14px; }
  .chapter-head .chapter-letter { font-size: 54px; }
  .chapter-name h3 { font-size: 30px; }
  .card-title { font-size: 19px; }
  .card-sheet { padding: 7px; }
  .card-code { top: 13px; left: 13px; }

  .guide-grid { grid-template-columns: 1fr; gap: 24px; }
  .about-copy > p { font-size: 13px; }

  .footer-top { grid-template-columns: 1fr; gap: 22px; }
  .footer-top-link { justify-self: start; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 4px; }

  .viewer { grid-template-rows: 50px minmax(0, 1fr) 46px 78px; }
  .viewer-info { top: 50px; bottom: 124px; }
  .viewer-chapter { display: none; }
  .viewer-slash { display: none; }
  .viewer-mini-title { display: block; }
  .viewer-code { font-size: 17px; }
  .viewer-action { height: 34px; }
  .viewer-close { padding-left: 10px; margin-left: 2px; }
  .viewer-counter { font-size: 9px; }
  .zoom-tools button { height: 28px; min-width: 30px; }
  .rail-item { width: 64px; height: 44px; }
}
