/* Don't Queue At The Bar
   Big type, one idea per screen, scrolling down a very long page. */

:root {
  --cream: #fff4dc;
  --ink:   #16161d;
  --green: #0f5b43;
  --amber: #ffb627;
  --red:   #d62839;   /* deep enough for cream text at 4.5:1 */
  --red-soft: #ff6b76; /* red text on ink */
  --pink:  #ff9ec1;
  --blue:  #2447f5;

  --font: "Avenir Next", "Helvetica Neue", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  text-align: center;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Browser surfaces: selection, focus and caret come from the palette. */
::selection { background: var(--ink); color: var(--amber); }
.c-ink ::selection, .c-green ::selection, .c-blue ::selection, .c-red ::selection,
.site-footer ::selection { background: var(--amber); color: var(--ink); }

a:focus-visible { outline: 3px solid currentColor; outline-offset: 4px; border-radius: 4px; }

/* Skip link: first tab stop, visible only on focus. */
.skip {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 0.7em 1.2em;
  background: var(--ink);
  color: var(--cream);
  border: 3px solid var(--amber);
  border-radius: 999px;
  font-weight: 900;
  text-decoration: none;
  translate: 0 -200%;
}
.skip:focus-visible { translate: 0 0; outline: none; }

/* ---------- Screens (full-viewport sections) ---------- */

.screen {
  --sx: 6vw; /* side padding; the history strip bleeds out by this much */
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 12vh var(--sx);
  overflow: hidden;
}

.inner { width: min(1200px, 100%); }

.c-cream { background: var(--cream); color: var(--ink); }
.c-ink   { background: var(--ink);   color: var(--cream); }
.c-green { background: var(--green); color: var(--cream); }
.c-amber { background: var(--amber); color: var(--ink); }
.c-red   { background: var(--red);   color: var(--cream); }
.c-pink  { background: var(--pink);  color: var(--ink); }
.c-blue  { background: var(--blue);  color: var(--cream); }

/* ---------- Type ---------- */

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }

.mega {
  font-size: clamp(3rem, 12vw, 11rem);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-transform: lowercase;
}

.mega.upper { text-transform: uppercase; font-size: clamp(2.6rem, 10.5vw, 9.5rem); }

.big {
  font-size: clamp(2.2rem, 7vw, 6rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.mid {
  font-size: clamp(1.3rem, 3.2vw, 2.6rem);
  line-height: 1.3;
  font-weight: 600;
  margin-top: 0.8em;
}

.small {
  font-size: clamp(1rem, 2vw, 1.6rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  opacity: 0.8;
  margin: 0.8em 0;
}

.c-red .small, .c-blue .small { opacity: 1; } /* 80% cream on red or blue falls under 4.5:1 */
.dim { opacity: 0.55; }
.accent { color: var(--amber); }
.mega + .mid, .big + .mid, .mid + .big { margin-top: 1em; }

a.plain { color: inherit; text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 3px; }

.cta {
  display: inline-block;
  margin-top: 1.4em;
  padding: 0.75em 1.5em;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-weight: 900;
  font-size: clamp(1.1rem, 2.6vw, 1.6rem);
  text-decoration: none;
  transition: scale 0.15s ease;
}

.cta:hover { scale: 1.03; }
.cta:focus-visible { outline: 4px solid var(--cream); outline-offset: 4px; }

.tag {
  display: inline-block;
  margin-top: 1.4em;
  padding: 0.45em 1.1em;
  border: 3px solid currentColor;
  border-radius: 999px;
  font-weight: 900;
  font-size: clamp(0.9rem, 1.8vw, 1.3rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  rotate: -3deg;
}

/* ---------- Hero ---------- */

/* --pf is the promo sticker's font size, which scales the whole sticker. The hero
   keeps that much room free at the bottom so the corner sticker never covers the title. */
.hero {
  --pf: clamp(7px, min(2.2vw, 1.8vh), 13px);
  padding-top: 6vh;
  padding-bottom: calc(var(--pf) * 16.5);
}
.hero .mega { font-size: clamp(1.8rem, min(13vw, 18vh), 12rem); text-transform: none; }
.hero .inner > * { animation: rise 0.9s cubic-bezier(.2, .8, .2, 1) both; }
.hero .inner > :nth-child(2) { animation-delay: 0.1s; }
.hero .inner > :nth-child(3) { animation-delay: 0.25s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(50px); }
  to   { opacity: 1; transform: none; }
}

/* The brand lockup, top left of the hero, linking home: the roundel beside the name, in
   ink on the cream (brand/BRIEF.md has the rules). 64px tall on desktop, never under 40px.
   Its clear space is an eighth of the mark's width (8px at 64px), so the offsets stay
   above that. The timeline rail is hidden on the hero and the promo sticker is bottom
   right, so nothing meets it. Flat, no shadow. */
.brand {
  position: absolute;
  top: clamp(14px, 3vh, 28px);
  left: clamp(14px, 3vw, 32px);
  z-index: 2;
  display: block;
  height: clamp(40px, 5vw, 64px);
}
.brand img { display: block; height: 100%; width: auto; }
.brand:focus-visible { outline: 3px solid var(--ink); outline-offset: 8px; border-radius: 4px; }

.scroll-hint {
  position: absolute;
  bottom: 4vh;
  left: 50%;
  translate: -50% 0;
  font-size: 3rem;
  font-weight: 900;
  color: inherit;
  text-decoration: none;
  animation: bob 1.6s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(12px); }
}

/* Very short screens (phones on their side): a smaller title leaves the corner clear. */
@media (max-height: 450px) {
  .hero .mega { font-size: min(11vw, 14.5vh); }
  .hero .mid { font-size: clamp(1rem, 2.4vw, 1.4rem); margin-top: 0.4em; }
}

/* Kitsch promo sticker: always the bottom right of the hero, swelling and shrinking.
   Everything inside is in em, so one font-size (--pf) scales the whole sticker with
   the screen. The scroll arrow keeps the bottom centre. */
.promo {
  position: absolute;
  right: max(12px, 1.6em);
  bottom: max(12px, 1.6em);
  z-index: 2;
  font-size: var(--pf);
  width: 15em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
  padding: 1.05em 1.3em 1.15em;
  border: 0.2em solid var(--ink);
  border-radius: 1.5em;
  background: var(--red);
  color: var(--cream);
  box-shadow: 0.4em 0.4em 0 var(--ink);
  text-decoration: none;
  text-wrap: balance;
  rotate: -4deg;
  transform-origin: 70% 70%;
  animation: promo-pulse 1.8s ease-in-out infinite;
}
.promo::before {
  content: "";
  position: absolute;
  inset: 0.3em;
  border: 0.12em dashed var(--cream);
  border-radius: 1.15em;
  pointer-events: none;
}
.promo .promo-big {
  font-size: 1.9em;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-shadow: 0.07em 0.07em 0 var(--ink);
}
.promo .promo-big em { font-style: normal; color: var(--amber); }
.promo .promo-small {
  font-size: 0.95em;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.04em;
  padding: 0.3em 0.85em;
  border-radius: 1em;
  background: var(--ink);
}
.promo:hover { animation-play-state: paused; scale: 1.06; }
.promo:focus-visible { outline: 4px solid var(--ink); outline-offset: 6px; }

@keyframes promo-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.07); }
}

