@font-face { font-family: "Cormorant"; src: url("../assets/fonts/cormorant-garamond-latin-300-normal.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("../assets/fonts/cormorant-garamond-latin-300-italic.woff2") format("woff2"); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("../assets/fonts/cormorant-garamond-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("../assets/fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("../assets/fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("../assets/fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --ink: #f3eadb;
  --ink-dim: rgba(243, 234, 219, 0.64);
  --ink-faint: rgba(243, 234, 219, 0.32);
  --gold: #d9b26f;
  --night: #07060a;
  --serif: "Cormorant", "Times New Roman", "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { background: var(--night); }
body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
kbd {
  font-family: var(--sans);
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--ink-faint);
  border-radius: 4px;
  color: var(--ink-dim);
  margin: 0 1px;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 1.5px solid var(--gold); outline-offset: 3px; }

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  opacity: 0.06;
  z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-3%, 2%); }
  66% { transform: translate(2%, -3%); }
  100% { transform: translate(0, 0); }
}

/* ---------- shared type ---------- */
.eyebrow, .num, .kicker {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--gold);
}
h1 em, h2 em {
  display: block;
  font-style: italic;
  font-weight: 400;
  color: var(--gold);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 11px 10px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: background 0.3s, border-color 0.3s;
}
.pill b { font-weight: inherit; }
.pill span {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  letter-spacing: 0;
  transition: transform 0.3s var(--ease);
}
.pill:hover { background: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.5); }
.pill:hover span { transform: translateX(3px); }

