/* Tokens */
:root {
  /* First paint is the Atelier with the Rhodium accent (the default look); atmosphere.js rewrites these at runtime. */
  --bg: #E8DEC9;
  --bg-2: #DCCFB6;
  --ink: #2A2622;
  --ink-2: #6A6257;
  --hair: rgba(42, 38, 34, 0.2);
  --accent: #35559E;
  --accent-2: #B5472B;
  --card: rgba(238, 230, 214, 0.66);
  --shadow: rgba(42, 38, 34, 0.28);

  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --fade: 900ms;
}

/* Base */
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-variation-settings: "opsz" 14, "SOFT" 20;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--fade) linear, color var(--fade) linear;
}
* { box-sizing: border-box; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

#scene {
  position: fixed; inset: 0; width: 100%; height: 100%; display: block;
  touch-action: none;
}
#vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 80% 70% at 56% 50%, transparent 60%, var(--bg-2) 100%);
  opacity: 0.35;
  transition: background var(--fade) linear;
}
#vignette::after {
  content: ""; position: absolute; inset: 0; opacity: 0.045; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
body[data-atmosphere="lume"] #vignette::after { opacity: 0.08; mix-blend-mode: screen; }
#annotations, #labels { position: fixed; inset: 0; pointer-events: none; }
#chrome { position: fixed; inset: 0; pointer-events: none; }
#chrome > * { pointer-events: auto; }
#chrome > .director-overlay, #chrome > .macro-card, #chrome > .xlabels, #chrome > #nudge, #chrome > .tour-caption { pointer-events: none; }
#chrome > .macro-card.show { pointer-events: auto; }

/* Type roles */
.mono { font-family: var(--mono); font-weight: 400; text-transform: uppercase; letter-spacing: 0.14em; }
.mono-value { font-family: var(--mono); font-weight: 500; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; text-transform: none; }

/* Masthead */
.masthead {
  position: absolute; top: 28px; left: 32px;
  display: flex; flex-direction: column; gap: 6px;
  transition: opacity 300ms linear;
}
.masthead-dim .masthead { opacity: 0.22; }
.wordmark {
  font-family: var(--serif); font-style: italic; font-weight: 450; font-size: 30px; line-height: 1;
  font-variation-settings: "opsz" 72, "SOFT" 30;
  letter-spacing: -0.005em;
}
.subline { font-size: 10.5px; letter-spacing: 0.16em; color: var(--ink-2); }
.progress { display: none; }


/* Preloader (Revision 7): full screen in the atmosphere tokens, wordmark, a 1 px bar with the percentage,
   the stage word, and the note. Static markup so it paints before any script runs; fades 600 ms when ready. */
