/* The Museum of Emergence: the building. */

:root {
  --paper: #f3efe6;
  --ink: #1b1a17;
  --ink-2: #5d574b;
  --gold-hi: #f3e2ad;
  --gold-1: #e6cf96;
  --gold-2: #c9a45c;
  --gold-3: #8a6a3a;
  --gold-4: #5d4526;
  --lobby: #0e0f12;
  --serif: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --plan-w: 76px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Grain: a mid-grey noise tile for overlay blending (paper tooth, plaster). */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n' x='0' y='0'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='.33 .33 .33 0 0 .33 .33 .33 0 0 .33 .33 .33 0 0 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --plaster: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='900'%3E%3Cfilter id='n' x='0' y='0'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.0045' numOctaves='5' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='.33 .33 .33 0 0 .33 .33 .33 0 0 .33 .33 .33 0 0 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* Speckle: dark fibres with alpha, laid straight onto paper. */
  --speckle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n' x='0' y='0'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .26 0 0 0 0 .18 1.4 0 0 0 -.62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

html {
  scroll-snap-type: y proximity;
  background: var(--lobby);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--lobby);
  color: #ece6d8;
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
html, body { overflow-x: clip; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.vh {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ico { width: 20px; height: 20px; flex: none; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus, #e6cf96); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: fixed; left: 16px; top: 12px; z-index: 100;
  padding: 12px 18px; background: var(--paper); color: var(--ink);
  font-weight: 600; text-decoration: none; border-radius: 3px;
  transform: translateY(-160%); transition: transform .2s var(--ease);
  --focus: #e6cf96;
}
.skip:focus-visible { transform: none; }

/* ---------------------------------------------------------------- fixtures */
/* The colour of the wall the visitor is standing at, so the phone's top scrim matches it. */
@property --here-wall { syntax: '<color>'; inherits: true; initial-value: #0d0e11; }
html { --here-wall: #0d0e11; transition: --here-wall .9s var(--ease); }
/* On phones a soft scrim (body::before, in the phone rules) sits behind the fixed room pill and sound switch. */
.where {
  margin: 0; display: none;
  align-items: center; gap: 8px;
  min-height: 44px; padding: 0 16px 0 13px; border: 0; border-radius: 999px;
  font: 500 11px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase;
  background: rgba(14, 15, 18, .8); color: #efe8d8;
  box-shadow: 0 0 0 1px rgba(230, 207, 150, .22), 0 6px 18px rgba(0,0,0,.3);
  transition: opacity .35s var(--ease), visibility 0s linear 0s, background .3s;
  --focus: #e6cf96;
}
.where .ico { width: 16px; height: 16px; color: var(--gold-1); }
.where:hover { background: rgba(30, 30, 34, .92); }
/* While the room's own sign passes under the pill, the pill steps back: the sign already says where you are. */
.where.is-tucked { opacity: 0; visibility: hidden; transition: opacity .35s var(--ease), visibility 0s linear .35s; }
/* The rail: sound and the floor plan, down the left edge like a museum's visitor desk. */
.rail {
  position: fixed; z-index: 39; left: max(14px, env(safe-area-inset-left)); top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: 62px;
  transition: transform .9s var(--ease);
}
/* In the foyer the desk steps aside, down to the lower left, so the museum's name has the room. */
[data-where='foyer'] .rail { transform: translateY(max(calc(max(14px, env(safe-area-inset-top)) - 50vh), calc(50vh - 100% - max(24px, env(safe-area-inset-bottom))))); }
.rail :focus-visible { outline-offset: -4px; border-radius: 8px; }
/* Over the one light room the fixtures go nearly opaque so their small type keeps its contrast. */
.in-light-room .sound-toggle, .in-light-room .plan, .in-light-room .where { background: rgba(14, 15, 18, .93); }
.sound-toggle {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 58px; padding: 8px 4px; border-radius: 10px; border: 0;
  background: rgba(14, 15, 18, .78); color: #efe8d8;
  box-shadow: 0 0 0 1px rgba(230, 207, 150, .16), 0 10px 30px rgba(0,0,0,.28);
  font: 600 9px/1.1 var(--sans); letter-spacing: .14em; text-transform: uppercase;
  transition: background .3s, box-shadow .3s;
  --focus: #e6cf96;
}
.sound-toggle:hover { background: rgba(30, 30, 34, .92); }
.sound-toggle .st-ico { display: inline-flex; }
.sound-toggle .st-ico--on { display: none; }
.sound-toggle.is-on .st-ico--on { display: inline-flex; color: var(--gold-1); }
.sound-toggle.is-on .st-ico--off { display: none; }
.sound-toggle.is-on { box-shadow: 0 0 0 1px rgba(230, 207, 150, .55), 0 10px 30px rgba(0,0,0,.28); }

/* Floor plan: a section drawing of the building, top to bottom like the walk. */
.plan {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 4px 10px; border-radius: 10px;
  background: rgba(14, 15, 18, .72);
  box-shadow: 0 0 0 1px rgba(230, 207, 150, .16), 0 10px 30px rgba(0,0,0,.28);
  color: #e9e1cf;
  --focus: #e6cf96;
}
.fp-toggle {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 44px; min-height: 44px; padding: 4px; border: 0; border-radius: 6px;
  background: transparent; color: #e9e1cf;
  font: 600 9px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase;
}
.fp-toggle:hover { background: rgba(255,255,255,.06); }
.fp-body { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.plan.is-collapsed .fp-body { display: none; }
.fp-svg { width: 54px; height: auto; display: block; overflow: visible; }
.fp-walls path, .fp-walls rect { stroke: #d9ceb4; stroke-width: 1.1; fill: none; opacity: .75; }
.fp-door { stroke: rgba(14,15,18,1); stroke-width: 2.2; }
.fp-hit { fill: transparent; }
.fp-fill { fill: rgba(233, 225, 207, .06); transition: fill .4s; }
.fp-room.is-seen .fp-fill { fill: rgba(233, 225, 207, .14); }
.fp-room:hover .fp-fill { fill: rgba(233, 225, 207, .26); }
.fp-room.is-current .fp-fill { fill: var(--acc); }
.fp-num { font: 500 8px/1 var(--mono); fill: #c9c0ac; }
.fp-room.is-current .fp-num { fill: #fff6e0; }
.fp-room:focus-visible { outline: none; }
/* Focus reads as a lit, ringed room, never as one more wall line. */
.fp-room:focus-visible .fp-fill {
  fill: color-mix(in srgb, var(--acc) 55%, transparent); stroke: #fff6e0; stroke-width: 2;
  filter: drop-shadow(0 0 1.2px #000) drop-shadow(0 0 1.2px #000);
}
.fp-room:focus-visible .fp-num { fill: #fff6e0; font-weight: 700; }
/* Touch screens and short screens: the drawing is a map to look at; tapping it opens the big list. */
.plan.is-sheet .fp-body { display: flex; }
.plan.is-sheet .fp-room { pointer-events: none; }
.plan.is-sheet .fp-svg { cursor: pointer; }
@media (max-height: 520px) {
  .plan.is-sheet .fp-svg { display: none; }
  .plan { padding: 6px 4px 8px; }
  .sound-toggle { min-height: 50px; }
}

/* The floor plan as a sheet: every stop as a large, easy target. */
.plan-sheet {
  position: fixed; margin: auto auto 0; padding: 0; border: 0;
  width: min(560px, 100vw); max-width: 100vw; max-height: min(86svh, 720px);
  border-radius: 16px 16px 0 0;
  background: #15161a; color: #efe8d8;
  box-shadow: 0 0 0 1px rgba(230, 207, 150, .2), 0 -20px 60px rgba(0,0,0,.55);
  overflow: auto; overscroll-behavior: contain;
  --focus: #e6cf96;
}
.plan-sheet[open] { animation: sheet-up .38s var(--ease) both; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.plan-sheet::backdrop { background: rgba(6, 6, 8, .62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.ps-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 10px 10px 20px; background: #15161a;
  border-bottom: 1px solid rgba(230, 207, 150, .12);
}
.ps-title { margin: 0; font: italic 600 24px/1.1 var(--serif); color: #f6ecd6; }
.ps-close {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 999px;
  background: transparent; color: #efe8d8;
}
.ps-close:hover { background: rgba(255,255,255,.06); }
.ps-list { list-style: none; margin: 0; padding: 8px 10px max(14px, env(safe-area-inset-bottom)); display: grid; gap: 2px; }
.ps-item {
  width: 100%; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  min-height: 52px; padding: 4px 12px 4px 8px; border: 0; border-radius: 10px;
  background: transparent; color: #efe8d8; text-align: left;
}
.ps-item:hover { background: rgba(255,255,255,.05); }
.ps-num {
  display: inline-grid; place-items: center; width: 40px; height: 36px; border-radius: 6px;
  font: 500 12.5px/1 var(--mono); letter-spacing: -.02em; color: #e9e1cf;
  box-shadow: inset 0 0 0 1px rgba(233, 225, 207, .28);
}
.ps-item.is-seen .ps-num { background: rgba(233, 225, 207, .08); }
.ps-item[aria-current] .ps-num { background: var(--acc); color: #15161a; box-shadow: none; }
.ps-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ps-k { font: 600 10px/1.2 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: #b9b09c; }
.ps-t { font: italic 500 18px/1.2 var(--serif); color: #f3e9d2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-here { font: 600 10px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--gold-1); white-space: nowrap; }
@media (orientation: landscape) and (max-height: 520px) {
  .plan-sheet { margin: auto; border-radius: 16px; width: min(760px, calc(100vw - 32px)); max-height: calc(100svh - 24px); }
  /* Two columns that read down, like the walk: Foyer to IV, then V to the shop. */
  .ps-list { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(5, auto); grid-auto-flow: column; column-gap: 8px; padding-bottom: 12px; }
  .ps-head { padding-top: 8px; padding-bottom: 6px; }
  .ps-item { min-height: 48px; }
}
@media (min-width: 700px) and (min-height: 521px) {
  .plan-sheet { margin: auto; border-radius: 16px; }
}
.fp-you { fill: #fff9ea; stroke: rgba(14,15,18,.9); stroke-width: 1; transition: cy .6s var(--ease); }
.fp-caption { margin: 0; font: 500 9px/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: #cfc6b2; text-align: center; }

/* The guard. */
.guard {
  position: fixed; z-index: 45; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 24px); opacity: 0; pointer-events: none;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
  width: min(560px, calc(100vw - 32px));
}
.guard.is-on { opacity: 1; transform: translate(-50%, 0); }
.guard-card {
  display: flex; gap: 14px; align-items: center;
  padding: 14px 18px 14px 16px; border-radius: 12px;
  background: rgba(16, 17, 21, .94); color: #efe8d8;
  box-shadow: 0 0 0 1px rgba(230, 207, 150, .22), 0 18px 40px rgba(0,0,0,.45);
}
.guard-cap { width: 34px; height: 22px; flex: none; color: #4a5470; filter: drop-shadow(0 0 1.5px rgba(230,207,150,.75)); }
.guard-text { margin: 0; font: italic 500 18px/1.35 var(--serif); }

/* ---------------------------------------------------------------- foyer */
.foyer {
  position: relative; min-height: 100vh; min-height: 100svh; overflow: hidden;
  scroll-snap-align: start; isolation: isolate;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  /* The top padding is the museum's name: it always keeps a clear band of wall, and on a
     short screen the foyer grows taller than the screen rather than hang the ticket over it. */
  padding: max(34svh, 270px) 16px max(34px, env(safe-area-inset-bottom), calc(8svh - 10px));
  background:
    radial-gradient(ellipse 70% 55% at 50% 34%, rgba(233, 184, 114, .10), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 110%, #1a1712, transparent 60%),
    #0d0e11;
}
.foyer-host { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.foyer-fallback {
  position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); z-index: 1;
  width: min(86%, 1100px); text-align: center; pointer-events: none;
  display: none; color: #f1e6cc;
}
.no-foyer .foyer-fallback { display: block; animation: rise 1.6s var(--ease) both; }
.ff-the { display: block; font: italic 500 clamp(20px, 2.4vw, 32px)/1 var(--serif); letter-spacing: .08em; color: var(--gold-1); margin-bottom: .3em; }
.ff-name { display: block; font: 500 clamp(40px, 7.6vw, 112px)/.95 var(--serif); letter-spacing: -.01em; text-wrap: balance; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, calc(-50% + 14px)); } }

.foyer-lower {
  position: relative; z-index: 2; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  pointer-events: none;
}
.foyer-lower > * { pointer-events: auto; }
.tagline {
  margin: 0; text-align: center; color: #efe6d2;
  font: italic 500 clamp(19px, 2vw, 26px)/1.3 var(--serif); letter-spacing: .01em;
  text-shadow: 0 1px 12px rgba(0,0,0,.7); text-wrap: balance;
}
.night {
  margin: -6px 0 0; font: 500 11px/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase;
  color: #cfc4ad; text-align: center; text-shadow: 0 1px 8px rgba(0,0,0,.8);
}
.foyer-hint {
  position: absolute; z-index: 2; left: 50%; bottom: 10px; transform: translateX(-50%); margin: 0;
  font: 500 10px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: rgba(230, 220, 196, .55);
  display: none;
}

/* ---------------------------------------------------------------- ticket */
.ticket-mount { display: flex; justify-content: center; width: 100%; }
.ticket {
  --tk-paper: #f2e9d6;
  --tk-ink: #221e18;
  --tk-ink-2: #5e5546;
  --tk-red: #a13a28;
  --focus: #a13a28;
  position: relative; display: flex; width: min(640px, 100%);
  color: var(--tk-ink);
  filter: drop-shadow(0 18px 26px rgba(0,0,0,.5)) drop-shadow(0 2px 3px rgba(0,0,0,.35));
  transform: rotate(-1.2deg);
  animation: ticket-in 1.4s .5s var(--ease) both;
}
@keyframes ticket-in { from { opacity: 0; transform: translateY(26px) rotate(-3deg); } }
.tk-main, .tk-stub {
  position: relative;
  background-color: var(--tk-paper);
  background-image: var(--speckle), linear-gradient(170deg, rgba(255,255,255,.35), rgba(255,255,255,0) 40%, rgba(120,90,40,.08));
  background-size: 200px 200px, 100% 100%;
}
.tk-main {
  flex: 1 1 auto; min-width: 0;
  padding: 18px 24px 18px 22px;
  border-radius: 6px 0 0 6px;
  -webkit-mask:
    radial-gradient(circle at 100% 0, transparent 10px, #000 10.5px),
    radial-gradient(circle at 100% 100%, transparent 10px, #000 10.5px),
    radial-gradient(circle at 100% 50%, transparent 2.4px, #000 2.9px) 0 5px / 100% 10px repeat-y;
  -webkit-mask-composite: source-in, source-in;
  mask:
    radial-gradient(circle at 100% 0, transparent 10px, #000 10.5px),
    radial-gradient(circle at 100% 100%, transparent 10px, #000 10.5px),
    radial-gradient(circle at 100% 50%, transparent 2.4px, #000 2.9px) 0 5px / 100% 10px repeat-y;
  mask-composite: intersect;
  overflow: hidden;
}
.tk-main::before {
  /* Double rule border, like an engraved ticket. */
  content: ''; position: absolute; inset: 7px 9px 7px 7px; pointer-events: none;
  border: 1px solid rgba(161, 58, 40, .55);
  box-shadow: inset 0 0 0 2px var(--tk-paper), inset 0 0 0 2.6px rgba(161, 58, 40, .35);
  border-radius: 3px;
}
.tk-stub {
  flex: 0 0 136px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 12px; border-radius: 0 6px 6px 0; text-align: center;
  -webkit-mask:
    radial-gradient(circle at 0 0, transparent 10px, #000 10.5px),
    radial-gradient(circle at 0 100%, transparent 10px, #000 10.5px),
    radial-gradient(circle at 0 50%, transparent 2.4px, #000 2.9px) 0 5px / 100% 10px repeat-y;
  -webkit-mask-composite: source-in, source-in;
  mask:
    radial-gradient(circle at 0 0, transparent 10px, #000 10.5px),
    radial-gradient(circle at 0 100%, transparent 10px, #000 10.5px),
    radial-gradient(circle at 0 50%, transparent 2.4px, #000 2.9px) 0 5px / 100% 10px repeat-y;
  mask-composite: intersect;
  transition: transform 1.1s var(--ease), opacity 1.1s var(--ease);
  transform-origin: 20% 90%;
}
.tk-stub::before {
  content: ''; position: absolute; inset: 7px 7px 7px 9px; pointer-events: none;
  border: 1px solid rgba(161, 58, 40, .55); border-radius: 3px;
}
.tk-perf { width: 0; flex: none; }
.tk-rose {
  position: absolute; right: -36px; top: 50%; width: 250px; height: 250px; transform: translateY(-50%);
  color: rgba(161, 58, 40, .15); pointer-events: none;
}
.tk-top { position: relative; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.tk-house { font: 600 10.5px/1.25 var(--sans); letter-spacing: .2em; text-transform: uppercase; text-wrap: balance; }
.tk-no { font: 400 12px/1 var(--mono); color: var(--tk-red); white-space: nowrap; }
.tk-no-label { font: 600 9px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; margin-right: 2px; color: var(--tk-ink-2); }
.tk-admit { position: relative; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 6px 0 8px; }
.tk-admit-big { font: italic 600 44px/1 var(--serif); color: var(--tk-red); letter-spacing: -.005em; }
.tk-admit-sub { font: 500 12px/1.3 var(--sans); color: var(--tk-ink-2); }
.tk-data { position: relative; display: flex; gap: 28px; margin: 0 0 10px; }
.tk-data div { display: flex; flex-direction: column; gap: 3px; }
.tk-data dt { font: 600 9px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--tk-ink-2); }
.tk-data dd { margin: 0; font: 500 14px/1.2 var(--sans); }
.tk-data dd.mono { font: 400 13.5px/1.2 var(--mono); }
.tk-code { position: relative; display: flex; flex-direction: column; gap: 3px; width: min(250px, 100%); margin-bottom: 14px; }
.barcode { display: block; width: 100%; height: 34px; color: var(--tk-ink); }
.tk-digits { font-size: 9.5px; letter-spacing: .28em; color: var(--tk-ink-2); }
.tk-actions { position: relative; display: flex; gap: 10px; flex-wrap: wrap; }
.tk-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 16px 0 13px; border-radius: 4px;
  background: transparent; color: var(--tk-ink);
  border: 1.5px solid rgba(34, 30, 24, .7);
  font: 600 13px/1 var(--sans); letter-spacing: .02em;
  transition: background .2s, color .2s, transform .2s var(--ease);
}
.tk-btn .ico { width: 18px; height: 18px; }
.tk-btn:hover { background: rgba(34, 30, 24, .08); }
.tk-btn:active { transform: translateY(1px); }
.tk-btn-primary { background: var(--tk-ink); color: var(--tk-paper); border-color: var(--tk-ink); }
.tk-btn-primary:hover { background: #3a3228; }
.tk-stub-admit { position: relative; font: italic 600 25px/1 var(--serif); color: var(--tk-red); }
.tk-stub-no { position: relative; font-size: 11px; color: var(--tk-ink); }
.tk-stub-code { position: relative; width: 96px; height: 22px; }
.tk-stub-keep { position: relative; font: 600 8px/1.3 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--tk-ink-2); }

.ticket.is-torn .tk-main { clip-path: var(--tear); }
.ticket.is-torn .tk-stub {
  clip-path: var(--tear);
  transform: translate(26px, 30px) rotate(9deg);
}
.ticket.is-torn { animation: ticket-jolt .5s var(--ease) both; }
@keyframes ticket-jolt {
  0% { transform: rotate(-1.2deg); }
  30% { transform: translateX(-5px) rotate(-1.9deg); }
  100% { transform: rotate(-1.2deg); }
}

/* ---------------------------------------------------------------- rooms */
.room {
  --ink-w: #f0eade;
  --ink-w2: #b9b2a3;
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  --work-h: clamp(440px, calc(100svh - 30px - 52px - 22px - 38px), 900px);
  grid-template-rows: auto 1fr auto;
  grid-template-areas: 'sign label' 'work label' 'work next';
  column-gap: clamp(32px, 3.6vw, 64px);
  row-gap: 22px;
  align-items: center;
  padding: 30px clamp(36px, 4vw, 72px) 38px calc(var(--plan-w) + clamp(28px, 3vw, 56px));
  color: var(--ink-w);
  background: linear-gradient(180deg, var(--wall-top) 0%, var(--wall) 24%, var(--wall) 72%, var(--wall-low) 100%);
  --spot-x: 38%;
  --focus: var(--accent);
}
.room:focus { outline: none; }
.room::before {
  /* The gallery lights: they come up as you walk in. */
  content: ''; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse 30% 22% at var(--spot-x) 6%, color-mix(in srgb, var(--wall-lit) 70%, transparent), transparent 100%),
    radial-gradient(ellipse 40% 50% at var(--spot-x) 40%, var(--wall-lit) 0%, color-mix(in srgb, var(--wall-lit) 55%, transparent) 45%, transparent 80%),
    radial-gradient(ellipse 22% 36% at 84% 50%, color-mix(in srgb, var(--wall-lit) 50%, transparent), transparent 85%);
  opacity: .3;
  transition: opacity 1.8s cubic-bezier(.3, .1, .2, 1) .15s;
}
.room.is-lit::before { opacity: 1; }
.wall-tex {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--plaster), var(--grain);
  background-size: 900px 900px, 240px 240px;
  mix-blend-mode: overlay; opacity: .2;
}
.room--light .wall-tex { opacity: .32; mix-blend-mode: multiply; }
.room::after {
  /* A skirting shadow where the wall meets the floor. */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.22));
}
.room--light::after { background: linear-gradient(180deg, transparent, rgba(60,55,45,.08)); }
/* A white cube is lit from everywhere: the frame casts a softer, warmer shadow onto the bench. */
.room--light .frame {
  box-shadow:
    inset 0 0 0 1px rgba(44, 26, 6, .55),
    inset 0 0 6px 2px rgba(58, 36, 8, .5),
    0 1px 0 1px rgba(60, 50, 30, .18),
    0 26px 36px -18px rgba(50, 42, 30, .42),
    0 50px 70px -40px rgba(50, 42, 30, .3),
    0 8px 16px -6px rgba(50, 42, 30, .26);
}

.room-sign {
  grid-area: sign; align-self: end;
  display: flex; align-items: baseline; gap: 12px; min-height: 46px; padding-top: 6px;
  color: var(--ink-w);
}
.room-sign-word { font: 600 11px/1 var(--sans); letter-spacing: .28em; text-transform: uppercase; color: var(--ink-w2); }
.room-sign-num { font: 500 40px/.8 var(--serif); letter-spacing: .02em; }
.room-sign-rule { width: 38px; height: 1px; background: currentColor; opacity: .35; align-self: center; }
.room-sign-of { font: italic 500 16px/1 var(--serif); color: var(--ink-w2); }

.work {
  grid-area: work; min-width: 0; display: flex; flex-direction: column; align-items: stretch;
  height: var(--work-h);
}
.frame-wrap { position: relative; flex: 1 1 auto; min-height: 0; }
/* The light the living art throws on its wall. Its colour is read from the art every few
   seconds (js/shell-room.js); a change is a slow cross-fade between two layers. */
.spill { position: absolute; inset: 6% -24% -30% -24%; z-index: -1; pointer-events: none; --spill-a: .15; }
.spill i {
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(closest-side, var(--c) 0%, color-mix(in srgb, var(--c) 42%, transparent) 52%, transparent 100%);
  transition: opacity 2.4s cubic-bezier(.4, 0, .2, 1);
}
.spill i.on { opacity: calc(var(--spill-a) * var(--lvl, 1)); }
.room--light .spill { --spill-a: .09; }

/* The gilded frame: outer lip, cove, bead, sight edge, linen liner, gold fillet.
   The cove is lit from above: each side gets its own tone through a mitred overlay. */
.frame {
  --lip: 6px;
  --cove: 22px;
  position: relative;
  height: 100%;
  padding: var(--cove);
  border: var(--lip) solid;
  border-color: #f6e4a8 #8c6933 #56401f #d2ae63;
  background:
    linear-gradient(118deg, transparent 30%, rgba(255, 246, 214, .2) 41%, transparent 50%, transparent 72%, rgba(255, 240, 196, .12) 80%, transparent 88%),
    var(--grain),
    linear-gradient(90deg, #b48b3c, #d8b163 18%, #b28a43 38%, #e0bf72 58%, #a9843d 80%, #c9a255);
  background-size: 100% 100%, 240px 240px, 100% 100%;
  background-blend-mode: normal, soft-light, normal;
  box-shadow:
    inset 0 0 0 1px rgba(44, 26, 6, .55),
    inset 0 0 6px 2px rgba(58, 36, 8, .5),
    0 1px 0 1px rgba(0, 0, 0, .28),
    0 30px 40px -16px rgba(0, 0, 0, .7),
    0 64px 90px -34px rgba(0, 0, 0, .6),
    0 10px 20px -6px rgba(0, 0, 0, .45);
}
.frame::before {
  /* Mitred light: brighter on top and left, falling into shade on the right and bottom. */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  border: var(--cove) solid;
  border-color: rgba(255, 246, 214, .26) rgba(40, 22, 4, .2) rgba(30, 16, 2, .4) rgba(255, 240, 200, .1);
}
.bead {
  position: relative; height: 100%;
  border: 4px dotted;
  border-color: #f1dca0 #a78447 #6e5130 #d4b371;
  background: #6a4f2c;
  box-shadow: 0 0 0 1px rgba(56, 36, 12, .65), 0 0 8px 2px rgba(40, 24, 6, .5);
}
.sight {
  height: 100%;
  border: 3px solid;
  border-color: #5d4526 #c9a45c #e6cf96 #8a6a3a;
}
.liner {
  height: 100%;
  padding: 13px;
  background:
    repeating-linear-gradient(0deg, rgba(60, 50, 30, .07) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(60, 50, 30, .06) 0 1px, transparent 1px 3px),
    #e7dfcb;
  box-shadow: inset 0 7px 9px -3px rgba(40, 28, 10, .45), inset 5px 0 7px -3px rgba(40, 28, 10, .25), inset -2px -2px 3px rgba(255,255,255,.25);
}
.fillet {
  height: 100%;
  border: 3px solid;
  border-color: #6b5130 #e6cf96 #f3e2ad #a07c42;
  box-shadow: 0 0 0 1px rgba(90, 64, 30, .5), -1px -1px 2px rgba(40, 28, 10, .3);
}
.host {
  position: relative; overflow: hidden;
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--wall) 70%, #fff 6%), color-mix(in srgb, var(--wall) 80%, #000));
  touch-action: pan-y;
}
.host::after {
  /* A whisper of glass glare over the work, top left, from the spotlight. */
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: linear-gradient(128deg, rgba(255, 250, 235, .055) 0%, rgba(255,250,235,0) 34%);
}

.play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 22px 0 18px; border-radius: 999px; border: 0;
  background: rgba(243, 239, 230, .94); color: #1b1a17;
  font: 600 14px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.play svg { width: 20px; height: 20px; }
.play { transition: opacity .3s; }
.user-played .play {
  left: auto; top: auto; right: var(--inset-art, 64px); bottom: var(--inset-art, 64px); transform: none;
  min-height: 44px; padding: 0 16px 0 12px; font-size: 12px; opacity: .78;
}
.user-played .play:hover, .user-played .play:focus-visible { opacity: 1; }
/* The quiet pause in the corner of every frame (and of the foyer). */
.play--corner, .user-played .play--corner {
  left: auto; top: auto; right: var(--inset-art, 64px); bottom: var(--inset-art, 64px); transform: none;
  width: 44px; height: 44px; min-height: 44px; padding: 0; gap: 0; justify-content: center;
  background: rgba(14, 15, 18, .55); color: #f3ecdc;
  box-shadow: 0 0 0 1px rgba(243, 236, 220, .3), 0 6px 16px rgba(0,0,0,.3);
  /* Quiet, but still 3:1 against the brightest art (the leopard's orange ground). */
  opacity: .72; transition: opacity .3s, background .3s;
  --focus: #f3ecdc;
}
.play--corner .play-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.play--corner svg { width: 18px; height: 18px; }
.play--corner:hover, .play--corner:focus-visible, .play--corner.is-stopped { opacity: .95; background: rgba(14, 15, 18, .78); }
.foyer-pause { position: absolute; z-index: 3; top: max(18px, env(safe-area-inset-top)); right: max(18px, env(safe-area-inset-right)); bottom: auto; }
.no-foyer .foyer-pause { display: none; }

/* The bench under the frame: controls. */
.console {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px;
  min-height: 44px; margin-top: 28px; padding-left: 2px;
}
.console--empty { visibility: hidden; }
.ctl { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; }
.ctl-label { font: 500 11px/1.2 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-w2); }
.ctl-btn {
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  background: transparent; color: var(--ink-w);
  border: 1px solid color-mix(in srgb, var(--ink-w) 45%, transparent);
  font: 500 13px/1 var(--sans); letter-spacing: .03em;
  transition: background .2s, border-color .2s, color .2s;
}
.ctl-btn:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.ctl-btn:active { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.ctl-select-wrap { position: relative; display: inline-flex; }
.ctl-select-wrap::after {
  content: ''; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border-right: 1.5px solid var(--ink-w); border-bottom: 1.5px solid var(--ink-w); transform: rotate(45deg); pointer-events: none;
}
.ctl-select {
  appearance: none; -webkit-appearance: none;
  min-height: 44px; padding: 0 36px 0 14px; border-radius: 6px;
  background: color-mix(in srgb, var(--wall) 70%, #000 30%); color: var(--ink-w);
  border: 1px solid color-mix(in srgb, var(--ink-w) 35%, transparent);
  font: 500 13px/1 var(--sans);
}
.room--light .ctl-select { background: color-mix(in srgb, var(--wall) 80%, #fff); }
.ctl-select option { background: #1b1a17; color: #f0eade; }
.ctl-range {
  --p: 50%;
  appearance: none; -webkit-appearance: none; width: 108px; height: 44px; background: transparent; margin: 0;
}
.ctl-range::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) var(--p), color-mix(in srgb, var(--ink-w) 28%, transparent) var(--p));
}
.ctl-range::-moz-range-track { height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--ink-w) 28%, transparent); }
.ctl-range::-moz-range-progress { height: 3px; background: var(--accent); }
.ctl-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7.5px; border-radius: 50%;
  background: var(--ink-w); border: 3px solid var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.ctl-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink-w); border: 3px solid var(--accent); }
.ctl-range:focus-visible { outline-offset: 0; }
.ctl-out { min-width: 3.5ch; font-size: 12px; color: var(--ink-w); }
.ctl-toggle {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px;
  background: transparent; border: 0; color: var(--ink-w);
}
.ctl-toggle-track {
  position: relative; width: 36px; height: 20px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink-w) 22%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink-w) 40%, transparent);
  transition: background .25s;
}
.ctl-toggle-knob {
  position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink-w); transition: transform .25s var(--ease), background .25s;
}
.ctl-toggle[aria-checked='true'] .ctl-toggle-track { background: var(--accent); box-shadow: none; }
.ctl-toggle[aria-checked='true'] .ctl-toggle-knob { transform: translateX(16px); background: var(--on-accent); }

/* On wide screens each slider and menu wears its label above it, so a bench of four
   controls stays on one 44px row and every frame in the building hangs at the same size. */
@media (min-width: 700px) {
  .console { gap: 6px 18px; }
  .ctl--range, .ctl--select {
    display: inline-grid; grid-template-columns: auto auto; grid-template-rows: 13px 31px;
    column-gap: 8px; row-gap: 0; align-items: center; min-height: 44px;
  }
  .ctl--range .ctl-label, .ctl--select .ctl-label {
    grid-column: 1 / -1; font-size: 10px; line-height: 13px; letter-spacing: .12em; white-space: nowrap;
  }
  .ctl--range .ctl-range { width: clamp(84px, 7vw, 120px); height: 31px; }
  .ctl--select .ctl-select-wrap { grid-column: 1 / -1; }
  .ctl--select .ctl-select { min-height: 31px; height: 31px; padding: 0 32px 0 11px; font-size: 12.5px; }
  .ctl--select .ctl-select-wrap::after { right: 12px; }
  .ctl-btn { padding: 0 16px; }
}
/* Where the bench is too narrow for the busiest room's four controls on one row, every room
   reserves two rows, so the frames still match from room to room. */
@media (min-width: 1100px) {
  .work { container-type: inline-size; }
  @container (max-width: 659px) {
    .console { min-height: 94px; align-content: flex-start; }
  }
}

/* The wall label: a paper card on a thin mount. */
.label {
  /* Every label hangs from the same line as the room sign, so titles do not bob from room to room. */
  grid-area: label; align-self: start;
  position: relative;
  padding: 22px 26px 22px;
  color: var(--ink);
  background-color: var(--paper);
  background-image: var(--speckle), linear-gradient(160deg, rgba(255,255,255,.5), rgba(255,255,255,0) 45%);
  background-size: 200px 200px, 100% 100%;
  border-radius: 1.5px;
  box-shadow:
    0 1px 0 rgba(255,255,255,.4) inset,
    1px 0 0 rgba(0,0,0,.08),
    3px 4px 0 -1px color-mix(in srgb, var(--wall) 60%, #000),
    0 18px 30px -10px rgba(0,0,0,.5),
    0 4px 8px rgba(0,0,0,.2);
  --focus: #1b1a17;
}
.room--light .label { box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 3px 4px 0 -1px #c9c6bb, 0 16px 28px -12px rgba(40,36,28,.35), 0 2px 5px rgba(40,36,28,.14); }
.label > *, .lb-head > p { margin: 0; }
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; margin: -4px 0 0; }
.lb-room { font: 600 10.5px/1 var(--sans); letter-spacing: .26em; text-transform: uppercase; color: var(--ink-2); }
.lb-title { margin-top: 6px; font: italic 600 32px/1.04 var(--serif); letter-spacing: -.005em; text-wrap: balance; }
.lb-artist { margin-top: 12px; font: 600 14px/1.35 var(--sans); }
.lb-after { margin-top: 2px; font: 400 13.5px/1.35 var(--sans); color: var(--ink-2); }
.lb-facts { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lb-facts div { display: flex; flex-direction: column; gap: 3px; }
.lb-facts dt { font: 600 9.5px/1.2 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); }
.lb-facts dd { margin: 0; font: 400 12px/1.42 var(--sans); }
.lb-note {
  margin-top: 14px; padding-top: 13px;
  border-top: 1px solid rgba(27, 26, 23, .16);
  font: 400 13.5px/1.54 var(--sans); hyphens: manual; -webkit-hyphens: manual; overflow-wrap: break-word; text-wrap: pretty;
}
.lb-touch { margin-top: 11px; display: flex; gap: 8px; align-items: flex-start; font: italic 500 16.5px/1.28 var(--serif); color: #2e2b25; }
.lb-touch .ico { width: 19px; height: 19px; margin-top: 1px; color: var(--ink-2); }
.lb-live {
  margin-top: 13px; padding: 9px 12px 8px;
  border-radius: 3px;
  background: #1c1b18; color: #e8e1d0;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.7);
  display: grid; gap: 3px;
  font: 400 11.5px/1.45 var(--mono);
}
.lv-row { display: flex; justify-content: space-between; gap: 12px; min-height: 16.6px; }
.lv-row.empty { display: none; }
.lv-row.pending { visibility: hidden; }
.lv-k { color: #a9a18f; font-family: var(--sans); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-v { color: var(--accent); white-space: nowrap; }
.room--light .lv-v { color: #9fc0f0; }
.lv-row--timer { margin-top: 3px; padding-top: 5px; border-top: 1px solid rgba(232, 225, 208, .12); }
.lv-row--timer .mono { color: #e8e1d0; }
.lv-dot { width: 6px; height: 6px; border-radius: 50%; background: #6d675b; flex: none; }
.lv-dot.on { background: #8ee08e; box-shadow: 0 0 6px #8ee08e; }
.lb-foot { margin-top: 14px; display: flex; }
.guide-btn {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 40px; padding: 0 14px 0 11px; border-radius: 999px; flex: none;
  background: transparent; color: var(--ink);
  border: 1px solid rgba(27, 26, 23, .35);
  font: 600 12px/1 var(--sans); letter-spacing: .04em;
  transition: background .2s, border-color .2s;
}
.guide-btn:hover { background: rgba(27, 26, 23, .06); border-color: rgba(27, 26, 23, .6); }
.guide-btn .ico { width: 18px; height: 18px; }
.guide-bars { display: none; gap: 2px; align-items: flex-end; height: 12px; }
.guide-bars i { width: 2px; background: currentColor; animation: bars 1s ease-in-out infinite; }
.guide-bars i:nth-child(2) { animation-delay: -.3s; }
.guide-bars i:nth-child(3) { animation-delay: -.6s; }
@keyframes bars { 0%, 100% { height: 3px; } 50% { height: 12px; } }
.guide-btn.is-speaking { background: var(--ink); color: var(--paper); }
.guide-btn.is-speaking .guide-bars { display: inline-flex; }

/* Wayfinding sign at the foot of each room. */
.next {
  grid-area: next; justify-self: end; align-self: end; margin: -6px -6px -24px 0;
  display: inline-grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  min-height: 44px; padding: 4px 6px 4px 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-w2); text-align: right;
  transition: color .25s;
}
.next:hover { color: var(--ink-w); }
.next-k { grid-column: 1; font: 600 10px/1.3 var(--sans); letter-spacing: .2em; text-transform: uppercase; }
.next-t { grid-column: 1; font: italic 500 15px/1.2 var(--serif); color: var(--ink-w); }
.next-arrow { grid-column: 2; grid-row: 1 / span 2; width: 22px; height: 22px; }
.next:hover .next-arrow { animation: nudge 1.2s var(--ease) infinite; }
@keyframes nudge { 50% { transform: translateY(3px); } }

.is-resting .lb-live, .is-resting .console, .is-resting .play { visibility: hidden; }

/* On loan. */
.loan {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px; text-align: center; color: #efe8d8;
  background: radial-gradient(ellipse at 50% 30%, #3a3833, #1d1c19);
}
.loan-nail { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #d8d2c4, #6c665a 60%, #3a3630); box-shadow: 0 6px 8px rgba(0,0,0,.5); margin-bottom: 18px; }
.loan-title { margin: 0; font: italic 600 clamp(24px, 3vw, 36px)/1.1 var(--serif); }
.loan-sub { margin: 0; max-width: 34ch; font: 400 14px/1.5 var(--sans); color: #c9c1b0; }

/* ---------------------------------------------------------------- gift shop */
.shop {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; min-height: 100svh; scroll-snap-align: start;
  padding: 104px clamp(20px, 4vw, 72px) 72px calc(var(--plan-w) + clamp(28px, 3vw, 56px));
  --wall: #26201b;
  --focus: #e6cf96;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(255, 214, 150, .16), transparent 70%),
    linear-gradient(180deg, #1d1814, #2a231d 30%, #2a231d 75%, #17130f);
  color: #f0e8d6;
}
.shop .wall-tex { opacity: .25; }
.shop-head { max-width: 760px; margin: 0 auto 44px; text-align: center; }
.shop-kicker { margin: 0; font: 600 11px/1 var(--sans); letter-spacing: .28em; text-transform: uppercase; color: #c7bba2; }
.shop-title { margin: 14px 0 0; font: italic 600 clamp(38px, 5.4vw, 72px)/1 var(--serif); color: #f6ecd6; text-wrap: balance; }
.shop-lede { margin: 16px auto 0; max-width: 58ch; font: 400 15.5px/1.6 var(--sans); color: #d9cfbc; text-wrap: pretty; }
/* The ticket stub, handed back punched. Everything inside is laid out in em on a fixed grid,
   so the mask that cuts the holes (js/shell-ticket.js) always meets its printed rings. */
.keep {
  --tk-paper: #f2e9d6; --tk-ink: #221e18; --tk-ink-2: #5e5546; --tk-red: #a13a28;
  margin: 34px auto 0; display: flex; flex-direction: column; align-items: center; gap: 14px;
  font-size: min(15px, calc((100vw - 40px) / 30.5));
}
.keep-shadow {
  transform: rotate(-1.6deg);
  filter: drop-shadow(0 .8em 1em rgba(0,0,0,.42)) drop-shadow(0 1px 1.5px rgba(0,0,0,.4));
}
.keep-stub {
  position: relative; width: 30em; height: 9.6em; color: var(--tk-ink); text-align: left;
  background-color: var(--tk-paper);
  background-image: var(--speckle), linear-gradient(170deg, rgba(255,255,255,.35), rgba(255,255,255,0) 40%, rgba(120,90,40,.08));
  background-size: 200px 200px, 100% 100%;
  border-radius: 0 .4em .4em 0;
  clip-path: var(--tear);
  -webkit-mask: var(--holes); -webkit-mask-composite: source-in;
  mask: var(--holes); mask-composite: intersect;
}
.keep-stub::before {
  content: ''; position: absolute; inset: .47em .47em .47em .6em; pointer-events: none;
  border: 1px solid rgba(161, 58, 40, .55); border-radius: 3px;
}
.keep-stub::after {
  /* The fold between the stub's own printing and the conductor's punch row. */
  content: ''; position: absolute; left: 13.1em; top: 1.1em; bottom: 1.1em; pointer-events: none;
  border-left: 1px dashed rgba(161, 58, 40, .4);
}
.keep-left {
  position: absolute; left: .9em; top: 0; bottom: 0; width: 11.6em;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5em; text-align: center;
}
.keep .tk-stub-admit { font-size: 1.75em; }
.keep .tk-stub-no { font-size: .74em; }
.keep .tk-stub-code { width: 7.4em; height: 1.45em; }
.keep .tk-stub-keep { font-size: .54em; }
.keep-k {
  /* Its own font size is .64em, so its offsets are divided by .64 to stay on the stub's grid. */
  position: absolute; left: calc(13.85em / .64); top: calc(1.75em / .64); margin: 0;
  font: 600 .64em/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--tk-ink-2);
}
.keep-holes { list-style: none; margin: 0; padding: 0; }
.keep-hole { position: absolute; left: var(--x); top: 5.1em; width: 0; height: 0; }
.keep-ring, .keep-chad {
  position: absolute; left: -.5em; top: -.5em; width: 1em; height: 1em; border-radius: 50%;
}
/* Where the conductor's punch will go: a fine printed ring. */
.keep-ring { border: 1px dotted rgba(161, 58, 40, .6); }
.keep-hole.is-punched .keep-ring { border: 0; box-shadow: 0 0 0 1.5px rgba(94, 85, 70, .22); }
/* The disc the punch knocks out, falling away. */
.keep-chad { background: var(--tk-paper); opacity: 0; pointer-events: none; }
.keep-chad.is-falling { animation: chad-fall .42s cubic-bezier(.5, 0, .75, .4) both; }
@keyframes chad-fall {
  0% { opacity: 1; transform: none; }
  30% { opacity: 1; transform: translate(0, .1em) scale(.94); }
  100% { opacity: 0; transform: translate(.35em, 2.2em) rotate(70deg) scale(.7); }
}
.keep-num {
  position: absolute; left: calc(-1em / .95); width: calc(2em / .95); top: calc(.95em / .95); text-align: center;
  font: 500 .95em/1 var(--serif); color: var(--tk-ink-2);
}
.keep-hole.is-punched .keep-num { color: var(--tk-ink); font-weight: 600; }
.keep-cap { margin: 0; font: italic 500 17px/1.35 var(--serif); color: #d9cfbc; text-wrap: balance; }
/* The rack: two, three or four across, with a short last row centred rather than left with a gap. */
.shop-rack {
  list-style: none; margin: 0 auto; padding: 0;
  max-width: 1400px;
  --gap: 36px;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch;
  gap: 48px var(--gap);
}
.pc-slot { flex: 0 0 100%; display: flex; transform: rotate(var(--tilt, 0deg)); transition: transform .45s var(--ease); }
@media (min-width: 700px) { .pc-slot { flex-basis: calc((100% - var(--gap)) / 2); } }
@media (min-width: 1100px) { .pc-slot { flex-basis: calc((100% - var(--gap) * 2) / 3); } }
@media (min-width: 1640px) { .pc-slot { flex-basis: calc((100% - var(--gap) * 3) / 4); } }
.pc-slot:hover, .pc-slot:focus-within { transform: rotate(0deg) translateY(-4px); }
.pc { flex: 1 1 auto; display: flex; flex-direction: column; gap: 12px; align-items: stretch; margin: 0; }
.pc-face {
  position: relative;
  container-type: inline-size;
  /* The stamp grows with the card, so its lettering stays legible on a phone. */
  --st: clamp(58px, 18cqw, 78px);
  padding: 12px 12px 0;
  background-color: #fbf8f1;
  background-image: var(--speckle);
  background-size: 200px 200px;
  color: #1b1a17;
  box-shadow: 0 1px 1px rgba(0,0,0,.2), 0 14px 26px -8px rgba(0,0,0,.6), 0 30px 50px -24px rgba(0,0,0,.5);
}
.pc-imgwrap { position: relative; aspect-ratio: 1720 / 990; background: #222; box-shadow: 0 0 0 1px rgba(40,32,20,.18); overflow: hidden; }
.pc-img { display: block; width: 100%; height: 100%; }
/* Room for the stamp and, just left of it, the round postmark. */
.pc-cap { padding: 12px calc(var(--st) * 2.08 + 18px) 14px 2px; min-height: calc(var(--st) * 1.2 + 26px); }
.pc-title { margin: 0; font: italic 600 21px/1.1 var(--serif); text-wrap: balance; }
.pc-meta { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 2px 12px; font: 500 10.5px/1.3 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: #5d574b; }
.pc-seed { font-family: var(--mono); letter-spacing: .06em; color: #7a2f22; }
.pc-stamp { position: absolute; right: 14px; bottom: 14px; width: var(--st); height: auto; transform: rotate(2deg); filter: drop-shadow(0 1px 2px rgba(0,0,0,.3)); }
.pc-stamp-house { font: 600 7.2px/1 var(--sans); letter-spacing: .1em; }
.pc-stamp-num { font: 600 31px/1 var(--serif); }
.pc-stamp-who { font: 600 6.6px/1 var(--sans); letter-spacing: .1em; }
/* A duplex cancel: the date ring stands clear of the stamp and only its wavy bars run across it. */
.pc-postmark {
  position: absolute; width: calc(var(--st) * 1.9); height: auto;
  right: calc(var(--st) * .42 + 12px); bottom: calc(14px + var(--st) * .02);
  color: rgba(30, 34, 48, .74); transform: rotate(-7deg); pointer-events: none;
  mix-blend-mode: multiply;
}
.pc-pm-arc { font: 600 7.6px/1 var(--sans); letter-spacing: .1em; fill: currentColor; }
.pc-pm-date { font: 600 7.6px/1 var(--sans); letter-spacing: .02em; fill: currentColor; }
.pc-dl {
  align-self: flex-start; margin-top: auto;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 16px 0 12px; border-radius: 999px;
  background: transparent; color: #f0e8d6; border: 1px solid rgba(240, 232, 214, .4);
  font: 500 13px/1 var(--sans); letter-spacing: .02em;
  transition: background .2s, border-color .2s, opacity .2s;
}
.pc-dl:hover { border-color: var(--gold-1); background: rgba(230, 207, 150, .1); }
.pc-dl.is-busy { opacity: .6; cursor: progress; }
.pc--sold .pc-face { filter: saturate(.7); }
.pc-sold-img {
  position: relative; aspect-ratio: 1720 / 990; display: grid; place-items: center;
  background:
    repeating-linear-gradient(135deg, rgba(0,0,0,.08) 0 2px, transparent 2px 9px),
    radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--wall) 75%, #fff 12%), var(--wall));
  box-shadow: inset 0 0 0 1px rgba(40,32,20,.18);
}
.pc-sold-stamp {
  padding: 8px 16px 7px; border: 2.5px solid #c24a33; color: #c24a33; border-radius: 4px;
  font: 600 20px/1 var(--sans); letter-spacing: .24em; text-transform: uppercase;
  transform: rotate(-8deg); background: rgba(251, 248, 241, .9);
  box-shadow: 0 0 0 3px rgba(251,248,241,.9);
}
.pc-sold-line { margin: 0; font: italic 500 16px/1.4 var(--serif); color: #d9cfbc; }
.shop-actions {
  max-width: 1400px; margin: 64px auto 0;
  display: flex; flex-wrap: wrap; gap: 12px 14px; justify-content: center; align-items: center;
}
.shop-btn {
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  background: transparent; color: #f3ead7; border: 1px solid rgba(240, 232, 214, .45);
  font: 600 14px/1 var(--sans); letter-spacing: .02em;
  transition: background .2s, border-color .2s;
}
.shop-btn:hover { border-color: var(--gold-1); background: rgba(230, 207, 150, .1); }
.shop-btn--primary { background: var(--gold-1); color: #1f1a12; border-color: var(--gold-1); }
.shop-btn--primary:hover { background: #f1dca6; }
.shop-status { flex-basis: 100%; margin: 6px 0 0; min-height: 1.5em; text-align: center; font: italic 500 17px/1.4 var(--serif); color: #e6dcc5; }

/* ---------------------------------------------------------------- footer */
.footer {
  position: relative; scroll-snap-align: end;
  padding: 72px 24px 56px calc(var(--plan-w) + 24px);
  text-align: center; color: #cfc6b3;
  /* The shop's warm floor fades into the night outside: no hard seam at the door. */
  background: linear-gradient(180deg, #17130f 0, #0b0b0d 160px) #0b0b0d;
}
/* Closing time: a line that waits in reserved space above the motto until the lights go out. */
.closing { display: none; }
.js .closing {
  display: block; margin: 0 auto 26px; max-width: 32em; min-height: 2.7em;
  font: italic 500 clamp(19px, 1.9vw, 24px)/1.35 var(--serif); color: #d9cfbc; text-wrap: balance;
  visibility: hidden; opacity: 0; transform: translateY(8px);
  transition: opacity .6s var(--ease), transform .6s var(--ease), visibility 0s linear .6s;
}
.js .closing.is-shown {
  visibility: visible; opacity: 1; transform: none;
  transition: opacity 1.6s var(--ease) var(--after, 0s), transform 1.6s var(--ease) var(--after, 0s), visibility 0s linear var(--after, 0s);
}
.closing-work { font-style: normal; font-weight: 600; color: #f3e9d2; }
.reduced-motion .closing, .reduced-motion .closing.is-shown { transform: none; transition: none; }
.fp-room { transition: opacity .7s var(--ease); }
.fp-room.is-closed { opacity: .22; }
.footer-motto { margin: 0; font: italic 600 clamp(28px, 3.6vw, 44px)/1.1 var(--serif); color: #f3e9d2; text-wrap: balance; }
.footer-kicker { margin: 40px auto 0; max-width: 60ch; font: 600 11px/1.7 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: #a79d89; text-wrap: balance; }
.credits {
  list-style: none; margin: 22px auto 0; padding: 0; max-width: 980px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px 28px; text-align: left;
}
.credits li { display: flex; flex-direction: column; gap: 3px; padding-top: 10px; border-top: 1px solid rgba(230, 207, 150, .16); }
.cr-name { font: italic 600 19px/1.15 var(--serif); color: #efe5cf; }
.cr-what { font: 400 12.5px/1.4 var(--sans); color: #b3a994; }
.footer-credit { margin: 18px auto 0; max-width: 72ch; font: 400 14px/1.7 var(--sans); color: #bdb3a0; text-wrap: pretty; }
.footer-small { margin: 18px auto 0; max-width: 60ch; font: 400 12px/1.6 var(--sans); color: #a0978a; }

/* ---------------------------------------------------------------- responsive */
@media (min-width: 1100px) and (max-height: 880px) {
  .label { padding: 18px 22px 18px; }
  .lb-title { font-size: 29px; }
  .lb-artist { margin-top: 8px; }
  .lb-facts { margin-top: 9px; }
  .lb-note { margin-top: 11px; padding-top: 10px; font-size: 13px; line-height: 1.5; }
  .lb-touch { margin-top: 8px; font-size: 15.5px; }
  .lb-live { margin-top: 10px; padding: 7px 11px 6px; gap: 1px; }
}
@media (min-width: 1100px) and (max-height: 780px) {
  .room { padding-top: 18px; padding-bottom: 26px; row-gap: 14px; --work-h: clamp(420px, calc(100svh - 18px - 40px - 14px - 26px), 900px); }
  .room-sign { min-height: 40px; padding-top: 0; }
  .room-sign-num { font-size: 34px; }
  .console { margin-top: 18px; }
  .label { padding: 14px 20px 15px; }
  .lb-head { min-height: 36px; }
  .guide-btn { min-height: 36px; }
  .lb-title { margin-top: 2px; font-size: 26px; }
  .lb-artist { margin-top: 6px; font-size: 13.5px; }
  .lb-after { font-size: 12.5px; }
  .lb-facts { margin-top: 8px; gap: 12px; }
  .lb-facts dd { font-size: 11.5px; line-height: 1.36; }
  .lb-note { margin-top: 9px; padding-top: 9px; font-size: 12.5px; line-height: 1.46; }
  .lb-touch { margin-top: 7px; font-size: 15px; line-height: 1.22; }
  .lb-live { margin-top: 9px; padding: 6px 10px 5px; gap: 0; font-size: 11px; }
  .lv-k { font-size: 10.5px; }
  .lv-row--timer { margin-top: 2px; padding-top: 3px; }
}
@media (max-width: 1099px) {
  .room {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    grid-template-areas: 'sign' 'work' 'label';
    row-gap: 22px; align-items: start;
    padding: 40px 40px 64px calc(var(--plan-w) + 28px);
  }
  .work { height: auto; }
  .frame-wrap { flex: none; }
  .frame { height: clamp(340px, 62svh, 640px); }
  .label { max-width: 640px; justify-self: start; width: 100%; margin-top: 14px; }
  .next { grid-area: auto; margin: 4px -6px 0 0; }
}

@media (max-width: 699px) {
  :root { --plan-w: 0px; }
  .rail { display: contents; }
  .plan { display: none; }
  .where {
    display: inline-flex; position: fixed; z-index: 40;
    top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left));
  }
  /* A pseudo-element, so the foyer's title (which measures the fixed fixtures) never counts it as a wall. */
  body::before {
    content: ''; display: block; position: fixed; inset: 0 0 auto 0; z-index: 38; pointer-events: none;
    height: calc(76px + env(safe-area-inset-top));
    background: linear-gradient(180deg,
      color-mix(in srgb, var(--here-wall) 88%, transparent) 0%,
      color-mix(in srgb, var(--here-wall) 55%, transparent) 45%,
      transparent 100%);
  }
  .sound-toggle .st-text { display: none; }
  .sound-toggle {
    position: fixed; z-index: 40; top: max(14px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right));
    width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 999px;
  }
  .room {
    padding: 74px 16px 48px;
    row-gap: 16px;
  }
  .room-sign { min-height: 40px; }
  .console--empty { display: none; }
  .next { margin: 4px 0 0; padding-right: 0; }
  .label { margin-top: 10px; }
  .room-sign-num { font-size: 34px; }
  .frame { --lip: 3px; --cove: 9px; height: min(66svh, 540px); }
  .frame-wrap { --inset-art: 30px; }
  /* In line with the room pill and the sound switch, one row of fixtures across the top. */
  .foyer-pause { top: max(14px, env(safe-area-inset-top)); right: calc(max(16px, env(safe-area-inset-right)) + 54px); }
  .frame::before { border-width: var(--cove); }
  .bead { border-width: 3px; }
  .sight { border-width: 2px; }
  .liner { padding: 6px; }
  .fillet { border-width: 2px; }
  .console { margin-top: 20px; gap: 4px 12px; }
  .ctl--range, .ctl--select { width: 100%; }
  .ctl--range .ctl-label, .ctl--select .ctl-label { flex: 0 0 38%; }
  .ctl-range { flex: 1 1 auto; width: auto; min-width: 0; }
  .ctl-out { text-align: right; min-width: 5ch; }
  .label { padding: 20px 20px 18px; }
  .guide-btn { min-height: 44px; }
  .lb-facts { grid-template-columns: 1fr; gap: 8px; }
  .lb-title { font-size: 28px; }
  .shop { padding: 104px 16px 56px; }
  .shop-rack { row-gap: 40px; }
  .footer { padding: 56px 16px 48px; }
  .js .closing { min-height: 4.05em; }
  .foyer { padding-bottom: max(22px, env(safe-area-inset-bottom)); }
  .foyer-lower { gap: 16px; }
  .ticket { flex-direction: row; transform: rotate(-.6deg); }
  .tk-main { padding: 14px 14px 14px 16px; }
  .tk-stub { flex-basis: 86px; padding: 12px 6px; }
  .tk-stub-admit { font-size: 19px; }
  .tk-stub-code { width: 64px; }
  .tk-admit-big { font-size: 36px; }
  .tk-admit { margin: 4px 0 6px; gap: 2px 12px; }
  .tk-data { gap: 18px; }
  .tk-code { width: 100%; margin-bottom: 12px; }
  .tk-actions { flex-direction: column; gap: 8px; }
  .tk-btn { width: 100%; justify-content: center; }
  .tk-house { font-size: 9px; letter-spacing: .16em; }
  .tk-rose { width: 200px; height: 200px; right: -60px; }
  .tk-admit-sub { display: none; }
  .tk-admit-big { font-size: 34px; }
  .tk-data { margin-bottom: 8px; }
  .tk-code { margin-bottom: 10px; }
  .barcode { height: 28px; }
  .tagline { font-size: 18px; }
}

@media (max-width: 380px) {
  .tk-stub { flex-basis: 80px; padding: 14px 12px 14px 14px; gap: 7px; }
  .tk-stub-admit { font-size: 15px; line-height: 1.05; }
  .tk-stub-code { width: 52px; }
  .tk-stub-no { font-size: 9.5px; }
  .tk-stub-keep { font-size: 7.5px; letter-spacing: .14em; }
  /* The visitor number takes its own line rather than being cut off at the perforation. */
  .tk-top { flex-wrap: wrap; row-gap: 4px; }
}

/* Short screens (a phone on its side, a laptop zoomed to 200%). */
@media (min-width: 700px) and (max-width: 860px) {
  /* Keep the ticket clear of the visitor desk down the left edge. */
  .foyer { padding-left: calc(var(--plan-w) + 30px); }
}
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  /* The first screen is the museum's name; the tagline and the top of the ticket wait just below. */
  .foyer { padding-top: max(240px, calc(100svh - 104px)); }
  .foyer-lower { gap: 16px; }
}
@media (max-height: 520px) and (min-aspect-ratio: 1/1) and (max-width: 1099px) {
  /* The whole picture, sign and frame fit the screen when a room snaps into place. */
  .room { padding-top: 10px; row-gap: 8px; }
  .room-sign { min-height: 34px; padding-top: 0; }
  .room-sign-num { font-size: 30px; }
  .frame { --lip: 4px; --cove: 14px; height: max(220px, calc(100svh - 62px)); }
  .frame::before { border-width: var(--cove); }
  .liner { padding: 8px; }
  .frame-wrap { --inset-art: 42px; }
}
@media (max-width: 699px) and (max-height: 520px) and (min-aspect-ratio: 1/1) {
  /* A small phone on its side: the room pill up top already names the room. */
  .room { padding-top: 62px; }
  .room-sign { display: none; }
  .frame { height: max(200px, calc(100svh - 72px)); }
}
@media (max-width: 1099px), (max-height: 520px) {
  .guide-btn { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.reduced-motion .ticket, .reduced-motion .foyer-fallback { animation: none; }