/* ---------- loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--night);
  transition: opacity 1.2s var(--ease), visibility 1.2s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader-lamp {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #ffe2aa;
  box-shadow: 0 0 calc(10px + var(--p, 0) * 70px) calc(var(--p, 0) * 18px) rgba(255, 210, 140, 0.45);
  opacity: calc(0.3 + var(--p, 0) * 0.7);
  margin-bottom: 18px;
}
.loader-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 34px;
}
.loader-title em { color: var(--gold); font-weight: 400; }
.loader-text { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-dim); }
.loader-line { width: 160px; height: 1px; background: rgba(255, 255, 255, 0.1); }
.loader-line i { display: block; height: 100%; background: var(--gold); transform-origin: left; transform: scaleX(0); transition: transform 0.4s; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: max(18px, env(safe-area-inset-top)) var(--gutter) 18px;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  pointer-events: none;
}
.topbar > *, .topbar-right > * { pointer-events: auto; }
.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 -28px;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(7, 6, 10, 0.92) 55%, rgba(7, 6, 10, 0));
  opacity: 0;
  transition: opacity 0.4s;
}
/* On the scrolling wall, keep content from running under the top bar. */
.on-wall .topbar::before { opacity: 1; }
.logo { font-weight: 600; color: var(--ink); text-decoration: none; }
.logo i { font-style: normal; color: var(--gold); margin: 0 0.25em; }
.topbar-right { display: flex; align-items: center; gap: 22px; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 6px 2px;
}
.toggle-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  transition: background 0.3s, box-shadow 0.3s;
}
.toggle[aria-pressed="true"] .toggle-dot { background: #ffe2aa; box-shadow: 0 0 10px rgba(255, 220, 160, 0.9); }
.toggle:hover { color: var(--ink); }
.toggle-icon { display: none; width: 20px; height: 20px; color: var(--ink-dim); }
.toggle[aria-pressed="true"] .toggle-icon { color: #ffe2aa; filter: drop-shadow(0 0 6px rgba(255, 220, 160, 0.8)); }
.toggle[aria-pressed="false"] .wave { opacity: 0.25; }


.now-playing {
  position: fixed;
  top: max(54px, calc(env(safe-area-inset-top) + 40px));
  right: var(--gutter);
  z-index: 20;
  max-width: min(460px, 70vw);
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-dim);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.8s, transform 0.8s var(--ease);
}
.now-playing.on { opacity: 1; transform: none; }

/* ---------- intro ---------- */
.intro {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-align: center;
  width: min(92vw, 900px);
  pointer-events: none;
}
.intro::before {
  content: "";
  position: absolute;
  inset: -45% -20%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(5, 4, 6, 0.6), rgba(5, 4, 6, 0));
}
.intro .kicker { margin-bottom: 16px; }
.intro h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(40px, 6.4vw, 92px);
  line-height: 1.02;
  text-shadow: 0 0 28px rgba(255, 214, 150, 0.16), 0 2px 30px rgba(0, 0, 0, 0.65);
}
.hint {
  margin-top: 20px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.intro .hint { transition: opacity 0.6s; }
.intro.entered .hint { opacity: 0; }

/* ---------- gallery card captions ---------- */
.cards-ui { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.card-cap, .card-open, .card-year {
  position: absolute;
  left: 0; top: 0;
  will-change: transform, opacity;
}
.card-cap {
  transform-origin: 0 100%;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
}
.card-cap p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--gold);
  margin-bottom: 2px;
}
.card-cap h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 44px;
  line-height: 1;
}
.card-open {
  width: 46px; height: 46px;
  margin: -46px 0 0 -46px;
  transform-origin: 100% 100%;
  border-radius: 50%;
  background: rgba(10, 8, 6, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  font-size: 16px;
  pointer-events: auto;
  transition: background 0.3s, border-color 0.3s;
}
.card-open:hover { background: rgba(217, 178, 111, 0.9); border-color: transparent; color: #111; }
.card-year {
  transform-origin: 50% 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 30px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.card-year span { display: block; text-align: center; }
.card-year .e {
  font-style: italic;
  font-size: 22px;
  color: var(--ink-dim);
  opacity: 0;
  transition: opacity 0.4s;
}
.card-year.on .y { color: var(--ink); }
.card-year.on .e { opacity: 1; }

/* ---------- timeline scrubber ---------- */
.scrub {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 2 * var(--gutter)));
  z-index: 12;
  text-align: center;
}
.scrub-track { position: relative; cursor: grab; touch-action: none; }
.scrub-track:active { cursor: grabbing; }
.scrub ol {
  list-style: none;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--ink-faint);
}
.scrub li { flex: 1; position: relative; }
.scrub li button {
  width: 100%;
  padding: 12px 0 2px;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  transition: color 0.3s;
}
.scrub li button::before {
  content: "";
  position: absolute;
  top: -4px; left: 50%;
  width: 1px; height: 7px;
  background: var(--ink-faint);
}
.scrub li button:hover, .scrub li button.on { color: var(--ink); }
.scrub li button.on { color: var(--gold); }
.scrub-dot {
  position: absolute;
  top: 0; left: 0;
  width: 9px; height: 9px;
  margin: -5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 14px var(--gold);
  pointer-events: none;
}

/* ---------- immersive view ---------- */
.view {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s var(--ease), visibility 0.6s;
}
.view.on { opacity: 1; visibility: visible; }
.view.on .view-back, .view.on .view-panel.on, .view.on .hotspot, .view.on .chapters { pointer-events: auto; }

.view-back {
  position: fixed;
  top: max(54px, calc(env(safe-area-inset-top) + 40px));
  left: var(--gutter);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  transition: color 0.3s;
}
.view-back:hover { color: var(--ink); }

.view-panel {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(70px, 12vh, 130px);
  max-width: min(560px, calc(100vw - 2 * var(--gutter)));
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.9s var(--ease);
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.65);
}
.view-panel.on { opacity: 1; transform: none; transition-delay: 0.25s; }
.view.swapping .view-panel, .view.swapping .hotspot { opacity: 0 !important; transition-delay: 0s; }