#preloader {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--ink);
  transition: opacity 600ms ease-out, visibility 0s linear 600ms;
}
#preloader.done { opacity: 0; visibility: hidden; pointer-events: none; }
#preloader .pl-inner { width: min(360px, 76vw); display: flex; flex-direction: column; gap: 14px; transform: translateY(-4vh); }
#preloader .pl-word {
  font-family: var(--serif); font-style: italic; font-weight: 380; font-size: 40px; line-height: 1;
  font-variation-settings: "opsz" 72, "SOFT" 30; letter-spacing: -0.005em; margin-bottom: 14px;
}
#preloader .pl-bar { position: relative; height: 1px; background: var(--hair); overflow: hidden; }
#preloader .pl-bar > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: var(--accent); }
#preloader .pl-row { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: 0.14em; color: var(--ink-2); }
#preloader .pl-row .pl-pct { color: var(--ink); font-variant-numeric: tabular-nums; }
#preloader .pl-note { margin: 18px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); max-width: 34ch; font-variation-settings: "opsz" 14, "SOFT" 30; }
@media (prefers-reduced-motion: reduce) { #preloader { transition-duration: 1ms; } }

/* Top-right cluster */
.topright {
  position: absolute; top: 30px; right: 32px;
  display: flex; align-items: flex-end; gap: 12px;
  transition: opacity 300ms linear;
}
/* Control groups (Revision 7): a tracked caption over each pill. */
.control { display: inline-flex; flex-direction: column; align-items: center; gap: 7px; }
.control .caption { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.22em; color: var(--ink-2); text-transform: uppercase; line-height: 1; text-shadow: 0 0 6px var(--bg), 0 0 14px var(--bg); transition: color var(--fade) linear, text-shadow var(--fade) linear; }
.topright .hints-button { margin-bottom: 1px; }
.pill {
  display: inline-flex; align-items: center;
  border: 1px solid var(--hair); border-radius: 999px; padding: 3px;
  background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: border-color var(--fade) linear, background-color var(--fade) linear;
}
.pill button {
  font-family: var(--mono); font-weight: 500; text-transform: uppercase; letter-spacing: 0.12em; font-size: 10.5px;
  line-height: 1; padding: 8px 14px; border-radius: 999px; color: var(--ink-2); white-space: nowrap;
  transition: color 200ms linear, background-color 200ms linear;
}
.pill button[aria-pressed="true"], .pill button[aria-checked="true"] { color: var(--bg); background: var(--ink); }
.pill button .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; box-shadow: 0 0 0 1px var(--hair); }
.icon-button {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--hair); display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-family: var(--mono); font-weight: 500; font-size: 12px;
  transition: color 200ms linear, border-color var(--fade) linear, background-color var(--fade) linear;
}
.icon-button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.icon-button svg { width: 15px; height: 15px; display: block; }
.icon-button svg .fill { fill: currentColor; }
.icon-button svg .line { stroke: currentColor; fill: none; stroke-width: 1.2; stroke-linecap: round; }
.pill.atmo .glyph { display: block; width: 13px; height: 13px; flex: none; }
.pill.atmo button { display: inline-flex; align-items: center; gap: 7px; }
.pill.atmo .glyph .fill { fill: currentColor; }
.pill.atmo .glyph .line { stroke: currentColor; fill: none; stroke-width: 1.2; stroke-linecap: round; }
.card .handle { display: none; }
.card .collapsed, .card .expanded { display: contents; }

/* Specimen card */
.card {
  position: absolute; left: 32px; top: calc(50% + 10px); transform: translateY(-50%);
  width: 300px; padding: 26px 28px;
  border: 1px solid var(--hair); background: var(--card);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; flex-direction: column; gap: 0;
  transition: opacity 300ms linear, border-color var(--fade) linear, background-color var(--fade) linear;
}
.card .figure { font-size: 10px; color: var(--ink-2); }
.card .title {
  font-family: var(--serif); font-style: italic; font-weight: 420; font-size: 40px; line-height: 1.05; margin-top: 10px;
  font-variation-settings: "opsz" 96, "SOFT" 30; letter-spacing: -0.01em;
}
.card .subtitle { font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-top: 8px; transition: color var(--fade) linear; }
.card .prose { font-family: var(--serif); font-weight: 380; font-size: 15.5px; line-height: 1.45; margin-top: 18px; font-variation-settings: "opsz" 14, "SOFT" 30; }
.readouts { margin-top: 20px; display: flex; flex-direction: column; gap: 9px; }
.readout { position: relative; display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 5px; }
.readout .label { font-size: 10px; color: var(--ink-2); }
.readout .value { font-size: 12px; }
.readout .value.stopped { color: var(--accent-2); }
.readout .bar { position: absolute; left: 0; bottom: 0; width: 60%; height: 1px; background: var(--hair); }
.readout .bar > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: var(--accent); transition: width 120ms linear, background-color var(--fade) linear; }
.trace { margin-top: 16px; }
.trace canvas { display: block; width: 244px; height: 48px; }
.trace .caption { font-size: 9px; color: var(--ink-2); margin-top: 6px; letter-spacing: 0.14em; }
.wind { display: none; margin-top: 18px; height: 44px; border: 1px solid var(--hair); border-radius: 8px; font-family: var(--mono); font-weight: 500; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); -webkit-user-select: none; user-select: none; touch-action: none; }
.wind:active, .wind.held { background: var(--ink); color: var(--bg); }
[data-touch="true"] .wind { display: block; }
.card .nowebgl { font-family: var(--serif); font-weight: 380; font-size: 15.5px; line-height: 1.45; margin-top: 18px; }

/* Bottom row */
/* Centred with the independent translate property so the arrive animation's transform cannot override it (that
   override had left the pill's left edge on the centre line since Revision 1). */
