/* ============================================================
   ATLAS OF PAINTINGS — "Quiet Gallery"
   Minimal · editorial · experiential.
   Type: Fraunces (display + reading) · Inter (UI + meta)
   Light gallery surface, ink type, a whisper of sienna.
   ============================================================ */

:root {
  /* light gallery */
  --bg:        #f4f1ea;
  --bg-2:      #efeae0;
  --surface:   #fbfaf5;
  --ink:       #1b1815;
  --ink-2:     #565049;
  --ink-soft:  #565049;        /* alias used inline in JS */
  --muted:     #6f685d;   /* WCAG-AA (~4.9:1) on the light bg */
  --line:      rgba(27, 24, 21, 0.09);
  --line-2:    rgba(27, 24, 21, 0.16);
  --accent:    #a23a20;        /* muted sienna, used sparingly */
  --paper-3:   #e3ddd0;        /* image placeholder */

  /* dark immersive (cinema) */
  --void:      #100e0c;
  --void-2:    #1a1714;
  --bone:      #efe9dd;
  --bone-soft: rgba(239, 233, 221, 0.62);
  --bone-faint:rgba(239, 233, 221, 0.40);
  --void-line: rgba(239, 233, 221, 0.14);

  /* type */
  --serif: "Fraunces", Georgia, serif;
  --ui:    "Inter", system-ui, -apple-system, sans-serif;
  --mono:  "Inter", ui-monospace, monospace;

  /* metrics + motion */
  --bar-h: 70px;
  --gut: clamp(16px, 4.5vw, 64px);   /* phone floor 20→16 reclaims a column; desktop ceiling 64 unchanged (within 2px of old ≥1025) */
  --ease:    cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out:cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);

  /* --- responsive foundation (mobile + tablet spec) --- */
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:24px; --sp-6:32px; --sp-7:48px;
  --tap: 44px;                       /* minimum touch-target */
  --bar-h-mobile: 56px;              /* topbar shrinks 70→56 on phones */
  --tabbar-h: 56px;                  /* bottom tab bar height */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --bg-cur: var(--bg);
}
/* one alias cascades --bar-h to .controls top / .detail padding / hero offsets on phones */
@media (max-width: 600px){ :root{ --bar-h: var(--bar-h-mobile); } }
/* tablet: trade the desktop-luxe gutter for grid canvas */
@media (min-width: 768px) and (max-width: 1024px){ :root{ --gut: clamp(20px, 4vw, 40px); } }

/* ---- exquisite dark mode: warm near-black gallery ---- */
:root[data-theme="dark"] {
  --bg:       #14110d;
  --bg-2:     #1c1813;
  --surface:  #221c15;
  --ink:      #ede5d6;
  --ink-2:    #cfc6b4;
  --ink-soft: #b7ae9c;
  --muted:    #9e9380;
  --line:     rgba(237, 229, 214, 0.10);
  --line-2:   rgba(237, 229, 214, 0.19);
  --accent:   #c5512f;
  --paper-3:  #2a231b;
}
:root[data-theme="dark"] .hero__wordmark { mix-blend-mode: screen; }
:root[data-theme="dark"] .fx-grain { mix-blend-mode: screen; opacity: 0.035; }
:root[data-theme="dark"] .fx-vignette { background: radial-gradient(120% 100% at 50% 50%, transparent 60%, rgba(0,0,0,0.34)); }
:root[data-theme="dark"] .detail__frame { box-shadow: 0 40px 90px -40px rgba(0,0,0,0.7); }
:root[data-theme="dark"] .tile::after { background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.82)); }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--line-2); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font-family: var(--ui); font-size: 16px; line-height: 1.5;
  font-weight: 400; letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.is-cinema { background: var(--void); color: var(--bone); overflow: hidden; }
