/* The Comprehensive Account - shared design system.
   Five registers from the novel: Court gold, chaos red, scribe ink, administered
   cloud white, deep jade. Wei's four inks mark the text: black for fact, red for
   discrepancy, blue for cross-reference, amber for what exceeded the record. */

:root {
  --gold-1: #f8d050; --gold-2: #e8b838; --gold: #d4a020; --gold-4: #b08010; --gold-5: #906800; --gold-6: #705000;
  --red-1: #f04020; --red-2: #e03010; --red: #c82000; --red-4: #a01800; --red-5: #801000; --red-6: #600800;
  --ink: #1a1810; --ink-2: #2a2820; --ink-3: #3a3830; --ink-4: #4a4840; --ink-5: #5a5850; --ink-6: #6a6860;
  --cloud: #f0eee8; --cloud-2: #e0ded8; --cloud-3: #d0cec8; --cloud-4: #c0beb8; --cloud-5: #b0aea8; --cloud-6: #a09e98;
  --jade-1: #0a3828; --jade-2: #145040; --jade-3: #1e6858; --jade-4: #288070; --jade-5: #329888; --jade: #3cb0a0;
  --ink-fact: #1a1810; --ink-discrepancy: #b01c08; --ink-crossref: #2b4a7a; --ink-amber: #a8620e;

  --f-display: "Grenze Gotisch", "UnifrakturMaguntia", Georgia, serif;
  --f-body: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --f-brush: "Ma Shan Zheng", "KaiTi", "STKaiti", serif;

  --step--1: 0.8125rem;
  --step-0: clamp(1.0625rem, 0.99rem + 0.3vw, 1.1875rem);
  --step-1: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --step-2: clamp(1.6rem, 1.3rem + 1.3vw, 2.25rem);
  --step-3: clamp(2.2rem, 1.6rem + 2.6vw, 3.6rem);
  --step-4: clamp(3rem, 1.9rem + 5vw, 6.5rem);

  --measure: 36rem;
  --gutter: clamp(1rem, 0.6rem + 2vw, 2.5rem);
  --masthead-h: 3.5rem;
  --ease-ink: cubic-bezier(.2, .7, .1, 1);
  --ease-seal: cubic-bezier(.7, 0, .2, 1);

  /* Register defaults: the door (ink ground, paper type). */
  --bg: #0e0c08; --bg-2: #17140e; --fg: #ece5d3; --fg-2: #bdb4a0; --muted: #8f8676;
  --accent: var(--gold); --accent-2: var(--red-2); --rule: rgba(236, 229, 211, .16);
  --panel: rgba(20, 17, 12, .94); --focus: var(--gold-1);
  color-scheme: dark;
}