.modectl { position: absolute; bottom: 30px; left: 50%; width: max-content; translate: -50% 0; transition: opacity 300ms linear; }
.colorctl { position: absolute; bottom: 30px; right: 32px; transition: opacity 300ms linear; align-items: flex-end; }
.colorctl .caption { padding-right: 14px; }
/* Stops 24 px short of the centred view pill (312 px wide): half the viewport, less the 32 px left inset, half the pill
   and the gap. The old 50vw - 150px ignored the inset and ran under the pill below about 1300 px. */
.hints { position: absolute; bottom: 30px; left: 32px; display: flex; flex-direction: column; gap: 6px; transition: opacity 300ms linear; max-width: calc(50vw - 32px - 156px - 24px); }
.hints .line { font-family: var(--mono); font-size: 10px; letter-spacing: 0.02em; color: var(--ink); opacity: 0.6; text-transform: none; }
.hints .footer { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.02em; color: var(--ink-2); opacity: 0.5; text-transform: none; }

/* Hints popover */
.popover {
  position: absolute; top: 76px; right: 32px; width: 340px; padding: 18px 20px;
  border: 1px solid var(--hair); background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: none; flex-direction: column; gap: 8px;
}
.popover.open { display: flex; }
.popover .row { display: flex; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; }
.popover .row .k { color: var(--ink); font-weight: 500; white-space: nowrap; }
.popover .row .d { color: var(--ink-2); text-align: right; text-transform: none; }
.popover .row .k span + span::before { content: " · "; color: var(--ink-2); font-weight: 400; }

/* Director overlay */
.director-overlay {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink);
  padding: 10px 16px; border: 1px solid var(--hair); background: var(--card); opacity: 0; pointer-events: none;
  transition: opacity 200ms linear;
}
.director-overlay.show { opacity: 1; }

/* Macro card */
.macro-card {
  position: absolute; width: 284px; padding: 16px 18px; pointer-events: none;
  border: 1px solid var(--hair); background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; transform: translateY(6px); transition: opacity 240ms ease-out, transform 240ms ease-out;
}
.macro-card.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.macro-card .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.macro-card .label { font-family: var(--serif); font-weight: 460; font-size: 21px; line-height: 1.1; letter-spacing: -0.005em; color: var(--ink); font-variation-settings: "opsz" 32, "SOFT" 20; }
.macro-card .close { appearance: none; border: 1px solid var(--hair); background: transparent; color: var(--ink-2); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; margin: -4px -6px -4px 0; transition: color 160ms linear, border-color 160ms linear, background 160ms linear; }
.macro-card .close:hover { color: var(--ink); border-color: var(--ink-2); }
.macro-card .close:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.macro-card .spec { margin-top: 10px; display: flex; flex-direction: column; }
.macro-card .stat { align-self: flex-start; font-size: 10px; letter-spacing: 0.08em; text-transform: none; color: var(--ink); border: 1px solid var(--hair); padding: 4px 8px 3px; margin: 0 0 12px; }
.macro-card .stat[hidden], .macro-card [hidden] { display: none; }
.macro-card .cap { font-size: 8.5px; letter-spacing: 0.2em; color: var(--ink-2); }
.macro-card .line { margin: 5px 0 12px; font-family: var(--serif); font-size: 15px; line-height: 1.4; font-weight: 400; color: var(--ink); font-variation-settings: "opsz" 14, "SOFT" 10; }
.macro-card .line:last-child { margin-bottom: 0; }
.macro-card .nav { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--hair); font-size: 9.5px; letter-spacing: 0.08em; }
.macro-card .nav .counter { color: var(--ink-2); }
.macro-card .navbtn { appearance: none; border: 0; background: transparent; color: var(--ink); font: inherit; letter-spacing: inherit; text-transform: uppercase; padding: 6px 4px; cursor: pointer; opacity: 0.85; transition: opacity 160ms linear, color 160ms linear; }
.macro-card .navbtn:hover { opacity: 1; color: var(--accent); }
.macro-card .navbtn:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.macro-card .navbtn span { font-size: 14px; line-height: 0; position: relative; top: 1px; }