body.no-scroll { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; padding: 0; }
img { display: block; max-width: 100%; }
::selection { background: var(--ink); color: var(--bg); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* faint film grain — barely there */
.fx-grain {
  position: fixed; inset: 0; z-index: 9000; pointer-events: none; opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.fx-vignette { position: fixed; inset: 0; z-index: 8999; pointer-events: none; background: radial-gradient(120% 100% at 50% 50%, transparent 70%, rgba(27,24,21,0.05)); }
body.is-cinema .fx-grain { opacity: 0.03; mix-blend-mode: screen; }
body.is-cinema .fx-vignette { background: radial-gradient(120% 120% at 50% 48%, transparent 54%, rgba(0,0,0,0.74)); }

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

/* ============================================================
   BOOT
   ============================================================ */
.boot { position: fixed; inset: 0; z-index: 9500; display: grid; place-items: center; background: var(--bg); }
.boot__bar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: var(--gut); font: 500 11px/1 var(--ui); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.boot__center { text-align: center; }
.boot__word { display: flex; gap: 0.04em; justify-content: center; }
.boot__word span {
  font: 300 clamp(30px, 8.2vw, 104px)/1 var(--serif); letter-spacing: -0.02em;
  display: inline-block; opacity: 0; transform: translateY(40%);
  animation: bootChar 1.1s var(--ease-out) forwards;
}
.boot__word span:nth-child(1){animation-delay:.05s}.boot__word span:nth-child(2){animation-delay:.12s}
.boot__word span:nth-child(3){animation-delay:.19s}.boot__word span:nth-child(4){animation-delay:.26s}
.boot__word span:nth-child(5){animation-delay:.33s}.boot__word span:nth-child(6){animation-delay:.40s}
.boot__word span:nth-child(7){animation-delay:.47s}.boot__word span:nth-child(8){animation-delay:.54s}
.boot__word span:nth-child(9){animation-delay:.61s}.boot__word span:nth-child(10){animation-delay:.68s}
@keyframes bootChar { to { opacity: 1; transform: translateY(0); } }
.boot__sub { font: 400 italic clamp(15px, 2.4vw, 24px)/1 var(--serif); letter-spacing: 0.02em; color: var(--ink-2); margin-top: 0.4em; opacity: 0; animation: fadeUp 1s var(--ease-out) 0.5s forwards; }
.boot__progress { height: 1px; width: min(280px, 60vw); margin: 2.4em auto 0; background: var(--line-2); overflow: hidden; }
.boot__progress i { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.4s var(--ease); }
.boot__meta { font: 500 10px/1.6 var(--ui); letter-spacing: 0.16em; margin-top: 1.6em; color: var(--muted); text-transform: uppercase; opacity: 0; animation: fadeUp 1s var(--ease-out) 0.7s forwards; }
.boot.is-done { animation: bootOut 0.8s var(--ease-io) forwards; }
@keyframes bootOut { to { opacity: 0; visibility: hidden; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   APP CHROME
   ============================================================ */
.app { min-height: 100svh; display: flex; flex-direction: column; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 700;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: var(--bar-h); padding: 0 var(--gut);
  transition: background 0.5s var(--ease), border-color 0.5s var(--ease), backdrop-filter 0.5s;
  border-bottom: 1px solid transparent;
}
.topbar.solid { background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(16px) saturate(1.1); -webkit-backdrop-filter: blur(16px) saturate(1.1); border-bottom-color: var(--line); }
.topbar__brand { display: inline-flex; align-items: center; gap: 0.66em; font: 500 15px/1 var(--serif); letter-spacing: 0; }
.topbar__brand b { font-weight: 500; }
.topbar__brand .dot { display: none; }
/* Moonlit-faun brand mark — a theme-aware CSS mask so it takes the ink colour in dark + light */
.brand__mark { flex: none; width: 17px; height: 30px; background: var(--ink);
  -webkit-mask: url(/faun.svg) center/contain no-repeat; mask: url(/faun.svg) center/contain no-repeat; }
.brand__words { display: inline-flex; align-items: baseline; gap: 0.5em; }
.topbar__brand .brand__words > span { font-size: 15px; font-family: var(--serif); font-style: italic; color: var(--ink-2) !important; font-weight: 400 !important; }
.topbar__nav { display: flex; gap: 4px; justify-self: center; }
.navlink {
  position: relative; font: 500 12px/1 var(--ui); letter-spacing: 0.06em; text-transform: uppercase;
  padding: 10px 16px; color: var(--ink-2); transition: color 0.3s var(--ease);
}
.navlink::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 6px; height: 1px; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 0.4s var(--ease); }
.navlink:hover { color: var(--ink); }
.navlink:hover::after, .navlink.is-active::after { transform: scaleX(1); }
.navlink.is-active { color: var(--ink); }
.navlink__badge {
  display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 100px;
  background: var(--accent); color: #fff; font: 600 10px/1 var(--ui); vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.topbar__right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.topbar__count { font: 500 11px/1 var(--ui); letter-spacing: 0.08em; color: var(--muted); font-variant-numeric: tabular-nums; }
.topbar__count b { font-weight: 600; color: var(--ink); }

.iconbtn { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 50%; color: var(--ink); transition: background 0.3s var(--ease), color 0.3s, transform 0.3s var(--ease), border-color 0.3s; }
.iconbtn:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.iconbtn:active { transform: scale(0.92); }
.iconbtn svg { width: 16px; height: 16px; }
.iconbtn:disabled { opacity: 0.35; pointer-events: none; }

/* ── phone bottom tab bar (mobile nav) — hidden on desktop / fine pointer ── */
.tabbar { display: none; }
@media (max-width: 767px) and (pointer: coarse) {
  /* hide the in-bar links; the bottom bar owns navigation */
  .topbar__nav { display: none; }
  .topbar { grid-template-columns: 1fr auto; height: calc(var(--bar-h-mobile) + var(--safe-t)); padding-top: var(--safe-t); }
  .topbar__count { display: none; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 750;
    height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(18px) saturate(1.1); -webkit-backdrop-filter: blur(18px) saturate(1.1);
    border-top: 1px solid var(--line);
    transition: transform 0.4s var(--ease);
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: var(--tap); color: var(--ink-2); position: relative;
    font: 500 9px/1 var(--ui); letter-spacing: 0.06em; text-transform: uppercase;
    -webkit-tap-highlight-color: transparent;
  }
  .tab__ic { width: 22px; height: 22px; display: grid; place-items: center; transition: transform 0.3s var(--ease); }
  .tab__ic svg { width: 21px; height: 21px; }
  .tab.is-active { color: var(--ink); }
  .tab.is-active .tab__ic { color: var(--accent); }
  .tab:active .tab__ic { transform: scale(0.86); }
  .tab__badge { position: absolute; top: 7px; left: calc(50% + 9px); width: 7px; height: 7px; border-radius: 100px; background: var(--accent); display: none; }
  .tab__badge.is-on { display: block; }

  /* free fixed/footer/grid content from the bar */
  .gallery { padding-bottom: calc(clamp(60px, 8vw, 110px) + var(--tabbar-h) + var(--safe-b)); }
  .footer { padding-bottom: calc(28px + var(--tabbar-h) + var(--safe-b)); }
  .toast { bottom: calc(20px + var(--tabbar-h) + var(--safe-b)); }

  /* immersive routes provide their own chrome — slide the bar away (revealed on their wake) */
  body.is-cinema .tabbar, body.is-hall .tabbar { transform: translateY(120%); }
  /* the hall GATE is a browsing surface, not an immersive scene — keep the tab bar
     present and above the overlay so mobile navigation never dead-ends */
  body.is-hall.is-hall-gate .tabbar { transform: none; z-index: 900; }
}

/* ── tablet (768–1024): keep the horizontal topbar nav (it fits) but relieve the squeeze ── */
@media (min-width: 768px) and (max-width: 1024px) {
  .navlink { padding: 10px 11px; }
  .topbar__nav { gap: 2px; }
}
@media (min-width: 768px) and (max-width: 900px) {
  .topbar__count { display: none; }   /* count is duplicated in .gallery__meta — reclaim the width on small tablets */
}

/* ============================================================
   HERO — 3D experience
   ============================================================ */
.hero { position: relative; height: 100svh; min-height: 600px; overflow: hidden; }
.hero__grid { display: none; }
.hero__stage { position: absolute; inset: 0; z-index: 1; touch-action: none; }
.hero__stage > div { pointer-events: auto; }
.hero::after { /* soft top/bottom fade to seat the scene */
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, var(--bg) 0%, transparent 18%, transparent 72%, var(--bg) 100%);
}
.hero__index { position: absolute; top: calc(var(--bar-h) + 6px); left: var(--gut); right: var(--gut); z-index: 4; display: flex; justify-content: space-between; font: 500 11px/1 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); pointer-events: none; }

.hero__overlay { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; padding: 0 var(--gut); }
.hero__overlay::before { content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(120vh, 1100px); height: min(80vh, 720px); background: radial-gradient(ellipse at center, color-mix(in srgb, var(--bg) 62%, transparent) 0%, transparent 62%); pointer-events: none; z-index: -1; }
.hero__wordmark { margin: 0; line-height: 0.92; font-weight: 300; letter-spacing: -0.03em; font-family: var(--serif); font-size: clamp(58px, 11.5vw, 184px); color: var(--ink); mix-blend-mode: multiply; }
.hero__wordmark .ln { display: block; overflow: hidden; }
.hero__wordmark .ln > span { display: block; transform: translateY(110%); }
.hero.in .hero__wordmark .ln > span { animation: lineUp 1.1s var(--ease-out) forwards; }
.hero__wordmark .ln:nth-child(2) > span { animation-delay: 0.12s; }
.hero__wordmark em { font-style: italic; font-weight: 300; letter-spacing: -0.035em; color: var(--ink); }
@keyframes lineUp { to { transform: translateY(0); } }

.hero__row { margin-top: clamp(18px, 3vh, 36px); display: flex; flex-direction: column; align-items: center; gap: 26px; opacity: 0; animation: fadeUp 1.1s var(--ease-out) 0.5s forwards; }
.hero__lede { max-width: 40ch; font: 400 clamp(15px, 1.6vw, 19px)/1.6 var(--ui); color: var(--ink-2); text-wrap: balance; }
.hero__lede b { font-weight: 500; color: var(--ink); }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; pointer-events: auto; }

.btn {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 26px; border-radius: 100px; font: 500 13px/1 var(--ui); letter-spacing: 0.02em;
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  transition: background 0.4s var(--ease), color 0.4s var(--ease), transform 0.4s var(--ease), box-shadow 0.4s;
  overflow: hidden;
}
.btn::after { display: none; }
.btn svg { width: 14px; height: 14px; position: relative; z-index: 1; }
.btn span, .btn { z-index: 1; }
.btn:hover { background: var(--ink); color: var(--bg); transform: translateY(-2px); box-shadow: 0 14px 30px -16px rgba(27,24,21,0.5); }
.btn:active { transform: translateY(0); }
.btn--accent { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn--accent:hover { background: var(--accent); border-color: var(--accent); }

/* 3D painting frames (CSS3DObject children) */
/* will-change is toggled ON only while the loop runs (.h3d-live on the mount) so
   an idle / static hero does not hold compositor layers — the mobile perf hazard. */
.h3d { position: relative; cursor: pointer; transition: filter 0.5s var(--ease), opacity 0.5s var(--ease); will-change: auto; }
/* during flight the look is JS-driven every frame — kill the 0.5s CSS transition so blur/
   opacity track depth without lag (the recycle cross-fade sets its own inline transition). */
.h3d-live .h3d { transition: none; will-change: transform, opacity, filter; }

/* ---- tunnel mode: the hero IS the page (#/) ---- */
body.is-tunnel { overflow: hidden; height: 100svh; overscroll-behavior: none; }
body.is-tunnel .topbar { background: transparent; border-bottom-color: transparent; }
body.is-tunnel #view > .hero { height: 100svh; }
/* depth haze toward the throat — deepens the corridor + hides recycle pops */
.hero::before { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse 62% 52% at 50% 50%, transparent 38%, color-mix(in srgb, var(--bg) 72%, transparent) 100%); }

/* drift hint + iOS gyro opt-in button */
/* full-width flex centring — translateX(-50%) was overwritten by the fadeUp keyframe's
   transform (forwards fill), stranding the hint right of centre at every width */
.hero__drift { position: absolute; left: 0; right: 0; bottom: max(26px, calc(env(safe-area-inset-bottom) + 12px)); z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font: 500 10px/1 var(--ui); letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
  opacity: 0; animation: fadeUp 1s var(--ease-out) 1s forwards; pointer-events: none; }
.hero__drift-tilt { pointer-events: auto; display: inline-flex; gap: 8px; align-items: center;
  padding: 9px 16px; border: 1px solid var(--line-2); border-radius: 100px; color: var(--ink);
  background: color-mix(in srgb, var(--bg) 60%, transparent); backdrop-filter: blur(8px);
  letter-spacing: 0.06em; text-transform: none; font-size: 12px; transition: color 0.3s var(--ease), border-color 0.3s; }
.hero__drift-tilt:hover { border-color: var(--ink); }
.hero__drift-tilt.hidden { display: none; }
@media (max-width: 600px) {
  /* the shared `fadeUp` keyframe animates `transform` (translateY only), which overwrites
     the base `translateX(-50%)` when it holds (`forwards`) — stranding the hint off-centre
     and jammed against the right edge on phones. Centre transform-independently instead:
     full-width + flex `align-items:center` centres the copy, and the animation's translateY
     entrance still plays. Desktop (≥1025, frozen) keeps its original left:50% rule untouched. */
  .hero__drift { left: 0; right: 0; padding: 0 var(--gut); }
  .hero__drift-hint { display:block; font-size:9px; letter-spacing:0.12em; text-align:center; }
}

/* ---- Collection header (All / Saved) ---- */
.coll-intro { padding-top: calc(var(--bar-h) + clamp(28px, 5vw, 64px)); padding-bottom: clamp(16px, 3vw, 28px); grid-template-columns: 1fr; gap: 18px; }
.coll-head__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.coll-toggle { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line-2); border-radius: 100px; }
.coll-toggle__b { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 100px; font: 500 13px/1 var(--ui); color: var(--ink-2); transition: background 0.25s var(--ease), color 0.25s; white-space: nowrap; }
.coll-toggle__b svg { width: 14px; height: 14px; }
.coll-toggle__b.is-on { background: var(--ink); color: var(--bg); }
.coll-head__meta { font: 500 11px/1.5 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.coll-head__actions { display: inline-flex; gap: 10px; }
.coll-clear.is-armed { border-color: var(--accent); color: var(--accent); }
.h3d__inner { background: var(--surface); padding: 10px; box-shadow: 0 30px 60px -30px rgba(20,16,12,0.55), 0 6px 16px -10px rgba(20,16,12,0.4); transition: box-shadow 0.5s var(--ease), transform 0.5s var(--ease); }
.h3d img { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--paper-3); }
.h3d__cap { position: absolute; left: 0; right: 0; top: 100%; margin-top: 12px; text-align: center; font: 400 italic 14px/1.3 var(--serif); color: var(--ink); opacity: 0; transform: translateY(-6px); transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); }
.h3d:hover { filter: none !important; opacity: 1 !important; }
.h3d:hover .h3d__inner { box-shadow: 0 50px 90px -36px rgba(20,16,12,0.6), 0 0 0 1px var(--line-2); transform: scale(1.04); }
.h3d:hover .h3d__cap { opacity: 1; transform: translateY(0); }

.hero__fallback { position: absolute; inset: 0; z-index: 1; display: grid; grid-template-columns: repeat(6, 1fr); opacity: 0.5; }
.hero__fallback img { width: 100%; height: 100%; object-fit: cover; }

/* Responsive overlay — a self-contained, always-legible text column. The JS
   aperture (apertureX/Y per tier) is sized to match these footprints so tunnel
   frames never sit under the wordmark or CTA at any breakpoint. */
/* PHONE: bottom-anchored stack, full-bleed pills, smaller wordmark */
@media (max-width: 600px) {
  .hero__overlay { justify-content: flex-end; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .hero__wordmark { font-size: clamp(34px, 9.5vw, 56px); }
  .hero__row { margin-top: 18px; gap: 18px; width: 100%; }
  .hero__lede { max-width: 30ch; font-size: 15px; }
  .hero__cta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(420px, 100%); }
  .hero__cta .btn { width: 100%; justify-content: center; padding: 14px 18px; }
  .hero__cta .btn--accent { grid-column: 1 / -1; }   /* primary CTA full-width on top */
  .hero__overlay::before { width: 140vw; height: 70vh; }  /* wider scrim for legibility */
}
/* TABLET / iPad: centered, intermediate wordmark, single-row wrap CTA */
@media (min-width: 601px) and (max-width: 1024px) {
  .hero__wordmark { font-size: clamp(64px, 9vw, 104px); }
  .hero__lede { max-width: 34ch; }
  .hero__cta { gap: 10px; }
}

/* ============================================================
   CONTENT BLOCK headings (between hero & grid)
   ============================================================ */
.section-intro { padding: clamp(48px, 9vw, 120px) var(--gut) clamp(24px, 4vw, 48px); display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: end; }
@media (max-width: 767px) { .section-intro { grid-template-columns: 1fr; gap: 14px; } }
.section-intro h2 { margin: 0; font: 300 clamp(34px, 5.5vw, 76px)/0.98 var(--serif); letter-spacing: -0.025em; }
.section-intro h2 em { font-style: italic; }
.section-intro .meta { font: 500 11px/1.7 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); text-align: right; }
@media (max-width: 767px) { .section-intro .meta { text-align: left; } }