.view-title h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(48px, 7.6vw, 116px);
  line-height: 0.95;
  margin-top: 10px;
}
/* The painting's dominant colours, dark to light. */
.palette { display: flex; gap: 7px; margin-top: 16px; }
.palette span {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(243, 234, 219, 0.28);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.view-title .sub {
  margin-top: 16px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(19px, 1.9vw, 24px);
}
.view-title .sub b {
  font-style: italic;
  font-weight: 400;
  color: var(--ink-dim);
  margin-left: 0.4em;
}
.view-title .lead {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-dim);
  max-width: 50ch;
}
.view-title .pills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.view-detail {
  padding: 24px 26px 26px;
  max-width: min(410px, calc(100vw - 2 * var(--gutter)));
  background: linear-gradient(160deg, rgba(20, 16, 12, 0.74), rgba(10, 8, 6, 0.52));
  border: 1px solid rgba(217, 178, 111, 0.22);
  border-radius: 4px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-shadow: none;
}
.view-detail h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.1;
  margin: 10px 0 12px;
}
.view-detail p:last-child { font-size: 14px; line-height: 1.7; color: var(--ink-dim); }

.view-next {
  left: 50%;
  bottom: auto;
  top: 50%;
  transform: translate(-50%, calc(-50% + 18px));
  text-align: center;
}
.view-next.on { transform: translate(-50%, -50%); }
.view-next h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(38px, 5.6vw, 80px);
  line-height: 1.02;
  margin: 12px 0 26px;
  text-shadow: 0 0 28px rgba(255, 214, 150, 0.16), 0 2px 30px rgba(0, 0, 0, 0.65);
}

.hotspots { position: absolute; inset: 0; }
.hotspot {
  position: absolute;
  left: 0; top: 0;
  width: 30px; height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  border: 1px solid rgba(217, 178, 111, 0.9);
  background: rgba(10, 8, 6, 0.35);
  color: var(--gold);
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  display: grid;
  place-items: center;
  box-shadow: 0 0 18px rgba(217, 178, 111, 0.45);
  opacity: 0;
  transition: opacity 0.5s, background 0.3s, color 0.3s, box-shadow 0.3s;
}
.hotspot::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  animation: ping 2.2s ease-out infinite;
  pointer-events: none;
}
/* No scale here: it would also scale the JS translate that positions the marker. */
.hotspot:hover, .hotspot.on { background: var(--gold); color: #111; box-shadow: 0 0 0 4px rgba(217, 178, 111, 0.25), 0 0 26px rgba(217, 178, 111, 0.8); }
@keyframes ping {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(2.6); opacity: 0; }
}

.chapters {
  position: absolute;
  right: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chapters button {
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
}
.chapters button::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  border: 1px solid var(--ink-dim);
  transition: background 0.3s, transform 0.3s;
}
.chapters button.on::before { background: var(--gold); border-color: var(--gold); transform: scale(1.4); }


/* ---------- loupe & cursor ---------- */
.cursor {
  position: fixed;
  left: 0; top: 0;
  z-index: 40;
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 1px solid rgba(255, 226, 170, 0.55);
  pointer-events: none;
  opacity: 0;
  display: grid;
  place-items: center;
  transition: opacity 0.4s, width 0.35s var(--ease), height 0.35s var(--ease), margin 0.35s var(--ease), background 0.35s;
}
.cursor::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 4px; height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: #ffe2aa;
  transition: opacity 0.2s;
}
.cursor span {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #111;
  opacity: 0;
  transition: opacity 0.2s;
}
.cursor.label {
  width: 74px; height: 74px;
  margin: -37px 0 0 -37px;
  background: rgba(255, 226, 170, 0.92);
  border-color: transparent;
}
.cursor.label::after { opacity: 0; }
.cursor.label span { opacity: 1; }
.cursor.hover { width: 54px; height: 54px; margin: -27px 0 0 -27px; }
.cursor.hide { opacity: 0 !important; }
@media (pointer: fine) {
  body, button, a, .scrub-track { cursor: none; }
  .cursor.on { opacity: 1; }
}