/* Winding nudge: a hairline from the crown to a pill that is held. */
#nudge { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 360ms ease-out; }
#nudge.show { opacity: 1; }
#nudge svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#nudge .lead { fill: none; stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: var(--len, 160); stroke-dashoffset: var(--len, 160); }
#nudge .lead.draw { animation: nudgeDraw 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes nudgeDraw { to { stroke-dashoffset: 0; } }
#nudge .anchor { fill: var(--ink-2); }
.nudge-pill {
  position: absolute; left: 0; top: 0; pointer-events: auto; appearance: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 9px 16px 9px 14px; border-radius: 999px; border: 1px solid var(--hair);
  background: var(--card); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: var(--ink); font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  animation: nudgeIn 600ms cubic-bezier(0.2, 0.7, 0.2, 1) 500ms both; touch-action: none; user-select: none; -webkit-user-select: none;
  transition: background 200ms linear, border-color 200ms linear, color 200ms linear, transform 200ms ease-out;
}
#nudge.flip .nudge-pill { align-items: flex-end; text-align: right; }
.nudge-pill .label { font-weight: 600; position: relative; padding-left: 14px; }
#nudge.flip .nudge-pill .label { padding-left: 0; padding-right: 14px; }
.nudge-pill .label::before { content: ""; position: absolute; left: 0; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); transform: translateY(-50%); animation: nudgePulse 1.6s ease-in-out infinite; }
#nudge.flip .nudge-pill .label::before { left: auto; right: 0; }
.nudge-pill .sub { font-size: 8.5px; letter-spacing: 0.08em; text-transform: none; color: var(--ink-2); }
/* Power bar (Revision 7): 64 x 2 px under the label, the fill is the reserve. Inverts with the pill. */
.nudge-pill .power { position: relative; display: block; width: 64px; height: 2px; margin: 3px 0 2px; background: var(--hair); border-radius: 1px; overflow: hidden; }
#nudge.flip .nudge-pill .power { margin-left: auto; }
.nudge-pill .power > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width 200ms linear; }
.nudge-pill.holding .power, .nudge-pill.auto .power { background: rgba(255, 255, 255, 0.18); }
.nudge-pill.holding .power > i, .nudge-pill.auto .power > i { background: var(--bg); }
.nudge-pill:hover { border-color: var(--ink-2); }
.nudge-pill.holding { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.nudge-pill.holding .sub { color: var(--bg); opacity: 0.7; }
.nudge-pill.holding .label::before { animation: none; background: var(--bg); }
/* Auto-wind (Revision 6): the pill inverts while the crown turns and a hairline fills along its bottom edge. */
.nudge-pill.auto { background: var(--ink); color: var(--bg); border-color: var(--ink); overflow: hidden; }
.nudge-pill.auto .sub { color: var(--bg); opacity: 0.7; }
.nudge-pill.auto .label::before { animation: nudgeSpin 900ms linear infinite; background: transparent; border: 1.5px solid var(--bg); border-right-color: transparent; width: 6px; height: 6px; }
@keyframes nudgeSpin { to { transform: translateY(-50%) rotate(360deg); } }
.nudge-pill.auto::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--accent); transform-origin: left; animation: nudgeFill 3s linear both; }
@keyframes nudgeFill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.nudge-pill:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
.nudge-pill.stopped .label::before { background: var(--accent); }
@keyframes nudgePulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 60% { box-shadow: 0 0 0 6px transparent; } }
@keyframes nudgeIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; } }
.cinematic #nudge, .tour #nudge, body[data-macro] #nudge { opacity: 0 !important; pointer-events: none; }

/* Tour: the interface steps back; one caption at a time. */
.tour .card, .tour #annotations, .tour .hints, .tour .labels-chip, .tour .macro-card { opacity: 0 !important; pointer-events: none !important; }
.tour-caption {
  position: absolute; left: 50%; bottom: 112px; transform: translate(-50%, 8px); width: min(560px, calc(100vw - 48px)); text-align: center; pointer-events: none;
  padding: 14px 22px 16px; border: 1px solid var(--hair); background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; transition: opacity 320ms ease-out, transform 320ms ease-out;
}
.tour-caption.show { opacity: 1; transform: translate(-50%, 0); transition: opacity 480ms ease-out 160ms, transform 560ms cubic-bezier(0.2, 0.7, 0.2, 1) 160ms; }
.tour-caption .index { font-size: 9px; letter-spacing: 0.16em; color: var(--ink-2); margin-bottom: 8px; }
.tour-caption .text { font-family: var(--serif); font-style: italic; font-weight: 420; font-size: 24px; line-height: 1.25; color: var(--ink); font-variation-settings: "opsz" 48, "SOFT" 30; text-wrap: balance; }
[data-layout="mobile"] .tour-caption { bottom: 128px; }
[data-layout="mobile"] .tour-caption .text { font-size: 19px; }