/* slim stats line */
.stats { display: flex; flex-wrap: wrap; gap: clamp(28px, 6vw, 80px); padding: 0 var(--gut) clamp(28px, 4vw, 44px); border-bottom: 1px solid var(--line); }
.stat__n { font: 300 clamp(28px, 3.4vw, 46px)/1 var(--serif); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat__l { font: 500 10px/1.4 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }

/* ============================================================
   CONTROLS — minimal
   ============================================================ */
.controls { position: sticky; top: var(--bar-h); z-index: 600; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.controls__main { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; }
.search { flex: 1 1 320px; display: flex; align-items: center; gap: 14px; padding: 0 var(--gut); min-height: 64px; }

/* Artist filter typeahead */
.artistcombo { position: relative; flex: 0 1 280px; display: flex; align-items: center; gap: 10px; padding: 0 clamp(16px, 2vw, 28px); border-left: 1px solid var(--line); min-height: 64px; }
.artistcombo svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.artistcombo input { flex: 1; min-width: 0; border: none; background: none; outline: none; font: 400 14px/1 var(--ui); color: var(--ink); padding: 6px 0; }
.artistcombo input::placeholder { color: var(--muted); }
.artistcombo__clear { flex: none; color: var(--muted); padding: 4px; display: inline-flex; }
.artistcombo__clear svg { width: 13px; height: 13px; }
.artistcombo__clear:hover { color: var(--accent); }
.artistcombo__menu { position: absolute; top: 100%; left: 0; right: 0; z-index: 40; max-height: 320px; overflow-y: auto; background: var(--bg); border: 1px solid var(--line); border-top: none; box-shadow: 0 24px 48px -24px rgba(0,0,0,0.4); }
.artistcombo__opt { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 16px; cursor: pointer; font: 400 14px/1.2 var(--ui); color: var(--ink); }
.artistcombo__opt em { font-style: normal; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.artistcombo__opt:hover, .artistcombo__opt.is-active { background: var(--bg-2); color: var(--accent); }
@media (max-width: 767px) { .artistcombo { flex-basis: 100%; border-left: none; border-top: 1px solid var(--line); } }

/* keyboard focus ring for grid tiles + interactive controls */
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; z-index: 5; }
.artistcombo input:focus-visible, .search input:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }

/* GLOBAL keyboard focus visibility (the app had none) — mouse users never see it */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
a:focus-visible, button:focus-visible, [role="link"]:focus-visible, [tabindex]:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* skip-to-content link (first focusable element) */
.skip-link { position: fixed; top: -60px; left: 12px; z-index: 2000; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 6px; font: 500 13px/1 var(--ui); transition: top 0.2s; }
.skip-link:focus { top: 12px; }
.search svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.search input { flex: 1; border: none; background: none; outline: none; font: 400 17px/1 var(--ui); letter-spacing: -0.01em; color: var(--ink); padding: 6px 0; }
.search input::placeholder { color: var(--muted); }
.search__clear { font: 500 11px/1 var(--ui); letter-spacing: 0.1em; color: var(--muted); padding: 8px; text-transform: uppercase; }
.search__clear:hover { color: var(--accent); }

.yearrange { display: flex; align-items: center; gap: 6px; padding: 0 var(--gut); border-left: 1px solid var(--line); }
.yearrange label { font: 500 10px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.yearrange input { width: 4.2em; font: 500 12px/1 var(--ui); border: 1px solid var(--line-2); border-radius: var(--radius, 8px); background: none; outline: none; color: var(--ink); padding: 7px 8px; text-align: center; -moz-appearance: textfield; }
.yearrange input::-webkit-outer-spin-button, .yearrange input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.yearrange input:focus { border-color: var(--ink); }
.yearrange .yr-dash { color: var(--muted); }
@media (max-width: 767px) { .yearrange { border-left: none; padding-top: 8px; } }
.sortwrap { display: flex; align-items: center; gap: 8px; padding: 0 var(--gut); border-left: 1px solid var(--line); }
.sortwrap label { font: 500 10px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.sortwrap select { font: 500 12px/1 var(--ui); letter-spacing: 0.02em; border: none; background: none; outline: none; color: var(--ink); cursor: pointer; padding: 8px 4px; }

.viewtoggle { display: flex; border-left: 1px solid var(--line); }
.viewtoggle button { width: 58px; display: grid; place-items: center; color: var(--ink-2); transition: color 0.3s, background 0.3s; }
.viewtoggle button.is-active { color: var(--ink); }
.viewtoggle button:hover { background: var(--bg-2); color: var(--ink); }
.viewtoggle svg { width: 17px; height: 17px; }

/* facets — quiet pills */
.facets { display: flex; align-items: center; gap: 8px; padding: 14px var(--gut); overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line); }
.facets::-webkit-scrollbar { display: none; }
.facets__group { display: flex; align-items: center; gap: 7px; flex: none; }
.facets__label { font: 500 10px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding-right: 4px; }
.chip {
  flex: none; font: 450 13px/1 var(--ui); letter-spacing: -0.005em; padding: 9px 14px; border-radius: 100px;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.18s var(--ease);
}
.chip:hover { border-color: color-mix(in srgb, var(--ink) 55%, var(--line-2)); color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.chip:active { transform: scale(0.97); }
/* selected = sienna-tinted, bordered — present but calm (NOT a full ink slab) */
.chip.is-on {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  color: var(--ink); font-weight: 500;
}
:root[data-theme="dark"] .chip.is-on { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.chip .ct { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.is-on .ct { color: color-mix(in srgb, var(--accent) 75%, var(--ink)); }
/* the ✕ glyph: hidden until selected, then a small rotated "remove" mark */
.chip__tick { width: 0; height: 13px; overflow: hidden; display: inline-flex; align-items: center; opacity: 0; margin-left: -7px; transition: width 0.22s var(--ease), opacity 0.22s, margin 0.22s; }
.chip__tick svg { width: 13px; height: 13px; transform: rotate(45deg); color: var(--accent); }
.chip.is-on .chip__tick { width: 13px; opacity: 1; margin-left: 0; }
.chip--shelf.is-on { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: color-mix(in srgb, var(--accent) 65%, transparent); color: var(--ink); }
.chip--shelf.is-on .chip__tick svg { transform: none; }   /* shelves keep a true ✕ */
.facets__sep { width: 1px; align-self: stretch; background: var(--line-2); flex: none; margin: 2px 6px; }

.activebar { display: flex; align-items: center; gap: 8px; padding: 0 var(--gut) 14px; font: 500 11px var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); flex-wrap: wrap; }
.activebar:empty { display: none; }
.activetag { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 100px; background: var(--bg-2); font: 500 11px/1 var(--ui); letter-spacing: 0.02em; text-transform: none; color: var(--ink); }
.activetag button { font-size: 14px; line-height: 1; color: var(--muted); }
.activetag button:hover { color: var(--accent); }
.activebar__clear { margin-left: auto; font: 500 11px/1 var(--ui); letter-spacing: 0.08em; color: var(--accent); }
.activebar__clear:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── advanced-filter panel ──────────────────────────────────────────── */
.filtersbtn { display: inline-flex; align-items: center; gap: 8px; padding: 0 18px; min-height: 64px; border-left: 1px solid var(--line); font: 500 12px/1 var(--ui); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); transition: color 0.3s var(--ease), background 0.3s; }
.filtersbtn svg { width: 16px; height: 16px; color: var(--muted); transition: transform 0.35s var(--ease), color 0.3s; }
.filtersbtn:hover, .filtersbtn:hover svg { color: var(--ink); }
.filtersbtn.is-open { background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--ink); }
.filtersbtn.is-open .filtersbtn__caret { transform: rotate(180deg); }
.filtersbtn__ct { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 100px; background: var(--accent); color: #fff; font: 600 10px/18px var(--ui); text-align: center; font-variant-numeric: tabular-nums; }
.filtersbtn__ct.hidden { display: none; }

/* scrim — desktop: invisible/no-op; mobile sheet: dim backdrop */
.filterpanel__scrim { display: none; }

.filterpanel {
  overflow: hidden; max-height: 0; opacity: 0; border-top: 1px solid transparent;
  transition: max-height 0.42s var(--ease), opacity 0.28s var(--ease), border-color 0.3s;
  background: color-mix(in srgb, var(--bg-2) 78%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.filterpanel.is-open { max-height: min(78vh, 760px); opacity: 1; overflow-y: auto; border-top-color: var(--line); overscroll-behavior: contain; }
.filterpanel__inner { padding: 0; }

/* header */
.filterpanel__header {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 16px;
  padding: 16px var(--gut) 14px; background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.filterpanel__grip { display: none; }
.filterpanel__titles { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; min-width: 0; }
.filterpanel__title { font: 500 19px/1.1 var(--serif); letter-spacing: -0.01em; color: var(--ink); margin: 0; }
.filterpanel__count { font: 500 12px/1 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0; font-variant-numeric: tabular-nums; transition: color 0.3s; }
.filterpanel__count b { color: var(--accent); font-weight: 600; }
.filterpanel__count-dim { opacity: 0.6; font-style: italic; text-transform: none; letter-spacing: 0; }
.filterpanel__close { margin-left: auto; flex: none; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--ink-2); transition: color 0.25s, border-color 0.25s, background 0.25s, transform 0.25s var(--ease); }
.filterpanel__close svg { width: 16px; height: 16px; }
.filterpanel__close:hover { color: var(--ink); border-color: var(--line-2); background: var(--bg-2); transform: rotate(90deg); }

.filterpanel__body { padding: 22px var(--gut) 18px; }

.filterpanel__tools { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: flex-end; margin-bottom: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.filterpanel__tools .artistcombo, .filterpanel__tools .yearrange { border-left: none; padding: 0; }
.filterpanel__tools .fsec--tool { flex: 1 1 240px; min-width: 0; }

.filterpanel__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 26px 36px; }
.filterpanel__loading { color: var(--muted); font: 400 italic 14px/1.4 var(--serif); padding: 12px 0; }

/* loading skeleton */
.filterpanel__skeleton { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 16px; }
.filterpanel__skeleton .sk-row { display: flex; flex-wrap: wrap; gap: 7px; }
.sk-chip { height: 33px; border-radius: 100px; background: linear-gradient(90deg, var(--line) 25%, var(--line-2) 50%, var(--line) 75%); background-size: 200% 100%; animation: skShimmer 1.4s var(--ease) infinite; }
@keyframes skShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* facet section */
.fsec { min-width: 0; }
.fsec__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; min-height: 22px; }
.fsec__heading { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.fsec__label { font: 500 10px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.fsec__pill { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 100px; font: 600 10px/17px var(--ui); text-align: center; background: var(--accent); color: #fff; font-variant-numeric: tabular-nums; transform: scale(0); transition: transform 0.22s var(--ease-out); }
.fsec__pill.is-on { transform: scale(1); }
.fsec__clear { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); transition: color 0.2s, background 0.2s; }
.fsec__clear svg { width: 13px; height: 13px; }
.fsec__clear:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.fsec__clear.hidden { display: none; }

/* in-facet search */
.fsec__search { display: flex; align-items: center; gap: 8px; padding: 7px 11px; margin-bottom: 10px; border: 1px solid var(--line-2); border-radius: 9px; background: color-mix(in srgb, var(--bg) 50%, transparent); transition: border-color 0.2s, background 0.2s; }
.fsec__search:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2)); background: var(--bg); }
.fsec__search svg { width: 14px; height: 14px; flex: none; color: var(--muted); }
.fsec__search input { flex: 1; min-width: 0; border: none; background: none; outline: none; font: 400 13px/1 var(--ui); color: var(--ink); padding: 1px 0; }
.fsec__search input::placeholder { color: var(--muted); }

.fsec__wall { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px; margin: -2px; }
.fsec__wall.hidden { display: none; }
/* an expanded facet spans the full grid width so the wall of chips flows in a tidy band
   instead of forcing a single tall column (which left ragged gaps beside it) */
.fsec--expanded { grid-column: 1 / -1; }
.fsec--expanded .fsec__head, .fsec--expanded .fsec__search { max-width: 520px; }
.fsec__empty { font: 400 italic 13px/1.4 var(--serif); color: var(--muted); padding: 6px 2px; }
.fsec__empty.hidden { display: none; }
.fsec__more { margin-top: 10px; font: 500 11px/1 var(--ui); letter-spacing: 0.04em; color: var(--accent); align-self: flex-start; }
.fsec__more.hidden { display: none; }
.fsec__more:hover { text-decoration: underline; text-underline-offset: 3px; }

/* chip entrance — subtle fade-rise, staggered by position */
.filterpanel.is-open .fsec__wall .chip { animation: chipIn 0.32s var(--ease-out) backwards; }
.fsec__wall .chip:nth-child(n+1)  { animation-delay: 0.00s; }
.fsec__wall .chip:nth-child(n+6)  { animation-delay: 0.03s; }
.fsec__wall .chip:nth-child(n+12) { animation-delay: 0.06s; }
@keyframes chipIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* footer */
.filterpanel__foot {
  position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 16px;
  padding: 14px var(--gut); margin-top: 8px;
  background: color-mix(in srgb, var(--bg-2) 94%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.filterpanel__clearall { margin-right: auto; display: inline-flex; align-items: center; gap: 6px; font: 500 11px/1 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); transition: color 0.25s; }
.filterpanel__clearall-ic { width: 13px; height: 13px; }
.filterpanel__clearall:hover { color: var(--accent); }
.filterpanel__done { padding: 12px 24px; font-variant-numeric: tabular-nums; transition: opacity 0.25s, background 0.3s var(--ease), color 0.3s; }
.filterpanel__done b { font-weight: 600; }
.filterpanel__done:disabled { opacity: 0.45; pointer-events: none; }

/* ── mobile: true bottom-sheet ─────────────────────────────────────── */
@media (max-width: 767px) {
  /* lock background scroll only when the panel is a fixed sheet (mobile). On desktop
     the panel is in-flow content, so locking body overflow would freeze the whole
     page while it's open — the "filtering blocks scrolling" bug. Scoped here. */
  :root.filters-locked, :root.filters-locked body { overflow: hidden; }

  /* .controls' backdrop-filter creates a containing block that would pin the fixed
     sheet to the bar instead of the viewport. Drop the blur on mobile (panel is
     in-flow on desktop, so the frosted bar is preserved there); keep the bar opaque. */
  .controls { backdrop-filter: none; -webkit-backdrop-filter: none; background: color-mix(in srgb, var(--bg) 95%, transparent); }

  /* phone controls: row 1 = full-width search; row 2 = Filters (grows) + Sort + Cinema */
  .search { flex: 1 1 100%; min-height: 56px; border-bottom: 1px solid var(--line); }
  .filtersbtn { border-left: none; flex: 1 1 auto; justify-content: center; min-height: 52px; }
  .sortwrap { border-left: 1px solid var(--line); flex: 0 0 auto; min-height: 52px; padding: 0 16px; }
  .sortwrap label { display: none; }                /* the first option "Discover (varied)" self-labels */
  .sortwrap select { min-height: 44px; padding: 8px 6px; }
  .viewtoggle { border-left: 1px solid var(--line); flex: 0 0 auto; }
  .viewtoggle button[data-v="grid"] { display: none; }  /* grid is the only list mode on phone — drop the redundant toggle */
  .viewtoggle button[data-v="cinema"] { width: 52px; min-height: 52px; }

  .filterpanel__scrim {
    display: block; position: fixed; inset: 0; z-index: 1190; background: rgba(0,0,0,0.5);
    opacity: 0; pointer-events: none; transition: opacity 0.34s var(--ease); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  }
  .filterpanel__scrim.is-open { opacity: 1; pointer-events: auto; }

  .filterpanel { max-height: 0; }
  .filterpanel.is-open {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 1200;
    max-height: min(86vh, 86dvh); border-radius: 20px 20px 0 0;
    border-top: 1px solid var(--line-2); background: var(--bg);
    box-shadow: 0 -24px 60px -30px rgba(0,0,0,0.55);
    animation: sheetUp 0.42s var(--ease-out);
    display: flex; flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .filterpanel__inner { display: flex; flex-direction: column; min-height: 0; flex: 1; }
  .filterpanel__body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1; min-height: 0; }

  /* drag-handle */
  .filterpanel__header { padding-top: 8px; cursor: grab; touch-action: none; }
  .filterpanel__grip { display: block; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 40px; height: 4px; border-radius: 100px; background: var(--line-2); }
  .filterpanel__titles { padding-top: 8px; }
  .filterpanel__title { font-size: 17px; }

  .filterpanel__grid { grid-template-columns: 1fr; gap: 22px; }
  .filterpanel__tools { flex-direction: column; align-items: stretch; }
  .filterpanel__tools .fsec--tool { flex: 1 1 auto; }

  .filterpanel__foot { padding: 14px var(--gut) calc(14px + env(safe-area-inset-bottom, 0px)); }
  .filterpanel__done { flex: 1; justify-content: center; }
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ── tablet (768–1024): the filter panel is a right-anchored SLIDE-IN SIDEBAR, not a
   bottom sheet — it exploits the iPad's width and keeps the grid + scroll position
   visible underneath. Scroll-lock is safe here because the sidebar is position:fixed
   (the in-flow desktop ≥1025 panel keeps NO lock — that was the original freeze bug). ── */
@media (min-width: 768px) and (max-width: 1024px) {
  :root.filters-locked, :root.filters-locked body { overflow: hidden; }
  .controls { backdrop-filter: none; -webkit-backdrop-filter: none; }   /* same containing-block reason as the sheet */
  .filterpanel__scrim {
    display: block; position: fixed; inset: 0; z-index: 1190; background: rgba(0,0,0,0.42);
    opacity: 0; pointer-events: none; transition: opacity 0.34s var(--ease); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  }
  .filterpanel__scrim.is-open { opacity: 1; pointer-events: auto; }
  .filterpanel { max-height: 0; }
  .filterpanel.is-open {
    position: fixed; top: calc(var(--bar-h) + var(--safe-t)); right: 0; bottom: 0; left: auto; z-index: 1200;
    width: min(380px, 44vw); max-height: none; border-radius: 0;
    border-left: 1px solid var(--line-2); background: var(--bg);
    box-shadow: -24px 0 60px -30px rgba(0,0,0,0.5);
    animation: sheetInRight 0.42s var(--ease-out);
    display: flex; flex-direction: column;
    padding-bottom: var(--safe-b);
  }
  .filterpanel__inner { display: flex; flex-direction: column; min-height: 0; flex: 1; }
  .filterpanel__body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1; min-height: 0; }
  .filterpanel__grid { grid-template-columns: 1fr; gap: 22px; }   /* 380px is one column */
  .filterpanel__tools { flex-direction: column; align-items: stretch; }
  .filterpanel__foot { position: sticky; bottom: 0; }
}
@keyframes sheetInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* respect reduced motion for the new transforms */
@media (prefers-reduced-motion: reduce) {
  .filterpanel.is-open .fsec__wall .chip { animation: none; }
  .filterpanel.is-open { animation: none; }
  .sk-chip { animation: none; }
}

/* ============================================================
   GALLERY — airy justified grid
   ============================================================ */
.gallery { position: relative; padding: clamp(22px, 3vw, 40px) var(--gut) clamp(60px, 8vw, 110px); flex: 1; }
.gallery__meta { display: flex; justify-content: space-between; align-items: baseline; font: 500 11px/1 var(--ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 22px; }
.gallery__meta b { color: var(--ink); font-weight: 600; }
.gallery__viewport { position: relative; width: 100%; }

.tile { position: absolute; overflow: hidden; background: var(--paper-3); cursor: pointer; will-change: transform; contain: layout paint; }
.tile__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06); transition: opacity 0.9s var(--ease-out), transform 1.4s var(--ease-out), filter 0.6s var(--ease); }
.tile.loaded .tile__img { opacity: 1; transform: scale(1); }
.tile:hover .tile__img { transform: scale(1.05); }
/* terminal image failure: reveal the info bar so the work is never anonymous */
.tile.is-broken .tile__info { opacity: 0.8; transform: none; }
.tile.is-broken::before { content: "image unavailable"; position: absolute; inset: 0; display: grid; place-items: center;
  font: 500 9px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.tile__skel { position: absolute; inset: 0; background: var(--paper-3); }
.tile.loaded /* terminal image failure: reveal the info bar so the work is never anonymous */
.tile.is-broken .tile__info { opacity: 0.8; transform: none; }
.tile.is-broken::before { content: "image unavailable"; position: absolute; inset: 0; display: grid; place-items: center;
  font: 500 9px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.tile__skel { opacity: 0; }

.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(18,14,11,0.72)); opacity: 0; transition: opacity 0.5s var(--ease); pointer-events: none; }
.tile:hover::after { opacity: 1; }

.tile__num { position: absolute; top: 12px; left: 13px; z-index: 3; font: 500 10px/1 var(--ui); letter-spacing: 0.08em; color: #fff; opacity: 0; transform: translateY(-4px); transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); font-variant-numeric: tabular-nums; }
.tile:hover .tile__num { opacity: 0.85; transform: translateY(0); }
.tile__save { position: absolute; top: 8px; right: 9px; z-index: 4; width: 32px; height: 32px; display: grid; place-items: center; color: #fff; opacity: 0; transform: translateY(-4px); transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); }
.tile:hover .tile__save { opacity: 0.9; transform: translateY(0); }
.tile__save:hover { opacity: 1; transform: scale(1.12); }
.tile__save svg { width: 19px; height: 19px; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)); }
.tile.is-saved .tile__save { opacity: 1; transform: translateY(0); }
.tile.is-saved .tile__save svg { fill: var(--accent); color: #fff; }

.tile__info { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 26px 15px 15px; color: #fff; opacity: 0; transform: translateY(8px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.tile:hover .tile__info { opacity: 1; transform: translateY(0); }
.tile__title { font: 400 italic 16px/1.2 var(--serif); letter-spacing: -0.005em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile__sub { font: 500 10px/1.4 var(--ui); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 7px; color: rgba(255,255,255,0.72); }
.tile__sub .ac { color: #fff; }

/* ── panorama / ultra-tall works: show the COMPLETE image, never cropped ──
   Ultra-wide handscrolls span their own full-width row; ultra-tall hanging
   scrolls get a centered contain panel. Both sit on a thin, intentional mat
   and skip the cover-crop + zoom so nothing is sliced off. */
.tile--pano, .tile--tall { background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.tile--pano .tile__img, .tile--tall .tile__img {
  object-fit: contain; object-position: center;
  transform: none; padding: 10px;
}
.tile--pano.loaded .tile__img, .tile--tall.loaded .tile__img { transform: none; }

/* ── touch: hover never fires, so tile chrome (title/index/save) is permanently
   visible-but-subtle. Gated to coarse only → desktop hover choreography untouched. ── */
@media (pointer: coarse) {
  .tile::after { opacity: 1; background: linear-gradient(180deg, transparent 50%, rgba(18,14,11,0.80)); }
  :root[data-theme="dark"] .tile::after { background: linear-gradient(180deg, transparent 46%, rgba(0,0,0,0.86)); }
  .tile__info { opacity: 1; transform: none; padding: 22px 12px 12px; }
  .tile__num { opacity: 0.75; transform: none; }
  .tile__title { font-size: 14px; }
  .tile__sub { font-size: 9px; margin-top: 5px; }
  .tile__save { opacity: 0.92; transform: none; top: 4px; right: 4px; width: var(--tap); height: var(--tap); }
  /* pano/tall/stub render the art on a light mat — a dark scrim would sit on the mat,
     not the picture, so suppress it and let the label sit on the mat colour. */
  .tile--pano::after, .tile--tall::after, .tile--stub::after { opacity: 0; }
  .tile--pano .tile__info, .tile--tall .tile__info, .tile--stub .tile__info {
    color: var(--ink);
    background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 90%, transparent) 65%);
  }
  .tile--pano .tile__sub, .tile--tall .tile__sub, .tile--stub .tile__sub { color: var(--muted); }
  .tile--pano .tile__sub .ac, .tile--tall .tile__sub .ac, .tile--stub .tile__sub .ac { color: var(--ink); }
}
.tile--pano:hover .tile__img, .tile--tall:hover .tile__img { transform: none; }
/* a tighter mat for the very tall scrolls so the strip reads as deliberate */
.tile--tall .tile__img { padding: 8px 14px; }
:root[data-theme="dark"] .tile--pano, :root[data-theme="dark"] .tile--tall { background: rgba(0,0,0,0.28); box-shadow: inset 0 0 0 1px rgba(239,233,221,0.07); }

/* metadata-only stubs (in-copyright works) — an engraved "plate" stands in for the
   absent image: a museum label, not a broken frame. */
.tile--stub { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); }
.tile__plate { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 18px;
  background:
    repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--ink) 4%, transparent) 7px 8px),
    radial-gradient(120% 90% at 50% 18%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 62%); }
.tile__plate-mark { font: 300 clamp(40px, 7vw, 72px)/0.9 var(--serif); color: var(--ink); opacity: 0.82; }
.tile__plate-note { font: 500 9px/1 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); opacity: 0; transform: translateY(4px); transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); }
.tile--stub:hover .tile__plate-note { opacity: 0.9; transform: translateY(0); }
.tile--stub .tile__num { color: var(--accent); opacity: 0.92; transform: none; mix-blend-mode: normal; }
:root[data-theme="dark"] .tile--stub { background: rgba(0,0,0,0.22); }