/* ---------- wall (end of the timeline) ---------- */
.wall {
  position: fixed;
  inset: 0;
  z-index: 14;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  opacity: 0;
  visibility: hidden;
  -webkit-user-select: text;
  user-select: text;
}
.wall.live { visibility: visible; }
.wall-inner {
  min-height: 100%;
  padding: 110px var(--gutter) 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.wall h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(36px, 5vw, 70px);
  line-height: 1.04;
  margin: 12px 0 44px;
}
/* Like a gallery hang: every painting sits on one line, with a label beneath
   it whose date, title and artist line up across the row. */
.wall-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 56px clamp(18px, 2.4vw, 36px);
  width: min(1180px, 100%);
  align-items: start;
}
.wall-grid button {
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  width: 100%;
  text-align: center;
}
.wall-grid .frame {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: clamp(130px, 15vw, 190px);
}
.wall-grid img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.8);
  filter: brightness(0.82);
  transition: filter 0.4s, transform 0.6s var(--ease);
}
.wall-grid button:hover img { filter: brightness(1.05); transform: translateY(-4px); }
.wall-grid .label {
  display: grid;
  justify-items: center;
  gap: 7px;
  margin-top: 22px;
  padding-top: 16px;
  max-width: 17em;
  position: relative;
}
.wall-grid .label::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: 22px; height: 1px;
  margin-left: -11px;
  background: rgba(217, 178, 111, 0.55);
}
.wall-grid .y {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--gold);
}
.wall-grid .t {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.14;
  letter-spacing: 0.005em;
  color: var(--ink);
  text-wrap: balance;
}
.wall-grid .a {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-dim);
}
.wall-grid button:hover .t { color: #fff; }
.wall-foot {
  margin-top: auto;
  padding-top: 56px;
  max-width: 640px;
  display: grid;
  gap: 12px;
}
.sig {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 26px;
}
.sig em { font-weight: 400; color: var(--gold); }
.links a {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid var(--ink-faint);
  padding-bottom: 3px;
}
.links a:hover { border-color: var(--gold); color: var(--gold); }
.credits { font-size: 11px; line-height: 1.7; color: var(--ink-faint); }
.copy { font-size: 10px; letter-spacing: 0.14em; color: var(--ink-faint); }

.noscript, .no-webgl-note {
  position: fixed;
  inset: auto 0 40% 0;
  text-align: center;
  font-family: var(--serif);
  font-size: 22px;
  z-index: 60;
}

/* Fallback without WebGL 2: the wall is the whole site. */
.no-webgl .wall { opacity: 1 !important; visibility: visible !important; }
.no-webgl #gl, .no-webgl .scrub, .no-webgl .intro, .no-webgl .toggle { display: none; }

.lost {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  background: rgba(7, 6, 10, 0.86);
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--gold);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
}
.lost.on { opacity: 1; visibility: visible; }


/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .topbar-right { gap: 12px; }
  .toggle-label, .toggle-dot { display: none; }
  .now-playing { font-size: 12px; max-width: 80vw; }
  .toggle-icon { display: block; }
  .toggle { padding: 6px 2px; }
  .scrub li button { font-size: 0; padding-top: 10px; }
  .scrub li button.on { font-size: 12px; }
  .view-title .lead { display: none; }
  .view-panel { bottom: 76px; }
  .view-detail { padding: 18px 20px 20px; }
  .view-detail h3 { font-size: 24px; }
  .chapters { top: auto; bottom: 30%; }
  .view-back kbd { display: none; }
  .wall-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 16px; }
  .wall-grid .frame { height: 120px; }
  .wall-grid .label { margin-top: 16px; padding-top: 12px; }
  .wall-grid .t { font-size: 17px; }
  .wall-grid .a { font-size: 13px; }
}

@media (max-height: 560px) {
  .card-year .e { display: none; }
}