/* Load and cinematic states (Revision 4: the interface composes itself at the end of the opening) */
.cinematic #chrome > *:not(.masthead):not(.card), .cinematic #annotations { opacity: 0 !important; pointer-events: none; }
.card.pre { clip-path: inset(0 100% 0 0); }
.card.in { animation: cardWipe 760ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes cardWipe { from { clip-path: inset(-1px 100% -1px -1px); } to { clip-path: inset(-1px -1px -1px -1px); } }
.card > * { transition: opacity 640ms cubic-bezier(0.2, 0.7, 0.2, 1), transform 640ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.card.pre > * { opacity: 0; transform: translateY(16px); transition: none; }
.card.in > .figure { transition-delay: 380ms; }
.card.in > .title { transition-delay: 450ms; }
.card.in > .subtitle { transition-delay: 540ms; }
.card.in > .collapsed { transition-delay: 560ms; }
.card.in > .prose { transition-delay: 620ms; }
.card.in > .readouts { transition-delay: 720ms; }
.card.in > .trace { transition-delay: 860ms; }
.card.in > .wind { transition-delay: 940ms; }
.card.in > .expanded { transition-delay: 720ms; }
.card.in .readout:nth-child(2) { transition-delay: 60ms; }
.card.in .readout:nth-child(3) { transition-delay: 120ms; }
.card.in .readout:nth-child(4) { transition-delay: 180ms; }
.card.in .readout { transition: opacity 500ms ease-out; }
.card.pre .readout { opacity: 0; }
/* The chrome arrives: pills and hints rise in, staggered; the margin notes write in with their hairlines. */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.arrive .topright { animation: rise 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.arrive .modectl { animation: rise 700ms cubic-bezier(0.2, 0.7, 0.2, 1) 120ms both; }
.arrive .colorctl { animation: rise 700ms cubic-bezier(0.2, 0.7, 0.2, 1) 220ms both; }
.arrive .hints { animation: rise 700ms cubic-bezier(0.2, 0.7, 0.2, 1) 320ms both; }
.arrive .labels-chip { animation: rise 700ms cubic-bezier(0.2, 0.7, 0.2, 1) 200ms both; }
#annotations svg > g:not(.drawing) { opacity: 0; }
#annotations svg.in > g:not(.drawing) { animation: noteIn 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(200ms + var(--i, 0) * 90ms); }
@keyframes noteIn { from { opacity: 0; transform: translateX(8px); } to { opacity: 0.72; transform: none; } }
#annotations svg.in .hair { stroke-dashoffset: 0; transition: stroke-dashoffset 900ms cubic-bezier(0.2, 0.7, 0.2, 1); transition-delay: calc(380ms + var(--i, 0) * 90ms); }
#annotations svg:not(.in) g:not(.drawing) .hair { stroke-dashoffset: var(--len, 90); }
#annotations .drawing { opacity: 0; transition: opacity 1200ms linear 300ms; }
#annotations svg.in .drawing { opacity: 0.42; }
@media (prefers-reduced-motion: reduce) {
  .card.in, .arrive .topright, .arrive .modectl, .arrive .colorctl, .arrive .hints, .arrive .labels-chip, #annotations svg.in > g { animation-duration: 1ms !important; animation-delay: 0ms !important; }
  .card > *, #annotations .hair, #annotations .drawing { transition-duration: 1ms !important; transition-delay: 0ms !important; }
}
.masthead > * { transition: opacity 500ms ease-out, transform 500ms ease-out; }
.masthead.pre > * { opacity: 0; transform: translateY(-6px); transition: none; }
.moment-hidden #chrome > *:not(.director-overlay), .moment-hidden #annotations { opacity: 0 !important; pointer-events: none; transition: none; }

/* Exploded labels */
.xlabels { position: absolute; inset: 0; pointer-events: none; display: none; }
.xlabels svg { pointer-events: none; }
.xlabels.show { display: block; }
.xlabels svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.xlabels .leader { stroke: var(--ink-2); stroke-width: 1; fill: none; opacity: 0; transition: opacity 240ms linear; }
.xlabels .anchor { fill: var(--ink-2); opacity: 0; transition: opacity 240ms linear; }
.xlabels .leader.in, .xlabels .anchor.in { opacity: 0.6; }
.xlabels.portrait .leader.in { opacity: 0.3; }
.xlabel { position: absolute; pointer-events: auto; font-family: var(--mono); font-weight: 400; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); line-height: 20px; height: 20px; padding: 0 2px; white-space: nowrap; opacity: 0; transform: translateY(4px); transition: opacity 240ms ease-out, transform 240ms ease-out; }
.xlabel.in { opacity: 1; transform: none; }
.xlabel:hover { color: var(--accent); }

/* Annotations (both atmospheres since Revision 5: Lume is the default and the plain words must be there) */
#annotations { transition: opacity var(--fade) linear; }
body[data-atmosphere="lume"] #annotations { opacity: 0.9; }
#annotations svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#annotations text { font-family: var(--serif); font-style: italic; font-weight: 380; font-size: 13px; fill: var(--ink-2); font-variation-settings: "opsz" 14, "SOFT" 30; }
#annotations .hair { stroke: var(--ink-2); stroke-width: 1; fill: none; }
#annotations .arc { stroke: var(--ink-2); stroke-width: 0.8; fill: none; }
body[data-mode="exploded"] #annotations, body[data-macro] #annotations { opacity: 0 !important; }

.idle #chrome > *:not(.card):not(.macro-card):not(#nudge), .idle #annotations { opacity: 0; pointer-events: none; }
.idle .macro-card { opacity: 0; }
[data-layout="mobile"].idle .card { opacity: 1; }
#scene.pointer { cursor: pointer; }

.chrome-hidden #chrome > *:not(.card), .chrome-hidden #annotations { opacity: 0 !important; pointer-events: none !important; }
/* #film: the take has no chrome at all; the card comes back with the rest when the take ends. */
.film #chrome > *:not(.tour-caption), .film #annotations, .film .nudge-pill { opacity: 0 !important; pointer-events: none !important; }
.director-hidden #chrome > *:not(.director-overlay), .director-hidden #annotations { opacity: 0 !important; pointer-events: none !important; }
/* Sizzle reels (12): a take hides everything at once and the cursor with it; the interface fades back after. */
.reel #chrome, .reel #annotations, .reel #labels, .reel .nudge-pill { opacity: 0 !important; pointer-events: none !important; transition: none !important; }
.reel, .reel * { cursor: none !important; }
.reel-out #chrome, .reel-out #annotations, .reel-out #labels { transition: opacity 700ms linear; }
/* Takes that show the page: all of it, the tour's captions only, or Dissected's labels only. */
.reel.reel-ui-full #chrome, .reel.reel-ui-full #annotations, .reel.reel-ui-full #labels,
.reel.reel-ui-captions #chrome, .reel.reel-ui-labels #labels { opacity: 1 !important; }
.reel.reel-ui-captions #chrome > *:not(.tour-caption) { opacity: 0 !important; transition: none !important; }
/* The long takes fade the interface in and out between their cinematic stretches and their demonstrations. */
.reel.reel-ui-fade #chrome, .reel.reel-ui-fade #annotations, .reel.reel-ui-fade #labels { transition: opacity 650ms ease !important; }
.reel-pointer { position: fixed; left: 0; top: 0; z-index: 75; pointer-events: none; opacity: 0; transition: opacity 250ms linear; will-change: transform; }
.reel-pointer.on { opacity: 1; }
.reel-pointer svg { display: block; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45)); transform-origin: 3px 3px; }
.reel-pointer .ring { position: absolute; left: -15px; top: -15px; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--accent); opacity: 0; }
.reel-pointer.tap .ring { animation: reel-ring 560ms ease-out; }
.reel-pointer.tap svg { animation: reel-press 300ms ease-out; }
@keyframes reel-ring { from { transform: scale(0.35); opacity: 0.95; } to { transform: scale(1.5); opacity: 0; } }
@keyframes reel-press { 40% { transform: scale(0.84); } }
.reel-menu {
  position: fixed; left: 50%; top: 50%; translate: -50% -50%; z-index: 70; width: 380px; padding: 18px 20px 14px;
  border: 1px solid var(--hair); background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; flex-direction: column; opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 160ms linear, visibility 0s linear 160ms;
}
.reel-menu.open { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 160ms linear; }
.reel-menu .title { font-size: 10px; color: var(--ink-2); margin-bottom: 4px; }
.reel-menu .list { max-height: min(54vh, 400px); overflow-y: auto; margin: 0 -8px; padding: 0 8px; scrollbar-width: thin; scrollbar-color: var(--hair) transparent; }
.reel-menu .sect { font-size: 9px; color: var(--ink-2); opacity: 0.8; margin: 10px 0 2px; }
.reel-menu .row { display: grid; grid-template-columns: 18px 1fr auto; align-items: baseline; gap: 10px; padding: 7px 8px; margin: 0 -8px; width: calc(100% + 16px); text-align: left; }
.reel-menu .row:hover, .reel-menu .row:focus-visible { background: var(--hair); outline: none; }
.reel-menu .row .k { font-family: var(--mono); font-size: 10px; color: var(--accent); }
.reel-menu .row .name { font-style: italic; font-size: 16px; }
.reel-menu .row .d { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em; color: var(--ink-2); }
.reel-menu .foot { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.02em; color: var(--ink-2); margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  :root { --fade: 0ms; }
}

