/* ---------- tokens ---------- */
:root {
  --bg: #121013;
  --bg-elevated: #191518;
  --panel: #1e1a1d;
  --panel-border: #322c30;
  --ink: #ece6de;
  --ink-dim: #b3aaa1;
  --ink-faint: #8a8079;
  --gold: #c9a15a;
  --gold-bright: #e4c584;
  --gold-text: #d9b06e;
  --cabinet-1: #2a2118;
  --cabinet-2: #0f0d0b;
  --felt-green: #1c2a22;
  --felt-green-2: #0d1611;
  --badge-bg: radial-gradient(circle at 34% 26%, #2a2118, #0f0d0b);
  --badge-ink: #e4c584;
  --guilloche: rgba(201, 161, 90, .5);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-2: 0 2px 6px rgba(0,0,0,.5), 0 16px 40px rgba(0,0,0,.45);
}

:root[data-theme="light"] {
  --bg: #f3ede2;
  --bg-elevated: #ece3d4;
  --panel: #fbf7ef;
  --panel-border: #ddd0b8;
  --ink: #241f1a;
  --ink-dim: #55483c;
  --ink-faint: #7a6c5c;
  --gold: #93672c;
  --gold-bright: #7a5322;
  --gold-text: #7a5322;
  --shadow-1: 0 1px 2px rgba(60,45,20,.08), 0 8px 20px rgba(60,45,20,.08);
  --shadow-2: 0 2px 6px rgba(60,45,20,.1), 0 16px 32px rgba(60,45,20,.12);
  --badge-bg: linear-gradient(155deg, #e8dcc4, #cdb894);
  --badge-ink: #6b4718;
  --guilloche: rgba(122, 83, 34, .5);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3ede2;
    --bg-elevated: #ece3d4;
    --panel: #fbf7ef;
    --panel-border: #ddd0b8;
    --ink: #241f1a;
    --ink-dim: #55483c;
    --ink-faint: #7a6c5c;
    --gold: #93672c;
    --gold-bright: #7a5322;
    --gold-text: #7a5322;
    --shadow-1: 0 1px 2px rgba(60,45,20,.08), 0 8px 20px rgba(60,45,20,.08);
    --shadow-2: 0 2px 6px rgba(60,45,20,.1), 0 16px 32px rgba(60,45,20,.12);
    --badge-bg: linear-gradient(155deg, #e8dcc4, #cdb894);
    --badge-ink: #6b4718;
    --guilloche: rgba(122, 83, 34, .5);
  }
}

* { box-sizing: border-box; }
html { color-scheme: dark light; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse 1200px 600px at 50% -10%, rgba(201,161,90,.07), transparent 60%);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
a { color: var(--gold-text); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
button { font-family: inherit; }

/* ---------- header ---------- */
/* The header sits on a reeded edge — the fine milling cut into a coin's rim,
   originally to make clipping detectable. Here it just marks the boundary. */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
}
.site-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px;
  background-image: repeating-linear-gradient(90deg, var(--gold) 0 1px, transparent 1px 4px);
  opacity: .22; pointer-events: none;
}
.header-row { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark svg { width: 30px; height: 30px; display: block; }
.mark-ring { fill: none; stroke: var(--gold); stroke-width: 2.5; }
.mark-face { fill: var(--gold); opacity: .18; }
.brand-text { font-family: var(--serif); font-weight: 700; font-size: 1.35rem; letter-spacing: .02em; white-space: nowrap; }
.header-stats { display: flex; gap: 20px; font-size: .8rem; color: var(--ink-faint); }
.header-stats b { color: var(--gold-text); font-weight: 700; }
.theme-toggle {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--panel-border);
  background: var(--panel); color: var(--ink-dim); display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex: none; transition: border-color .15s, color .15s;
}
.theme-toggle:hover { border-color: var(--gold); color: var(--gold-text); }
.theme-toggle svg { width: 16px; height: 16px; }

/* ---------- hero ---------- */
/* Behind the title, a guilloché rosette — the engine-turned figure cut on a
   rose lathe, the ornamental language of coin dies and security printing
   since the 18th century. Drawn live in app.js from a hypotrochoid, the same
   curve the lathe traces mechanically. */
.hero { padding: 56px 0 28px; text-align: center; position: relative; }
.hero-guilloche {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, 92vw); height: min(560px, 92vw); pointer-events: none; z-index: 0;
  color: var(--guilloche); opacity: .16;
  -webkit-mask-image: radial-gradient(circle, #000 42%, transparent 72%);
  mask-image: radial-gradient(circle, #000 42%, transparent 72%);
}
.hero-guilloche path { fill: none; stroke: currentColor; stroke-width: .55; vector-effect: non-scaling-stroke; }
.hero > h1, .hero > p { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2.1rem, 4vw, 3rem); color: var(--ink); }
.hero h1 em { font-style: normal; color: var(--gold-text); }
.hero p { max-width: 640px; margin: 14px auto 0; color: var(--ink-dim); font-size: 1.05rem; }

/* ---------- controls ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; margin: 28px 0 8px; }
.search-box { position: relative; }
.search-box input {
  width: 280px; max-width: 60vw; padding: 11px 16px 11px 38px; border-radius: 999px;
  border: 1px solid var(--panel-border); background: var(--panel); color: var(--ink); font-size: .92rem;
  outline: none; transition: border-color .15s;
}
.search-box input:focus { border-color: var(--gold); }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; stroke: var(--ink-faint); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--panel-border); background: var(--panel);
  color: var(--ink-dim); font-size: .82rem; cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--gold); color: var(--ink); }
.chip.active { background: var(--gold); border-color: var(--gold); color: #171112; font-weight: 600; }

/* ---------- section titles ---------- */
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 44px 0 18px; }
.section-title h2 { font-size: 1.5rem; }
.section-title .count { color: var(--ink-faint); font-size: .85rem; }
.section-lede { color: var(--ink-dim); font-size: .92rem; max-width: 640px; margin: -10px 0 18px; }

/* ---------- flag grid ---------- */
.flag-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; }
@media (max-width: 900px) { .flag-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 500px) { .flag-grid { grid-template-columns: repeat(2, 1fr); } }
.flag-tile {
  display: block; text-decoration: none; color: inherit; background: var(--panel);
  border: 1px solid var(--panel-border); border-radius: var(--radius-md); overflow: hidden;
  cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.flag-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-1); border-color: var(--gold); }
.flag-img-wrap { aspect-ratio: 4 / 3; background: var(--bg-elevated); overflow: hidden; }
.flag-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.flag-meta { padding: 10px 12px 12px; }
.flag-name { font-size: .86rem; font-weight: 600; display: block; line-height: 1.25; }
.flag-count { font-size: .74rem; color: var(--ink-faint); margin-top: 2px; display: block; }