@media (max-height: 640px) {
  .view-title h2 { font-size: clamp(36px, 9vh, 72px); }
  .view-title .lead { display: none; }
  .view-title .pills { margin-top: 14px; }
  .view-panel { bottom: 52px; }
  .view-detail { padding: 16px 20px 18px; }
  .view-detail h3 { font-size: 24px; margin: 6px 0 8px; }
  .view-back { top: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .hotspot::after { animation: none; }
}


/* ---------- investigation ---------- */
/* A gold pill: the way into a painting that can be played. */
.pill-case { border-color: rgba(217, 178, 111, 0.75); background: rgba(217, 178, 111, 0.16); color: #ffe7bd; }
.pill-case span { background: var(--gold); color: #111; }
.pill-case:hover { background: rgba(217, 178, 111, 0.3); border-color: var(--gold); }
.pill.ghost { background: transparent; border-color: rgba(255, 255, 255, 0.18); color: var(--ink-dim); }
.pill:disabled { opacity: 0.35; pointer-events: none; }

/* While investigating, the tour's own furniture steps aside. */
.view.casing .view-panel, .view.casing .hotspot, .view.casing .chapters { opacity: 0 !important; pointer-events: none !important; }

.case { position: absolute; inset: 0; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity 0.6s var(--ease), visibility 0.6s; }
.case.on { opacity: 1; visibility: visible; }

.case-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.case-lines path {
  fill: none;
  stroke-width: 0.8;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  filter: drop-shadow(0 0 3px rgba(255, 210, 150, 0.45));
  transition: stroke-dashoffset 2s var(--ease) 0.5s, opacity 0.6s 0.5s;
}
.case-lines path.on { stroke-dashoffset: 0; opacity: 0.55; }
.case-lines path.on.dim { opacity: 0.18; }

.case-marks { position: absolute; inset: 0; }
.case-mark, .case-hint-ring, .case-suspect {
  position: absolute;
  left: 0; top: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s;
}
.case-mark.on, .case-hint-ring.on, .case-suspect.on { opacity: 1; pointer-events: auto; }
/* A found clue: a small hollow ring, quiet enough to sit on a face. */
.case-mark {
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  border: 1px solid rgba(255, 226, 176, 0.75);
  box-shadow: 0 0 8px rgba(255, 210, 150, 0.35);
  transition: opacity 0.5s, transform 0.3s;
}
.case-mark::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; } /* bigger tap target */
.case-mark.on { opacity: 0.7; }
.case-mark.on:hover { opacity: 1; background: rgba(255, 226, 176, 0.25); }
.case-hint-ring {
  width: 92px; height: 92px;
  margin: -46px 0 0 -46px;
  border-radius: 50%;
  border: 2px solid rgba(255, 220, 160, 0.95);
  background: radial-gradient(circle, rgba(255, 214, 150, 0.18), rgba(255, 214, 150, 0) 70%);
  animation: hint 1.4s ease-in-out infinite;
}
.case-hint-ring .label {
  position: absolute;
  top: 100%;
  left: 50%;
  margin-top: 10px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--gold);
  color: #111;
}
.case-hint-ring.edge-l .label { left: 0; transform: none; }
.case-hint-ring.edge-r .label { left: auto; right: 0; transform: none; }
@keyframes hint { 50% { box-shadow: 0 0 0 14px rgba(255, 210, 140, 0.16), 0 0 44px rgba(255, 210, 140, 0.65); } }

/* Suspects: a ring on each face, a name beneath. */
.case-suspect { width: 0; height: 0; }
.case-suspect .ring {
  position: absolute;
  left: -38px; top: -38px;
  width: 76px; height: 76px;
  border-radius: 50%;
  border: 1px solid rgba(243, 234, 219, 0.7);
  box-shadow: 0 0 22px rgba(0, 0, 0, 0.5);
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s, transform 0.4s var(--ease);
}
.case-suspect .name {
  position: absolute;
  top: 46px; left: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(10, 8, 6, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  transition: background 0.3s, color 0.3s;
}
.case-suspect.edge-r .name { left: 26px; transform: translateX(-100%); }
.case-suspect.edge-l .name { left: -26px; transform: none; }
.case-suspect:hover .ring { border-color: var(--gold); transform: scale(1.06); }
.case-suspect.picked .ring { border: 2px solid var(--gold); background: rgba(217, 178, 111, 0.12); box-shadow: 0 0 0 6px rgba(217, 178, 111, 0.18), 0 0 30px rgba(255, 200, 120, 0.6); }
.case-suspect.picked .name { background: var(--gold); color: #111; }
.case-suspect.guilty .ring { border: 2px solid #e0674b; box-shadow: 0 0 26px rgba(224, 103, 75, 0.6); background: none; }
.case-suspect.innocent .ring { border: 2px solid #9fc4a2; box-shadow: 0 0 26px rgba(159, 196, 162, 0.5); background: none; }
.is-file .case-suspect { pointer-events: none; }

/* HUD while searching. */
.case-hud {
  position: absolute;
  left: 50%;
  bottom: clamp(26px, 5vh, 48px);
  transform: translate(-50%, 10px);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 12px 10px 22px;
  border-radius: 999px;
  border: 1px solid rgba(217, 178, 111, 0.3);
  background: rgba(10, 8, 6, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.5s, transform 0.6s var(--ease);
}
.is-search .case-hud { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.case-count { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.case-hint { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--ink-dim); }
.case-hint-btn {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--ink-dim);
  transition: color 0.3s, border-color 0.3s;
}
.case-hint-btn:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.5); }

.case-exit {
  position: absolute;
  top: max(54px, calc(env(safe-area-inset-top) + 40px));
  right: var(--gutter);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 6px 0;
  pointer-events: auto;
  transition: color 0.3s;
}
.case-exit span:first-child { font-size: 16px; letter-spacing: 0; margin-right: 4px; }
.case-exit:hover { color: var(--ink); }
.is-file .case-exit { z-index: 2; }

/* Panels share the tour's language: serif titles, a dark glass card. */
.case-panel {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(70px, 12vh, 130px);
  max-width: min(560px, calc(100vw - 2 * var(--gutter)));
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.9s var(--ease);
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.7);
}
.case-panel.on { opacity: 1; transform: none; transition-delay: 0.3s; pointer-events: auto; }
.case-panel h2 { font-family: var(--serif); font-weight: 300; font-size: clamp(38px, 5vw, 72px); line-height: 1; margin: 12px 0 16px; }
.case-panel .lead { font-size: 15px; line-height: 1.7; color: var(--ink-dim); max-width: 46ch; }
.case-panel .pill { margin-top: 24px; }

.case-clue, .case-accuse {
  padding: 24px 26px 26px;
  max-width: min(430px, calc(100vw - 2 * var(--gutter)));
  background: linear-gradient(160deg, rgba(20, 16, 12, 0.8), rgba(10, 8, 6, 0.6));
  border: 1px solid rgba(217, 178, 111, 0.28);
  border-radius: 4px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-shadow: none;
}
.case-clue .num { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.case-clue h3, .case-accuse h3 { font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.1; margin: 10px 0 12px; }
.case-clue .text, .case-accuse .text { font-size: 14px; line-height: 1.7; color: var(--ink-dim); }
.case-clue .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.case-clue .actions .pill { margin-top: 0; }
.case-accuse { left: 50%; transform: translate(-50%, 18px); bottom: clamp(26px, 5vh, 48px); text-align: center; }
.case-accuse.on { transform: translate(-50%, 0); }

/* The case file: a dark sheet on the right, the painting still glowing beside it. */
.case-file {
  left: auto;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(520px, 100vw);
  max-width: none;
  padding: calc(max(54px, env(safe-area-inset-top) + 40px) + 40px) clamp(24px, 4vw, 52px) 56px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-user-select: text;
  user-select: text;
  background: linear-gradient(90deg, rgba(7, 6, 10, 0.55), rgba(7, 6, 10, 0.94) 22%);
  text-shadow: none;
  transform: translateX(24px);
}
.case-file.on { transform: none; }
.case-file .file-head h2 { margin-top: 0; }
.file-roll { list-style: none; margin: 30px 0 8px; display: grid; gap: 14px; }
.file-roll li { padding: 14px 16px; border-left: 2px solid; background: rgba(255, 255, 255, 0.03); }
.file-roll li.guilty { border-color: #e0674b; }
.file-roll li.innocent { border-color: #9fc4a2; }
.file-roll b { font-family: var(--serif); font-weight: 500; font-size: 20px; }
.file-roll .tag { margin-left: 10px; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-faint); }
.file-roll li.guilty .tag { color: #e9907b; }
.file-roll li.innocent .tag { color: #b5d6b7; }
.file-roll p { margin-top: 6px; font-size: 14px; line-height: 1.6; color: var(--ink-dim); }
.file-sections { margin-top: 40px; padding-top: 28px; border-top: 1px solid rgba(217, 178, 111, 0.25); }
.file-sections .eyebrow { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.file-sections section { margin-top: 26px; }
.file-sections h4 { font-family: var(--serif); font-weight: 500; font-size: 24px; line-height: 1.15; }
.file-sections p { margin-top: 8px; font-size: 14px; line-height: 1.75; color: var(--ink-dim); }

/* The lamp warms near a clue and fills as it rests on one. */
.cursor.searching {
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border-color: rgba(255, 226, 170, calc(0.35 + var(--warm, 0) * 0.65));
  box-shadow: 0 0 calc(var(--warm, 0) * 34px) rgba(255, 200, 120, calc(var(--warm, 0) * 0.8)),
              inset 0 0 0 calc(var(--dwell, 0) * 23px) rgba(255, 214, 150, 0.28);
}

@media (max-width: 760px) {
  .case-hud { gap: 12px; padding: 8px 8px 8px 16px; bottom: 22px; }
  .case-hint { display: none; }
  .case-panel { bottom: 90px; }
  .case-panel .lead { font-size: 14px; }
  .case-clue, .case-accuse { padding: 18px 20px 20px; }
  .case-clue h3, .case-accuse h3 { font-size: 24px; }
  .case-accuse { width: calc(100vw - 2 * var(--gutter)); bottom: 22px; }
  .case-suspect .ring { left: -26px; top: -26px; width: 52px; height: 52px; }
  .case-suspect .name { top: 32px; font-size: 9px; letter-spacing: 0.12em; padding: 4px 8px; }
  .case-file { background: rgba(7, 6, 10, 0.94); }
  .case-exit span:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .case-hint-ring { animation: none; }
  .case-lines path { transition: opacity 0.4s; }
}


/* ---------- language ---------- */
/* The language switch is always a word, on phones too. */
.toggle-lang { min-width: 34px; justify-content: center; }
.toggle-lang .toggle-label { display: inline !important; letter-spacing: 0.12em; }
html.lang-zh .toggle-lang .toggle-label { font-family: var(--sans); }

/* Chinese reads better without the wide tracking and italics used for Latin capitals. */
html.lang-zh .view-detail p:last-child,
html.lang-zh .view-title .lead,
html.lang-zh .case-panel .lead,
html.lang-zh .case-clue .text,
html.lang-zh .case-accuse .text,
html.lang-zh .file-roll p,
html.lang-zh .file-sections p { line-height: 1.85; letter-spacing: 0.02em; }
html.lang-zh .view-detail h3,
html.lang-zh .case-clue h3,
html.lang-zh .case-accuse h3,
html.lang-zh .file-sections h4,
html.lang-zh .file-roll b { font-weight: 600; letter-spacing: 0.02em; }
html.lang-zh .case-panel h2,
html.lang-zh .file-head h2 { font-weight: 500; line-height: 1.2; letter-spacing: 0.02em; }
html.lang-zh .intro h1 { line-height: 1.25; }
html.lang-zh .intro h1 em, html.lang-zh .case-hint, html.lang-zh .view-title .sub b { font-style: normal; }
html.lang-zh .pill, html.lang-zh .case-count, html.lang-zh .case-hint-btn,
html.lang-zh .case-suspect .name, html.lang-zh .case-hint-ring .label,
html.lang-zh .case-exit, html.lang-zh .view-back, html.lang-zh .toggle { letter-spacing: 0.08em; }