/* Mobile layout: viewports under 760 px wide or aspect below 0.8 */
[data-layout="mobile"] .masthead { top: 18px; left: 18px; }
[data-layout="mobile"] .wordmark { font-size: 24px; }
[data-layout="mobile"] .subline { font-size: 9px; letter-spacing: 0.12em; margin-top: 4px; max-width: 60vw; white-space: normal; line-height: 1.5; }
[data-layout="mobile"] .masthead .progress { width: 160px; }
[data-layout="mobile"] .topright { top: 16px; right: 16px; gap: 8px; }
[data-layout="mobile"] .pill.atmo .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[data-layout="mobile"] .pill.atmo .glyph { display: block; }
[data-layout="mobile"] .pill.atmo button { padding: 0; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; position: relative; }
[data-layout="mobile"] .pill.atmo button[aria-pressed="true"] { background: transparent; color: var(--accent); }
[data-layout="mobile"] .icon-button { width: 44px; height: 44px; }
[data-layout="mobile"] .hints-button { display: none; }
[data-layout="mobile"] .popover { top: 70px; right: 16px; left: 16px; width: auto; }
[data-layout="mobile"] #annotations { display: none; }

[data-layout="mobile"] .card {
  left: 10px; right: 10px; top: auto; bottom: 10px; transform: none; width: auto;
  padding: 10px 20px 18px; border-radius: 20px; gap: 0; max-height: 78vh; overflow: hidden;
  transition: opacity 300ms linear, border-color var(--fade) linear, background-color var(--fade) linear;
}
[data-tier="mobile"][data-layout="mobile"] .card { backdrop-filter: none; -webkit-backdrop-filter: none; background: color-mix(in srgb, var(--bg) 90%, transparent); }
[data-layout="mobile"] .card .handle { display: block; width: 44px; height: 22px; margin: 0 auto 4px; position: relative; touch-action: none; }
[data-layout="mobile"] .card .handle::after { content: ""; position: absolute; left: 50%; top: 9px; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--ink-2); opacity: 0.45; }
[data-layout="mobile"] .card .figure { font-size: 9px; }
[data-layout="mobile"] .card .title { font-size: 30px; margin-top: 4px; cursor: pointer; }
[data-layout="mobile"] .card .subtitle { margin-top: 4px; }
[data-layout="mobile"] .card .collapsed { display: block; margin-top: 12px; }
[data-layout="mobile"] .card .collapsed .readout { margin-bottom: 0; }
[data-layout="mobile"] .card .collapsed .wind { display: block; margin-top: 12px; height: 46px; width: 100%; }
[data-layout="mobile"] .card .prose, [data-layout="mobile"] .card .readouts, [data-layout="mobile"] .card .trace, [data-layout="mobile"] .card .expanded { display: none; }
[data-layout="mobile"] .card.open .prose, [data-layout="mobile"] .card.open .readouts, [data-layout="mobile"] .card.open .trace { display: block; }
[data-layout="mobile"] .card.open .readouts { display: flex; }
[data-layout="mobile"] .card.open .expanded { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
[data-layout="mobile"] .card.open { overflow-y: auto; }
[data-layout="mobile"] .card .prose { font-size: 14.5px; margin-top: 14px; }
[data-layout="mobile"] .card .trace canvas { width: 100%; height: 48px; }
[data-layout="mobile"] .card .expanded .colorctl { position: static; transform: none; align-self: flex-start; align-items: flex-start; }
[data-layout="mobile"] .card .expanded .colorctl .caption { padding: 0 0 0 4px; }
[data-layout="mobile"] .card .expanded .hints { position: static; max-width: none; }
[data-layout="mobile"] .modectl { bottom: calc(var(--sheet-h, 190px) + 22px); }
[data-layout="mobile"] .pill button { min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; }
[data-layout="mobile"] .modepill button { padding: 0 12px; font-size: 10px; letter-spacing: 0.1em; }
[data-layout="mobile"] .pill.atmo button { min-height: 38px; }
[data-layout="mobile"] .macro-card { width: auto; left: 16px !important; right: 16px; }
[data-layout="mobile"] .director-overlay { font-size: 9px; letter-spacing: 0.1em; white-space: nowrap; }
[data-layout="mobile"] .xlabel { font-size: 9.5px; line-height: 16px; height: 16px; }
[data-layout="mobile"].idle .card { opacity: 1; }

/* Focus */
button:focus-visible, .xlabel:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; border-radius: 999px; }
.card .handle:focus-visible, .wind:focus-visible { border-radius: 8px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .card > *, .masthead > *, .macro-card, .xlabel, .xlabels .leader, .xlabels .anchor { transition-duration: 1ms !important; }
}
#scene.fade-in { animation: sceneFade 600ms linear both; }
@keyframes sceneFade { from { opacity: 0; } to { opacity: 1; } }