body[data-register="court"], body[data-register="filing"], body[data-register="paper"] {
  /* The accent is also the colour of small labels: a gold dark enough to read on the paper
     (5:1; gold-5 was 4.3). */
  --bg: var(--cloud); --bg-2: #e7e5de; --fg: var(--ink); --fg-2: var(--ink-3); --muted: var(--ink-5);
  --accent: #806000; --accent-2: var(--red-4); --rule: rgba(26, 24, 16, .14);
  --panel: rgba(240, 238, 232, .97); --focus: var(--red-4);
  color-scheme: light;
}
body[data-register="ledger"] {
  --bg: #e4e1d8; --bg-2: #d9d6cc; --fg: var(--ink); --fg-2: var(--ink-3); --muted: var(--ink-5);
  --accent: var(--red-4); --accent-2: var(--ink-crossref); --rule: rgba(26, 24, 16, .16);
  --panel: rgba(228, 225, 216, .97); --focus: var(--red-4);
  color-scheme: light;
}
body[data-register="jade"] {
  --bg: var(--jade-1); --bg-2: #0d4231; --fg: #e2f2ec; --fg-2: #a9cfc3; --muted: #7fae9f;
  --accent: var(--jade); --accent-2: var(--gold-2); --rule: rgba(226, 242, 236, .16);
  --panel: rgba(8, 44, 32, .95); --focus: var(--gold-1);
  color-scheme: dark;
}
body[data-register="road"] {
  /* Chaos red, a shade deeper, so its small labels read on the dust (5.2:1; red was 4.3). */
  --bg: var(--cloud-2); --bg-2: var(--cloud-3); --fg: var(--ink-2); --fg-2: var(--ink-4); --muted: var(--ink-5);
  --accent: var(--ink-discrepancy); --accent-2: var(--jade-3); --rule: rgba(42, 40, 32, .16);
  --panel: rgba(224, 222, 216, .97); --focus: var(--red-4);
  color-scheme: light;
}
body[data-register="seal"] {
  --bg: #140c08; --bg-2: #1e120c; --fg: #f2e8da; --fg-2: #cdb9a4; --muted: #9c8570;
  --accent: var(--gold-2); --accent-2: var(--red-2); --rule: rgba(242, 232, 218, .15);
  --panel: rgba(26, 14, 9, .95); --focus: var(--gold-1);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--masthead-h) + 1rem); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--fg);
  font-family: var(--f-body); font-size: var(--step-0); line-height: 1.6;
  font-optical-sizing: auto; font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  transition: background-color .9s var(--ease-ink), color .9s var(--ease-ink);
  overflow-x: clip;
}
body[data-register="court"], body[data-register="filing"] {
  /* The jade floor of the Court: fitted so finely that there are no gaps. */
  background-image:
    linear-gradient(to right, rgba(26,24,16,.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(26,24,16,.045) 1px, transparent 1px);
  background-size: 42px 42px;
}
img, svg, canvas, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
/* Headings break into even lines, and paragraphs avoid a last line of one word. */
h1, h2, h3, .section-title, .room-title { text-wrap: balance; }
p, li, figcaption, blockquote { text-wrap: pretty; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0; font-weight: 400; line-height: 1.08; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--fg); color: var(--bg); padding: .5rem .9rem; }
.skip-link:focus { top: .6rem; }
main { display: block; outline: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ type roles */
.label {
  font-family: var(--f-mono); font-size: var(--step--1); font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; line-height: 1.35; color: var(--muted);
  font-variant-numeric: tabular-nums lining-nums;
}
.display { font-family: var(--f-display); font-weight: 600; letter-spacing: -.005em; line-height: .92; }
.room-title { font-family: var(--f-display); font-weight: 600; font-size: var(--step-4); line-height: .9; letter-spacing: -.01em; }
.section-title { font-size: var(--step-3); font-weight: 350; letter-spacing: -.02em; line-height: 1.02; font-variation-settings: "opsz" 72; }
.lede { font-size: var(--step-1); line-height: 1.45; color: var(--fg-2); max-width: var(--measure); font-variation-settings: "opsz" 24; }
.prose { max-width: var(--measure); }
.prose p { hyphens: auto; }
.brush { font-family: var(--f-brush); font-weight: 400; line-height: 1; }

/* Quotations from the novel look like filed slips: the words, then where they were filed. */
.slip {
  position: relative; margin: 0; padding: 1.1rem 1.25rem 1rem; max-width: var(--measure);
  background: color-mix(in srgb, var(--bg) 70%, var(--fg) 6%);
  border-left: 2px solid var(--accent);
}
.slip blockquote, .slip p.said { margin: 0 0 .6rem; font-size: var(--step-1); line-height: 1.4; font-variation-settings: "opsz" 30; }
.slip figcaption, .slip .filed { font-family: var(--f-mono); font-size: var(--step--1); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.said-line { font-size: var(--step-2); line-height: 1.22; font-weight: 350; font-variation-settings: "opsz" 60; max-width: 26ch; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: .55rem; min-height: 2.75rem; padding: .55rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--fg) 45%, transparent); border-radius: 2px; background: transparent;
  font-family: var(--f-body); font-size: 1rem; letter-spacing: .01em; cursor: pointer; text-decoration: none;
  transition: background-color .25s, color .25s, border-color .25s, transform .25s var(--ease-ink);
}
.btn:hover { border-color: var(--fg); background: color-mix(in srgb, var(--fg) 8%, transparent); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-seal { background: var(--red); border-color: var(--red); color: #fbf3e6; }
.btn-seal:hover { background: var(--red-4); border-color: var(--red-4); color: #fff; }
.btn-quiet { border-color: transparent; padding-inline: .6rem; }
.btn-quiet:hover { border-color: var(--rule); }
.btn[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

/* ------------------------------------------------------------------ masthead */
.masthead {
  position: sticky; top: 0; z-index: 40; height: var(--masthead-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 var(--gutter); color: var(--fg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px) saturate(1.1); -webkit-backdrop-filter: blur(10px) saturate(1.1);
  border-bottom: 1px solid var(--rule);
  transition: transform .45s var(--ease-ink), background-color .9s;
}
.masthead.is-tucked { transform: translateY(-100%); }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; min-width: 0; }
.brand-name { font-family: var(--f-display); font-weight: 600; font-size: 1.35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-slit {
  display: inline-block; width: 4px; height: 1.35rem; flex: none;
  background: linear-gradient(var(--gold-1), var(--red-2) 60%, var(--red-5));
  clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
  box-shadow: 0 0 10px rgba(224, 48, 16, .6);
}
.masthead-nav { display: flex; align-items: center; gap: .25rem; }
.nav-link, .nav-btn {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 2.5rem; padding: .3rem .7rem;
  border: 0; background: none; border-radius: 2px; cursor: pointer; text-decoration: none;
  font-family: var(--f-mono); font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-2);
}
.nav-link:hover, .nav-btn:hover, .nav-link[aria-current="page"] { color: var(--fg); background: color-mix(in srgb, var(--fg) 7%, transparent); }
.nav-btn[aria-expanded="true"] { color: var(--bg); background: var(--fg); }
.desk-count {
  display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 .3rem;
  border-radius: 1rem; background: color-mix(in srgb, var(--fg) 14%, transparent); font-size: .7rem; letter-spacing: 0;
}
.desk-count.bump { animation: bump .6s var(--ease-ink); }
@keyframes bump { 30% { transform: scale(1.5); background: var(--red); color: #fff; } }
.sound-icon { width: .9rem; height: .9rem; position: relative; }
.sound-icon::before, .sound-icon::after { content: ""; position: absolute; bottom: 0; width: 2px; background: currentColor; }
.sound-icon::before { left: 2px; height: 40%; box-shadow: 4px -2px 0 0 currentColor, 8px 1px 0 0 currentColor; }
.is-sound-on .sound-icon::before { animation: eq 1.2s ease-in-out infinite; }
@keyframes eq { 50% { height: 90%; } }

@media (max-width: 760px) {
  .brand-name { font-size: 1.1rem; }
  .masthead-nav .nav-link { display: none; }
  /* Only the icon shows; the words stay for screen readers, which name the button by them. */
  .nav-btn [data-sound-label] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 420px) { .brand-name { max-width: 9.5rem; } .nav-btn { padding: .3rem .5rem; } }
@media (pointer: coarse) { .nav-link, .nav-btn { min-height: 2.75rem; } }

/* Rooms menu: the investigation's itinerary. */
.rooms-menu {
  position: fixed; inset: 0; z-index: 60; display: grid; justify-items: end;
  background: rgba(10, 8, 5, .55); animation: fade .35s ease;
}
.rooms-menu-inner {
  width: min(28rem, 100%); height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 1rem var(--gutter) 2rem;
  /* Solid: the page and the masthead's buttons showed through the translucent panel. */
  background: var(--bg); color: var(--fg); border-left: 1px solid var(--rule);
  box-shadow: -30px 0 70px rgba(0, 0, 0, .28);
  animation: slide-in .5s var(--ease-ink);
}
/* Close sits beside the heading, where the menu was opened, not below fourteen rooms. */
.rooms-menu-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.rooms-menu-head .label { margin: .75rem 0 0; }
.rooms-menu-close { flex: none; border: 1px solid var(--rule); }
.rooms-menu ol { list-style: none; margin: 1rem 0 1.5rem; padding: 0; counter-reset: none; }
.rooms-menu li a {
  display: grid; gap: .15rem; padding: .8rem .2rem .8rem 1rem; text-decoration: none;
  border-left: 2px solid var(--rule); transition: border-color .25s, padding .25s var(--ease-ink);
}
.rooms-menu li a:hover, .rooms-menu li a[aria-current="page"] { border-left-color: var(--accent); padding-left: 1.3rem; }
.menu-name { font-size: var(--step-1); line-height: 1.2; }
.rooms-menu li a.is-visited .menu-name::after { content: " \00b7  visited"; font-family: var(--f-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
@keyframes slide-in { from { transform: translateX(30%); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ------------------------------------------------------------------ desk (evidence) */
.desk {
  position: fixed; z-index: 55; right: var(--gutter); top: calc(var(--masthead-h) + .6rem);
  width: min(24rem, calc(100vw - 2 * var(--gutter))); max-height: calc(100vh - var(--masthead-h) - 1.5rem); overflow: auto;
  background: var(--panel); color: var(--fg); border: 1px solid var(--rule);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35); animation: drop .45s var(--ease-ink);
}
.desk-inner { padding: 1.1rem 1.2rem 1rem; }
.desk-title { font-size: var(--step-1); margin: .2rem 0 .8rem; }
.desk-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.desk-list li { padding: .6rem .7rem; border-left: 2px solid var(--ink-amber); background: color-mix(in srgb, var(--fg) 5%, transparent); }
.desk-list .desk-item-name { display: block; font-size: 1rem; line-height: 1.3; }
.desk-list .label { font-size: .68rem; }
.desk-list li.is-new { animation: settle .8s var(--ease-ink); }
@keyframes settle { from { transform: translateY(-14px) rotate(-1.5deg); opacity: 0; } }
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } }
.desk-empty { color: var(--fg-2); font-size: .98rem; }
.desk-actions { display: flex; justify-content: space-between; gap: .5rem; }

/* ------------------------------------------------------------------ sound */
.sound-panel {
  position: fixed; z-index: 55; right: var(--gutter); top: calc(var(--masthead-h) + .6rem);
  width: min(22rem, calc(100vw - 2 * var(--gutter))); padding: 1.1rem 1.2rem;
  background: var(--panel); color: var(--fg); border: 1px solid var(--rule); box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  animation: drop .45s var(--ease-ink);
}
.sound-note { font-size: .95rem; color: var(--fg-2); }
.sound-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; }
.sound-slider { display: grid; grid-template-columns: 5rem 1fr; align-items: center; gap: .6rem; margin: .4rem 0; font-size: .95rem; }
.sound-slider input { width: 100%; accent-color: var(--accent); }
.sound-now { min-height: 1.2em; margin: .6rem 0 0; }
.sound-resume {
  position: fixed; z-index: 50; left: 50%; bottom: 1.2rem; transform: translateX(-50%);
  padding: .6rem 1.1rem; border: 1px solid var(--rule); border-radius: 2rem; cursor: pointer;
  background: var(--panel); color: var(--fg); font-family: var(--f-mono); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3); animation: drop .5s var(--ease-ink);
}

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed; z-index: 70; left: 50%; bottom: 1.4rem; transform: translate(-50%, 140%);
  max-width: min(30rem, calc(100vw - 2rem)); padding: .7rem 1rem; background: var(--fg); color: var(--bg);
  font-size: .95rem; line-height: 1.35; box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
  transition: transform .5s var(--ease-ink), visibility 0s .5s; pointer-events: none; visibility: hidden;
}
.toast.is-shown { transform: translate(-50%, 0); visibility: visible; transition: transform .5s var(--ease-ink); }

/* ------------------------------------------------------------------ Wei's notation */
/* Marks are drawn as SVG over the phrase: circle (a problem), box (return to this),
   underline (a conclusion), amber (a registration: what exceeded the record). */
.wei-mark { position: relative; }
.wei-mark > svg.mark-svg { position: absolute; pointer-events: none; overflow: visible; z-index: 0; }
.mark-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.mark-svg.is-drawn path { transition: stroke-dashoffset var(--mark-dur, 1.1s) var(--ease-ink); stroke-dashoffset: 0 !important; }
.wei-mark[data-mark="amber"] { background: linear-gradient(transparent 58%, color-mix(in srgb, var(--ink-amber) 26%, transparent) 58%) no-repeat 0 0 / 0% 100%; transition: background-size 1.2s var(--ease-ink); }
.wei-mark[data-mark="amber"].is-drawn { background-size: 100% 100%; }
.wei-note {
  display: block; margin: .3rem 0 0; font-family: var(--f-mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase;
}

/* ------------------------------------------------------------------ layout pieces */
.wrap { width: 100%; max-width: 76rem; margin: 0 auto; padding: 0 var(--gutter); }
.room-head { padding-top: clamp(3rem, 8vh, 6rem); padding-bottom: clamp(2rem, 5vh, 3.5rem); }
.room-head .label { margin-bottom: 1rem; }
.room-head .lede { margin-top: 1.4rem; }
.band { padding: clamp(3.5rem, 10vh, 7rem) 0; position: relative; }
.band + .band { border-top: 1px solid var(--rule); }
.stage { position: relative; width: 100%; overflow: hidden; isolation: isolate; }
.stage canvas.fill, .stage .fill { position: absolute; inset: 0; width: 100%; height: 100%; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.rule { height: 1px; background: var(--rule); border: 0; margin: 2rem 0; }
.next-room {
  display: grid; gap: .3rem; padding: 2.5rem 0; text-decoration: none; border-top: 1px solid var(--rule);
}
.next-room .label { color: var(--muted); }
.next-room .next-name { font-family: var(--f-display); font-weight: 600; font-size: var(--step-3); line-height: 1; }
.next-room:hover .next-name { color: var(--accent); }
.next-room .next-teaser { color: var(--fg-2); max-width: var(--measure); }

/* Reveal on arrival. core.js hides only what is still below the fold when the page opens
   (.is-waiting) and fades it in as it arrives; what is already on screen is never hidden, so a
   reload or a page change does not flash, and nothing stays hidden if a script fails. */
.js [data-reveal].is-waiting { opacity: 0; transform: translateY(18px); }
.js [data-reveal].is-in { transition: opacity 1s var(--ease-ink), transform 1s var(--ease-ink); }
/* Controls that only work with JavaScript are hidden without it; with it, they keep their own display. */
html:not(.js) .js-only, html:not(.js) .js-only-flex { display: none !important; }

/* The field: a living ink background drawn by field.js. */
canvas.ink-field { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

/* ------------------------------------------------------------------ itinerary */
.itinerary { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
@media (max-width: 900px) { .itinerary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .itinerary { grid-template-columns: 1fr; } }
.itin-item a {
  position: relative; display: grid; align-content: end; gap: .35rem; min-height: 15rem; padding: 1.4rem 1.3rem 1.3rem;
  text-decoration: none; background: var(--bg); overflow: hidden; isolation: isolate;
}
.itin-slit {
  position: absolute; z-index: -1; left: 1.35rem; top: 1.3rem; width: 3px; height: 3.2rem;
  background: linear-gradient(var(--gold-1), var(--red-2) 60%, transparent);
  clip-path: polygon(0 0, 100% 0, 75% 100%, 25% 100%);
  transition: width .8s var(--ease-seal), left .8s var(--ease-seal), height .8s var(--ease-seal), top .8s var(--ease-seal), opacity .8s;
}
.itin-item a:hover .itin-slit, .itin-item a:focus-visible .itin-slit { left: 0; top: 0; width: 100%; height: 100%; opacity: .18; clip-path: none; }
/* With a plate, each card is a door: down its right edge runs the two-inch gap, and through it
   the middle of the room's painting. Hover or focus opens the door; the painting slides into
   place and a wash of the page keeps the text legible. */
.itin-item a:has(.itin-plate) { --gap: 1.9rem; padding-right: calc(var(--gap) + 1.6rem); }
.itin-plate {
  position: absolute; inset: 0; z-index: -2; background: #0e0c08; overflow: hidden;
  clip-path: polygon(calc(100% - var(--gap) - 8px) 1.2rem, calc(100% - var(--gap) + 8px) 1.2rem,
                     calc(100% - var(--gap) + 3px) calc(100% - 1.2rem), calc(100% - var(--gap) - 3px) calc(100% - 1.2rem));
  transition: clip-path 1.05s var(--ease-seal);
}
.itin-plate picture, .itin-plate img { display: block; width: 100%; height: 100%; }
.itin-plate img {
  object-fit: cover; object-position: 50% var(--focus-y, 50%);
  transform: translateX(calc(50% - var(--gap))); filter: sepia(.6) saturate(1.7) hue-rotate(-14deg) brightness(.9);
  transition: transform 1.05s var(--ease-seal), filter 1.05s var(--ease-ink);
}
.itin-plate ~ .itin-slit {
  left: auto; right: calc(var(--gap) - 1.5px); top: 1.2rem; width: 3px; height: calc(100% - 2.4rem);
  background: linear-gradient(var(--gold-1), var(--red-2) 55%, transparent); mix-blend-mode: screen; opacity: .55;
  clip-path: none;
}
.itin-item a:has(.itin-plate)::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0;
  background: linear-gradient(to top, var(--bg) 16%, color-mix(in srgb, var(--bg) 74%, transparent) 46%, color-mix(in srgb, var(--bg) 18%, transparent) 100%);
  transition: opacity .9s var(--ease-ink);
}
.itin-item a:hover .itin-plate, .itin-item a:focus-visible .itin-plate { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
.itin-item a:hover .itin-plate img, .itin-item a:focus-visible .itin-plate img { transform: none; filter: none; }
.itin-item a:hover::before, .itin-item a:focus-visible::before { opacity: 1; }
.itin-item a:hover .itin-plate ~ .itin-slit, .itin-item a:focus-visible .itin-plate ~ .itin-slit { opacity: 0; left: auto; top: 1.2rem; width: 3px; height: calc(100% - 2.4rem); }
.itin-item a:hover .label, .itin-item a:focus-visible .label { color: var(--fg-2); }
@media (hover: none) {
  .itin-item a:has(.itin-plate) { padding-right: 1.3rem; }
  .itin-plate { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
  .itin-plate img { transform: none; filter: none; }
  .itin-item a:has(.itin-plate)::before {
    opacity: 1;
    background: linear-gradient(to top, var(--bg) 28%, color-mix(in srgb, var(--bg) 84%, transparent) 56%, color-mix(in srgb, var(--bg) 22%, transparent) 100%);
  }
  .itin-item a:has(.itin-plate) .label { color: var(--fg-2); }
  .itin-plate ~ .itin-slit { opacity: 0; }
}

/* ------------------------------------------------------------------ plates
   A painted plate is first seen the way Wei first saw the courtyard: through a gap two
   inches wide at the top and three-quarters of an inch at the bottom. It opens as it rises
   into view; core.js sets --open (0 to 1) and --drift (a slow parallax, in percent). */
.plate { margin: clamp(.5rem, 2vh, 1.5rem) 0 clamp(1rem, 4vh, 2.5rem); }
.plate-frame {
  --open: 0; --drift: 0;
  --st: clamp(.7rem, 1.3vw, 1.15rem);
  --sb: calc(var(--st) * .375);
  --inset: 6%;
  position: relative; overflow: hidden; isolation: isolate;
  width: 100%; aspect-ratio: 16 / 9; max-height: 86vh; background: #0e0c08;
  clip-path: polygon(
    calc(50% - var(--st) - (50% - var(--st)) * var(--open)) calc(var(--inset) * (1 - var(--open))),
    calc(50% + var(--st) + (50% - var(--st)) * var(--open)) calc(var(--inset) * (1 - var(--open))),
    calc(50% + var(--sb) + (50% - var(--sb)) * var(--open)) calc(100% - var(--inset) * (1 - var(--open))),
    calc(50% - var(--sb) - (50% - var(--sb)) * var(--open)) calc(100% - var(--inset) * (1 - var(--open))));
}
.plate-frame picture, .plate-frame img { display: block; width: 100%; height: 100%; }
.plate-frame img {
  object-fit: cover; object-position: var(--focus, 50% 50%);
  transform: translate3d(0, calc(var(--drift) * 1%), 0) scale(1.08);
}
.plate-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--focus, 50% 50%);
  transform: translate3d(0, calc(var(--drift) * 1%), 0) scale(1.08); opacity: 0; transition: opacity 1.4s var(--ease-ink);
  pointer-events: none;
}
.plate-video.is-playing { opacity: 1; }
html.reduce-motion .plate-video { display: none; }
@media (prefers-reduced-motion: reduce) { .plate-video { display: none; } }
.plate-glow {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background: linear-gradient(90deg, transparent calc(50% - 3.5rem), rgba(248, 208, 80, .55) 50%, transparent calc(50% + 3.5rem));
  opacity: calc(1 - var(--open) * 1.7);
}
.plate-caption {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1rem;
  max-width: 76rem; margin: .9rem auto 0; padding: 0 var(--gutter);
  color: var(--fg-2); font-style: italic; font-size: .98rem; line-height: 1.45;
}
.plate-caption .label { font-style: normal; color: var(--accent); }
.plate--frontispiece { margin: 0 0 clamp(1.5rem, 4vh, 2.5rem); }
.plate--frontispiece .plate-frame { aspect-ratio: 21 / 9; }
.plate--frontispiece .plate-caption { padding: 0; margin-top: .7rem; }
@media (max-width: 700px) {
  .plate-frame { aspect-ratio: 4 / 3; }
  .plate--frontispiece .plate-frame { aspect-ratio: 16 / 10; }
}
.no-js .plate-frame, html.reduce-motion .plate-frame { --open: 1; --drift: 0; }
.itin-name { font-family: var(--f-display); font-weight: 600; font-size: var(--step-2); line-height: 1; }
.itin-teaser { color: var(--fg-2); font-size: 1rem; line-height: 1.4; max-width: 24rem; }
.itin-visited { position: absolute; top: 1.3rem; right: 1.3rem; }

/* ------------------------------------------------------------------ footer */
.site-footer { border-top: 1px solid var(--rule); padding: 3.5rem 0 4rem; color: var(--fg-2); font-size: .98rem; }
.footer-inner { max-width: 76rem; margin: 0 auto; padding: 0 var(--gutter); display: grid; gap: .6rem; }
.footer-title { display: flex; align-items: center; gap: .7rem; font-family: var(--f-display); font-weight: 600; font-size: var(--step-2); color: var(--fg); margin: 0; }
.footer-sub { margin: 0; }
.footer-rooms, .footer-links { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: .4rem 0 0; }
.footer-small { font-size: .85rem; color: var(--muted); max-width: 42rem; margin-top: 1rem; }

/* ------------------------------------------------------------------ motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .js [data-reveal].is-waiting { opacity: 1; transform: none; }
  .plate-frame { --open: 1; --drift: 0; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
html.reduce-motion [data-reveal].is-waiting { opacity: 1; transform: none; }

@media print {
  .masthead, .rooms-menu, .desk, .sound-panel, .sound-resume, .toast, canvas, .site-footer nav { display: none !important; }
  .plate-frame { --open: 1 !important; --drift: 0 !important; }
  .js [data-reveal].is-waiting { opacity: 1; transform: none; }
  body { background: #fff; color: #000; }
}