/* stub detail: the same plate, full-size, in place of the zoomable frame */
.detail__frame--stub { position: relative; cursor: default; aspect-ratio: 4 / 5; max-height: calc(100vh - var(--bar-h) - 132px); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2), 0 40px 80px -40px rgba(20,16,12,0.4); display: grid; }
.detail__plate { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: clamp(28px, 6vw, 64px);
  background:
    repeating-linear-gradient(135deg, transparent 0 9px, color-mix(in srgb, var(--ink) 4%, transparent) 9px 10px),
    radial-gradient(120% 80% at 50% 16%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%); }
.detail__plate-mark { font: 300 clamp(72px, 13vw, 140px)/0.85 var(--serif); color: var(--ink); opacity: 0.85; }
.detail__plate-label { font: 600 11px/1 var(--ui); letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); }
.detail__plate-note { max-width: 34ch; font: 400 italic clamp(14px, 1.6vw, 17px)/1.5 var(--serif); color: var(--ink-2); }

.empty { text-align: center; padding: 100px 20px; }
.empty h3 { font: 300 italic clamp(28px, 4vw, 44px) var(--serif); margin: 0 0 14px; color: var(--ink); }
.empty p { font: 500 11px/1.6 var(--ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* ============================================================
   DETAIL
   ============================================================ */
.detail { flex: 1; padding-top: var(--bar-h); }
/* Lightweight control row — NOT a second header. The fixed .topbar already provides
   nav; this is just back + prev/cinema/next, so it carries no bar chrome (no blurred
   background, border, or sticky bar) that would read as a stacked "double header" and
   push the artwork down the page. */
.detail__top { display: flex; align-items: center; justify-content: space-between; padding: 12px var(--gut) 4px; position: relative; z-index: 500; }
.detail__back { display: inline-flex; align-items: center; gap: 10px; font: 500 12px/1 var(--ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); transition: color 0.3s; }
.detail__back:hover { color: var(--ink); }
.detail__back svg { width: 16px; height: 16px; }
.detail__nav { display: flex; gap: 8px; }
/* gradient paints the left (image) column bg-2 full height so the pinned, shorter-than-
   panel stage never leaves a colour seam; right (panel) column stays page bg. 55.56% = 1.25/2.25fr */
.detail__grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 0; background: linear-gradient(90deg, var(--bg-2) 0 55.56%, transparent 55.56%); }

/* The panel is usually taller than the picture. Rather than top-pinning the image (which
   strands landscape/wide works above a big dead band), the stage is a viewport-height
   sticky panel that VERTICALLY CENTRES the picture and keeps it in view while reading —
   balanced whitespace for any aspect ratio, from tall portraits to 3:1 panoramas. */
.detail__stage { align-self: start; position: sticky; top: var(--bar-h); height: calc(100vh - var(--bar-h)); padding: clamp(18px, 2.6vh, 40px) clamp(30px, 5vw, 80px); display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg-2); }
.detail__frame { position: relative; min-height: 0; cursor: zoom-in; box-shadow: 0 40px 80px -40px rgba(20,16,12,0.5); max-width: 100%; background: var(--surface); padding: 0; transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease); }
.detail__frame:hover { transform: scale(1.01); box-shadow: 0 50px 100px -44px rgba(20,16,12,0.55); }
.detail__frame img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100vh - var(--bar-h) - 128px); object-fit: contain; view-transition-name: painting-hero; }