/* Phones in portrait: the arrow stays centred at the very bottom and the sticker
   sits right-aligned just above it, so the two never touch. */
@media (max-width: 560px) and (min-height: 451px) {
  .hero {
    --pf: clamp(8px, 3vw, 12px);
    padding-bottom: calc(var(--pf) * 16 + 4rem);
  }
  .scroll-hint { font-size: 2.4rem; }
  .promo {
    right: 12px;
    bottom: calc(4vh + 3.4rem);
  }
}

/* ---------- Pub scenes (built by script.js) ---------- */

.scene {
  --d: 5.2%;
  position: relative;
  width: min(760px, 100%, 58vh);
  aspect-ratio: 16 / 11;
  margin: 5vh auto 3vh;
  background: #0e0e13;
  color: var(--cream);
  border: 4px solid rgba(255, 244, 220, 0.9);
  border-radius: 24px;
  overflow: hidden;
  contain: layout paint; /* dots move by left/top; keep that layout work inside the stage */
  text-align: left;
}

.scene::after {
  content: attr(data-label);
  position: absolute;
  left: 4%;
  bottom: 4%;
  font-weight: 900;
  font-size: clamp(0.7rem, 1.8vw, 1.1rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.scene-stage { position: absolute; inset: 0; }

.scene-bar {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 14%;
  height: 5%;
  background: #c98a3e;
  border-radius: 6px;
  box-shadow: 0 5px 0 #8a5a22;
}

.scene-score {
  position: absolute;
  right: 4%;
  bottom: 4%;
  z-index: 2;
  text-align: right;
  font-weight: 800;
  font-size: clamp(0.7rem, 1.6vw, 1rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.1;
}

.scene-score b {
  display: block;
  color: var(--amber);
  font-size: clamp(1.8rem, 6vw, 3.4rem);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.dot {
  position: absolute;
  width: var(--d);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.7s ease, top 0.7s ease, opacity 0.5s ease, transform 0.3s ease, background 0.3s ease;
}

.dot.staff { background: var(--cream); }
.dot.staff.idle { opacity: 0.3; }
.dot.staff.busy { box-shadow: 0 0 0 4px rgba(255, 182, 39, 0.7); }

.dot.cust { background: var(--pink); }
.dot.cust.c1 { background: #7f95ff; }
.dot.cust.c2 { background: #4ad295; }
.dot.cust.c3 { background: #ff6b76; }
.dot.cust.c4 { background: #ffd36a; }
.dot.cust.serving {
  transform: translate(-50%, -50%) scale(1.25); /* keeps its own colour */
  transition-delay: 0s, 0.35s, 0s, 0s, 0s; /* steps up to the bar just after the last customer has gone */
}

/* A customer with their drink, heading away from the bar */
.dot.cust.leaving {
  transition: left 1.3s ease-in, top 1.3s ease-in, opacity 0.6s ease 0.7s, transform 0.3s ease, background 0.3s ease;
}

.dot.cust.has-drink::after {
  content: "";
  position: absolute;
  right: -22%;
  top: 8%;
  width: 42%;
  height: 66%;
  background: linear-gradient(var(--cream) 0 28%, var(--amber) 28% 100%);
  border-radius: 2px 2px 4px 4px;
}

/* A pint sliding across the bar from staff to customer */
.pint {
  position: absolute;
  z-index: 1;
  width: 2.6%;
  aspect-ratio: 0.62;
  transform: translate(-50%, -50%);
  background: linear-gradient(var(--cream) 0 28%, var(--amber) 28% 100%);
  border-radius: 2px 2px 5px 5px;
  transition: left 0.4s ease-in-out, top 0.4s ease-in-out;
}

/* ---------- Rule sections ---------- */

.rule-title {
  font-size: clamp(2.6rem, 9vw, 8rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-transform: lowercase;
}

.rule-title .num {
  display: block;
  font-size: 1.1em;
  opacity: 0.55;
}

.rule .scene { margin-top: 3vh; }

.versus .pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 1.5rem;
  margin: 4vh auto 1vh;
}

.versus .scene { margin: 0; width: 100%; }

/* ---------- Source lines (real figures carry one; worked examples say so) ---------- */

.src {
  width: min(62ch, 100%);
  margin: 1.6em auto 0;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0.75;
  text-wrap: pretty;
}

.src a { color: inherit; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.src a:hover { text-decoration-thickness: 3px; }

/* ---------- The maths: two bars, time to serve twenty orders ---------- */

.maths .mid { text-wrap: balance; }
.maths .tag { margin-top: 2.2em; }

.bars {
  width: min(900px, 100%);
  margin: 5vh auto 0;
  display: grid;
  gap: 1.4rem;
  text-align: left;
}

.bar-row .label {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  margin-bottom: 0.4rem;
  font-weight: 900;
  font-size: clamp(1.1rem, 2.6vw, 1.9rem);
  letter-spacing: 0.02em;
  text-transform: lowercase;
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: clamp(38px, 7vw, 72px);
  background: rgba(255, 244, 220, 0.12);
  border-radius: 16px;
  overflow: hidden;
}

.fill { height: 100%; border-radius: 16px; }
.fill.single { width: 100%; background: var(--red); }    /* the Single File */
.fill.cluster { width: 25%; background: var(--amber); } /* the Cluster's time, the thing to look at (Snug Green on ink is only 2.2:1) */

/* Bars grow when their screen appears, the single file first. */
.js .reveal .fill {
  clip-path: inset(0 100% 0 0 round 16px);
  transition: clip-path 1.4s cubic-bezier(.2, .8, .2, 1) 0.3s;
}
.js .reveal .fill.cluster { transition-delay: 1s; }
.js .reveal.in .fill { clip-path: inset(0 0 0 0 round 16px); }

/* ---------- How we got here: a horizontal strip of floor stickers ----------
   In-flow, horizontal, cards with big dates: nothing like the fixed vertical rail. The strip
   starts at the content gutter and bleeds to the right only, so the rail never sits over it.
   Native scroll with snap, so it swipes on a phone; the buttons and arrow keys are for desktop. */

.history { padding-bottom: 8vh; grid-template-columns: minmax(0, 1fr); } /* the strip must not widen the column */
.history .inner { margin-bottom: 4vh; }
.history .strip-foot { margin: 1.2rem 0 0; }

.strip-wrap {
  --card: min(100vw - 2 * var(--sx), 380px); /* the content column, capped */
  --sticker: 6.75rem;                          /* rem, so 200% text stays inside the circle */
  --gap: clamp(16px, 2.5vw, 28px);
  container-type: inline-size;
  min-width: 0;
  width: calc(100% + var(--sx));
  margin-inline: 0 calc(-1 * var(--sx));
}

/* the column measured from the strip's own width, which ignores a classic scrollbar */
@supports (width: 1cqw) {
  .strip-wrap { --card: min(100cqw - var(--sx), 380px); }
}

.strip {
  position: relative;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-right: var(--sx); /* the snap centre stays on the page axis */
  padding: 10px 0 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink) transparent;
}

.strip:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; border-radius: 4px; }

/* Enough room either side for the first and last stops to reach the snap centre, and not a
   pixel more, so the scroll range ends on the last card. */
.stops {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 calc((100% + var(--sx) - var(--card)) / 2) 0 calc((100% - var(--sx) - var(--card)) / 2);
  display: flex;
  align-items: stretch;
  gap: var(--gap);
  width: max-content;
}

/* the floor tape, drawn once, the full length of the strip */
.stops::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--sticker) / 2 - 2px);
  border-top: 4px dashed var(--ink);
  opacity: 0.45;
}

.stop {
  flex: none;
  width: var(--card);
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
  gap: 18px;
  scroll-snap-align: center;
}

.sticker {
  position: relative;
  z-index: 1;
  width: var(--sticker);
  height: var(--sticker);
  border-radius: 50%;
  background: var(--cream);
  border: 3px dashed var(--ink);
  display: grid;
  place-content: center;
  text-align: center;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  rotate: -4deg;
  transition: border-color 0.2s ease, scale 0.3s cubic-bezier(.2, .8, .2, 1);
}

.sticker small { display: block; font-size: 1rem; letter-spacing: 0.08em; }
.sticker b { display: block; font-size: 1.6rem; line-height: 1; letter-spacing: -0.03em; }
.sticker b.one { font-size: 1.35rem; letter-spacing: 0.02em; }
.stop.current .sticker { border-style: solid; scale: 1.08; }

/* the stickers get slapped down one after another when the strip appears */
.js .strip-wrap.reveal.in .sticker {
  animation: slap 0.45s cubic-bezier(.2, .8, .2, 1) backwards;
  animation-delay: calc(0.25s + var(--i, 0) * 70ms);
}

@keyframes slap {
  from { transform: scale(1.6); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.card {
  width: 100%;
  padding: clamp(16px, 2.2vw, 24px);
  background: var(--cream);
  color: var(--ink);
  border-radius: 24px;
  text-align: left;
  display: grid;
  grid-template-rows: auto auto 1fr auto; /* stage, heading, body (takes the slack), source */
  gap: 0.75em;
}

.card h3 {
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.03em;
  text-transform: lowercase;
}

.card p { font-size: 1.05rem; font-weight: 600; line-height: 1.35; text-wrap: pretty; }
.card .src { margin: 0.4em 0 0; width: auto; align-self: end; font-size: 1rem; }

.card.now { background: var(--ink); color: var(--cream); }
.card.now .mini { border: 3px solid rgba(255, 244, 220, 0.9); }
.card.now h3 { font-size: clamp(1.3rem, 2vw, 1.7rem); }
.card.now .count {
  position: relative;
  display: block;
  margin-bottom: 0.25em;
  color: var(--amber);
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  text-transform: lowercase;
  font-variant-numeric: tabular-nums;
}

/* While the count-up runs, the aria-hidden twin shows the running number and the real text
   is hidden visually only, so the DOM, screen readers, print and copy keep the final figure. */
.count .count-vis::before { content: attr(data-shown); }
.count.is-counting .count-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* the tiny stage: the same vocabulary as the sims (wood bar, cream staff, pink people) */
.mini {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 7;
  background: #0e0e13;
  border-radius: 14px;
}
.mini .bar { fill: #c98a3e; }
.mini .lip { fill: #8a5a22; }
.mini .staff circle { fill: var(--cream); }
.mini .staff .idle { opacity: 0.3; }
.mini .cust circle { fill: var(--pink); }
.mini .c1 { fill: #7f95ff; }
.mini .c2 { fill: #4ad295; }
.mini .c3 { fill: #ff6b76; }
.mini .c4 { fill: #ffd36a; }
.mini .dk { fill: rgba(255, 244, 220, 0.35); } /* don't know */
.mini .tables circle { fill: #c98a3e; }
.mini .door { fill: rgba(255, 244, 220, 0.6); }
.mini .stickers circle { fill: none; stroke: rgba(255, 244, 220, 0.45); stroke-width: 1.2; stroke-dasharray: 2 1.6; }
.mini .sign { fill: var(--cream); }
.mini .sign-txt { fill: #0e0e13; font: 900 8px var(--font); letter-spacing: 0.06em; text-transform: uppercase; }

.strip-controls {
  display: none; /* the buttons need script.js; without it the strip still scrolls */
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
}
.js .strip-controls { display: flex; }

.strip-btn {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  padding: 0;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 3px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  transition: scale 0.15s ease, opacity 0.2s ease;
}
.strip-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.strip-btn:hover { scale: 1.06; }
.strip-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.strip-btn[aria-disabled="true"] { opacity: 0.3; cursor: default; }
.strip-btn[aria-disabled="true"]:hover { scale: 1; }

.strip-count {
  min-width: 5ch;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.strip-foot .src { margin-top: 1.4em; }

.site-footer .sources { max-width: 62ch; font-size: 0.95em; text-wrap: pretty; } /* narrow, so a run of links reads as a list and clears the rail label */

/* ---------- How to do The Cluster: one sticky stage, four steps on one scroll ----------
   #howto is 4.5 viewports tall (five equal slices: the intro and the four steps). The stage
   inside it sticks to the top of the window and script.js sets, from the scroll position,
   the cumulative state classes s1..s4, the block colour (cream, then blue, then green on the
   last step: amber stays for the ring, the look and the pint) and --k, the progress through
   the current slice, so something moves on every scroll tick. The markup ships the finished
   frame (s1 s2 s3 s4 served, green) so the page reads without JS. The outer section must never
   get overflow: hidden, or the sticky stops working. */

.js .howto { position: relative; height: calc(100vh * 4.5); height: calc(100svh * 4.5); }

/* The step pills' targets: the start of each step's slice (slice = 3.5 viewports of travel / 5),
   just inside it. Anchor links, so nothing but the visitor's click moves the page. */
.howto-at { display: none; }
.js .howto-at {
  display: block;
  position: absolute;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
  top: calc((var(--at) + 0.02) * 70vh);
  top: calc((var(--at) + 0.02) * 70svh);
}

.howto-stick {
  --fg: var(--ink);
  --block: var(--cream);
  --k: 1;
  --sp: 1;
  position: sticky;
  top: 0;
  transition: background-color 0.5s ease, color 0.5s ease;
}
.js .howto-stick { height: 100vh; height: 100svh; min-height: 0; padding-block: 4vh; }
html:not(.js) .js-only { display: none; }
.howto-stick.c-blue  { --fg: var(--cream); --block: var(--blue); }
.howto-stick.c-green { --fg: var(--cream); --block: var(--green); }
html:not(.js) .howto-stick { position: relative; }

.howto .inner { width: min(1440px, 100%); }
.howto-grid {
  display: grid;
  gap: clamp(1.2rem, 4vh, 3rem);
  align-items: center;
  justify-items: center;
}

.howto-text { width: 100%; }
.howto-kicker { margin: 0 0 0.6em; opacity: 1; }
.howto .rule-title { font-size: clamp(2.2rem, min(7vw, 9vh), 6rem); }
.howto-step {
  margin: 0 0 0.5em;
  font-weight: 900;
  font-size: clamp(0.9rem, 1.8vw, 1.3rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}
.howto .mid { font-size: clamp(1.15rem, min(2.6vw, 3.4vh), 2.2rem); max-width: 28ch; margin-inline: auto; text-wrap: balance; }
.howto .small { margin-top: 0; }

/* The copy: intro and four steps, stacked in one cell, one shown at a time. */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2rem; }
.js .howto-copy { display: grid; }
.js .steps { display: contents; }
.js .howto-copy > .howto-head,
.js .steps > .step {
  grid-area: 1 / 1;
  opacity: 0;
  transform: translateY(28px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.55s cubic-bezier(.2, .8, .2, 1);
}
.js .howto-copy > .howto-head.active,
.js .steps > .step.active { opacity: 1; transform: none; pointer-events: auto; transition-delay: 0.1s; }

/* Step pills: outline = to come, filled = done, filled and bigger = now. */
.step-nav ol {
  --pill: 2.5em;
  position: relative;
  list-style: none;
  margin: clamp(0.75rem, 2.5vh, 1.5rem) auto 0;
  padding: 0;
  width: max-content;
  display: flex;
  gap: 0.9em;
  font-size: clamp(1rem, 2vw, 1.3rem);
}
.step-nav li { position: relative; z-index: 1; }

/* A track through the pills, filled as far as the scroll has got. */
.step-nav ol::before,
.step-nav .step-fill {
  content: "";
  position: absolute;
  z-index: 0;
  left: calc(var(--pill) / 2);
  top: 50%;
  height: 4px;
  translate: 0 -50%;
  background: currentColor;
  opacity: 0.3;
  width: calc(100% - var(--pill));
}
.step-nav .step-fill { opacity: 1; width: calc((100% - var(--pill)) * var(--sp)); }
.step-nav a {
  position: relative;
  background: var(--block);
  display: grid;
  place-items: center;
  width: 2.5em;
  height: 2.5em;
  border: 3px solid currentColor;
  border-radius: 999px;
  color: inherit;
  font-weight: 900;
  text-decoration: none;
  transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.step-nav li.done a,
.step-nav a[aria-current] { background: var(--fg); color: var(--block); }
.step-nav a[aria-current] { transform: scale(1.18); }
.step-nav a:hover { transform: scale(1.1); }
.step-nav a:focus-visible { outline: 3px solid currentColor; outline-offset: 4px; }
html:not(.js) .step-nav { display: none; }
@media (min-width: 720px) and (orientation: landscape) { .step-nav ol { margin-inline: 0; } }

/* The pub from above: the sims' stage, driven by the s1..s4 classes instead of a clock. */
.howto-pub {
  --d: 5.2%;
  position: relative;
  width: min(100%, 620px, calc(40svh * 16 / 11));
  aspect-ratio: 16 / 11;
  background: #0e0e13;
  color: var(--cream);
  border: 4px solid rgba(255, 244, 220, 0.9);
  border-radius: 24px;
  overflow: hidden;
  contain: layout paint;
  text-align: left;
}

.howto-pub .cap {
  position: absolute;
  left: 50%;
  translate: -50% -50%;
  white-space: nowrap;
  font-weight: 900;
  font-size: clamp(0.75rem, 1.4vw, 0.8rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.howto-pub .cap-bar { top: 16.5%; }
.s1:not(.s2) .cap-bar { opacity: 1; }
.howto-pub .cap-end {
  top: 78%;
  padding: 0.5em 1em;
  border: 3px solid var(--cream);
  border-radius: 999px;
  color: var(--cream);
  font-size: clamp(0.8rem, 1.6vw, 0.95rem);
  letter-spacing: 0.06em;
  text-transform: none;
  rotate: -3deg;
  transition: opacity 0.4s ease 0.3s;
}
.served .cap-end { opacity: 1; }

/* Background pints wait until yours arrives, so the amber of the moment is the only amber. */
.howto-pub .cust.has-drink:not(.you)::after { opacity: 0; transition: opacity 0.3s ease 0.2s; }
.served .howto-pub .cust.has-drink:not(.you)::after { opacity: 1; }

/* The barperson who serves you */
.howto-pub .keeper { left: 61%; top: 8%; }
.s3 .howto-pub .keeper { opacity: 1; box-shadow: 0 0 0 4px rgba(255, 182, 39, 0.7); }
.s4 .howto-pub .keeper { left: 65%; }
.served .howto-pub .keeper { box-shadow: none; }

/* You: start off the bottom edge, walk up, slide into the gap, step up, get served. */
.howto-pub .you {
  left: 50%;
  top: 97%;
  z-index: 2;
  transition-duration: 1.1s, 1.1s, 0.5s, 0.3s, 0.3s;
}
.howto-pub .you::before {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  translate: -50% 0;
  padding: 0.1em 0.55em;
  background: var(--cream);
  color: var(--ink);
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
/* Step 1 is scroll-linked: --k walks you up the room as the visitor scrolls. */
.s1 .you { left: calc(50% + 10% * var(--k)); top: calc(97% - 45% * var(--k)); transition-duration: 0.25s, 0.25s, 0.5s, 0.3s, 0.3s; }
.s2 .you { left: 67.1%; top: 28%; transition-duration: 1s, 1s, 0.5s, 0.3s, 0.3s; }
.s3 .you { transform: translate(-50%, -50%) scale(1.25); }
.howto-pub .you::after { opacity: 0; transition: opacity 0.3s ease; }
.served .you::after { opacity: 1; }
.served .you { transform: translate(-50%, -50%); }

/* The gap along the bar: a pulsing dashed ring while you pick it. */
.howto-pub .gap {
  position: absolute;
  left: 67.1%;
  top: 28%;
  width: calc(var(--d) * 2);
  aspect-ratio: 1;
  translate: -50% -50%;
  border: 3px dashed var(--amber);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
  animation: gap-pulse 1.1s ease-in-out infinite;
}
.s2:not(.s3) .gap { opacity: 1; }

@keyframes gap-pulse {
  0%, 100% { scale: 1; }
  50%      { scale: 1.18; }
}

/* The look: a line from your eyes to theirs, drawn on at step 3. */
.howto-pub .sight { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.howto-pub .sight line {
  stroke: var(--amber);
  stroke-width: 3px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  transition: stroke-dashoffset 0.2s ease, opacity 0.3s ease;
}
.s3 .sight line { opacity: 1; }
.s3 .sight line { stroke-dashoffset: calc(1 - min(1, var(--k) * 1.6)); } /* drawn by 60% of the way through step 3 */
.s4 .sight line { stroke-dashoffset: 0; opacity: 0; }

/* The tenner, held with quiet confidence. */
.howto-pub .note {
  position: absolute;
  left: 67.1%;
  top: 28%;
  width: calc(var(--d) * 0.9);
  aspect-ratio: 1.6;
  translate: 75% -150%;
  rotate: -14deg;
  background: var(--cream);
  border: 2px solid #c98a3e;
  border-radius: 2px;
  opacity: 0;
  z-index: 3;
  transition: opacity 0.3s ease 0.5s;
}
.s3:not(.s4) .note { opacity: 1; }

/* The pint: slides across the bar from the barperson to you at step 4, then you hold it. */
.howto-pub .pint {
  left: 65%;
  top: 16%;
  opacity: 0;
  transition: left 0.2s ease-out, top 0.2s ease-out, opacity 0.3s ease;
}
.s4 .pint { left: calc(65% + 2.1% * var(--k)); top: calc(16% + 7% * var(--k)); opacity: 1; }
.served .pint { opacity: 0; }

/* Desktop and landscape phones: copy left, pub right. */
@media (min-width: 720px) and (orientation: landscape) {
  .howto-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(1.5rem, 4vw, 4rem); text-align: left; }
  .howto-text { justify-self: start; }
  .howto .mid { margin-inline: 0; }
  .howto-pub { width: min(100%, 780px, calc(78svh * 16 / 11)); justify-self: end; }
}

/* Portrait phones: the rail is only on the left, so the stage takes the right-hand room,
   with bigger dots so the story reads at arm's length. */
@media (max-width: 600px) and (orientation: portrait) {
  .js .howto-stick { padding-inline: 52px 16px; }
  .howto-pub { --d: 7%; aspect-ratio: 16 / 10; width: 100%; }
  .howto-pub .note { width: calc(var(--d) * 1.1); }
}

/* Without JS the finished stage rides alongside the stacked steps. */
html:not(.js) .howto-pub { align-self: start; position: sticky; top: 12vh; }
html:not(.js) .howto-head { margin-bottom: 2rem; }

/* Above 900px the rail's chapter label is always open, about 265px in from the left, level
   with the title. The copy is left-aligned here, so keep it clear of the label. */
@media (min-width: 901px) and (orientation: landscape) {
  .howto-grid { padding-left: max(0px, calc(265px - (100vw - min(1200px, 88vw)) / 2)); }
}

/* ---------- Beer mats ---------- */

.mats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  margin: 5vh 0 2vh;
}

/* The mats are the real print artwork: /mats/*.svg, built by scripts/build-mats.mjs. */
.mat {
  --r: 0deg;
  width: clamp(220px, min(30vw, 38vh), 380px);
  height: auto;
  aspect-ratio: 1;
  flex: none;
  display: block;
  rotate: var(--r);
  filter: drop-shadow(0 10px 0 rgba(22, 22, 29, 0.25));
  animation: wobble 4s ease-in-out infinite alternate;
}

.mat.m1 { --r: -6deg; }
.mat.m2 { --r: 5deg;  animation-delay: -1.8s; }

@keyframes wobble {
  from { transform: rotate(-4deg) scale(1); }
  to   { transform: rotate(4deg) scale(1.04); }
}

/* ---------- Flyers (under the mats): the two faces, then the PDF downloads ----------
   The previews are PNGs of the real print pages (/flyers/preview-*.png, written by
   scripts/build-flyers.mjs). Tilted like the mats but still: nothing here loops. */

.flyers { margin-top: 8vh; }

.flyer-pair {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(1rem, 3vw, 2.5rem);
  margin: 4vh 0 3vh;
}

.flyer {
  --r: 0deg;
  width: clamp(120px, min(24vw, 36vh), 300px);
  height: auto;
  aspect-ratio: 210 / 297;
  flex: none;
  display: block;
  background: #fff;
  rotate: var(--r);
  filter: drop-shadow(0 10px 0 rgba(22, 22, 29, 0.25));
}

.flyer.f1 { --r: -2deg; }
.flyer.f2 { --r: 2deg; }

.flyer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}

.flyer-links a {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 0.7em 1.4em;
  border: 3px solid currentColor;
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
  font-weight: 900;
  font-size: clamp(1rem, 2vw, 1.4rem);
  line-height: 1.1;
}

.flyer-links small { font-weight: 600; font-size: 0.72em; letter-spacing: 0.04em; margin-top: 0.2em; opacity: 0.8; }

.flyer-links a:hover, .flyer-links a:focus-visible { background: var(--ink); color: var(--amber); outline: none; }

.flyers .fine { margin-top: 1.6em; font-size: 1rem; font-weight: 500; opacity: 0.75; text-wrap: pretty; }

/* ---------- Poll ----------
   Two equal ink buttons, so the question stays fair. The results keep the page's colour
   meanings: red is The Single File (for), green is The Cluster (against). */

.poll, .poll-results { width: min(760px, 100%); margin: 2em auto 0; }

/* After a vote the chart is the point: the kicker goes and the question steps down to .big,
   so the results, the total and the next step fit on a laptop screen. */
#poll.voted .poll-kicker { display: none; }
#poll.voted .mega {
  font-size: clamp(2.2rem, 7vw, 6rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
}
#poll .poll-results { margin-top: 1em; }

.poll-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 1rem;
}

.poll-choices button {
  display: grid;
  align-content: center;
  gap: 0.25em;
  padding: 0.7em 1em 0.8em;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font: inherit;
  cursor: pointer;
  transition: scale 0.15s ease;
}

.poll-choices button b { font-size: clamp(1.8rem, 4.4vw, 3rem); font-weight: 900; line-height: 1; letter-spacing: -0.03em; }
.poll-choices button span { font-size: 1rem; font-weight: 600; opacity: 0.8; }
.poll-choices button:hover { scale: 1.03; }
.poll-choices button:focus-visible { outline: 4px solid var(--ink); outline-offset: 4px; }
.poll-choices button:disabled { opacity: 0.6; cursor: wait; scale: 1; }
.poll-note { min-height: 1.5em; margin-top: 1.2em; font-weight: 700; }
.poll-note:focus { outline: none; } /* focused by script on "Changed your mind?" */
/* The side on record, on its button, after "Changed your mind?" */
.poll-choices button .poll-you { justify-self: center; margin-top: 0.35rem; font-size: 0.75rem; font-weight: 800; opacity: 1; }
.poll-small { margin-top: 0.4em; font-size: 1rem; font-weight: 500; opacity: 0.8; text-wrap: balance; }

/* The lead line ("The Cluster is winning.") */
.poll-head {
  margin-bottom: 0.6em;
  font-size: clamp(1.3rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.poll-head:focus { outline: none; } /* focused by script after a vote, never by the keyboard */

/* The results are a horizontal bar chart. Columns: label, plot, figures. The rows share the
   chart's columns (subgrid), so every bar starts on the same baseline and runs on the same
   0-100% scale, and the figures line up in a column of their own. Each plot cell fills its
   row and draws its own gridlines; the rows touch, so the lines run unbroken. */
.poll-chart {
  margin: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  column-gap: clamp(0.75rem, 2vw, 1.5rem);
  text-align: left;
}

.poll-bars,
.poll-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
}

.poll-bars { list-style: none; margin: 0; padding: 0; }
.poll-row { align-items: center; }

.poll-label {
  grid-column: 1;
  padding-block: 0.6rem;
  font-size: clamp(1.2rem, 2.8vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* A rubber stamp, like .tag, under the side you picked */
.poll-you {
  display: block;
  width: max-content;
  margin-top: 0.4rem;
  padding: 0.25em 0.75em;
  border: 3px solid currentColor;
  border-radius: 999px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  rotate: -3deg;
}
.poll-you[hidden] { display: none; }

.poll-plot {
  grid-column: 2;
  align-self: stretch;
  position: relative;
  display: flex;
  align-items: center;
}

/* Gridlines: the baseline at 0, hairlines at 50% and 100% */
.poll-plot::before,
.poll-plot::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.poll-plot::before {
  border-left: 2px solid rgba(22, 22, 29, 0.45);
  border-right: 1px solid rgba(22, 22, 29, 0.25);
}
/* The 50% line is the one that means something here: past it is a majority */
.poll-plot::after { left: calc(50% - 1px); border-left: 2px solid rgba(22, 22, 29, 0.3); }

.poll-fill {
  height: clamp(22px, 2.8vw, 34px);
  width: calc(var(--v, 0) * 100%);
  border-radius: 0 6px 6px 0; /* square on the baseline, rounded at the value end */
  background: var(--ink);
}
.poll-row[data-choice="single"] .poll-fill { background: var(--red); }
.poll-row[data-choice="cluster"] .poll-fill { background: var(--green); }
.reveal.in .poll-fill { animation: poll-grow 1.1s cubic-bezier(.2, .8, .2, 1) 0.15s both; }

@keyframes poll-grow {
  from { width: 0; }
}

.poll-fig {
  grid-column: 3;
  display: grid;
  justify-items: end;
  gap: 0.2rem;
  padding-block: 0.6rem;
  font-variant-numeric: tabular-nums; /* a column of figures, so they line up */
}
.poll-pc { font-size: clamp(1.6rem, 4.4vw, 3rem); font-weight: 900; line-height: 0.9; letter-spacing: -0.03em; }
.poll-n { font-size: clamp(1rem, 1.4vw, 1.1rem); font-weight: 600; opacity: 0.75; }

.poll-axis {
  grid-column: 2;
  position: relative;
  height: 1.3em;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}
.poll-axis span { position: absolute; top: 0; }
.poll-axis span:nth-child(1) { left: 0; }
.poll-axis span:nth-child(2) { left: 50%; translate: -50% 0; }
.poll-axis span:nth-child(3) { right: 0; }

/* Phones: the label and figures share a line, with the bar full width underneath */
@media (max-width: 560px) {
  .poll-chart { grid-template-columns: minmax(0, 1fr) max-content; }
  .poll-row { grid-template-rows: auto auto; align-items: end; }
  .poll-label {
    grid-row: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.5rem;
    padding-block: 1rem 0.4rem;
  }
  .poll-you { margin: 0; }
  .poll-you[hidden] { display: none; }
  .poll-fig { grid-column: 2; grid-row: 1; padding-block: 1rem 0.4rem; }
  .poll-plot { grid-column: 1 / -1; grid-row: 2; padding-block: 0.3rem; }
  .poll-axis { grid-column: 1 / -1; }
}

.poll-total { margin-top: 1em; font-size: 1rem; font-weight: 500; opacity: 0.8; text-wrap: balance; }
.poll-quip { margin-top: 0.6em; font-weight: 700; font-size: clamp(1.1rem, 2.2vw, 1.5rem); text-wrap: balance; }
.poll-next { margin-top: 0.8em; }
.poll-next[hidden] { display: none; }

/* "Changed your mind?" and "Keep my vote" */
.poll-link {
  margin-top: 0.5em;
  padding: 0.3em 0.2em;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
  cursor: pointer;
}
.poll-link:hover { text-decoration-thickness: 4px; }
.poll-link:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 4px; }

/* Windows High Contrast drops backgrounds, which would leave the chart with no bars */
@media (forced-colors: active) {
  .poll-row[data-choice] .poll-fill { forced-color-adjust: none; background: CanvasText; }
}

/* ---------- Petition ---------- */

.petition {
  width: min(560px, 100%);
  margin: 2em auto;
  display: grid;
  gap: 1rem;
  text-align: left;
}

.petition .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sig-count { margin-top: 0.8em; }

.petition label { display: grid; gap: 0.4rem; font-weight: 700; font-size: 1.1rem; }

.petition input[type="text"],
.petition input[type="email"] {
  font: inherit;
  font-size: 1.2rem;
  padding: 0.9em 1em;
  border-radius: 14px;
  border: 3px solid var(--cream);
  background: transparent;
  color: var(--cream);
}

.petition input { caret-color: var(--amber); }
.petition input::placeholder { color: rgba(255, 244, 220, 0.6); }
.petition input:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.petition input:user-invalid { border-color: var(--red); }

.petition .consent {
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.8rem;
  font-weight: 500;
  font-size: 0.95rem;
  opacity: 0.8;
}

.petition .consent input { width: 1.3rem; height: 1.3rem; accent-color: var(--amber); margin-top: 0.15rem; }
.petition .consent input:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.petition .consent input:user-invalid { outline: 3px solid var(--red-soft); outline-offset: 3px; }

.petition button {
  font: inherit;
  font-weight: 900;
  font-size: 1.4rem;
  padding: 0.8em 1em;
  border: 0;
  border-radius: 999px;
  background: var(--amber);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.petition button:hover { transform: scale(1.03); }
.petition button:focus-visible { outline: 3px solid var(--cream); outline-offset: 4px; }
.petition button:disabled { opacity: 0.6; cursor: wait; }
.form-msg { min-height: 1.5em; text-align: center; font-weight: 700; }

.share { display: grid; justify-items: center; gap: 0.6rem; }
.share[hidden] { display: none; }
.petition .share button {
  font-size: 1.1rem;
  background: transparent;
  color: var(--cream);
  border: 3px solid var(--cream);
  padding: 0.6em 1.4em;
}
.share .share-note { min-height: 1.4em; font-weight: 700; color: var(--amber); }
.form-msg.error { color: var(--red-soft); }
.form-msg.ok { color: var(--amber); }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--ink);
  color: rgba(255, 244, 220, 0.7);
  padding: 6vh 6vw 8vh;
  font-size: clamp(0.85rem, 1.5vw, 1.05rem);
  line-height: 1.5;
}

.site-footer p { margin: 0.6em auto; max-width: 820px; }
.site-footer a { color: var(--amber); text-decoration: underline; text-underline-offset: 4px; }
.emoji { font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: 0.3em; }

/* The beer fund: the footer's one ask, so full cream and a heavier link. */
.site-footer .beer-fund { margin-top: 1.4em; color: var(--cream); font-size: 1.15em; font-weight: 600; text-wrap: pretty; }
.site-footer .beer-fund a { font-weight: 900; text-decoration-thickness: 3px; white-space: nowrap; }
.site-footer .beer-fund a:hover { text-decoration-thickness: 5px; }

/* Screen-reader-only text. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Timeline rail (fixed, left) ---------- */

.timeline {
  --p: 0;
  position: fixed;
  left: clamp(8px, 1.6vw, 22px);
  top: 50%;
  translate: 0 -50%;
  z-index: 50;
  padding: 16px 10px;
  background: rgba(22, 22, 29, 0.9);
  border: 2px solid rgba(255, 244, 220, 0.3);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden; /* keeps the hidden rail out of the tab order */
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

.timeline.show { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }

.timeline ol {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 14px;
  height: min(56vh, 460px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* grey track */
.timeline ol::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 7px;
  bottom: 7px;
  width: 2px;
  background: rgba(255, 244, 220, 0.25);
}

/* amber progress fill */
.timeline .tl-fill {
  position: absolute;
  left: 6px;
  top: 7px;
  width: 2px;
  height: calc((100% - 14px) * var(--p));
  background: var(--amber);
}

.timeline li:not(.tl-fill) { position: relative; z-index: 1; }

.timeline a {
  display: block;
  position: relative;
  width: 14px;
  height: 14px;
  color: var(--cream);
  text-decoration: none;
}

/* 44px touch target around each 14px dot */
.timeline a::before { content: ""; position: absolute; inset: -15px; }

.timeline .mark {
  display: block;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid rgba(255, 244, 220, 0.55);
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.timeline li.done .mark { background: var(--amber); border-color: var(--amber); }

.timeline li.active .mark {
  background: var(--amber);
  border-color: var(--cream);
  transform: scale(1.5);
  box-shadow: 0 0 0 5px rgba(255, 182, 39, 0.35);
}

.timeline .lbl {
  position: absolute;
  left: calc(100% + 18px);
  top: 50%;
  translate: -8px -50%;
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  white-space: nowrap;
  padding: 0.4em 0.9em;
  background: var(--ink);
  color: var(--cream);
  border: 2px solid rgba(255, 244, 220, 0.3);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, translate 0.25s ease;
}

.timeline .lbl small {
  color: var(--amber);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timeline li.active .lbl,
.timeline a:hover .lbl,
.timeline a:focus-visible .lbl { opacity: 1; translate: 0 -50%; }

/* On the maths and history chapters the label would sit over the bars or the strip (both run
   from the content gutter), so there it shows only on hover or focus. */
.timeline li.active a[href="#maths"]:not(:hover):not(:focus-visible) .lbl,
.timeline li.active a[href="#history"]:not(:hover):not(:focus-visible) .lbl { opacity: 0; translate: -8px -50%; }

.timeline a:focus-visible { outline: 3px solid var(--amber); outline-offset: 4px; border-radius: 50%; }

/* Make room for the rail on narrower screens */
@media (max-width: 900px) {
  .screen { --sx: 52px; }
  .screen, .site-footer { padding-inline: 52px; }
  .timeline { padding: 12px 7px; }
  .timeline ol { height: min(50vh, 380px); }
  .timeline li.active .lbl { opacity: 0; } /* dots only; labels on tap/hover */
  .timeline a:hover .lbl, .timeline a:focus-visible .lbl { opacity: 1; }
}

@media (max-width: 600px) {
  .mega { font-size: 10.5vw; }
  .mega.upper { font-size: 9vw; }
  .hero .mega { font-size: min(12vw, 18vh); }
  .maths .mid br { display: none; }
}

/* ---------- Scroll reveal ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(60px) scale(0.97);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(.2, .8, .2, 1);
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- Print: every stop, wrapped, no controls ---------- */
@media print {
  .strip { overflow: visible; }
  .stops { width: auto; flex-wrap: wrap; padding: 0; }
  .stops::before { display: none; }
  .stop { width: calc(50% - var(--gap) / 2); }
  .strip-controls, .js .strip-controls { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-hint, .mat, .promo { animation: none; }
  .hero .inner > * { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .timeline, .timeline .mark, .timeline .lbl { transition: none; }
  .dot, .dot.cust.leaving, .pint { transition: none; }
  .howto-stick, .step-nav a, .howto-pub .cap, .howto-pub .gap, .howto-pub .sight line, .howto-pub .note,
  .howto-pub .you::after, .howto-pub .cust.has-drink::after { transition: none; animation: none; }
  .js .howto-copy > .howto-head, .js .steps > .step { transition: none; transform: none; }
  .poll-choices button { transition: none; }
  .reveal.in .poll-fill { animation: none; }
  .js .reveal .fill, .js .reveal.in .fill { clip-path: none; transition: none; }
  .js .strip-wrap.reveal.in .sticker { animation: none; }
  .sticker, .strip-btn { transition: none; }
}
