/* Daybook: soscitea's design system.
 *
 * A daybook is two things at once: a diary of the day, and the ledger of a
 * day's trade. soscitea's town is both. Every tick is written down, the ledger
 * closes to the credit, and every night its residents write about the day.
 * So the page is one day in Ashmere, read as a daybook, and five rules follow.
 *
 *   1. Scroll is the clock. The page runs from 07:10, when the recording
 *      begins, to midnight. The light, the paper and the clock in the bar all
 *      follow the hour (daybook.js sets the colour tokens below as you read).
 *   2. Every entry is real. Numbers and quotes come off the recording, with
 *      their day and time, set in the ledger face.
 *   3. Outside the frame. The recorded town sits inside a frame. The guides
 *      are painted figures standing outside it, on the page, with you.
 *   4. Credits move as light. Play money is drawn as warm light passing
 *      between hands: an economy is an exchange of energy.
 *   5. Plain words, one idea at a time. What isn't real is said first.
 *
 * Type: Instrument Serif for the day's headlines, Figtree for reading and for
 * the guides' voices, Martian Mono for every number, time and label.
 */

/* ---------- tokens ---------- */

@property --grow { syntax: "<number>"; inherits: true; initial-value: 0; }

:root {
  /* The day's light. These are dawn; daybook.js moves them with the hour. */
  --paper: #f4e8dc;
  --paper-2: #eedccb;
  --paper-3: #e6cfbb;
  --ink: #1d1915;
  --ink-2: #5a4b40;
  --ink-3: #7b6a5d;
  --rule: rgb(29 25 21 / .14);
  --sun: #f6a86b;
  --sun-x: 78vw;
  --sun-y: 30vh;
  --glow: rgb(255 176 112 / .38);
  --stars: 0;

  /* Fixed colours. Gold is play money in motion; each guide keeps the colour
     of the costume they wore in the recorded town. */
  --gold: #f2a93b;
  --gold-soft: #ffd98a;
  --gold-ink: #7a4d06;
  --c-chandler: #b8a894;
  --c-mira: #e8637c;
  --c-gambler: #c2802e;
  --c-scholar: #7d3346;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Figtree", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --t-hero: clamp(4.25rem, 11.4vw, 12.75rem);
  --t-h2: clamp(2.5rem, 5.6vw, 5.75rem);
  --t-h3: clamp(1.5rem, 2.4vw, 2.1rem);
  --t-lead: clamp(1.25rem, 1.55vw, 1.6rem);
  --t-body: clamp(1.0625rem, 1.12vw, 1.25rem);
  --t-small: .9375rem;
  --t-label: .6875rem;
  --t-clock: clamp(2.75rem, 6.4vw, 7rem);

  --gutter: clamp(1.25rem, 4.5vw, 5rem);
  --measure: 38rem;
  --radius: 22px;
  --radius-s: 14px;

  --ease: cubic-bezier(.22, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --z-sky: -1;
  --z-page: 1;
  --z-cast: 2;
  --z-over: 3;
  --z-bar: 20;
  --z-dock: 30;
  --z-loader: 50;

  color-scheme: light;
}
:root.is-night { color-scheme: dark; }

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; color: var(--ink); background: transparent;
  font: 400 var(--t-body) / 1.6 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas, iframe { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 400; }
h2 { font: 400 var(--t-h2) / .98 var(--serif); letter-spacing: -.012em; text-wrap: balance; max-width: 18ch; }
h3 { font: 600 1.125rem / 1.3 var(--sans); }
p { margin: 0; }
em { font-style: italic; }
::selection { background: var(--gold-soft); color: #1d1915; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 6px; }

.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-variation-settings: "wdth" 100; }
.label, .eyebrow, legend {
  font: 500 var(--t-label) / 1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2);
}
.note { font-size: var(--t-small); color: var(--ink-2); max-width: var(--measure); }
.link { font: 500 var(--t-small) / 1 var(--mono); letter-spacing: .04em; }

.skip { position: fixed; left: 1rem; top: -4rem; z-index: 100; padding: .75rem 1rem; background: var(--ink); color: var(--paper); border-radius: 999px; }
.skip:focus { top: 1rem; }

/* The guide's words sit inside each section for screen readers. The bubble
   shows them to everyone else. When the guide is hidden, they come back. */
.guide-say { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:root.guide-inline .guide-say:not(:empty) {
  position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal;
  margin-top: 2rem; max-width: var(--measure); padding: 1rem 1.25rem; border-left: 3px solid var(--guide-c, var(--gold));
  font-size: var(--t-small); color: var(--ink-2); background: color-mix(in srgb, var(--paper-2) 70%, transparent); border-radius: 0 var(--radius-s) var(--radius-s) 0;
}
:root.guide-inline .guide-say:not(:empty)::before { content: attr(data-who) "  "; font: 500 var(--t-label) / 1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); display: block; margin-bottom: .5rem; }