/* Short desktop windows: the card gives up its prose and tightens so it clears the masthead and the pills. */
@media (min-width: 760px) and (max-height: 720px) {
  [data-layout="desktop"] .card { padding: 18px 20px; }
  [data-layout="desktop"] .card .title { font-size: 30px; }
  [data-layout="desktop"] .card .prose { display: none; }
  [data-layout="desktop"] .card .readouts { margin-top: 14px; }
}
@media (min-width: 760px) and (max-height: 560px) {
  [data-layout="desktop"] .card .trace { display: none; }
}

/* Narrow desktop windows: the preset chips step above the mode pill instead of colliding with it. */
@media (min-width: 760px) and (max-width: 1040px) {
  [data-layout="desktop"] .colorctl { bottom: 92px; }
}

/* Exploded labels: desktop rows are placed absolutely; portrait uses one scrolling column under the stack. */
.xlabels .xlist { position: absolute; inset: 0; pointer-events: none; }
.xlabels.portrait .xlist { left: 18px; right: 18px; bottom: auto; display: flex; flex-direction: column; overflow-y: auto; pointer-events: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; mask-image: linear-gradient(to bottom, transparent, #000 10px, #000 calc(100% - 10px), transparent); -webkit-mask-image: linear-gradient(to bottom, transparent, #000 10px, #000 calc(100% - 10px), transparent); }
.xlabels.portrait .xlist::-webkit-scrollbar { display: none; }
.xlabels.portrait .xlabel { position: static; flex: 0 0 16px; height: 16px; line-height: 16px; font-size: 9.5px; letter-spacing: 0.1em; align-self: flex-start; transform: none; }
.labels-chip { display: none; position: absolute; right: 16px; bottom: calc(var(--sheet-h, 190px) + 76px); font-family: var(--mono); font-weight: 500; font-size: 10px; letter-spacing: 0.12em; padding: 8px 12px; border: 1px solid var(--hair); border-radius: 999px; color: var(--ink-2); background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: opacity 300ms linear, color 200ms linear, background-color 200ms linear; }
.labels-chip[aria-pressed="true"] { color: var(--bg); background: var(--ink); }
body[data-layout="mobile"][data-mode="exploded"] .labels-chip { display: inline-flex; }