/* ---------- badge (historical) grid ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.badge-tile {
  display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius-md);
  padding: 14px; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.badge-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-1); border-color: var(--gold); }
.badge-emblem {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, var(--cabinet-1), var(--cabinet-2));
  border: 1.5px solid var(--gold); display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; color: var(--gold-bright); font-size: 1.1rem;
}
.badge-name { font-size: .88rem; font-weight: 600; line-height: 1.25; display: block; }
.badge-era { font-size: .72rem; color: var(--ink-faint); margin-top: 2px; display: block; }

/* ---------- tile badge (flagless countries) ---------- */
.tile-badge {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; font-size: 1.7rem; letter-spacing: .06em;
  color: var(--badge-ink); background: var(--badge-bg);
}

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--ink-faint); }

/* ---------- breadcrumbs ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 28px 0 0; font-size: .82rem; }
.crumbs a { color: var(--ink-dim); text-decoration: none; }
.crumbs a:hover { color: var(--gold-text); text-decoration: underline; }
.crumbs [aria-current] { color: var(--gold-text); font-weight: 600; }
.crumb-sep { color: var(--ink-faint); opacity: .5; }

/* ---------- issuer grid ---------- */
.issuer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 56px; }
.issuer-tile {
  display: flex; gap: 16px; align-items: flex-start; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius-md);
  padding: 18px; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.issuer-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-1); border-color: var(--gold); }
.issuer-flag, .issuer-badge {
  flex: none; width: 60px; height: 44px; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--panel-border); display: block;
}
.issuer-flag img { width: 100%; height: 100%; object-fit: cover; display: block; }
.issuer-badge {
  display: flex; align-items: center; justify-content: center; border-color: var(--gold);
  background: var(--badge-bg);
  font-family: var(--serif); font-weight: 700; color: var(--badge-ink); font-size: 1.05rem; letter-spacing: .04em;
}
.issuer-body { display: block; min-width: 0; }
.issuer-name { display: block; font-family: var(--serif); font-size: 1.2rem; font-weight: 600; line-height: 1.2; }
.issuer-meta { display: block; font-size: .76rem; color: var(--gold-text); margin-top: 3px; letter-spacing: .02em; }
.issuer-note { display: block; font-size: .82rem; color: var(--ink-dim); margin-top: 8px; line-height: 1.5; }

/* ---------- tray bar + sort ---------- */
.tray-bar { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 44px 0 4px; }
.tray-bar .section-title.tray-title { margin: 0; }
.sorts { display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 999px; padding: 3px; }
.sort-btn {
  border: none; background: none; color: var(--ink-dim); font-size: .78rem; padding: 6px 14px;
  border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; white-space: nowrap;
}
.sort-btn:hover { color: var(--ink); }
.sort-btn.active { background: var(--gold); color: var(--on-amber, #171112); font-weight: 600; }
:root[data-theme="light"] .sort-btn.active { color: #fff; }

/* ---------- tray (one ruling authority) ---------- */
.tray { margin-top: 22px; }
.tray-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding-bottom: 9px; margin-bottom: 18px; border-bottom: 1px solid var(--panel-border);
}
.tray-head h3 { font-size: 1.15rem; font-weight: 600; }
.tray-era { font-size: .78rem; color: var(--gold-text); }
.tray-house { font-size: .74rem; color: var(--ink-faint); font-style: italic; }
.tray-count { margin-left: auto; font-size: .74rem; color: var(--ink-faint); }

/* ---------- coin card additions ---------- */
.coin-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.coin-head .coin-year { margin-left: auto; }
.coin-specs { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 0; padding: 0; }
.coin-specs dd {
  margin: 0; font-size: .68rem; color: var(--ink-dim); background: var(--bg-elevated);
  border: 1px solid var(--panel-border); border-radius: 4px; padding: 2px 7px; line-height: 1.5;
}
.coin-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 11px; }
.coin-grade {
  font-size: .66rem; font-weight: 700; letter-spacing: .06em; color: var(--gold-text);
  border: 1px solid var(--gold); border-radius: 3px; padding: 1px 6px;
}
.coin-ref { font-size: .68rem; color: var(--ink-faint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.coin-foot .coin-source { margin-top: 0; margin-left: auto; }

/* ---------- restrike / replica ----------
   A restrike is not the coin the catalogue describes. Mark it plainly and stop
   the catalogue's figures from reading as measurements of this piece. */
.coin-card.is-restrike { border-color: color-mix(in srgb, var(--gold) 45%, var(--panel-border)); }
.specimen-flag { display: flex; flex-direction: column; gap: 5px; margin: 10px 0 0; }
.specimen-mark {
  align-self: flex-start; font-size: .62rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--on-amber, #171112); background: var(--gold);
  border-radius: 3px; padding: 2px 7px;
}
:root[data-theme="light"] .specimen-mark { color: #fff; }
.specimen-note { font-size: .76rem; line-height: 1.5; color: var(--ink-dim); }
.coin-specs.is-catalogue dd { opacity: .72; border-style: dashed; }
.specs-caveat { margin: 6px 0 0; font-size: .66rem; color: var(--ink-faint); font-style: italic; }

/* ---------- awaiting photography ---------- */
.coin-stage.is-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; cursor: default; }
.coin-ghost { width: 42%; height: auto; fill: none; stroke: var(--gold); stroke-width: 2.5; opacity: .34; }
.coin-pending { font-size: .68rem; color: var(--ink-faint); letter-spacing: .04em; }
.coin-card.no-image { border-style: dashed; }

/* ---------- detail view ---------- */
.detail-back {
  display: inline-flex; align-items: center; gap: 6px; margin: 28px 0 0; color: var(--ink-dim);
  text-decoration: none; font-size: .85rem; border: none; background: none; cursor: pointer; padding: 0;
}
.detail-back:hover { color: var(--gold-text); }
.detail-header { display: flex; gap: 22px; align-items: center; margin: 22px 0 6px; flex-wrap: wrap; }
.detail-flag { width: 96px; height: 72px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--panel-border); flex: none; display: block; }
.detail-flag img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-badge, .detail-emblem {
  width: 88px; height: 88px; border-radius: 50%; flex: none;
  background: var(--badge-bg);
  border: 2px solid var(--gold); display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; color: var(--badge-ink); font-size: 1.7rem; letter-spacing: .04em;
}
.detail-titles h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
.detail-titles .era { color: var(--ink-faint); font-size: .85rem; margin-top: 4px; }
.detail-stats { display: flex; gap: 22px; margin: 18px 0 6px; flex-wrap: wrap; }
.detail-stat { }
.detail-stat b { font-family: var(--serif); font-size: 1.4rem; color: var(--gold-text); display: block; }
.detail-stat span { font-size: .74rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; }
.speciality {
  margin: 22px 0 8px; padding: 18px 22px; background: var(--panel); border: 1px solid var(--panel-border);
  border-left: 3px solid var(--gold); border-radius: var(--radius-sm); color: var(--ink-dim);
  font-size: .96rem; line-height: 1.65;
}
.speciality p { margin: 0; }
.speciality p + p { margin-top: 10px; }

/* ---------- coin grid ---------- */
.coin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; margin: 30px 0 60px; }
.coin-card {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-1);
}
.coin-stage {
  position: relative; aspect-ratio: 1 / 1;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,.05), transparent 55%),
    radial-gradient(circle at 50% 50%, var(--felt-green) 0%, var(--felt-green-2) 72%, #070b08 100%);
  perspective: 900px;
  cursor: pointer;
}
:root[data-theme="light"] .coin-stage, @media (prefers-color-scheme: light) { }
.coin-flip {
  position: absolute; inset: 10%; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.4,.2,.2,1);
}
.coin-card.flipped .coin-flip { transform: rotateY(180deg); }
.coin-face {
  position: absolute; inset: 0; backface-visibility: hidden; display: flex; align-items: center; justify-content: center;
}
.coin-face img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 10px 18px rgba(0,0,0,.55)); }
.coin-face.back { transform: rotateY(180deg); }
.coin-flip-hint {
  position: absolute; bottom: 8px; right: 10px; font-size: .68rem; color: var(--ink-faint);
  background: rgba(0,0,0,.35); padding: 3px 8px; border-radius: 999px; pointer-events: none;
  display: flex; align-items: center; gap: 4px;
}
.coin-info { padding: 14px 16px 16px; }
.coin-denom { font-family: var(--serif); font-weight: 700; font-size: 1.25rem; color: var(--ink); }
.coin-year { color: var(--gold-text); font-size: .85rem; font-weight: 600; margin-left: 6px; }
.coin-note { font-size: .82rem; color: var(--ink-dim); margin-top: 5px; line-height: 1.4; min-height: 1.2em; }
.coin-source { display: inline-block; margin-top: 9px; font-size: .7rem; color: var(--ink-faint); text-decoration: none; }
.coin-source:hover { color: var(--gold-text); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--panel-border); margin-top: 60px; padding: 26px 0 60px; color: var(--ink-faint); font-size: .8rem; text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .header-stats { display: none; }
  .hero { padding: 36px 0 18px; }
  .detail-header { gap: 14px; }
  .detail-flag, .detail-emblem { width: 72px; height: 54px; }
  .detail-emblem { height: 72px; }
}