/* Stacked layout for tablet/phone — placed AFTER the base rules so it actually wins
   (the previous media block sat before them and was silently overridden). */
/* Detail layout is ORIENTATION-aware below desktop (replaces the old flat ≤940 cut,
   which left a cramped 941–1024 two-pane dead zone and broke the 12.9" iPad on rotate):
   • phone+phablet (≤899), any orientation → stacked
   • tablet portrait (768–1024) → stacked (tall canvas wants one column)
   • tablet landscape (900–1024) → balanced two-pane
   • ≥1025 fine pointer → FROZEN desktop two-pane */
@media (max-width: 899px), (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  .detail__grid { grid-template-columns: 1fr; background: none; }
  .detail__stage { position: static; height: auto; min-height: 0; align-self: auto; padding: clamp(14px, 4vw, 28px) clamp(14px, 4vw, 28px) 2px; }
  .detail__frame { position: static; }
  .detail__frame img { max-height: 78vh; }
  .detail__frame--stub { aspect-ratio: auto; max-height: 78vh; }
  .detail__panel { padding: clamp(22px, 6vw, 40px) clamp(20px, 5vw, 32px) clamp(40px, 8vw, 60px); }
}
@media (min-width: 900px) and (max-width: 1024px) and (orientation: landscape) {
  .detail__grid { grid-template-columns: 1.1fr 1fr; }   /* rebalance the cramped 1.25fr 1fr for tablet landscape */
}
.detail__caption { font: 500 10px/1.5 var(--ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 20px; display: inline-flex; align-items: center; gap: 8px; }
.detail__caption svg { width: 13px; height: 13px; }

::view-transition-group(painting-hero) { animation-duration: 0.55s; animation-timing-function: var(--ease); }
::view-transition-old(painting-hero), ::view-transition-new(painting-hero) { mix-blend-mode: normal; height: 100%; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.45s; }

.detail__panel { padding: clamp(34px, 4vw, 72px) clamp(28px, 4vw, 64px); display: flex; flex-direction: column; }
.detail__num { font: 500 11px/1 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.detail__title { font: 300 clamp(32px, 4.2vw, 60px)/1.02 var(--serif); letter-spacing: -0.02em; margin: 18px 0 12px; }
.detail__artist { font: 400 clamp(16px, 1.6vw, 20px)/1.4 var(--ui); color: var(--ink-2); }
.detail__artist b { font-weight: 500; color: var(--ink); }
.detail__artist-link { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-2); transition: color 0.25s var(--ease), border-color 0.25s var(--ease); }
.detail__artist-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.detail__artist-link b { color: inherit; }

.detail__facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 34px 0; background: var(--line); border: 1px solid var(--line); }
@media (max-width: 600px) { .detail__facts { grid-template-columns: 1fr; } }
.fact { padding: 14px 16px; background: var(--bg); }
.fact dt { font: 500 9px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.fact dd { margin: 8px 0 0; font: 400 14px/1.4 var(--ui); color: var(--ink); }

.detail__read h4, .cin__read h4 { font: 500 11px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; display: flex; align-items: center; gap: 12px; }
.detail__read h4::after, .cin__read h4::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.prose { font: 400 17px/1.72 var(--serif); color: var(--ink); letter-spacing: 0.002em; hanging-punctuation: first last; text-wrap: pretty; }
.prose p { margin: 0 0 1.1em; }
.prose p:last-child { margin-bottom: 0; }
.prose-cite { font: 500 11px/1.5 var(--ui) !important; letter-spacing: 0.04em; color: var(--muted); margin-top: 1.4em !important; }
.prose-cite a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.prose-cite a:hover { color: var(--accent); }
/* DESC honesty note — shown only when confidence==='tombstone' (no Wikipedia article confirmed) */
.prose-note { font-style: italic; color: var(--muted); }

/* lazy-description skeleton */
.desc-skel { display: block; height: 0.85em; margin: 0 0 0.7em; border-radius: 3px; background: linear-gradient(100deg, var(--bg-2) 28%, color-mix(in srgb, var(--bg-2) 55%, #fff) 50%, var(--bg-2) 72%); background-size: 220% 100%; animation: shimmer 1.3s linear infinite; }
.desc-skel.short { width: 52%; }
@keyframes shimmer { to { background-position: -220% 0; } }
.cin__read .desc-skel { background: linear-gradient(100deg, rgba(239,233,221,0.07) 28%, rgba(239,233,221,0.16) 50%, rgba(239,233,221,0.07) 72%); background-size: 220% 100%; }

.dyk { margin: 30px 0; padding: 24px 26px; border-radius: 2px; background: var(--bg-2); border-left: 2px solid var(--accent); }
.dyk__l { font: 500 10px/1 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.dyk__t { font: 400 italic 16px/1.55 var(--serif); color: var(--ink); }

.detail__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.linkbtn { display: inline-flex; align-items: center; gap: 9px; padding: 12px 18px; border-radius: 100px; border: 1px solid var(--line-2); font: 500 12px/1 var(--ui); letter-spacing: 0.02em; color: var(--ink); transition: background 0.35s var(--ease), color 0.35s, transform 0.35s var(--ease), border-color 0.35s; }
.linkbtn:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); transform: translateY(-2px); }
.linkbtn svg { width: 14px; height: 14px; }
.linkbtn.is-on { border-color: var(--accent); color: var(--accent); }

.detail__rights { margin-top: 22px; font: 400 12px/1.6 var(--ui); color: var(--muted); }
.detail__tomb { margin-top: 10px; font: 400 italic 13px/1.6 var(--serif); color: var(--ink-2); }

.related { padding: clamp(40px, 6vw, 88px) var(--gut) clamp(60px, 8vw, 110px); border-top: 1px solid var(--line); }
.related__h { font: 500 11px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 22px; }
.related__row { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(160px, 21vw, 230px); gap: 14px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; }
.rcard { position: relative; aspect-ratio: 3/4; overflow: hidden; cursor: pointer; background: var(--paper-3); }
.rcard img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease); }
.rcard::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 50%, rgba(18,14,11,0.7)); opacity: 0; transition: opacity 0.4s; }
.rcard:hover img { transform: scale(1.05); }
.rcard:hover::after { opacity: 1; }
.rcard span { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 22px 12px 12px; color: #fff; font: 400 italic 13px/1.25 var(--serif); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: 0; transition: opacity 0.4s; }
.rcard:hover span { opacity: 1; }

/* ============================================================
   CINEMA — serene
   ============================================================ */
.cinema { position: fixed; inset: 0; z-index: 800; background: var(--void); display: flex; flex-direction: column; opacity: 0; }
.cinema.in { animation: fadeIn 0.7s var(--ease-out) forwards; }
.cinema.out { animation: cinFadeOut 0.5s var(--ease-io) forwards; }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes cinFadeOut { from { opacity: 1; } to { opacity: 0; } }
#cinema-gl { position: absolute; inset: 0; z-index: 0; }

.cin__stage { position: relative; flex: 1; z-index: 2; display: grid; place-items: center; overflow: hidden; }
/* invisible touch/tap surface — swipe + tap, behind nothing in the dock */
.cin__tap { position: absolute; inset: 0; z-index: 1; touch-action: none; }
.cin__layer { position: absolute; inset: 0; display: grid; place-items: center; }
.cin__img { max-width: min(90vw, 1400px); max-height: 76vh; width: auto; height: auto; object-fit: contain; box-shadow: 0 60px 140px -50px rgba(0,0,0,0.9), 0 0 0 1px rgba(239,233,221,0.06); }
/* per-slide directional Ken Burns driven by --kb-* custom props (calm, mechanical) */
.cin__layer.enter .cin__img {
  animation: cinImgIn 1.4s var(--ease-out) both,
             kenburns var(--kb-dur, 9600ms) cubic-bezier(0.4, 0, 0.6, 1) 0.3s both;
  transform-origin: var(--kb-ox, 50%) var(--kb-oy, 50%);
}
@keyframes cinImgIn { from { opacity: 0; transform: scale(1.04); filter: blur(8px); } to { opacity: 1; transform: scale(1); filter: blur(0); } }
@keyframes kenburns { from { transform: scale(var(--kb-s0, 1)); } to { transform: scale(var(--kb-s1, 1.05)); } }
.cin__layer.exit .cin__img { animation: cinImgOut 0.9s var(--ease) both; }
@keyframes cinImgOut { to { opacity: 0; transform: scale(0.99); filter: blur(6px); } }

/* center play/pause glyph flash on tap */
.cin__glyph { position: absolute; top: 50%; left: 50%; z-index: 8; width: 78px; height: 78px; transform: translate(-50%, -50%) scale(0.7); display: grid; place-items: center; border-radius: 50%; background: rgba(8,7,6,0.42); color: var(--bone); opacity: 0; transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out); pointer-events: none; }
.cin__glyph svg { width: 30px; height: 30px; }
.cin__glyph.show { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }

.cin__topnum { position: absolute; top: max(28px, env(safe-area-inset-top)); left: max(var(--gut), env(safe-area-inset-left)); z-index: 5; font: 500 11px/1.6 var(--ui); letter-spacing: 0.12em; color: var(--bone-faint); font-variant-numeric: tabular-nums; }
.cin__topnum b { color: var(--bone); display: block; font: 300 22px/1.2 var(--serif); }
.cin__exit { position: absolute; top: max(22px, env(safe-area-inset-top)); right: max(var(--gut), env(safe-area-inset-right)); z-index: 6; width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--void-line); border-radius: 50%; color: var(--bone); transition: background 0.4s var(--ease), color 0.4s, transform 0.5s var(--ease); }
.cin__exit:hover { background: var(--bone); color: var(--void); transform: rotate(90deg); }
.cin__exit svg { width: 18px; height: 18px; }
.cin__progress { position: absolute; top: env(safe-area-inset-top); left: 0; height: 2px; background: var(--bone); box-shadow: 0 0 12px rgba(239,233,221,0.5); z-index: 6; width: 0; }

.cin__dock { position: relative; z-index: 4; padding-bottom: max(0px, env(safe-area-inset-bottom)); animation: dockIn 0.8s var(--ease-out) 0.3s both; }
@keyframes dockIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.cin__caption { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 24px; padding: 24px var(--gut) 30px; }
.cin__capmain { position: relative; min-width: 0; cursor: pointer; }

/* Tier-1 ambient learning line — the "wall whisper" (one sentence, always on) */
.cin__whisper {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 14px);
  font: 300 italic clamp(15px, 1.7vw, 21px)/1.4 var(--serif);
  color: var(--bone-soft); letter-spacing: 0.005em; max-width: 52ch;
  opacity: 0; transition: opacity 0.9s var(--ease-out); pointer-events: none;
  text-wrap: balance;
}
.cin__whisper.show { opacity: 1; }
.cin__captitle { font: 300 clamp(22px, 3vw, 38px)/1.05 var(--serif); letter-spacing: -0.02em; color: var(--bone); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cin__captitle em, .cin__captitle { font-style: italic; }
.cin__capmeta { font: 500 11px/1 var(--ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--bone-soft); margin-top: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cin__capmeta .ac { color: var(--bone); }
.cin__expandhint { display: inline-flex; align-items: center; gap: 8px; font: 500 10px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone-faint); margin-top: 14px; transition: color 0.3s; }
.cin__capmain:hover .cin__expandhint { color: var(--bone-soft); }
.cin__expandhint svg { width: 12px; height: 12px; }

.cin__transport { display: flex; align-items: center; gap: 10px; }
.tbtn { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--void-line); border-radius: 50%; color: var(--bone); transition: background 0.35s var(--ease), color 0.35s, transform 0.3s var(--ease); }
.tbtn:hover { background: var(--bone); color: var(--void); }
.tbtn:active { transform: scale(0.9); }
.tbtn svg { width: 17px; height: 17px; }
.tbtn--play { width: 60px; height: 60px; background: var(--bone); color: var(--void); border-color: var(--bone); }
.tbtn--play:hover { background: transparent; color: var(--bone); }
.tbtn--wide { width: auto; padding: 0 18px; gap: 9px; border-radius: 100px; font: 500 11px/1 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; }
.tbtn.is-on { background: var(--bone); color: var(--void); }