/* ---------- the sky ---------- */

.sky { position: fixed; inset: 0; z-index: var(--z-sky); pointer-events: none; background: var(--paper); overflow: hidden; }
.sky-sun {
  position: absolute; left: var(--sun-x); top: var(--sun-y); width: 64vmax; height: 64vmax; translate: -50% -50%;
  background: radial-gradient(circle at center, var(--glow) 0%, transparent 60%);
}
.sky-sun::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 7vmax; height: 7vmax; translate: -50% -50%;
  border-radius: 50%; background: var(--sun); opacity: .22; filter: blur(2px);
}
.sky-stars {
  position: absolute; inset: 0; opacity: var(--stars);
  background-image:
    radial-gradient(1.4px 1.4px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 62%, #fff7 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 44% 28%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 74%, #fff6 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 71% 14%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 83% 48%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 92% 82%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 88%, #fff6 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 36% 90%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 38%, #fff6 50%, transparent 51%);
  background-size: 900px 700px;
}
.cast { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: var(--z-cast); pointer-events: none; }
main { position: relative; }
.foot { position: relative; z-index: var(--z-over); }
.entry-time, .dusk-line { position: relative; z-index: var(--z-over); }
.entry-body > *, .hero > *, .week > * { position: relative; z-index: var(--z-over); }

/* ---------- the bar ---------- */

.bar {
  position: fixed; inset: 0 0 auto; z-index: var(--z-bar);
  display: flex; align-items: center; gap: clamp(.75rem, 2vw, 2rem);
  padding: .9rem var(--gutter);
  background: linear-gradient(var(--paper) 30%, color-mix(in srgb, var(--paper) 0%, transparent));
}
.mark { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; }
.mark-word { font: italic 400 1.75rem / 1 var(--serif); letter-spacing: -.01em; }
.mark-sun {
  --r: .8rem; width: var(--r); height: var(--r); border-radius: 50%; background: var(--gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 25%, transparent);
  translate: 0 var(--mark-rise, 0);
  transition: background .6s var(--ease);
}
:root.is-night .mark-sun { background: #f3ecdf; box-shadow: inset -.28rem -.1rem 0 0 #b9b0c9; }
.bar-clock { display: inline-flex; gap: .6rem; margin-left: auto; font: 500 .8125rem / 1 var(--mono); letter-spacing: .06em; color: var(--ink-2); }
.bar-time { color: var(--ink); min-width: 5ch; }
.bar-nav { display: flex; gap: 1.5rem; font: 500 .8125rem / 1 var(--mono); letter-spacing: .04em; }
.bar-nav a { text-decoration: none; opacity: .8; }
.bar-nav a:hover { opacity: 1; text-decoration: underline; }

/* ---------- buttons, chips ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  height: 3rem; padding: 0 1.4rem; border: 0; border-radius: 999px; cursor: pointer; text-decoration: none;
  font: 600 1rem / 1 var(--sans); letter-spacing: .005em; white-space: nowrap;
  transition: transform .35s var(--spring), box-shadow .35s var(--ease), background .3s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -10px var(--gold), 0 0 0 4px color-mix(in srgb, var(--gold) 22%, transparent); }
.btn:active { transform: translateY(0) scale(.97); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-light { background: #f4ece2; color: #17182c; }
.bar-join { height: 2.5rem; padding: 0 1.1rem; font-size: .9375rem; }

.chip {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: .3rem; text-align: left;
  padding: .75rem 1rem .8rem; border-radius: var(--radius-s); cursor: pointer;
  border: 1px solid var(--rule); background: color-mix(in srgb, var(--paper-2) 60%, transparent);
  font: 600 .9375rem / 1.2 var(--sans);
  transition: transform .3s var(--spring), border-color .2s, background .2s;
}
.chip-at { font: 500 var(--t-label) / 1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.chip:hover { transform: translateY(-2px); border-color: var(--gold); }
.chip[aria-pressed="true"] { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, transparent); }
.chip[aria-pressed="true"] .chip-at::after { content: " · seen"; color: var(--gold); }

/* ---------- entries ---------- */

.entry {
  position: relative; display: grid; align-items: start;
  grid-template-columns: [time] minmax(9rem, 17rem) [body] minmax(0, 1fr);
  column-gap: clamp(1.5rem, 5vw, 6rem);
  max-width: 1480px; margin-inline: auto; padding: clamp(6rem, 16vh, 11rem) var(--gutter);
}
.entry-time { grid-column: time; position: sticky; top: 24vh; display: grid; gap: .5rem; padding-top: .6rem; }
.entry-day { font: 500 var(--t-label) / 1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.entry-clock {
  font: 300 var(--t-clock) / .9 var(--mono); font-variation-settings: "wdth" 112.5; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.entry-body { grid-column: body; display: grid; gap: 1.75rem; justify-items: start; }
.body { max-width: var(--measure); color: var(--ink); }
.body.small { font-size: var(--t-small); color: var(--ink-2); }
.body.result { color: var(--ink-2); }

/* Scenes pin while the scroll scrubs them: --p runs 0 to 1 across the section. */
.scene { display: block; height: var(--len, 250vh); padding: 0; max-width: none; }
.scene-pin {
  position: sticky; top: 0; min-height: 100svh; display: grid; align-content: center; align-items: start;
  grid-template-columns: [time] minmax(9rem, 17rem) [body] minmax(0, 1fr); column-gap: clamp(1.5rem, 5vw, 6rem);
  max-width: 1480px; margin-inline: auto; padding: 5.5rem var(--gutter) 3rem;
}
.scene .entry-time { position: static; }
.scene .entry-body { gap: 1.25rem; }
.scene h2 { font-size: clamp(2.25rem, 4.4vw, 4.5rem); }

/* Stages are where the painted figures stand. The canvas above draws into
   their boxes, so each keeps a fixed shape and nothing jumps as it loads. */
.stage { position: relative; display: block; width: 100%; }
.stage::after { content: ""; position: absolute; inset: auto 12% 6% 12%; height: 10%; border-radius: 50%; background: radial-gradient(closest-side, rgb(29 25 21 / .14), transparent); }
:root.cast-on .stage::after { display: none; }

/* ---------- hero ---------- */

.hero { min-height: 100svh; display: block; padding-top: clamp(4.75rem, 9.5vh, 6.5rem); padding-bottom: 1.5rem; }
.eyebrow { margin-bottom: .75rem; }
.hero-title {
  font: 400 var(--t-hero) / .82 var(--serif); letter-spacing: -.02em; text-transform: uppercase;
  margin-left: -.04em;
}
.hero-row { display: block; }
.hero-row:nth-child(2) { padding-left: .9em; }
.hero-title em { font-style: italic; letter-spacing: -.035em; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2rem, 5vw, 6rem); align-items: start; margin-top: clamp(.5rem, 2vh, 1.5rem); }
.hero-copy { display: grid; gap: 1.25rem; padding-top: clamp(1rem, 4vh, 2.5rem); }
.lead { font: 500 var(--t-lead) / 1.35 var(--sans); max-width: 26ch; letter-spacing: -.005em; }
.lead-2 { color: var(--ink-2); }
.cue { display: inline-flex; align-items: center; gap: .75rem; margin-top: 1rem; font: 500 .8125rem / 1 var(--mono); letter-spacing: .06em; text-decoration: none; }
.cue-sun { width: .9rem; height: .9rem; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 0 var(--gold); }
@media (prefers-reduced-motion: no-preference) {
  .cue-sun { animation: rise-sun 2.4s var(--ease) infinite; }
  @keyframes rise-sun { 0% { translate: 0 .5rem; opacity: 0; } 30% { opacity: 1; } 70% { translate: 0 -.25rem; opacity: 1; } 100% { translate: 0 -.25rem; opacity: 0; } }
}
.hero-cast { position: relative; display: grid; gap: .5rem; }
.hero-bubble {
  position: absolute; top: .25rem; left: 0; width: min(21rem, 100%); z-index: var(--z-over);
  padding: .9rem 1.1rem 1rem; border-radius: 18px; background: var(--paper); color: var(--ink); border: 1px solid var(--rule);
  box-shadow: 0 18px 50px -24px rgb(0 0 0 / .45); font: 500 1rem / 1.45 var(--sans);
  opacity: 0; transition: opacity .3s var(--ease), left .45s var(--spring); pointer-events: none; min-height: 4.4rem;
}
.hero-bubble.is-on { opacity: 1; }
.hero-bubble::after {
  content: ""; position: absolute; bottom: -8px; left: var(--tail, 50%); width: 14px; height: 14px; background: inherit;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); transform: translateX(-50%) rotate(45deg);
}
.stage-lineup { aspect-ratio: 16 / 7.7; }
.picker { border: 0; margin: 0; padding: 0; min-width: 0; }
.picker legend { margin-bottom: .75rem; }
.picker-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.pick {
  display: grid; gap: .3rem; align-content: start; text-align: left; cursor: pointer;
  padding: .75rem .85rem .85rem; border-radius: var(--radius-s); border: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper-2) 55%, transparent);
  transition: border-color .25s, background .25s, transform .35s var(--spring);
}
.pick:hover { transform: translateY(-2px); border-color: var(--ink-3); }
.pick[aria-pressed="true"] { border-color: var(--ink); background: var(--paper); box-shadow: 0 12px 30px -18px rgb(29 25 21 / .5); }
.pick-name { font: 600 1.0625rem / 1.1 var(--sans); display: flex; align-items: center; gap: .45rem; }
.pick-name::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--pc); }
.pick[data-guide="chandler"] { --pc: var(--c-chandler); }
.pick[data-guide="mira"] { --pc: var(--c-mira); }
.pick[data-guide="gambler"] { --pc: var(--c-gambler); }
.pick[data-guide="scholar"] { --pc: var(--c-scholar); }
.pick-tag { font-size: .8125rem; line-height: 1.35; color: var(--ink-2); }