/* ---------- collection world map ---------- */
/* Copper-to-gold intensity, tuned to the cabinet rather than a political-map
   palette. Water and land stay quiet so collected countries carry the eye. */
:root {
  --map-water: #0d1611;
  --map-land: #2a2624;
  --map-border: #14100d;
  --map-collected-1: #6f4f2a;
  --map-collected-2: #97702f;
  --map-collected-3: #c69a49;
  --map-collected-4: #efd07b;
}
:root[data-theme="light"] {
  --map-water: #e7ddc8;
  --map-land: #d6c8ac;
  --map-border: #c7b697;
  --map-collected-1: #dcbd8c;
  --map-collected-2: #c99a4f;
  --map-collected-3: #a9772f;
  --map-collected-4: #7a5322;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --map-water: #e7ddc8;
    --map-land: #d6c8ac;
    --map-border: #c7b697;
    --map-collected-1: #dcbd8c;
    --map-collected-2: #c99a4f;
    --map-collected-3: #a9772f;
    --map-collected-4: #7a5322;
  }
}

.eyebrow { margin: 0 0 2px; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-text); font-weight: 700; }

.collection-map-section {
  position: relative; margin: 30px 0 8px; padding: 20px 20px 16px;
  border: 1px solid var(--panel-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1);
  background:
    radial-gradient(1200px 300px at 50% -30%, rgba(201,161,90,.06), transparent 70%),
    linear-gradient(160deg, var(--cabinet-1), var(--cabinet-2));
}
:root[data-theme="light"] .collection-map-section { background: linear-gradient(160deg, #efe6d4, #e4d7bd); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .collection-map-section { background: linear-gradient(160deg, #efe6d4, #e4d7bd); }
}
.map-heading { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.map-heading h2 { font-size: 1.5rem; }
.map-heading > p { color: var(--ink-dim); font-size: .9rem; margin: 0; max-width: 420px; }

.map-views { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.map-view {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--panel-border);
  background: color-mix(in srgb, var(--panel) 70%, transparent); color: var(--ink-dim);
  font-size: .8rem; cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.map-view:hover { border-color: var(--gold); color: var(--ink); }
.map-view.active { background: var(--gold); border-color: var(--gold); color: #171112; font-weight: 600; }
:root[data-theme="light"] .map-view.active { color: #fff; }

.map-frame {
  position: relative; border-radius: var(--radius-md); overflow: hidden; min-height: 160px;
  background: var(--map-water); border: 1px solid var(--map-border);
}
.map-frame > svg.world-map { width: 100%; height: auto; display: block; }
.map-loading { text-align: center; color: var(--ink-faint); font-size: .85rem; padding: 44px 16px; margin: 0; }

.collection-map-section .map-countries path {
  fill: var(--map-land); stroke: var(--map-border); stroke-width: .5;
  transition: fill .15s ease, stroke .15s ease;
}
.collection-map-section .map-countries path[data-map-bucket="1"] { fill: var(--map-collected-1); }
.collection-map-section .map-countries path[data-map-bucket="2"] { fill: var(--map-collected-2); }
.collection-map-section .map-countries path[data-map-bucket="3"] { fill: var(--map-collected-3); }
.collection-map-section .map-countries path[data-map-bucket="4"] { fill: var(--map-collected-4); }
.collection-map-section .map-countries path[data-map-state="collected"] { cursor: pointer; }
.collection-map-section .map-countries path[data-map-state="collected"]:hover,
.collection-map-section .map-countries path[data-map-state="collected"]:focus-visible {
  stroke: var(--ink); stroke-width: 1.3; outline: none;
}

.map-legend { display: flex; align-items: center; gap: 6px; margin: 12px 0 2px; font-size: .72rem; color: var(--ink-faint); }
.map-swatch { width: 22px; height: 12px; border-radius: 3px; border: 1px solid var(--map-border); }
.map-swatch[data-map-bucket="1"] { background: var(--map-collected-1); }
.map-swatch[data-map-bucket="2"] { background: var(--map-collected-2); }
.map-swatch[data-map-bucket="3"] { background: var(--map-collected-3); }
.map-swatch[data-map-bucket="4"] { background: var(--map-collected-4); }
.map-legend-label { letter-spacing: .04em; }

.map-region-list { margin: 12px 0 0; }
.map-region-list-title { margin: 0 0 8px; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.map-region-list-items { display: flex; flex-wrap: wrap; gap: 6px; }
.map-region-chip {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--panel-border);
  background: color-mix(in srgb, var(--panel) 70%, transparent); color: var(--ink);
  font-size: .8rem; transition: border-color .15s, color .15s;
}
.map-region-chip span { color: var(--gold-text); font-weight: 700; font-size: .72rem; }
.map-region-chip:hover, .map-region-chip:focus-visible { border-color: var(--gold); color: var(--gold-text); outline: none; }
.map-note { margin: 8px 0 0; font-size: .76rem; color: var(--ink-faint); line-height: 1.5; }

.map-tip {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -135%);
  background: color-mix(in srgb, var(--bg-elevated) 92%, #000); color: var(--ink);
  border: 1px solid var(--gold); border-radius: 6px; padding: 4px 9px; font-size: .78rem;
  white-space: nowrap; pointer-events: none; opacity: 0; z-index: 5; box-shadow: var(--shadow-1);
  transition: opacity .12s ease;
}
.map-tip[data-show="1"] { opacity: 1; }
@media (hover: none) { .map-tip { display: none; } }

/* India historical callout: the bridge from a modern-country map pick to its
   historical issuers. */
.historical-callout {
  margin: 22px 0 8px; padding: 16px 20px; background: var(--panel);
  border: 1px solid var(--panel-border); border-left: 3px solid var(--gold); border-radius: var(--radius-sm);
}
.historical-callout h2 { font-size: 1.2rem; margin: 0 0 4px; }
.historical-callout p { margin: 0; color: var(--ink-dim); font-size: .9rem; line-height: 1.6; }

@media (max-width: 640px) {
  .collection-map-section { padding: 16px 12px 12px; }
  .map-heading > p { max-width: none; }
  .map-tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .collection-map-section .map-countries path { transition: none; }
  .map-tip { transition: none; }
}

/* ---------- exhibition ----------
   A display case rather than a grid: one series at a time, in plates. Each
   plate holds two coins; each coin sets its obverse/reverse against a
   two-column information panel, so a plate reads as a 2x2 block. */
.header-link {
  font-size: .82rem; color: var(--ink-dim); text-decoration: none; white-space: nowrap;
  padding: 6px 13px; border: 1px solid var(--panel-border); border-radius: 999px; transition: border-color .15s, color .15s;
}
.header-link:hover { border-color: var(--gold); color: var(--gold-text); }

.exhibit-head { display: flex; gap: 22px; align-items: center; margin: 22px 0 6px; flex-wrap: wrap; }

.exhibit-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin: 26px 0 18px; padding: 10px 14px; background: var(--panel);
  border: 1px solid var(--panel-border); border-radius: 999px;
}
.exhibit-pageinfo { font-size: .82rem; color: var(--ink-dim); letter-spacing: .04em; }
.exhibit-pageinfo b { color: var(--gold-text); font-family: var(--serif); font-size: 1.05rem; }
.exhibit-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.exhibit-btn {
  font: inherit; font-size: .8rem; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--panel-border); background: var(--bg-elevated); color: var(--ink-dim);
  text-decoration: none; transition: border-color .15s, color .15s;
}
.exhibit-btn:hover { border-color: var(--gold); color: var(--gold-text); }
.exhibit-btn.is-off { opacity: .38; pointer-events: none; }

/* Each series can set its own case colours. The default is the cabinet's wood
   and brass; a series carrying data-series-theme overrides these tokens. */
.exhibit, .gallery-card {
  --ex-plate: linear-gradient(160deg, var(--cabinet-1), var(--cabinet-2));
  --ex-vitrine: rgba(0,0,0,.22);
  --ex-sheen: rgba(255,255,255,.05);
  --ex-border: var(--panel-border);
  --ex-dim: var(--ink-faint);
  --ex-ink: var(--ink);
  --ex-soft: var(--ink-dim);
  --ex-glow: rgba(255,240,210,.12);
  --ex-rule: var(--gold);
  --ex-ribbon: none;
  --ex-label: #f5f1e6;
  --ex-label-edge: #ddd4c1;
  --ex-label-accent: #7a5322;
}

/* United Kingdom — the Crown Jewels room: a near-black gallery, each coin
   spotlit behind glass, Union blue and crimson, and a printed cream label. */
[data-series-theme="uk"] {
  --ex-plate:
    radial-gradient(1100px 380px at 50% -12%, rgba(150,180,240,.13), transparent 72%),
    linear-gradient(168deg, #0d1430 0%, #080c1c 58%, #05070f 100%);
  --ex-vitrine:
    radial-gradient(ellipse 70% 60% at 50% 22%, rgba(120,155,225,.16), transparent 72%),
    linear-gradient(180deg, #0a1029 0%, #060915 100%);
  --ex-sheen: rgba(170,200,255,.10);
  --ex-border: #26325a;
  --ex-dim: #93a6cd;
  --ex-ink: #eef2fa;
  --ex-soft: #c3d0e8;
  --ex-glow: rgba(190,215,255,.20);
  --ex-rule: #c9a15a;
  --ex-ribbon: linear-gradient(90deg, #012169 0 34%, #f4f6fa 34% 66%, #c8102e 66% 100%);
  --ex-label-accent: #8c1c2b;
}
:root[data-theme="light"] [data-series-theme="uk"] {
  --ex-plate:
    radial-gradient(1100px 380px at 50% -12%, rgba(1,33,105,.09), transparent 72%),
    linear-gradient(168deg, #e9edf7, #d7deee);
  --ex-vitrine:
    radial-gradient(ellipse 70% 60% at 50% 22%, rgba(255,255,255,.85), transparent 72%),
    linear-gradient(180deg, #dfe5f2, #cfd8ea);
  --ex-sheen: rgba(255,255,255,.7);
  --ex-border: #bcc7e0;
  --ex-dim: #5c6c90;
  --ex-ink: #131a2c;
  --ex-soft: #3c4864;
  --ex-glow: rgba(255,255,255,.9);
  --ex-rule: #8a6a2f;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) [data-series-theme="uk"] {
    --ex-plate:
      radial-gradient(1100px 380px at 50% -12%, rgba(1,33,105,.09), transparent 72%),
      linear-gradient(168deg, #e9edf7, #d7deee);
    --ex-vitrine:
      radial-gradient(ellipse 70% 60% at 50% 22%, rgba(255,255,255,.85), transparent 72%),
      linear-gradient(180deg, #dfe5f2, #cfd8ea);
    --ex-sheen: rgba(255,255,255,.7);
    --ex-border: #bcc7e0;
    --ex-dim: #5c6c90;
    --ex-ink: #131a2c;
    --ex-soft: #3c4864;
    --ex-glow: rgba(255,255,255,.9);
    --ex-rule: #8a6a2f;
  }
}

/* China — lantern-red walls and gilt frames, each zodiac animal
   under a warm spot. A celebration theme for the lunar series. */
[data-series-theme="china"] {
  --ex-plate:
    radial-gradient(1100px 380px at 50% -12%, rgba(220,60,30,.15), transparent 72%),
    linear-gradient(168deg, #2a0a08 0%, #1c0604 58%, #0f0302 100%);
  --ex-vitrine:
    radial-gradient(ellipse 70% 60% at 50% 22%, rgba(200,80,40,.14), transparent 72%),
    linear-gradient(180deg, #200806 0%, #120302 100%);
  --ex-sheen: rgba(255,210,130,.12);
  --ex-border: #5a2a1a;
  --ex-dim: #c9a086;
  --ex-ink: #faf0e4;
  --ex-soft: #d4b8a0;
  --ex-glow: rgba(255,200,100,.22);
  --ex-rule: #c9a15a;
  --ex-ribbon: linear-gradient(90deg, #c8102e 0 40%, #ffd700 40% 60%, #c8102e 60% 100%);
  --ex-label-accent: #8c1c1c;
}
:root[data-theme="light"] [data-series-theme="china"] {
  --ex-plate:
    radial-gradient(1100px 380px at 50% -12%, rgba(200,16,46,.08), transparent 72%),
    linear-gradient(168deg, #f7e9e6, #eed8d3);
  --ex-vitrine:
    radial-gradient(ellipse 70% 60% at 50% 22%, rgba(255,255,255,.85), transparent 72%),
    linear-gradient(180deg, #f2ddd8, #e8cec8);
  --ex-sheen: rgba(255,255,255,.7);
  --ex-border: #d4a8a0;
  --ex-dim: #7a3a2e;
  --ex-ink: #2a0a06;
  --ex-soft: #5a2218;
  --ex-glow: rgba(255,255,255,.9);
  --ex-rule: #8a4a1f;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) [data-series-theme="china"] {
    --ex-plate:
      radial-gradient(1100px 380px at 50% -12%, rgba(200,16,46,.08), transparent 72%),
      linear-gradient(168deg, #f7e9e6, #eed8d3);
    --ex-vitrine:
      radial-gradient(ellipse 70% 60% at 50% 22%, rgba(255,255,255,.85), transparent 72%),
      linear-gradient(180deg, #f2ddd8, #e8cec8);
    --ex-sheen: rgba(255,255,255,.7);
    --ex-border: #d4a8a0;
    --ex-dim: #7a3a2e;
    --ex-ink: #2a0a06;
    --ex-soft: #5a2218;
    --ex-glow: rgba(255,255,255,.9);
    --ex-rule: #8a4a1f;
  }
}

/* India — an indigo room lit saffron, with the tricolour on the ribbon. */
[data-series-theme="india"] {
  --ex-plate:
    radial-gradient(1100px 380px at 50% -12%, rgba(244,166,60,.13), transparent 72%),
    linear-gradient(168deg, #1d1533 0%, #140e24 58%, #0a0714 100%);
  --ex-vitrine:
    radial-gradient(ellipse 70% 60% at 50% 22%, rgba(244,166,60,.14), transparent 72%),
    linear-gradient(180deg, #180f2c 0%, #0b0716 100%);
  --ex-sheen: rgba(255,215,150,.11);
  --ex-border: #3b2c5e;
  --ex-dim: #a99ac6;
  --ex-ink: #f6efe6;
  --ex-soft: #cbbfd8;
  --ex-glow: rgba(255,200,110,.2);
  --ex-rule: #f4a63c;
  --ex-ribbon: linear-gradient(90deg, #ff9933 0 33%, #ffffff 33% 66%, #138808 66% 100%);
  --ex-label-accent: #8a5a12;
}
:root[data-theme="light"] [data-series-theme="india"] {
  --ex-plate:
    radial-gradient(1100px 380px at 50% -12%, rgba(244,166,60,.12), transparent 72%),
    linear-gradient(168deg, #f4eee6, #e7ddd0);
  --ex-vitrine:
    radial-gradient(ellipse 70% 60% at 50% 22%, rgba(255,255,255,.85), transparent 72%),
    linear-gradient(180deg, #efe5d8, #e2d5c4);
  --ex-sheen: rgba(255,255,255,.7);
  --ex-border: #cbb89c;
  --ex-dim: #6d5a36;
  --ex-ink: #241a2e;
  --ex-soft: #4b3d55;
  --ex-glow: rgba(255,255,255,.9);
  --ex-rule: #9a6512;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) [data-series-theme="india"] {
    --ex-plate:
      radial-gradient(1100px 380px at 50% -12%, rgba(244,166,60,.12), transparent 72%),
      linear-gradient(168deg, #f4eee6, #e7ddd0);
    --ex-vitrine:
      radial-gradient(ellipse 70% 60% at 50% 22%, rgba(255,255,255,.85), transparent 72%),
      linear-gradient(180deg, #efe5d8, #e2d5c4);
    --ex-sheen: rgba(255,255,255,.7);
    --ex-border: #cbb89c;
    --ex-dim: #6d5a36;
    --ex-ink: #241a2e;
    --ex-soft: #4b3d55;
    --ex-glow: rgba(255,255,255,.9);
    --ex-rule: #9a6512;
  }
}

.coming-soon .plaque .coming-soon-tag {
  color: var(--ex-rule);
  font-style: italic;
  letter-spacing: .06em;
}
.coming-soon .mat.is-empty { opacity: .5; }

.plaque .represents {
  display: block;
  font-size: .68rem;
  letter-spacing: .04em;
  color: var(--ex-rule);
  margin-top: 2px;
}
/* The note sits on a cream label, so it takes a dark ink rather than the
   gallery's soft-on-dark colour, which washed out to near-illegible here. */
.plaque .note {
  display: block;
  font-size: .64rem;
  line-height: 1.4;
  color: #5f5647;
  margin-top: 6px;
  font-style: italic;
}

/* --- the gallery entrance --- */
.gallery-head { text-align: center; padding: 46px 0 34px; }
.gallery-eyebrow {
  margin: 0; font-size: .64rem; letter-spacing: .34em; text-transform: uppercase;
  color: var(--ex-rule);
}
.gallery-eyebrow::after {
  content: ""; display: block; width: 34px; height: 1px; margin: 12px auto 0; background: var(--ex-rule); opacity: .5;
}
.gallery-country {
  display: inline-flex; align-items: center; gap: 10px; margin: 22px 0 0;
  font-size: .82rem; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-dim);
}
.gallery-country img {
  width: 26px; height: 18px; object-fit: cover; border-radius: 2px; border: 1px solid var(--panel-border);
}
.gallery-title {
  font-family: var(--serif); font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 600;
  line-height: 1.05; margin: 10px 0 0; color: var(--ink);
}
.gallery-dates {
  margin: 10px 0 0; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--gold-text);
}
.gallery-intro { max-width: 60ch; margin: 26px auto 0; text-align: left; }
.gallery-intro p { margin: 0; color: var(--ink-dim); font-size: .96rem; line-height: 1.75; }
.gallery-intro p + p { margin-top: 12px; }
.gallery-facts {
  display: flex; justify-content: center; gap: 0; list-style: none; margin: 30px 0 0; padding: 0;
}
.gallery-facts li { padding: 0 26px; }
.gallery-facts li + li { border-left: 1px solid var(--panel-border); }
.gallery-facts b {
  display: block; font-family: var(--serif); font-size: 1.7rem; font-weight: 600; color: var(--gold-text); line-height: 1;
}
.gallery-facts span {
  display: block; margin-top: 5px; font-size: .62rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint);
}

/* --- the foyer: each exhibit announced by one of its own coins, hung side by
   side like posters outside a gallery. The grid takes as many as are added. --- */
.gallery-cards {
  display: grid; gap: 26px; margin-bottom: 60px; align-items: stretch;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
}
.gallery-card {
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit; position: relative; overflow: hidden;
  border: 1px solid var(--ex-border); border-radius: var(--radius-lg);
  background: var(--ex-plate); box-shadow: var(--shadow-1);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.gallery-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; z-index: 2;
  background: var(--ex-ribbon); opacity: .9;
}
.gallery-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: var(--ex-rule); }

/* The coin stands in a lit case across the head of the card */
.gallery-card-coin {
  position: relative; flex: none; aspect-ratio: 20 / 11;
  background: var(--ex-vitrine); border-bottom: 1px solid var(--ex-border);
  display: flex; align-items: center; justify-content: center;
}
.gallery-card-coin::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 58% 70% at 50% 40%, var(--ex-glow), transparent 72%);
}
.gallery-card-coin::after {
  content: ""; position: absolute; left: 34%; right: 34%; bottom: 11%; height: 12px;
  border-radius: 50%; background: radial-gradient(ellipse at center, rgba(0,0,0,.55), transparent 72%);
}
.gallery-card-coin img {
  position: relative; z-index: 1; height: 78%; width: auto; max-width: 62%; object-fit: contain;
  filter: drop-shadow(0 16px 26px rgba(0,0,0,.6));
  transition: transform .25s ease;
}
.gallery-card:hover .gallery-card-coin img { transform: translateY(-3px) scale(1.03); }

.gallery-card-body { display: flex; flex-direction: column; flex: 1; padding: 26px 28px 28px; }
.gallery-card-country {
  margin: 0; font-size: .68rem; letter-spacing: .26em; text-transform: uppercase; color: var(--ex-dim);
}
.gallery-card-title {
  font-family: var(--serif); font-size: clamp(1.7rem, 2.6vw, 2.3rem); font-weight: 600;
  line-height: 1.12; margin: 8px 0 0; color: var(--ex-ink);
}
.gallery-card-dates {
  margin: 6px 0 0; font-family: var(--serif); font-style: italic; font-size: 1rem; color: var(--ex-rule);
}
.gallery-card-lede {
  margin: 14px 0 0; font-size: .9rem; line-height: 1.65; color: var(--ex-soft);
}
.gallery-card-meta { margin: 16px 0 0; font-size: .76rem; letter-spacing: .05em; color: var(--ex-dim); }
.gallery-card-meta b { font-family: var(--serif); font-size: 1.05rem; color: var(--ex-ink); font-weight: 600; }
.gallery-card-cta {
  display: inline-block; margin-top: auto; padding-top: 18px;
  font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ex-rule);
}
@media (max-width: 700px) {
  .gallery-cards { gap: 20px; }
  .gallery-card-coin { aspect-ratio: 16 / 9; }
  .gallery-card-body { padding: 22px 20px 24px; }
}

/* --- the case --- */
.exhibit-page {
  position: relative; overflow: hidden;
  display: grid; gap: 20px; margin-bottom: 30px; padding: 26px 24px 24px;
  border: 1px solid var(--ex-border); border-radius: var(--radius-lg);
  background: var(--ex-plate);
  box-shadow: var(--shadow-2);
}
.exhibit-page::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--ex-ribbon); opacity: .9; pointer-events: none;
}
.exhibit-plate-no {
  margin: 0; font-size: .62rem; letter-spacing: .26em; text-transform: uppercase;
  color: var(--ex-dim); text-align: center;
}

/* One object on show: the lit case, then the wall label mounted beside it.
   The label is deliberately smaller than the case — as a printed label is
   beside a real vitrine — so it is centred rather than stretched to match. */
/* Case and label are one pair: both stretch to the same height, the coins
   centred in their glass and the label's footer resting on the bottom edge. */
.object { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 6fr); gap: 26px; align-items: stretch; }
.object + .object { margin-top: 26px; padding-top: 26px; border-top: 1px solid var(--ex-border); }

/* The vitrine is the case interior, not a second box inside the case: the two
   coins sit straight on the case floor, each in its own pool of light, with no
   border or panel of their own. */
.object-case {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  align-content: center; padding: 6px 6px 2px;
}
.object-no {
  position: absolute; top: 9px; right: 13px; font-family: var(--serif);
  font-size: .9rem; color: var(--ex-rule); opacity: .85; letter-spacing: .04em;
}
.object-face { margin: 0; }
.object-face figcaption {
  margin-top: 7px; text-align: center; font-size: .6rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ex-dim);
}
/* The coin is not in a box of its own — it sits in a pool of gallery light
   cast on the case floor, with its own shadow beneath it. */
.object-lit {
  position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden;
  background: radial-gradient(ellipse 62% 48% at 50% 36%, var(--ex-glow), transparent 72%);
}
.object-lit::after {
  content: ""; position: absolute; left: 24%; right: 24%; bottom: 10%; height: 9px;
  border-radius: 50%; background: radial-gradient(ellipse at center, rgba(0,0,0,.45), transparent 72%);
}
.object-lit img {
  position: absolute; inset: 8%; width: 84%; height: 84%; object-fit: contain; z-index: 1;
  filter: drop-shadow(0 12px 20px rgba(0,0,0,.55));
}
.object-empty {
  grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; min-height: 170px; border: 1px dashed var(--ex-border); border-radius: 10px;
}

/* The wall label is printed card stock, so it carries its own dark ink
   regardless of how dark the gallery around it is. Re-pointing the tokens here
   keeps every line inside the label legible on the cream. */
.object-label {
  --ex-ink: #23201b;
  --ex-soft: #4c4538;
  --ex-dim: #736853;
  --ex-rule: var(--ex-label-accent);
  min-width: 0; padding: 16px 18px; border-radius: var(--radius-sm);
  background: var(--ex-label); border: 1px solid var(--ex-label-edge);
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column;
}
.label-link { margin-top: auto; }
.label-title {
  font-family: var(--serif); font-size: 1.3rem; font-weight: 600; line-height: 1.15;
  color: var(--ex-ink); margin: 0;
}
.label-date {
  margin: 2px 0 0; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ex-rule);
}
.label-maker { margin: 6px 0 0; font-size: .8rem; font-style: italic; color: var(--ex-soft); }
.label-text {
  margin: 9px 0 0; padding-top: 9px; border-top: 1px solid var(--ex-label-edge);
  font-size: .78rem; line-height: 1.5; color: var(--ex-soft);
}
.label-tomb { margin: 10px 0 0; display: grid; gap: 4px; }
.label-tomb > div { display: grid; grid-template-columns: 6.4em 1fr; gap: 9px; align-items: baseline; }
.label-tomb dt {
  font-size: .55rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ex-dim); line-height: 1.5;
}
.label-tomb dd { margin: 0; font-size: .76rem; line-height: 1.4; color: var(--ex-ink); overflow-wrap: anywhere; }
.label-foot {
  margin: 9px 0 0; padding-left: 9px; border-left: 2px solid var(--ex-rule);
  font-size: .69rem; font-style: italic; line-height: 1.45; color: var(--ex-soft);
}
.label-link {
  display: inline-block; margin-top: 9px; font-size: .66rem; letter-spacing: .06em;
  color: var(--ex-dim); text-decoration: none;
}
.label-link:hover { color: var(--ex-rule); }

.exhibit-closing {
  margin: 8px 0 60px; padding: 16px 20px; background: var(--panel); border: 1px solid var(--panel-border);
  border-left: 3px solid var(--gold); border-radius: var(--radius-sm);
  font-size: .85rem; color: var(--ink-dim); line-height: 1.6;
}

@media (max-width: 900px) {
  .object { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 640px) {
  .header-link { display: none; }
  .exhibit-page { padding: 14px; }
  .object-label { padding: 16px; }
  .label-tomb > div { grid-template-columns: 1fr; gap: 0; }
  .exhibit-bar { border-radius: var(--radius-md); }
  .gallery-title { font-size: 2.1rem; }
}

@media print {
  .site-header, .site-footer, .exhibit-bar, .crumbs, .exhibit-closing, .label-link { display: none !important; }
  body { background: #fff; }
  .gallery-title, .label-title, .label-tomb dd, .label-text { color: #000 !important; }
  .exhibit-page {
    background: #fff !important; border: 1px solid #bbb; box-shadow: none;
    break-after: page; page-break-after: always;
  }
  .exhibit-page:last-child { break-after: auto; page-break-after: auto; }
  .object { break-inside: avoid; page-break-inside: avoid; }
  .object-case, .object-label { background: #fff !important; box-shadow: none; }
}

/* ---------- exhibition gallery (immersive walk-through) ----------
   Scrolling pans the hall horizontally: a foyer, room title-cards, and walls of
   framed coins. On narrow screens or with reduced motion the JS adds .is-vertical
   (and if JS never runs, the :not(.is-immersive) rule does the same), so the
   panels simply stack and scroll — the walk is an enhancement, never a gate. */
.gallery-scroll { position: relative; width: 100vw; margin-left: calc(50% - 50vw); }
.gallery-pin { position: relative; overflow: hidden; background: var(--ex-plate); }
.gallery-scroll.is-immersive .gallery-pin { position: sticky; top: 0; height: 100vh; }
.gallery-pin::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(140% 90% at 50% -14%, rgba(150,180,240,.10), transparent 60%),
    radial-gradient(120% 80% at 50% 122%, rgba(0,0,0,.55), transparent 55%);
}
.gallery-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 26vh; pointer-events: none; z-index: 0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.45)); }
.gallery-floor::before { content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, rgba(150,180,240,.05) 0 1px, transparent 1px 8%);
  transform: perspective(300px) rotateX(60deg); transform-origin: top; opacity: .4; }

.gallery-track {
  position: relative; z-index: 1; display: flex; align-items: center;
  gap: clamp(40px, 6vw, 120px); padding: 0 10vw; height: 100vh; will-change: transform;
}
.panel { flex: 0 0 auto; position: relative; }

/* foyer */
.foyer { width: min(680px, 86vw); text-align: center; }
.foyer-eyebrow { font-size: .64rem; letter-spacing: .3em; text-transform: uppercase; color: var(--ex-rule); }
.foyer-title { font-family: var(--serif); font-size: clamp(2.4rem, 5vw, 4.2rem); font-weight: 600; line-height: 1.02; margin: 12px 0 0; color: var(--ex-ink); }
.foyer-dates { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--ex-rule); margin-top: 8px; }
.foyer-tagline { margin: 14px auto 0; max-width: 34ch; font-size: 1rem; line-height: 1.5; color: var(--ex-ink); opacity: .9; }
.foyer-intro { margin: 22px auto 0; max-width: 52ch; text-align: left; }
.foyer-intro p { margin: 0; color: var(--ex-soft); font-size: .95rem; line-height: 1.7; }
.foyer-intro p + p { margin-top: 10px; }
.foyer-facts { display: flex; justify-content: center; list-style: none; margin: 26px 0 0; padding: 0; }
.foyer-facts li { padding: 0 22px; } .foyer-facts li + li { border-left: 1px solid var(--ex-border); }
.foyer-facts b { display: block; font-family: var(--serif); font-size: 1.6rem; color: var(--ex-rule); }
.foyer-facts span { display: block; margin-top: 4px; font-size: .6rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ex-dim); }
.foyer-hint { margin-top: 30px; font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ex-dim); }
.foyer-hint span { color: var(--ex-rule); }

/* room divider */
.room-card { width: min(320px, 74vw); text-align: center; }
.room-card::before, .room-card::after { content: ""; display: block; width: 40px; height: 1px; margin: 0 auto; background: var(--ex-rule); opacity: .5; }
.room-card::before { margin-bottom: 18px; } .room-card::after { margin-top: 18px; }
.room-num { font-size: .62rem; letter-spacing: .3em; text-transform: uppercase; color: var(--ex-dim); }
.room-name { font-family: var(--serif); font-size: clamp(1.6rem, 2.6vw, 2.3rem); font-weight: 600; margin: 8px 0 0; color: var(--ex-ink); }
.room-sub { font-family: var(--serif); font-style: italic; color: var(--ex-rule); margin-top: 4px; }

/* portrait-era divider — the monarch's obverse announces each era */
.portrait-card { width: min(360px, 80vw); text-align: center; }
.portrait-frame { width: clamp(130px, 14vw, 190px); aspect-ratio: 1; margin: 14px auto 4px; }
.portrait-card .room-name { margin-top: 16px; }
.portrait-note { margin: 12px auto 0; max-width: 34ch; font-size: .8rem; font-style: italic; line-height: 1.6; color: var(--ex-soft); }

/* a wall of coins */
.wall { display: flex; align-items: flex-start; justify-content: center; gap: clamp(36px, 5vw, 84px); }

/* framed coin */
.framed { display: flex; flex-direction: column; align-items: center; position: relative; }
.framed::before {
  content: ""; position: absolute; top: -16vh; left: 50%; transform: translateX(-50%);
  width: 44vh; height: 52vh; pointer-events: none; filter: blur(4px);
  background: radial-gradient(ellipse 40% 60% at 50% 0%, rgba(240,230,200,.18), transparent 66%);
  animation: gallery-glow 6s ease-in-out infinite;
}
@keyframes gallery-glow { 0%,100% { opacity: .82; } 50% { opacity: 1; } }
.frame {
  position: relative; width: clamp(150px, 17vw, 232px); aspect-ratio: 1; border-radius: 50%; padding: 15px; cursor: pointer;
  background: radial-gradient(circle at 34% 26%, #f0d79a, #b98d3f 46%, #7a5a24 100%);
  box-shadow: 0 20px 46px rgba(0,0,0,.6), inset 0 2px 4px rgba(255,255,255,.4), inset 0 -6px 12px rgba(0,0,0,.5);
  transition: transform .45s cubic-bezier(.22,.61,.36,1), box-shadow .45s;
  perspective: 900px; /* gives the coin real depth as it turns */
}
.frame.no-flip { cursor: default; }
.frame:hover, .frame:focus-visible { transform: translateY(-9px) scale(1.03); box-shadow: 0 32px 60px rgba(0,0,0,.7); outline: none; }
/* No overflow:hidden here — it would flatten the 3D and break the turn. The
   circular recess comes from the border-radius background alone. */
.mat {
  position: relative; width: 100%; height: 100%; border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #12182f, #070b16 78%);
  box-shadow: inset 0 6px 18px rgba(0,0,0,.7);
  transform-style: preserve-3d; transition: transform .7s cubic-bezier(.4,.2,.2,1);
}
.frame.flipped .mat { transform: rotateY(180deg); }
.mat .face { position: absolute; inset: 13%; width: 74%; height: 74%; object-fit: contain; backface-visibility: hidden; -webkit-backface-visibility: hidden; filter: drop-shadow(0 8px 14px rgba(0,0,0,.6)); }
.mat .face.back { transform: rotateY(180deg); }
.mat.is-empty { display: flex; align-items: center; justify-content: center; }
.mat.is-empty .coin-ghost { width: 44%; height: auto; fill: none; stroke: var(--ex-rule); stroke-width: 2.5; opacity: .4; }
/* The hint sits below the frame rather than on the coin: it now names the side
   you would be turning to, which is too long to float over the design. */
.turn-hint {
  position: absolute; bottom: -21px; left: 50%; transform: translateX(-50%);
  font-size: .6rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ex-rule); opacity: .8; pointer-events: none; white-space: nowrap;
  transition: opacity .2s;
}
.frame:hover .turn-hint, .frame:focus-visible .turn-hint { opacity: 1; }

/* 01 / 04 — a set announces its own size. */
.coin-seq { margin: 0 0 15px; font-family: var(--serif); font-size: .82rem; letter-spacing: .2em; color: var(--ex-rule); opacity: .85; }
.coin-seq i { font-style: normal; opacity: .4; margin: 0 5px; }

/* Square coins get a square frame, and they fill it — the recessed mat that
   suits a round coin just reads as a box behind a square one. */
.frame.shape-square { border-radius: 7%; padding: 8px; }
.frame.shape-square .mat { border-radius: 5%; background: none; box-shadow: none; }
.frame.shape-square .mat .face { inset: 2%; width: 96%; height: 96%; border-radius: 4%; }

/* plaque */
/* A museum label is small and dense on purpose — it should not compete with
   the object above it. */
.plaque {
  margin-top: 34px; width: min(246px, 60vw); text-align: center; padding: 11px 13px; border-radius: 5px;
  background: var(--ex-label); border: 1px solid var(--ex-label-edge); box-shadow: 0 10px 22px rgba(0,0,0,.4); color: #2a2418;
}
.plaque h3 { font-family: var(--serif); font-size: .98rem; font-weight: 600; line-height: 1.15; color: #231f18; }
/* For a series about places, the place leads: the Chinese name sits above the
   English one, and province and heritage status get their own lines. */
.plaque .cn { display: block; font-family: var(--serif); font-size: 1.1rem; line-height: 1.1; color: #8c1c2b; margin-bottom: 1px; }
.plaque .place { display: block; margin-top: 4px; font-size: .64rem; font-weight: 600; letter-spacing: .04em; color: #4a4235; }
.plaque .unesco { display: block; margin-top: 1px; font-size: .55rem; letter-spacing: .08em; text-transform: uppercase; color: #7a6a45; }
.plaque .yr { display: block; margin-top: 5px; font-size: .58rem; letter-spacing: .12em; text-transform: uppercase; color: #8c1c2b; }
.plaque .by { display: block; margin-top: 7px; font-size: .78rem; font-style: italic; color: #5a5142; }
.plaque .meta { display: block; margin-top: 6px; font-size: .68rem; color: #6a614f; line-height: 1.4; }
.plaque-link { display: inline-block; margin-top: 8px; font-size: .62rem; letter-spacing: .06em; color: #8a6a2f; text-decoration: none; }
.plaque-link:hover { text-decoration: underline; }

/* exit */
.exit { width: min(520px, 86vw); text-align: center; }
.exit-eyebrow { font-size: .64rem; letter-spacing: .3em; text-transform: uppercase; color: var(--ex-rule); }
.exit-text { margin: 16px auto 0; max-width: 46ch; color: var(--ex-soft); font-size: .9rem; line-height: 1.7; }
.exit-link { display: inline-block; margin-top: 22px; font-size: .8rem; letter-spacing: .06em; color: var(--ex-rule); text-decoration: none; }
.exit-link:hover { text-decoration: underline; }

/* chrome */
.gallery-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(150,180,240,.12); z-index: 4; }
.gallery-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ex-rule), #e7cd8f); box-shadow: 0 0 10px var(--ex-rule); }
.gallery-hint { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 4; font-size: .66rem; letter-spacing: .24em; text-transform: uppercase; color: var(--ex-dim); transition: opacity .4s; }
.gallery-hint span { color: var(--ex-rule); }
.gallery-foot { display: flex; gap: 10px; justify-content: center; margin: 26px 0 60px; }
.gallery-foot .exhibit-btn { font: inherit; font-size: .78rem; padding: 9px 18px; border-radius: 999px; cursor: pointer; text-decoration: none; border: 1px solid var(--panel-border); background: var(--panel); color: var(--ink-dim); transition: border-color .15s, color .15s; }
.gallery-foot .exhibit-btn:hover { border-color: var(--gold); color: var(--gold-text); }

/* fallback: stack & scroll (narrow screens, reduced motion, or no JS) */
.gallery-scroll.is-vertical, .gallery-scroll:not(.is-immersive) { height: auto !important; }
.gallery-scroll.is-vertical .gallery-pin, .gallery-scroll:not(.is-immersive) .gallery-pin { position: static; height: auto; overflow: visible; }
.gallery-scroll.is-vertical .gallery-track, .gallery-scroll:not(.is-immersive) .gallery-track {
  flex-direction: column; align-items: center; height: auto; transform: none !important; will-change: auto; gap: 44px; padding: 34px 20px 54px;
}
.gallery-scroll.is-vertical .panel, .gallery-scroll:not(.is-immersive) .panel { width: min(760px, 92vw); }
.gallery-scroll.is-vertical .gallery-progress, .gallery-scroll.is-vertical .gallery-hint, .gallery-scroll.is-vertical .gallery-floor { display: none; }
.gallery-scroll.is-vertical .framed::before { top: -40px; height: 200px; }

@media (max-width: 520px) { .wall { flex-direction: column; align-items: center; gap: 40px; } }
@media (prefers-reduced-motion: reduce) { .framed::before { animation: none; } .mat, .frame { transition: none; } }
@media print {
  .gallery-scroll { width: auto; margin: 0; }
  .gallery-pin { position: static !important; height: auto !important; overflow: visible !important; background: #fff; }
  .gallery-track { display: block !important; transform: none !important; height: auto; padding: 0; }
  .gallery-progress, .gallery-hint, .gallery-floor, .foyer-hint, .turn-hint { display: none !important; }
  .panel { width: auto !important; break-inside: avoid; margin-bottom: 24px; }
  .foyer-title, .room-name, .plaque h3 { color: #000; }
}

/* ---------- reveal on scroll ----------
   Sections lift quietly into place as they scroll into view. Driven by a CSS
   view() timeline — no JavaScript, GPU-composited — and wrapped in @supports so
   that where the browser lacks it, the rule is skipped and content is simply
   visible. Motion is never allowed to gate content. Reduced-motion users get
   no movement at all. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    [data-reveal] {
      animation: reveal-rise linear both;
      animation-timeline: view();
      animation-range: entry 4% entry 62%;
    }
  }
}
@keyframes reveal-rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- utility ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.exhibit-foot { text-align: center; margin: 6px 0 60px; }
.exhibit-foot .exhibit-btn {
  font: inherit; font-size: .78rem; letter-spacing: .04em; padding: 9px 20px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--panel-border); background: var(--panel); color: var(--ink-dim);
  transition: border-color .15s, color .15s;
}
.exhibit-foot .exhibit-btn:hover { border-color: var(--gold); color: var(--gold-text); }