.cin__read { position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; max-height: 0; overflow: hidden; background: color-mix(in srgb, var(--void) 95%, #000); border-top: 1px solid var(--void-line); transition: max-height 0.6s var(--ease-io); }
.cin__read.open { max-height: min(66vh, 580px); }
.cin__readinner { padding: clamp(28px, 4vw, 56px) var(--gut); display: grid; grid-template-columns: 1.6fr 1fr; gap: clamp(30px, 5vw, 70px); max-height: min(66vh, 580px); overflow-y: auto; scrollbar-color: var(--void-line) transparent; scrollbar-width: thin; }
@media (max-width: 1024px) { .cin__readinner { grid-template-columns: 1fr; } }   /* stack the cited drawer through tablet portrait */
.cin__read .prose { color: var(--bone); }
.cin__read h4 { color: var(--bone-soft); }
.cin__read h4::after { background: var(--void-line); }
.cin__read .detail__facts { background: var(--void-line); border-color: var(--void-line); }
.cin__read .fact { background: var(--void-2); }
.cin__read .fact dt { color: var(--bone-faint); }
.cin__read .fact dd { color: var(--bone); }
.cin__read .dyk { background: rgba(239,233,221,0.05); border-left-color: var(--accent); }
.cin__read .dyk__t { color: var(--bone); }
.cin__read .linkbtn { color: var(--bone); border-color: var(--void-line); }
.cin__read .linkbtn:hover { background: var(--bone); color: var(--void); }
/* Tier-2 citation — the source the data layer returns (finally surfaced) */
.cin__cite { margin-top: 14px; font: 500 10px/1.5 var(--ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--bone-faint); }
.cin__cite:empty { display: none; }
.cin__cite a { color: var(--bone-soft); border-bottom: 1px solid var(--void-line); transition: color 0.3s var(--ease); }
.cin__cite a:hover { color: var(--bone); }

.cin__keys { position: absolute; left: var(--gut); bottom: 50%; z-index: 3; font: 400 10px/1.9 var(--ui); letter-spacing: 0.06em; color: var(--bone-faint); opacity: 0; transition: opacity 0.5s; pointer-events: none; }
.cinema:hover .cin__keys { opacity: 0.45; }
.cin__keys kbd { border: 1px solid var(--void-line); border-radius: 3px; padding: 1px 5px; margin-right: 5px; }

/* auto-hide chrome after idle — the immersive payoff (backdrop + image stay) */
.cinema .cin__dock, .cinema .cin__topnum, .cinema .cin__exit, .cinema .cin__keys { transition: opacity 0.6s var(--ease); }
.cinema.idle .cin__dock, .cinema.idle .cin__topnum, .cinema.idle .cin__exit, .cinema.idle .cin__keys { opacity: 0; pointer-events: none; }
.cinema.idle { cursor: none; }

@media (max-width: 760px) { .cin__keys, .cin__topnum { display: none; } .cin__caption { grid-template-columns: 1fr; } .cin__transport { justify-content: space-between; } .cin__capmeta { white-space: normal; } }
@media (pointer: coarse) { .cin__keys { display: none; } }

/* ============================================================
   HALL — immersive WebGL gallery
   ============================================================ */
body.is-hall { overflow: hidden; background: #0c0b0a; }
/* the hall is a full-screen overlay appended to <body>; hide the page beneath it so
   the index can never bleed through during the fade-in or any slow first frame. */
body.is-hall #root { visibility: hidden; }
/* Cinema too: a hard cut under the overlay — the outgoing page must never show through
   mid-fade (the route swap beneath is instant; the overlay supplies the cinematic fade) */
body.is-cinema #root { visibility: hidden; }
.hall { position: fixed; inset: 0; z-index: 820; background: #0c0b0a; opacity: 0; transition: opacity 0.7s var(--ease-out); }
.hall.in { opacity: 1; }
#hall-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hall .cin__exit { color: var(--bone); border-color: var(--void-line); }
.hall__hint { position: absolute; left: 50%; top: 26px; transform: translateX(-50%); z-index: 6; font: 500 10px/1 var(--ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--bone-faint); display: flex; gap: 4px; align-items: center; }
.hall__hint kbd { border: 1px solid var(--void-line); border-radius: 3px; padding: 2px 6px; color: var(--bone-soft); }
@media (max-width: 767px) { .hall__hint { font-size: 9px; top: 18px; } }

/* Hall v2 — pointer-lock walk + cinematic focus */
.hall.locked { cursor: none; }
.hall__cross { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(255,255,255,0.6), 0 0 6px rgba(0,0,0,0.5); z-index: 5; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.hall.locked .hall__cross { opacity: 0.75; }
.hall__hud { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; text-align: center; color: var(--bone); padding: 24px 34px; border: 1px solid var(--void-line); border-radius: 4px; background: rgba(12,11,10,0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); pointer-events: none; }
.hall__hud.hidden { display: none; }
.hall__hud b { display: block; font: 400 italic clamp(20px,3vw,26px)/1 var(--serif); margin-bottom: 14px; }
.hall__hud span { font: 500 11px/1.8 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--bone-soft); }
.hall__hud kbd { border: 1px solid var(--void-line); border-radius: 3px; padding: 1px 6px; margin: 0 2px; }
.hall__hudbtns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px; pointer-events: auto; }
.hall__hudbtns button { font: 500 12px/1 var(--ui); letter-spacing: 0.03em; color: var(--bone); border: 1px solid var(--void-line); border-radius: 100px; padding: 13px 22px; display: inline-flex; align-items: center; white-space: nowrap; transition: background 0.3s var(--ease), color 0.3s, transform 0.3s var(--ease); }
.hall__hudbtns button:hover { background: var(--bone); color: var(--void); transform: translateY(-2px); }
/* narrow fine-pointer windows: the WASD hint must never wrap mid-phrase — shrink, then yield */
@media (max-width: 680px) { #hall-walk { font-size: 10px; padding: 11px 14px; } }
@media (max-width: 470px) { #hall-walk { display: none; } }
.hall__hudbtns kbd { border: 1px solid currentColor; border-radius: 3px; padding: 0 4px; margin: 0 1px; opacity: 0.65; }
#hall-tour { background: var(--bone); color: var(--void); border-color: var(--bone); }
#hall-tour:hover { background: transparent; color: var(--bone); }
.hall.touring { cursor: default; }
.hall.touring .hall__cross { opacity: 0; }
.hall__name { position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%) translateY(8px); z-index: 5; text-align: center; opacity: 0; transition: opacity 0.35s, transform 0.35s; pointer-events: none; }
.hall__name.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hall.focused .hall__name { opacity: 0; }
.hall__name b { display: block; font: 400 italic clamp(18px,2.4vw,24px)/1.1 var(--serif); color: var(--bone); }
.hall__name span { font: 500 10px/1.6 var(--ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--bone-soft); }

/* Tour lower-third (Tour 2.0): letterspaced eyebrow + serif title + meta, bottom-centre,
   bone-on-void, fades with .show. Only shown during the cinematic tour. */
.hall__lower { position: absolute; left: 50%; bottom: clamp(40px, 8vh, 88px); transform: translateX(-50%) translateY(10px); z-index: 5; text-align: center; max-width: min(80vw, 640px); opacity: 0; transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); pointer-events: none; }
.hall__lower.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hall__lower-eye { font: 600 10px/1 var(--ui); letter-spacing: 0.18em; text-transform: uppercase; color: var(--bone-soft); margin-bottom: 12px; }
.hall__lower-title { font: 400 italic clamp(22px, 3vw, 34px)/1.08 var(--serif); letter-spacing: -0.01em; color: var(--bone); }
.hall__lower-meta { margin-top: 8px; font: 500 11px/1.5 var(--ui); letter-spacing: 0.06em; color: var(--bone-soft); }
/* whisper "click to skip" during the entrance cinematic */
.hall__skip { position: absolute; right: max(var(--gut), env(safe-area-inset-right)); bottom: max(26px, env(safe-area-inset-bottom)); z-index: 6; font: 500 10px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone-faint); opacity: 0; transition: opacity 0.6s var(--ease); pointer-events: none; }
.hall__skip.show { opacity: 1; }
/* ?perfdbg overlay — top-left mono chip; hidden unless .hall.perfdbg */
.hall__perf { position: absolute; left: max(14px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); z-index: 9; display: none; font: 500 11px/1.4 var(--mono); letter-spacing: 0.02em; color: var(--bone-soft); background: rgba(12,11,10,0.6); border: 1px solid var(--void-line); border-radius: 4px; padding: 6px 10px; pointer-events: none; white-space: nowrap; }
.hall.perfdbg .hall__perf { display: block; }
.hall__dim { position: absolute; inset: 0; z-index: 3; background: radial-gradient(58% 72% at 32% 50%, transparent 38%, rgba(0,0,0,0.6)); opacity: 0; transition: opacity 0.9s var(--ease); pointer-events: none; }
.hall.focused .hall__dim { opacity: 1; }
.hall__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 86vw); z-index: 7; background: color-mix(in srgb, var(--void) 92%, #000); border-left: 1px solid var(--void-line); padding: clamp(28px,3.4vw,52px); overflow-y: auto; transform: translateX(103%); transition: transform 0.7s var(--ease-io); color: var(--bone); }
.hall__panel.open { transform: translateX(0); }
.hall__back { display: inline-flex; align-items: center; gap: 8px; font: 500 11px/1 var(--ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--bone); margin-bottom: 30px; }
.hall__back:hover { color: var(--bone); }
.hall__back svg { width: 15px; height: 15px; }
.hall__look { font: 500 10px/1.5 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); padding-bottom: 14px; border-bottom: 1px solid var(--void-line); margin-bottom: 20px; }
.hall__title { font: 300 clamp(26px,3.4vw,40px)/1.04 var(--serif); letter-spacing: -0.02em; margin: 0 0 8px; color: var(--bone); }
.hall__by { font: 400 16px/1.3 var(--ui); color: var(--bone-soft); margin-bottom: 22px; }
.hall__known { font: 500 10.5px/1.6 var(--ui); letter-spacing: 0.03em; color: rgba(239,233,221,0.8); padding: 11px 0; border-top: 1px solid var(--void-line); border-bottom: 1px solid var(--void-line); margin-bottom: 22px; }
.hall__known .k { display: inline-block; font: 600 9px/1 var(--ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--bone); background: rgba(236,230,218,0.18); padding: 3px 7px; border-radius: 3px; margin-right: 9px; }
.hall__prose { font: 400 16.5px/1.7 var(--serif); color: var(--bone); hanging-punctuation: first; }
.hall__prose p { margin: 0 0 1em; }
.hall__src { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hall__panel .linkbtn { color: var(--bone); border-color: var(--void-line); }
.hall__panel .linkbtn:hover { background: var(--bone); color: var(--void); border-color: var(--bone); }
.hall__panel .dyk { background: rgba(236,230,218,0.05); border-left-color: var(--accent); margin: 22px 0; }
.hall__panel .dyk__t { color: var(--bone); }
@media (max-width: 640px) { .hall__panel { width: 100vw; } }

/* ── Collections antechamber (DOM gallery of doorways) ── */
.hall.is-gate { background: radial-gradient(120% 130% at 50% -10%, #161210 0%, #0a0908 70%); overflow-y: auto; }
.hall__gate { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: clamp(72px, 10vh, 140px) clamp(20px, 5vw, 64px) clamp(48px, 8vh, 96px); }
@media (pointer: coarse) and (max-width: 767px) { .hall__gate { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 28px); } }
.hall__gate-head { text-align: center; max-width: 640px; margin-bottom: clamp(32px, 5vh, 56px); }
.hall__gate-eye { font: 600 10px/1 var(--ui); letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); margin-bottom: 18px; }
.hall__gate-title { font: 300 clamp(30px, 5.2vw, 56px)/1.04 var(--serif); letter-spacing: -0.02em; color: var(--bone); margin: 0 0 16px; }
.hall__gate-lede { font: 400 clamp(14px, 1.6vw, 17px)/1.55 var(--ui); color: var(--bone-soft); margin: 0 auto; max-width: 52ch; }
.hall__doors { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: clamp(12px, 1.6vw, 20px); width: 100%; max-width: 1080px; }
.hall__door { position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--void-line); border-radius: 5px; overflow: hidden; text-align: left; color: var(--bone); background: #100d0a; cursor: pointer; transition: transform 0.5s var(--ease-out), border-color 0.5s var(--ease); }
.hall__door:hover { transform: translateY(-4px); border-color: rgba(236,230,218,0.4); }
.hall__door-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(7px) brightness(0.42) sepia(0.4) saturate(0.7); transform: scale(1.18); transition: filter 0.6s var(--ease), transform 0.6s var(--ease-out); }
.hall__door:hover .hall__door-bg { filter: blur(4px) brightness(0.58) sepia(0.3); transform: scale(1.12); }
.hall__door::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,9,8,0.1) 30%, rgba(10,9,8,0.92) 100%); }
/* palette-tinted top wash (per-door via --door-tint) — a whisper of the salon's laylight */
.hall__door::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0.22; background: radial-gradient(120% 80% at 50% -10%, var(--door-tint, #ffe7bf), transparent 62%); mix-blend-mode: screen; transition: opacity 0.5s var(--ease); }
.hall__door:hover::before { opacity: 0.34; }
.hall__door-in { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 18px 20px 17px; }
.hall__door-label { display: block; font: 400 italic clamp(19px, 2vw, 24px)/1.1 var(--serif); letter-spacing: -0.01em; }
.hall__door-sub { display: block; margin-top: 6px; font: 500 10px/1.4 var(--ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--bone-soft); }
.hall__gateback { position: absolute; left: 22px; top: 22px; z-index: 8; display: inline-flex; align-items: center; gap: 6px; font: 500 11px/1 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--bone); border: 1px solid var(--void-line); border-radius: 100px; padding: 9px 15px; background: rgba(12,11,10,0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background 0.3s var(--ease), color 0.3s; }
.hall__gateback svg { width: 14px; height: 14px; }
.hall__gateback:hover { background: var(--bone); color: var(--void); }
.hall.is-gate .hall__gateback { display: none; }
.hall.locked .hall__gateback, .hall.touring .hall__gateback { opacity: 0; pointer-events: none; }
.hall.is-coarse .hall__cross { display: none; }
@media (max-width: 640px) {
  .hall__doors { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .hall__door { aspect-ratio: 1 / 1; }
}

/* ============================================================
   LIGHTBOX / TOAST / FOOTER
   ============================================================ */
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(16,14,12,0.97); display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity 0.45s var(--ease); cursor: zoom-out; padding: 0; }
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 94vw; max-height: 92vh; max-height: 92dvh; width: auto; height: auto; object-fit: contain; box-shadow: 0 0 0 1px rgba(239,233,221,0.08); transform: scale(0.97); transition: transform 0.5s var(--ease-out); }
.lightbox.open img { transform: scale(1); }
.lightbox__close { position: absolute; top: max(24px, env(safe-area-inset-top)); right: max(28px, env(safe-area-inset-right)); color: var(--bone); font: 500 11px/1 var(--ui); letter-spacing: 0.1em; text-transform: uppercase; border: 1px solid var(--void-line); border-radius: 100px; padding: 12px 16px; }

/* ---- Deep-zoom viewer (OpenSeadragon) ---- */
.zoomer { position: fixed; inset: 0; z-index: 1000; background: rgba(16,14,12,0.985); opacity: 0; pointer-events: none; transition: opacity 0.45s var(--ease); }
:root:not([data-theme="dark"]) .zoomer { background: color-mix(in srgb, var(--bg) 96%, #000); }
.zoomer.open { opacity: 1; pointer-events: auto; }
.zoomer__stage {
  position: absolute !important;
  inset: 0;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
}
.zoomer__rail { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(18px, env(safe-area-inset-top)) max(var(--gut), env(safe-area-inset-right)) 18px max(var(--gut), env(safe-area-inset-left)); pointer-events: none; }
/* only the OPEN viewer's controls are interactive — otherwise the closed (opacity:0, z-1000)
   rail buttons sit over the topbar and steal its clicks. */
.zoomer.open .zoomer__rail > * { pointer-events: auto; }
.zoomer__cap { font: 500 11px/1 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.zoomer__tools { display: flex; gap: 8px; }
.zoomer .iconbtn { color: var(--bone); border-color: var(--void-line); background: rgba(16,14,12,0.5); }
.zoomer .iconbtn:hover { background: var(--bone); color: #14110c; border-color: var(--bone); }
.zoomer__close { color: var(--bone); font: 500 11px/1 var(--ui); letter-spacing: 0.1em; text-transform: uppercase; border: 1px solid var(--void-line); border-radius: 100px; padding: 12px 16px; background: transparent; }
.zoomer__close:hover { background: var(--bone); color: #14110c; }
.zoomer__hint { position: absolute; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3; font: 500 10px/1 var(--ui); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); transition: opacity 0.6s var(--ease); pointer-events: none; }
.zoomer.is-ready .zoomer__hint { opacity: 0; }
.zoomer__skel { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 0.3s var(--ease); }
.zoomer.is-loading .zoomer__skel { opacity: 1; }
.zoomer__skel i { width: min(60vw, 520px); height: 2px; background: var(--void-line); overflow: hidden; display: block; }
.zoomer__skel i::after { content: ""; display: block; height: 100%; width: 40%; background: var(--bone); animation: zoomSlide 1.1s var(--ease-io) infinite; }
@keyframes zoomSlide { from { transform: translateX(-120%); } to { transform: translateX(320%); } }
.zoomer .openseadragon-canvas { outline: none !important; }
.zoomer .navigator { border: 1px solid var(--void-line) !important; background: rgba(16,14,12,0.6) !important; border-radius: 2px; margin: 14px !important; }
.zoomer .displayregion { border: 1px solid var(--accent) !important; }
@media (max-width: 600px) { .zoomer .navigator { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .zoomer { transition: none; } }

/* z-index 1300: above the filter sheet (1200), below the skip-link (2000) */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 1300; background: var(--ink); color: var(--bg); padding: 14px 22px; border-radius: 100px; font: 500 12px/1 var(--ui); letter-spacing: 0.02em; opacity: 0; pointer-events: none; transition: opacity 0.4s, transform 0.4s var(--ease-out); display: flex; align-items: center; gap: 10px; box-shadow: 0 20px 50px -20px rgba(0,0,0,0.5); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .tac { color: #fff; }

.footer { border-top: 1px solid var(--line); padding: clamp(48px, 7vw, 96px) var(--gut); display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; background: var(--bg-2); }
@media (max-width: 767px) { .footer { grid-template-columns: 1fr; gap: 28px; } }
.footer__brand { font: 300 clamp(40px, 7vw, 92px)/0.9 var(--serif); letter-spacing: -0.03em; }
.footer__brand em { font-style: italic; }
.footer p { font: 400 13px/1.7 var(--ui); color: var(--ink-2); max-width: 42ch; }
.footer__col h5 { font: 500 10px/1 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; }
.footer__col a { display: block; font: 400 15px/2 var(--serif); color: var(--ink-2); transition: color 0.3s; }
.footer__col a:hover { color: var(--ink); }

/* ============================================================
   COLLECTION — your saved works (header actions + onboarding)
   ============================================================ */
.collection__actions {
  display: flex; flex-wrap: wrap; gap: 12px;
  padding: clamp(8px, 2vw, 20px) var(--gut) clamp(24px, 4vw, 40px);
}
.collection__clear.is-armed { background: var(--accent); color: #fff; border-color: var(--accent); }
.collection__empty { padding: clamp(60px, 10vw, 120px) var(--gut); }
.collection__empty h3 { font: 300 italic clamp(28px, 4vw, 44px) var(--serif); margin: 0 0 16px; color: var(--ink); }
.collection__empty p { font: 400 clamp(14px, 1.4vw, 17px)/1.6 var(--ui); color: var(--ink-2); max-width: 46ch; margin: 0 auto 28px; text-transform: none; letter-spacing: 0; }
.collection__hint { font-style: italic; color: var(--muted); margin-top: -14px; }
.collection__cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* utility */
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.coord { display: none; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out); }
.reveal.in { opacity: 1; transform: translateY(0); }

@media (max-width: 680px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .topbar__nav { justify-self: center; gap: 0; }
  .navlink { padding: 10px 9px; }
  .topbar__right { gap: 6px; }
  .topbar__count { display: none; }   /* meaningful only on Collection; reclaim the width */
  .stats { gap: 28px 40px; }
}
/* ============================================================
   DISCOVER — The Wanderer (single-card serendipity)
   ============================================================ */
.wndr { min-height: calc(100svh - var(--bar-h)); padding: calc(var(--bar-h) + clamp(22px, 4vw, 50px)) var(--gut) 48px; display: flex; flex-direction: column; align-items: center; }
.wndr__top { width: 100%; max-width: 1120px; display: flex; flex-direction: column; align-items: center; gap: 16px; margin-bottom: clamp(16px, 2.6vw, 30px); }
.wndr__eyebrow { font: 500 11px/1 var(--ui); letter-spacing: 0.22em; color: var(--muted); }
.wndr__modes { display: flex; gap: 9px; flex-wrap: wrap; justify-content: center; }
.wndr__mode { display: flex; flex-direction: column; gap: 3px; padding: 9px 18px; border: 1px solid var(--line); border-radius: 100px; background: transparent; cursor: pointer; transition: border-color .3s var(--ease), background .3s var(--ease); text-align: center; }
.wndr__mode b { font: 500 13px/1 var(--ui); letter-spacing: 0.02em; color: var(--ink-2); }
.wndr__mode span { font: 400 10.5px/1.2 var(--ui); letter-spacing: 0.03em; color: var(--muted); }
.wndr__mode:hover:not(.is-active) { border-color: var(--ink-2); }
.wndr__mode.is-active { background: var(--ink); border-color: var(--ink); }
.wndr__mode.is-active b { color: var(--bg); }
.wndr__mode.is-active span { color: color-mix(in srgb, var(--bg) 65%, var(--ink)); }

.wndr__stage { position: relative; width: 100%; max-width: 1120px; display: flex; align-items: center; justify-content: center; gap: clamp(8px, 2vw, 24px); }
.wndr__plate { position: relative; flex: 1; height: min(58vh, 600px); display: flex; align-items: center; justify-content: center; cursor: pointer; touch-action: pan-y; }
.wndr__plate.is-loading::before { content:""; position:absolute; inset:0; background: var(--paper-3); opacity:.5; }
.wndr__img { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .7s var(--ease); }
.wndr__img.in { opacity: 1; }
.wndr__img.out { opacity: 0; }
.wndr__img img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: 0 40px 90px -42px rgba(0,0,0,.6); }
.wndr__nav { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 70%, transparent); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; transition: border-color .3s, color .3s, transform .3s; z-index: 2; }
.wndr__nav:hover { color: var(--ink); border-color: var(--ink-2); transform: scale(1.06); }
.wndr__nav svg { width: 18px; height: 18px; }

.wndr__caption { width: 100%; max-width: 760px; text-align: center; margin-top: clamp(18px, 3vw, 30px); }
.wndr__why { font: 500 10.5px/1 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.wndr__title { font: 300 clamp(24px, 3.4vw, 40px)/1.06 var(--serif); letter-spacing: -0.02em; margin: 0 0 8px; }
.wndr__meta { font: 400 14px/1.5 var(--ui); color: var(--ink-2); }
.wndr__meta .ac { color: var(--ink); font-weight: 500; }
.wndr__dyk { margin-top: 14px; min-height: 1.4em; }
.wndr__whisper { font: italic 400 15px/1.6 var(--serif); color: var(--ink-2); }

.wndr__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; margin-top: 22px; }
.wndr__actions .linkbtn.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
#wndr-hint { color: var(--muted); pointer-events: none; background: transparent; border-color: transparent; }
#wndr-hint kbd { border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; margin: 0 2px; font-size: 10px; }

.wndr__trail { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: clamp(22px, 3.4vw, 40px); max-width: 640px; }
.wndr__chip { width: 44px; height: 44px; border-radius: 6px; background-size: cover; background-position: center; background-color: var(--bg-2); border: 1px solid var(--line); cursor: pointer; opacity: .5; transition: opacity .3s, transform .3s, border-color .3s; }
.wndr__chip:hover { opacity: 1; transform: translateY(-2px); }
.wndr__chip.is-cur { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

@media (max-width: 680px) {
  .wndr__nav { width: 40px; height: 40px; }
  .wndr__plate { height: 46vh; }
  .wndr__chip { width: 38px; height: 38px; }
  #wndr-hint { display: none; }
}

/* floating thumb-zone Save ★ — touch only; the inline Save/Full-record sit mid-screen,
   out of easy reach on a tall phone. Hidden on desktop / fine pointer. */
.wndr__savefab { display: none; }
@media (pointer: coarse) {
  .wndr__savefab {
    display: grid; place-items: center; position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(16px + var(--tabbar-h) + var(--safe-b)); z-index: 740;
    width: 56px; height: 56px; border-radius: 50%;
    background: color-mix(in srgb, var(--bg) 80%, transparent); color: var(--ink);
    border: 1px solid var(--line-2); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 10px 30px -12px rgba(0,0,0,0.5);
  }
  .wndr__savefab svg { width: 24px; height: 24px; }
  .wndr__savefab.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
  .wndr__savefab.is-on svg { fill: #fff; }
  .wndr__savefab:active { transform: translateX(-50%) scale(0.92); }
  /* the inline Save button is redundant with the fab on touch — keep Full-record only */
  .wndr__actions #wndr-save { display: none; }
}

/* ============================================================
   MOBILE COMPATIBILITY & TOUCH UX  (mobile-audit pass)
   ============================================================ */

/* P1-2 · kill the grey/blue tap flash; iOS Safari + Android Chrome */
* { -webkit-tap-highlight-color: transparent; }

/* P0-1 · iOS zooms the page when a focused control is < 16px and never zooms back.
   Bump the RENDERED size on coarse pointers (keeps the small desktop look). */
@media (pointer: coarse) {
  .yearrange input,
  .sortwrap select,
  .artistcombo input,
  .fsec__search input,
  .search input { font-size: 16px; }
}

/* P1-1 · honour the 44px touch-target minimum on the primary icon controls */
@media (pointer: coarse) {
  .iconbtn { width: 44px; height: 44px; }
  .detail__nav { gap: 10px; }
  .search__clear { padding: 12px 10px; }
  .artistcombo__clear { padding: 10px; }
  /* extended touch-target sweep (mobile+tablet spec §7.2) — padding/min-height only,
     so desktop fine-pointer geometry is untouched */
  .navlink { padding-block: 13px; }
  .chip { padding: 11px 16px; }
  .filterpanel__close { width: 44px; height: 44px; }
  .viewtoggle button, .coll-toggle__b, .wndr__mode { min-height: 44px; }
  .linkbtn { min-height: 44px; }
  .footer__col a { min-height: 40px; display: inline-flex; align-items: center; }
  /* Wanderer prev/next arrows shrink to 40px under the ≤680 width rule — restore the 44px
     floor on touch (fine-pointer desktop keeps 46/40 exactly). */
  .wndr__nav { width: 44px; height: 44px; }
  /* Hall navigation chrome — exit is already 46px, but gateback/back/HUD buttons sit below
     44px on touch. Bump via padding/min so the immersive route is thumb-navigable. */
  .hall__gateback { padding: 12px 16px; }
  .hall__back { min-height: 44px; }
  .hall__hudbtns button { min-height: 44px; }
}

/* P1-2 · give taps a visible acknowledgement (most controls are hover-only) */
@media (pointer: coarse) {
  .tile:active .tile__img { filter: brightness(0.9); }
  .linkbtn:active, .btn:active { transform: scale(0.97); }
  .tab:active, .wndr__nav:active, .tbtn:active { transform: scale(0.94); }
}

/* P3-2 · stop long-press text-selection / callout on tap controls
   (prose, titles, credits stay selectable — it's an art archive) */
@media (pointer: coarse) {
  .tile, .chip, .navlink, .btn, .linkbtn, .tbtn, .iconbtn,
  .coll-toggle__b, .wndr__mode, .hall__door {
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  }
}

/* P3-3 · native momentum on inner scrollers (older iOS) */
.fsec__wall, .artistcombo__menu, .cin__readinner, .hall__panel,
.filterpanel, .related__row, .facets { -webkit-overflow-scrolling: touch; }

/* P2-4 · horizontal strips read as scrollable + snap on touch */
.related__row, .facets { scroll-snap-type: x proximity; }

/* The hint copy is coarse-aware now ("Drag to look around · tap a work to enter"), so
   coarse tablets KEEP it — it's the only interaction cue they get. */
@media (max-width: 1024px) and (pointer: coarse) { .hero__drift-hint { display: block; font-size: 10px; letter-spacing: 0.12em; } }