/* ---------- cast ---------- */

.stage-town { aspect-ratio: 16 / 4.6; margin-top: .5rem; }
.roster { display: grid; grid-template-columns: 4fr 5fr; gap: 1.5rem 3rem; width: 100%; }
.roster ul { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; }
.roster li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--rule); cursor: default; transition: background .2s; }
.roster li:hover { background: color-mix(in srgb, var(--gold) 8%, transparent); }
.roster b { font-weight: 600; }
.roster span { font-size: var(--t-small); color: var(--ink-2); font-style: italic; }
.roster .note { grid-column: 1 / -1; }

/* ---------- the board ---------- */

.job {
  position: relative; width: min(100%, 22rem); padding: 2.2rem 1.6rem 1.4rem; margin: .5rem 0 .25rem;
  background: #fbf6ec; color: #1d1915; border-radius: 6px; rotate: -2.2deg;
  box-shadow: 0 1px 0 rgb(0 0 0 / .05), 0 18px 40px -22px rgb(60 40 20 / .55);
  background-image: repeating-linear-gradient(transparent 0 27px, rgb(29 25 21 / .08) 27px 28px);
  display: grid; gap: .4rem;
}
.job-pin { position: absolute; top: .7rem; left: 50%; width: .9rem; height: .9rem; border-radius: 50%; translate: -50% 0; background: radial-gradient(circle at 35% 35%, #ff9d7a, #c2402a); box-shadow: 0 3px 5px rgb(0 0 0 / .3); }
.job-id { font: 500 var(--t-label) / 1 var(--mono); letter-spacing: .14em; color: #7b6a5d; }
.job-kind { font: 400 3rem / 1 var(--serif); }
.job-pay { font-size: 1.0625rem; }
.job-pay .num { font-weight: 600; font-size: 1.25rem; }
.job-when { font: 500 .6875rem / 1.4 var(--mono); letter-spacing: .06em; color: #7b6a5d; margin-top: .5rem; }

/* ---------- the auction ---------- */

.auction, .market, .gamble, .tavern, .thinker { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(1rem, 3vw, 2.5rem); align-items: center; width: 100%; }
.stage-auction { aspect-ratio: 16 / 9.5; }
.asks, .ledger { list-style: none; margin: 0; padding: 0; display: grid; }
.asks li {
  display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 1rem;
  padding: .85rem 0; border-top: 1px solid var(--rule);
  opacity: .22; transform: translateX(10px); transition: opacity .5s var(--ease), transform .6s var(--spring);
}
.asks li.is-on { opacity: 1; transform: none; }
.ask-who { font-weight: 600; }
.ask-at { font: 500 var(--t-label) / 1 var(--mono); letter-spacing: .08em; color: var(--ink-3); }
.ask-num { font-size: 1.5rem; font-weight: 500; }
.asks li.is-winner.is-won .ask-num { color: var(--gold-ink); background: var(--gold-soft); padding: 0 .4rem; border-radius: 6px; }
.ask-why { grid-column: 1 / -1; margin-top: -.35rem; font: italic 400 var(--t-small) / 1.45 var(--sans); color: var(--ink-2); }
.ask-why::before { content: "“"; } .ask-why::after { content: "”"; }
.asks li.is-winner.is-won .ask-who::after { content: "  gets the job"; font: 500 var(--t-label) / 1 var(--mono); letter-spacing: .08em; color: var(--gold-ink); }
.result { opacity: .2; transition: opacity .6s var(--ease); }
.scene.is-done .result, .entry:not(.scene) .result { opacity: 1; }

.toy-entry { padding-top: 0; }
.toy {
  width: min(100%, 44rem); padding: clamp(1.25rem, 3vw, 2.25rem); border-radius: var(--radius);
  border: 1px solid var(--rule); background: color-mix(in srgb, var(--paper-2) 65%, transparent);
  display: grid; gap: .9rem;
}
.toy-title { font: 400 clamp(1.75rem, 3vw, 2.5rem) / 1.05 var(--serif); }
.toy-label { font-size: var(--t-small); color: var(--ink-2); }
.toy-row { display: grid; grid-template-columns: 1fr 5.5rem; align-items: center; gap: 1.25rem; }
.toy-out { font-size: 2rem; font-weight: 500; text-align: right; }
.toy-verdict { font-weight: 600; min-height: 1.6em; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 2.25rem; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--gold) var(--fill, 30%), var(--rule) var(--fill, 30%)); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--rule); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--gold); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 1.5rem; height: 1.5rem; margin-top: -9px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); box-shadow: 0 4px 10px -4px rgb(0 0 0 / .4); }
input[type=range]::-moz-range-thumb { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); }

/* ---------- the market ---------- */

.stage-market { aspect-ratio: 16 / 10; }
.ledger li {
  display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; padding: .85rem 0; border-top: 1px solid var(--rule);
  opacity: .22; transition: opacity .5s var(--ease);
}
.ledger li.is-on { opacity: 1; }
.ledger-at { grid-column: 1 / -1; font: 500 var(--t-label) / 1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.ledger-what { font-weight: 500; }
.ledger-amt { font-size: 1.125rem; }
.ledger-amt.out { color: #9c2a43; }
.ledger-amt.in { color: #2f6b1f; }

/* ---------- someone's afternoon (the first run: the Gambler) ---------- */

.stage-story { aspect-ratio: 16 / 11; }
.tally { display: grid; gap: .1rem; }
.tally-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--rule); }
.tally-row .num { font-size: 1.5rem; }
.purse { height: .6rem; margin-top: 1rem; border-radius: 999px; background: var(--rule); overflow: hidden; }
.purse-fill { display: block; height: 100%; width: calc((1 - var(--p, 0)) * 100%); background: linear-gradient(90deg, var(--gold), var(--gold-soft)); border-radius: inherit; }
.stamp {
  justify-self: start; margin-top: 1.25rem; padding: .45rem .9rem; border: 2px solid #9c2a43; border-radius: 8px; color: #9c2a43;
  font: 600 .875rem / 1 var(--mono); letter-spacing: .14em; text-transform: uppercase; rotate: -6deg;
  opacity: 0; scale: 1.4; transition: opacity .25s, scale .45s var(--spring);
}
.scene.is-done .stamp { opacity: 1; scale: 1; }

/* ---------- the ladder ---------- */

.paid { width: min(100%, 40rem); border-collapse: collapse; font-variant-numeric: tabular-nums; }
.paid caption { text-align: left; padding-bottom: .75rem; font: 500 var(--t-label) / 1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.paid th, .paid td { padding: .8rem 0; border-top: 1px solid var(--rule); text-align: left; font-weight: 500; }
.paid thead th { font: 500 var(--t-label) / 1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); border-top: 0; }
.paid .n { text-align: right; }
.paid td.num { font-size: 1.125rem; }
.paid tbody tr:first-child td:last-child { color: var(--gold-ink); }

/* ---------- a bidder that gives reasons ----------
   Each ask sits in a thought bubble, in the colour of the bidder's costume,
   with the two small puffs a thought trails behind it. */

.stage-thinker { aspect-ratio: 16 / 11; }
.thoughts { list-style: none; margin: 0; padding: 0 0 .75rem; display: grid; gap: 1.6rem; }
.thought {
  position: relative; padding: .95rem 1.15rem 1rem; border-radius: 24px;
  background: color-mix(in srgb, var(--thinker, var(--gold)) 18%, var(--paper-2));
  opacity: .25; transform: translateY(8px); transition: opacity .5s var(--ease), transform .6s var(--spring);
}
.thought::before, .thought::after { content: ""; position: absolute; border-radius: 50%; background: inherit; }
.thought::before { width: .85rem; height: .85rem; left: 1.4rem; bottom: -.6rem; }
.thought::after { width: .45rem; height: .45rem; left: .85rem; bottom: -1.15rem; }
.thought.is-on { opacity: 1; transform: none; }
.thought-head { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.thought-at, .thought-job { font: 500 var(--t-label) / 1 var(--mono); color: var(--ink-3); }
.thought-ask { margin-left: auto; font-size: 1.35rem; font-weight: 600; }
.thought blockquote { margin: .45rem 0 0; font: 400 clamp(1.05rem, 1.35vw, 1.25rem) / 1.4 var(--sans); }
.thought-won { display: inline-block; margin-top: .6rem; padding: .3rem .55rem; border-radius: 6px; background: var(--gold-soft); color: var(--gold-ink); font: 600 var(--t-label) / 1 var(--mono); }

/* ---------- dusk ---------- */

.dusk { display: grid; place-items: center; min-height: 150vh; padding: 0 var(--gutter); }
.dusk-line { position: sticky; top: 42vh; font: italic 400 clamp(2.25rem, 6vw, 6rem) / 1 var(--serif); text-align: center; max-width: 14ch; text-wrap: balance; }

/* ---------- the tavern ---------- */

.stage-tavern { aspect-ratio: 16 / 11; }
.talk { display: grid; gap: 1.25rem; }
.said { margin: 0; padding: 1.1rem 1.25rem 1rem; border-radius: 18px 18px 18px 6px; background: color-mix(in srgb, var(--said-a, var(--c-gambler)) 22%, var(--paper-2)); opacity: .25; transition: opacity .5s var(--ease), transform .6s var(--spring); transform: translateY(8px); }
.said.is-on { opacity: 1; transform: none; }
.said-b { border-radius: 18px 18px 6px 18px; background: color-mix(in srgb, var(--said-b, var(--c-mira)) 24%, var(--paper-2)); justify-self: end; }
.said blockquote, .page blockquote { margin: 0; font: 400 clamp(1.25rem, 1.7vw, 1.6rem) / 1.25 var(--serif); }
.said figcaption, .page figcaption { margin-top: .6rem; font: 500 var(--t-label) / 1.4 var(--mono); letter-spacing: .08em; color: var(--ink-3); text-transform: uppercase; }

/* ---------- night pages ---------- */

.pages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1rem, 2.5vw, 2rem); width: 100%; }
.page {
  margin: 0; padding: clamp(1.25rem, 2.5vw, 2rem); border-radius: 6px;
  background: color-mix(in srgb, #f4ece2 7%, transparent); border: 1px solid var(--rule);
  background-image: repeating-linear-gradient(transparent 0 31px, color-mix(in srgb, var(--ink) 8%, transparent) 31px 32px);
}
.page:nth-child(odd) { rotate: -.6deg; } .page:nth-child(even) { rotate: .5deg; translate: 0 1.5rem; }
.ask-again { margin-top: 3rem; font: 400 clamp(2.5rem, 7vw, 7rem) / .9 var(--serif); text-transform: uppercase; opacity: .9; }
.ask-again em { font-style: italic; }

/* ---------- the week, full bleed ---------- */

.week { display: block; max-width: none; padding-inline: 0; }
.week-head, .week-foot { max-width: 1480px; margin-inline: auto; padding-inline: var(--gutter); display: grid; gap: 1.25rem; justify-items: start; }
.week-head h2 { max-width: none; }
.moments { display: flex; flex-wrap: wrap; gap: .6rem; align-items: stretch; margin-top: .5rem; }
.moments-count { align-self: center; margin-left: .5rem; font: 500 .8125rem / 1 var(--mono); letter-spacing: .06em; color: var(--ink-2); }
.frame-wrap { height: 175vh; margin-top: 2.5rem; }
.frame {
  position: sticky; top: 0; height: 100svh; width: 100%; overflow: hidden;
  transform: scale(calc(.8 + .2 * var(--grow))); transform-origin: 50% 40%;
  border-radius: calc(28px * (1 - var(--grow)));
  box-shadow: 0 40px 120px -40px rgb(0 0 0 / .7), 0 0 0 1px rgb(255 255 255 / .08);
  background: #111220;
}
.frame-view { width: 100%; height: 100%; border: 0; }
.week-foot { margin-top: 2rem; padding-bottom: 4rem; }

/* ---------- what's next ---------- */

.road { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; width: 100%; counter-reset: step; }
.road li { display: grid; grid-template-columns: 3.5rem minmax(0, 14rem) minmax(0, 1fr) auto; gap: .4rem 2rem; align-items: baseline; padding: 1.4rem 0; border-top: 1px solid var(--rule); counter-increment: step; }
.road li::before { content: counter(step, decimal-leading-zero); font: 300 1.5rem / 1 var(--mono); color: var(--ink-3); }
.road h3 { font: 400 1.75rem / 1.05 var(--serif); }
.road p { color: var(--ink-2); max-width: 34rem; }
.road-state { order: 5; justify-self: end; font: 500 var(--t-label) / 1 var(--mono); letter-spacing: .12em; text-transform: uppercase; padding: .45rem .7rem; border-radius: 999px; border: 1px solid var(--rule); white-space: nowrap; }
.road-state.done { border-color: #7fb069; color: #b4e39a; }
.road-state.part { border-color: var(--gold); color: var(--gold-soft); }
.road-state.soon { border-color: var(--ink-3); color: var(--ink-2); }

/* ---------- the register: every recorded run ---------- */

.runs { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; width: 100%; }
.run { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) auto; gap: .5rem 2rem; align-items: center; padding: 1.4rem 0; border-top: 1px solid var(--rule); }
.run-no { font-size: 2.25rem; font-weight: 800; line-height: 1; color: var(--ink-3); }
.run.is-here .run-no { color: var(--gold); }
.run-text { display: grid; gap: .35rem; }
.run-text h3 { font: 700 1.75rem / 1.05 var(--serif); }
.run-text p { color: var(--ink-2); max-width: 36rem; }
.run-facts { font: 600 var(--t-label) / 1.3 var(--mono); color: var(--ink-3); }
.run-links { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; justify-content: flex-end; }
.run-read { height: 2.5rem; padding: 0 1.1rem; font-size: .9375rem; }
.run-here { padding: .5rem .85rem; border-radius: 999px; border: 1px solid var(--gold); color: var(--gold-soft); font: 600 var(--t-label) / 1 var(--mono); white-space: nowrap; }
.run-note { display: inline-block; margin-bottom: 1rem; padding: .55rem 1rem; border-radius: 999px; border: 1px solid var(--rule); background: color-mix(in srgb, var(--gold) 14%, transparent); font-size: var(--t-small); }
.run-note a { font-weight: 600; margin-left: .35rem; }

/* ---------- the waitlist ---------- */

.form { display: grid; gap: 1.5rem; width: min(100%, 44rem); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: grid; gap: .5rem; font-weight: 600; font-size: .9375rem; }
.field .opt { font-weight: 400; color: var(--ink-3); }
.form input:not([type=radio]):not([type=checkbox]), .form select, .form textarea {
  font: 400 1rem / 1.4 var(--sans); color: var(--ink); width: 100%;
  padding: .85rem 1rem; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--ink) 24%, transparent);
  background: color-mix(in srgb, var(--paper-2) 70%, transparent);
  transition: border-color .2s, box-shadow .2s;
}
.form input:focus-visible, .form select:focus-visible, .form textarea:focus-visible { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 25%, transparent); }
.form textarea { resize: vertical; }
.choice { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.choice legend { width: 100%; margin-bottom: .6rem; }
.option { display: inline-flex; align-items: center; gap: .55rem; padding: .6rem .9rem; border-radius: 999px; border: 1px solid var(--rule); cursor: pointer; font-size: .9375rem; }
.option:has(input:checked) { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, transparent); }
.option input { accent-color: var(--gold); width: 1rem; height: 1rem; margin: 0; }
.contrib { display: none; gap: 1.25rem; }
.form:has(input[name=role][value=contribute]:checked) .contrib { display: grid; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form .btn { justify-self: start; }
.formnote { min-height: 1.4em; font-size: var(--t-small); color: #ffb3c1; }
.thanks { padding: 1.5rem 1.75rem; border-radius: var(--radius); background: color-mix(in srgb, #7fb069 18%, transparent); border: 1px solid #7fb069; font-size: 1.125rem; outline: none; }

/* ---------- footer ---------- */

.foot { padding: 6rem var(--gutter) 3rem; max-width: 1480px; margin-inline: auto; display: grid; gap: 3rem; }
.foot-big { font: 400 clamp(3rem, 11vw, 12rem) / .85 var(--serif); text-transform: uppercase; letter-spacing: -.02em; }
.foot-big em { font-style: italic; }
.foot-row { display: grid; grid-template-columns: 1fr auto; gap: 1rem 2rem; font-size: var(--t-small); color: var(--ink-2); border-top: 1px solid var(--rule); padding-top: 1.5rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: 1.5rem; font: 500 .8125rem / 1 var(--mono); }
.foot-house { font: 500 var(--t-label) / 1 var(--mono); letter-spacing: .12em; text-transform: uppercase; }

/* ---------- the guide's dock ---------- */

.dock {
  position: fixed; left: clamp(.75rem, 2vw, 1.75rem); bottom: clamp(.75rem, 2vw, 1.5rem); z-index: var(--z-dock);
  display: flex; align-items: flex-end; gap: .25rem; max-width: min(34rem, calc(100vw - 1.5rem));
  pointer-events: none;
}
.dock[hidden] { display: none; }
.dock > * { pointer-events: auto; }
.dock-figure { width: 6.5rem; height: 8.5rem; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50% 50% 20px 20px; }
.dock-figure .stage { width: 100%; height: 100%; }
.dock-bubble {
  position: relative; margin-bottom: 3.6rem; padding: .85rem 1.1rem 1rem; border-radius: 18px 18px 18px 4px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--rule);
  box-shadow: 0 18px 50px -24px rgb(0 0 0 / .45);
  transform-origin: 0% 100%;
}
:root.is-night .dock-bubble { background: #25233b; border-color: rgb(255 255 255 / .1); }
.dock-name { font: 500 var(--t-label) / 1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: .45rem; display: flex; align-items: center; gap: .45rem; }
.dock-name::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--guide-c, var(--gold)); }
.dock-line { font: 500 1rem / 1.45 var(--sans); min-height: 2.9em; }
.dock-hide {
  align-self: flex-start; margin-left: -.5rem; width: 1.75rem; height: 1.75rem; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-2); font-size: 1rem; line-height: 1;
}
:root[data-guide="chandler"] { --guide-c: var(--c-chandler); }
:root[data-guide="mira"] { --guide-c: var(--c-mira); }
:root[data-guide="gambler"] { --guide-c: var(--c-gambler); }
:root[data-guide="scholar"] { --guide-c: var(--c-scholar); }

/* ---------- the loader ---------- */

.loader {
  position: fixed; inset: 0; z-index: var(--z-loader); display: grid; place-items: center; align-content: center; gap: 1.5rem;
  background: #f4e8dc; color: #1d1915;
  transition: clip-path 1s cubic-bezier(.7, 0, .2, 1);
  clip-path: inset(0 0 0 0);
}
.loader.is-out { clip-path: inset(0 0 100% 0); }
.loader-horizon { position: relative; width: min(18rem, 70vw); height: 4.5rem; overflow: hidden; border-bottom: 1px solid rgb(29 25 21 / .35); }
.loader-sun { position: absolute; left: 50%; bottom: 0; width: 3.4rem; height: 3.4rem; border-radius: 50%; background: var(--gold); translate: -50% calc(100% - var(--rise, 0) * 100%); box-shadow: 0 0 40px 10px rgb(242 169 59 / .4); }
.loader-line { font: 500 .8125rem / 1 var(--mono); letter-spacing: .08em; display: flex; gap: 1rem; }
.loader-pct { min-width: 4ch; text-align: right; }

.sample-note { position: fixed; right: .35rem; top: 50%; z-index: var(--z-dock); writing-mode: vertical-rl; rotate: 180deg; translate: 0 -50%; font: 500 .625rem / 1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); pointer-events: none; }

/* ---------- motion: modern scroll-driven reveals where the browser has them ---------- */

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .entry:not(.scene) h2, .entry:not(.scene) > .entry-body > .body, .roster, .job, .paid, .pages .page, .road li, .toy, .week-head, .foot-big {
      animation: daybook-rise linear both; animation-timeline: view(); animation-range: entry 5% cover 28%;
    }
    .entry-clock { animation: daybook-tick linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }
    @keyframes daybook-rise { from { opacity: 0; translate: 0 2.5rem; } to { opacity: 1; translate: 0 0; } }
    @keyframes daybook-tick { from { opacity: 0; letter-spacing: .08em; } to { opacity: 1; } }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .asks li, .ledger li, .said, .thought, .result { opacity: 1; transform: none; }
  .frame { transform: none; border-radius: 0; }
}

/* ---------- small screens ---------- */

@media (max-width: 64rem) {
  .hero-grid { grid-template-columns: 1fr; }
  .auction, .market, .gamble, .tavern, .thinker { grid-template-columns: 1fr; }
  .roster { grid-template-columns: 1fr; }
  .road li { grid-template-columns: 2.5rem 1fr; }
  .road li p { grid-column: 2; }
  .road-state { order: 0; grid-column: 2; justify-self: start; }
  .run { grid-template-columns: 3rem minmax(0, 1fr); align-items: start; }
  .run-no { padding-top: .2rem; }
  .run-no { font-size: 1.6rem; }
  .run-links { grid-column: 2; justify-content: flex-start; }
}
@media (max-width: 48rem) {
  .bar-nav, .bar-clock .bar-day { display: none; }
  .bar { gap: .75rem; padding-block: .7rem; }
  .entry, .scene-pin { grid-template-columns: 1fr; }
  .entry-time { position: static; display: flex; align-items: baseline; gap: 1rem; padding: 0 0 1rem; }
  .entry-time, .entry-body { grid-column: 1; }
  .entry-clock { font-size: 2.75rem; }
  .hero-row:nth-child(2) { padding-left: .35em; }
  .picker-row { grid-template-columns: repeat(4, 1fr); gap: .35rem; }
  .pick { padding: .6rem .5rem; }
  .pick-tag { display: none; }
  .hero-bubble { position: static; width: auto; margin-top: .5rem; }
  .hero-bubble::after { display: none; }
  .pages { grid-template-columns: 1fr; }
  .page:nth-child(even) { translate: none; }
  .form-grid { grid-template-columns: 1fr; }
  .foot-row { grid-template-columns: 1fr; }
  .dock-figure { width: 4.75rem; height: 6.25rem; }
  .dock-bubble { margin-bottom: 2.6rem; padding: .7rem .85rem .75rem; }
  .dock-line { font-size: .875rem; min-height: 0; }
  .frame { height: 78svh; }
  .frame-wrap { height: 120svh; }
}
/* On phones, and on short windows, scenes stop pinning and simply play as they pass. */
@media (max-width: 48rem), (max-height: 40rem) {
  .scene { height: auto; }
  .scene-pin { position: relative; min-height: 0; padding-block: clamp(5rem, 12vh, 8rem); }
}
@media (prefers-contrast: more), (forced-colors: active) {
  .pick, .chip, .toy, .page, .job, .dock-bubble { outline: 1px solid CanvasText; }
}
