:root {
  --paper: #F4F0E6;
  --ink: #17211D;
  --tomato: #E4572E;
  --mustard: #E6B84A;
  --dill: #3F6B59;
  --tin: #D2D0C7;
  --line: 3px solid var(--ink);
  --offset: 5px 5px 0 var(--ink);
  --gutter: clamp(16px, 4vw, 48px);
  --oil:
    repeating-linear-gradient(-35deg, transparent 0 8px, rgba(170, 110, 20, .28) 8px 11px),
    repeating-linear-gradient(55deg, transparent 0 21px, rgba(255, 240, 190, .45) 21px 24px),
    var(--mustard);
  --oil-pale: #F3E4B8;
  /* Pale oil for behind reading text: paper and ink lead, mustard is an accent */
  --oil-soft:
    repeating-linear-gradient(-35deg, transparent 0 8px, rgba(170, 110, 20, .10) 8px 11px),
    var(--oil-pale);
  /* Tomato dark enough for small text on paper (5.6:1); plain tomato is display-size only */
  --tomato-ink: #A93A1B;
  --dark: #3A403C;
  --blue: #4A74A0;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { background: var(--paper); }
body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: Archivo, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font: inherit; color: inherit; }

/* Anything drawn gets the crayon grain + wobble */
.hand { filter: url(#hand); }

/* ---------- Landing: pinned while the tin opens and the camera dives in ---------- */

.intro { position: relative; height: 400svh; background: var(--paper); }

.intro-stage {
  --p: 0;       /* lid peel, 0..1 */
  --dive: 0;    /* camera into the tin, 0..1 */
  --zoom: 8;    /* scale that makes the oil cover the screen; set by peel.js */
  position: sticky;
  top: 0;
  display: grid;
  /* The title sits midway between the nav bar and the tin (equal space above and below it),
     and the tin stays near the middle of the screen. */
  grid-template-rows: auto minmax(16px, 1fr) auto minmax(16px, 1fr) auto 2.4fr auto;
  justify-items: center;
  height: 100svh;
  padding: 0 var(--gutter) 28px;
  overflow: hidden;
  touch-action: pan-y;   /* a sideways drag turns the tin (tin3d.js); vertical still scrolls */
}

.intro-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 16px 0;
  opacity: calc(1 - var(--dive) * 3);
  will-change: opacity;
}
.intro-bar { grid-row: 1; }
.hungry { grid-row: 3; }
.tin { grid-row: 5; }
.scroll-cue { grid-row: 7; align-self: end; }
.wordmark { font-size: 15px; font-weight: 850; font-stretch: 125%; letter-spacing: .02em; text-transform: uppercase; }
/* Sound: a small icon toggle, off by default. The label is for screen readers; pressed = on. */
.sound {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.sound svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sound .spk { fill: currentColor; }
.sound .waves, .sound[aria-pressed="true"] .mute { display: none; }
.sound[aria-pressed="true"] .waves { display: inline; }
.sound[aria-pressed="true"] { background: var(--mustard); }

.hungry {
  margin: 0;
  color: var(--tomato);
  font-family: Shrikhand, Archivo, serif;
  font-size: clamp(44px, 8.5vw, 128px);
  font-weight: 400;
  line-height: 1;
  text-align: center;
  text-shadow: 4px 4px 0 var(--ink);
  /* Same camera move as the tin: the title scales from the point the camera is diving at
     (the tin's centre, --tox/--toy), a little faster than the tin because it's nearer the
     lens, so it swells and slides out past the frame edge. peel.js sets the vars. */
  position: relative;
  z-index: 5;
  transform-origin: var(--tox, 50%) var(--toy, 50%);
  scale: var(--tscale, 1);
  opacity: var(--tfade, 1);
  will-change: translate, scale, opacity;
}
/* The tilt lives on the text, not the title: rotate and scale share one transform-origin,
   and pivoting the tilt around the tin's centre would swing the title sideways. */
.hungry span { display: inline-block; rotate: -3deg; }

/* The tin: tin3d.js draws it in 3D on a canvas over the whole stage, aimed at this box (the
   title's camera push measures from it too). The still is a frame of the same renderer at rest:
   it holds the spot until the 3D is up, and stays if there's no JavaScript or WebGL. */
.tin {
  position: relative;
  align-self: center;
  height: min(46svh, calc((100vw - 2 * var(--gutter)) / 1.62));
  aspect-ratio: 1.62;
}
/* The still overhangs the box by the margin it was captured with (the tin's corners and shadow
   reach past it), so it sits exactly where the live tin draws. */
.tin-still { position: absolute; left: -15%; top: -25%; width: 130%; height: 150%; transition: opacity .4s; }
.tin-live .tin-still { opacity: 0; }
.tin-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.intro-bar, .scroll-cue { position: relative; z-index: 3; }

.scroll-cue {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--tomato-ink);
  font-family: Caveat, cursive;
  font-size: 28px;
  font-weight: 700;
  white-space: nowrap;
  opacity: clamp(0, calc(1 - var(--p) * 6), 1);
  will-change: opacity;
}
.scroll-cue svg { width: 24px; height: 40px; }
.scroll-cue path { fill: none; stroke: var(--tomato); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }

.skip {
  position: absolute;
  right: var(--gutter);
  bottom: 28px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 650;
  text-decoration: underline wavy var(--tomato);
  text-underline-offset: 5px;
  cursor: pointer;
  opacity: calc(1 - var(--dive) * 3);
  z-index: 3;
}
.intro-stage.diving .skip { pointer-events: none; }

/* Inside the tin: flat oil takes over the screen, then the real headline lands */
.oil {
  position: absolute;
  inset: 0;
  background: var(--oil-soft);
  opacity: clamp(0, calc((var(--dive) - .82) * 6), 1);
  z-index: 2;
  pointer-events: none;
  will-change: opacity;
}

.inside-hero {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  max-width: 1320px;
  margin: 0 auto;
  /* Centre in the space above the belt, not the whole screen */
  padding: 0 var(--gutter) calc(var(--belt-clear, 15svh) + 26px);
  opacity: var(--reveal);
  translate: 0 calc((1 - var(--reveal)) * 40px);
  will-change: opacity, translate;
  z-index: 3;
  pointer-events: none;
}
.batch {
  display: inline-block;
  padding: 6px 10px;
  background: var(--tomato-ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 700;
  font-stretch: 80%;
  letter-spacing: .16em;
  text-transform: uppercase;
  rotate: -2deg;
}
.inside-hero h2 {
  margin: 20px 0 28px;
  font-size: clamp(44px, 7.4vw, 112px);
  font-weight: 830;
  font-stretch: 125%;
  line-height: .92;
  letter-spacing: -.02em;
}
.scribbled { position: relative; white-space: nowrap; }
.underline { position: absolute; left: -2%; bottom: -.16em; width: 104%; height: .3em; overflow: visible; }
.underline path { fill: none; stroke: var(--tomato); stroke-width: 6; stroke-linecap: round; }
.lede { max-width: 36ch; margin: 0 auto; font-size: clamp(18px, 1.6vw, 22px); font-weight: 500; }

.card {
  padding: 22px 26px 24px;
  border: var(--line);
  background: #FFFCF4;
  box-shadow: 8px 8px 0 var(--ink);
  rotate: -1deg;
}
.card-strip {
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: var(--line);
  font-size: 12px;
  font-weight: 750;
  font-stretch: 80%;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.card-strip b { color: var(--tomato-ink); }
.card h3 { margin: 14px 0 10px; font-size: clamp(22px, 2.4vw, 32px); font-weight: 800; font-stretch: 110%; line-height: 1.05; }

/* ---------- The Cannery: scroll runs the line sideways ---------- */

/* The line overlaps the landing's last screen, so it pins the instant the dive ends:
   no ordinary scrolling between the tin and the line. It stays invisible until pinned.
   The extra 40svh is the hold where the headline fades up before the line moves. */
.cannery {
  --reveal: 0;
  position: relative;
  z-index: 4;
  /* the screen it pins on + the headline's 40svh hold + the 3D line's run */
  height: calc(100svh + 40svh + 780svh);
  margin-top: -100svh;
}
.cannery:not(.line-on) { opacity: 0; pointer-events: none; }
/* The oil you dove into, fading out as the line pulls you along: no hard seam */
.station.hero::before {
  content: "";
  position: absolute;
  inset: 0 -40cqw 0 0;
  background: var(--oil-soft);
  -webkit-mask-image: linear-gradient(90deg, #000 72%, transparent);
  mask-image: linear-gradient(90deg, #000 72%, transparent);
}
.line-stage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  container-type: inline-size;
  background: linear-gradient(var(--oil-pale), var(--paper) 90svh);
}
.line-track {
  position: relative;
  display: flex;
  width: calc(var(--n) * 100cqw);
  height: 100%;
  transform: translateX(calc(var(--run, 0) * (var(--n) - 1) * -100cqw));
  will-change: transform;
}
.station {
  --mx: 60%;      /* where the machine sits across the station */
  --l: 0;         /* this station's position on the line: 0 = centred, ±1 = a whole station away */
  --in: 1;        /* the mess, 1 = whole, 0 = swallowed by the machine */
  --out: 0;       /* the can, 0 = not made yet, 1 = out */
  --hit: 0;       /* machine rattle while it works */
  position: relative;
  flex: none;
  width: 100cqw;
  height: 100%;
}

/* Belt, rollers and legs run continuously from station to station */
.belt {
  --belt-top: 15svh;
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--belt-top);
  height: 26px;
  border-block: var(--line);
  background: repeating-linear-gradient(90deg, var(--dark) 0 24px, #2B302D 24px 28px);
  background-position-x: calc(var(--run, 0) * (var(--n) - 1) * 50cqw);
}
.belt::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 3px);
  height: 26px;
  background: radial-gradient(circle at 15px 11px, var(--tin) 0 8px, var(--ink) 8px 10.5px, transparent 11px) repeat-x;
  background-size: 64px 26px;
}
.belt::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 30px);
  height: calc(var(--belt-top) - 30px);
  border-bottom: var(--line);
  background: repeating-linear-gradient(90deg, transparent 0 150px, var(--ink) 150px 156px, transparent 156px 256px);
}

.machine {
  position: absolute;
  z-index: 1;
  left: var(--mx);
  bottom: calc(15svh + 26px);
  width: min(36cqw, 440px);
  height: auto;
  overflow: visible;
  transform: translateX(-50%);
  translate: 0 calc(var(--hit) * -4px);
  rotate: calc(var(--hit) * 1.4deg);
  transform-origin: 50% 100%;
  will-change: transform, translate, rotate;
}

/* The rider: the mess rides the belt into the machine and a can comes out the far side.
   It moves at the belt's speed; peel.js only feeds it --l/--in/--out/--hit. */
.rider {
  --size: clamp(64px, 8cqw, 104px);
  position: absolute;
  left: var(--mx);
  bottom: calc(15svh + 26px);
  width: var(--size);
  height: var(--size);
  z-index: 2;     /* in front of the machine's base, so you see the swap happen */
  translate: calc(-50% + var(--l) * 50cqw) 0;
  will-change: translate;
}
.rider svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transform-origin: 50% 100%; }
.raw { scale: calc(.3 + var(--in) * .7) var(--in); opacity: var(--in); }
.done { scale: var(--out); }
.burst { opacity: var(--pop, 0); scale: calc(.6 + var(--pop, 0) * .6); transform-origin: 50% 50%; }
.burst path { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.spark { fill: none; stroke: var(--mustard); stroke-width: 4; stroke-linecap: round; }
.doodle { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }

.station .card {
  position: absolute;
  top: 16svh;
  left: 7cqw;
  width: min(34cqw, 430px);
}
.card p { margin: 0 0 10px; font-size: 17px; line-height: 1.45; }
.keep-going { color: var(--tomato-ink); font-family: Caveat, cursive; font-size: 26px !important; font-weight: 700; }
.promises { margin: 4px 0 0; padding: 0; list-style: none; }
.promises li { padding: 5px 0; border-top: 1.5px dashed rgba(23, 33, 29, .35); font-weight: 600; }
.promises li::before { content: "✦ "; color: var(--tomato-ink); }

/* Machine drawing kit */
.s { stroke: var(--ink); stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; fill: none; }
.f-tin { fill: var(--tin); }
.f-paper { fill: var(--paper); }
.f-mustard { fill: var(--mustard); }
.f-tomato { fill: var(--tomato); }
.f-dill { fill: var(--dill); }
.f-dark { fill: var(--dark); }
.f-blue { fill: var(--blue); }
.f-tape { fill: #F2E3B0; }
.grid, .lines { fill: none; stroke: var(--dill); stroke-width: 2; }
.lines { stroke: var(--ink); opacity: .45; }
.crack { fill: none; stroke: var(--tomato); stroke-width: 3; stroke-linejoin: round; }
.needle { stroke: var(--tomato); stroke-width: 4; stroke-linecap: round; }
.pipe-out, .wrench-out, .pencil-out { fill: none; stroke: var(--ink); stroke-linecap: round; }
.pipe-out { stroke-width: 18; }
.pipe-in { fill: none; stroke: var(--dill); stroke-width: 11; }
.wrench-out { stroke-width: 13; }
.wrench-in { fill: none; stroke: var(--tin); stroke-width: 7; stroke-linecap: round; }
.pencil-out { stroke-width: 12; }
.pencil-in { fill: none; stroke: var(--mustard); stroke-width: 6; stroke-linecap: round; }
.sketch { fill: none; stroke: var(--paper); stroke-width: 2.5; stroke-linecap: round; opacity: .9; }
.rays, .ticks, .drips { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.drips { stroke: var(--paper); }
.stamp { font: 800 22px Archivo, sans-serif; fill: var(--ink); }
.plate { font: 800 12px Archivo, sans-serif; letter-spacing: .12em; fill: var(--ink); text-anchor: middle; }

/* ---------- Toon pass: the line in the 3D tin's world (2026-09-24) ----------
   Shaded shapes (#shade, lit from the upper left like the tin), the tin's soft offset floor shadow,
   ink as heavy as the tin's outline, and machines + riders about twice the old size on desktop.
   No crayon wobble (#hand) on the line's drawings: anything that moves gets it redrawn every frame,
   and on the machines that made the line lag (133 ms a frame parked at a station, 17 ms without it,
   measured 2026-09-24). The shading does the "drawn" job now; the cards and title keep #hand. */
.line-track svg.hand { filter: none; }
.line-track .machine [class*="f-"].s, .line-track .rider [class*="f-"].s, .beer-can [class*="f-"].s { filter: url(#shade); }
.line-track svg.machine { filter: drop-shadow(14px 10px 0 rgb(23 33 29 / .16)); }
.line-track .rider svg, .line-track svg.beer-can { filter: drop-shadow(8px 6px 0 rgb(23 33 29 / .16)); }
.line-track .s { stroke-width: 2.2; }
/* outline pairs: an ink stroke under a coloured one, 2.2 of ink showing each side */
.line-track .pipe-out { stroke-width: 15.4; }
.line-track .wrench-out { stroke-width: 11.4; }
.line-track .pencil-out { stroke-width: 10.4; }
.line-track .rays, .line-track .ticks, .line-track .drips { stroke-width: 2.2; }
.line-track .puff { stroke-width: 1.8; }
.line-track .burst path { stroke-width: 3.5; }
@media (min-width: 641px) {
  .line-track .station { --mx: 65%; }
  .line-track .machine { width: min(50cqw, 620px); }
  .line-track .rider { --size: clamp(90px, 12cqw, 150px); }
}

.line-count {
  position: absolute;
  right: var(--gutter);
  top: 20px;
  font-size: 12px;
  font-weight: 750;
  font-stretch: 80%;
  letter-spacing: .14em;
  opacity: .7;
}

.cta {
  display: inline-flex;
  margin-top: 16px;
  padding: 12px 22px;
  border: var(--line);
  border-radius: 14px;
  background: var(--mustard);
  color: var(--ink);
  box-shadow: var(--offset);
  font-weight: 750;
  text-decoration: none;
}
.foot-mail { color: inherit; text-transform: none; letter-spacing: .04em; text-underline-offset: 3px; }
.cta:hover { translate: 2px 2px; box-shadow: 3px 3px 0 var(--ink); }
.cta:active { translate: 5px 5px; box-shadow: none; }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 20px var(--gutter) 28px;
  border-top: var(--line);
  background: var(--paper);
  font-size: 12px;
  font-weight: 700;
  font-stretch: 80%;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* Reduced motion: nothing pins, nothing zooms. The landing shows the tin already open, the
   inside headline follows as a normal section, and the line becomes stacked before/after stills. */
@media (prefers-reduced-motion: reduce) {
  .intro { height: auto; }
  .intro-stage { position: relative; grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; padding-bottom: 6svh; overflow: visible; overflow-x: clip; }
  .scroll-cue, .skip, .oil, .keep-going { display: none; }
  .inside-hero { position: static; padding: 16svh var(--gutter); opacity: 1; translate: none; pointer-events: auto; }
  .station.hero::before { inset: 0; -webkit-mask-image: none; mask-image: none; }

  .cannery { height: auto; margin-top: 0; }
  .cannery:not(.line-on) { opacity: 1; pointer-events: auto; }
  .line-stage { position: static; height: auto; overflow: visible; }
  .line-track { flex-direction: column; width: auto; transform: none; }
  .station { width: 100cqw; height: auto; min-height: 90svh; }
  .line-count { display: none; }
  .machine { translate: none; rotate: none; }
  .raw, .done { scale: 1; opacity: 1; }
  .burst { display: none; }
  .rider { translate: -50% 0; }
  .raw { translate: -22cqw 0; }
  .done { translate: 22cqw 0; }
}

/* ---------- Phones: the tin stands up and peels top-down ---------- */
@media (max-width: 640px) {
  .intro { height: 360svh; }
  .tin { height: min(34svh, calc((100vw - 2 * var(--gutter)) / 1.62)); aspect-ratio: 1.62; }
  .skip { right: auto; left: 50%; translate: -50% 0; bottom: 34px; }
  .scroll-cue { margin-bottom: 30px; }

  .station .card { top: 12svh; left: 5cqw; right: 5cqw; width: auto; padding: 16px 18px 18px; }
  .card h3 { font-size: 22px; }
  .card p { font-size: 15px; }
  /* Big enough to fill the paper between the card and the belt; the svh cap keeps it under the card on short phones */
  .machine { left: 50%; width: min(94cqw, 36svh * 1.23); }
  .belt { --belt-top: 11svh; }
  .machine { bottom: calc(11svh + 26px); }
  .station { --mx: 50%; --belt-clear: 11svh; }
  /* The inside headline must fit a 360px phone: let the underlined phrase wrap */
  .inside-hero h2 { font-size: clamp(32px, 10.5vw, 44px); }
  .scribbled { white-space: normal; }
  .rider { --size: 58px; bottom: calc(11svh + 26px); }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .intro { height: auto; }
  .raw { translate: -40cqw 0; }
  .done { translate: 40cqw 0; }
}

/* Keyboard focus: a thick ink ring with a mustard halo, visible on paper, oil and tin */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 7px var(--mustard); border-radius: 6px; }

/* ---------- Idle: the page keeps living when you stop scrolling ----------
   Everything here animates transforms or opacity on small parts, never the drawings'
   filters, and pauses when its section is off screen (peel.js sets data-awake). */

.idle { animation-play-state: paused; }
[data-awake] .idle { animation-play-state: running; }
.late { animation-delay: -1.6s !important; }

/* Landing */
.fidget { transform-origin: 50% 70%; animation: fidget 6s ease-in-out infinite; }
@keyframes fidget {
  0%, 78%, 100% { rotate: 0deg; }
  82% { rotate: -9deg; }
  86% { rotate: 7deg; }
  90% { rotate: -3deg; }
  94% { rotate: 1deg; }
}
.bob { animation: bob 1.6s ease-in-out infinite alternate; }
@keyframes bob { to { translate: 0 6px; } }

/* Riders jostle on the running belt */
.jostle { position: absolute; inset: 0; transform-origin: 50% 100%; animation: jostle .9s ease-in-out infinite; }
@keyframes jostle {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  30% { translate: 0 -2px; rotate: -1deg; }
  60% { translate: 0 0; rotate: .6deg; }
}

/* The belt creeps even when you don't scroll */
@property --creep { syntax: '<length>'; inherits: false; initial-value: 0px; }
.belt { background-position-x: calc(var(--run, 0) * (var(--n) - 1) * 50cqw + var(--creep)); animation: creep 2.4s linear infinite; }
@keyframes creep { to { --creep: 28px; } }
.station:not([data-awake]) .belt { animation-play-state: paused; }
/* The running line uses the one continuous belt; stations keep their own only for the
   stacked reduced-motion layout. */
.station .belt { display: none; }
.cannery:not([data-awake]) .belt-run { animation-play-state: paused; }
.belt-run { z-index: 1; }

/* SVG parts rotate around their own box unless told otherwise */
.machine .idle { transform-box: fill-box; }

.jiggle { transform-origin: 50% 100%; animation: jiggle 2.2s ease-in-out infinite; }
@keyframes jiggle { 0%, 100% { rotate: 0deg; } 25% { rotate: -4deg; } 50% { translate: 0 -3px; } 75% { rotate: 3deg; } }

.pulse { fill: none; stroke: var(--mustard); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 8 22; animation: pulse 1.1s linear infinite; }
@keyframes pulse { to { stroke-dashoffset: -30; } }

.needle { transform-box: view-box !important; transform-origin: 112px 156px; animation: needle 3.2s ease-in-out infinite; }
@keyframes needle { 0%, 100% { rotate: 0deg; } 20% { rotate: 14deg; } 28% { rotate: 8deg; } 60% { rotate: 22deg; } 70% { rotate: 16deg; } }

.lamp { animation: lamp 2.6s steps(1) infinite; }
@keyframes lamp { 0%, 100% { opacity: 1; } 8% { opacity: .35; } 12% { opacity: 1; } 16% { opacity: .35; } 20% { opacity: 1; } }

.puff { fill: var(--paper); stroke: var(--ink); stroke-width: 2.5; opacity: 0; transform-origin: 50% 50%; animation: puff 3.2s ease-out infinite; }
@keyframes puff {
  0% { opacity: 0; translate: 0 0; scale: .4; }
  15% { opacity: .9; }
  100% { opacity: 0; translate: 6px -46px; scale: 1.6; }
}

.tap { transform-box: view-box !important; transform-origin: 226px 166px; animation: tap 2.8s ease-in infinite; }
@keyframes tap { 0%, 60%, 100% { rotate: 0deg; } 70% { rotate: -16deg; } 76% { rotate: 2deg; } 82% { rotate: -10deg; } 88% { rotate: 1deg; } }

.ram { animation: ram 3.6s ease-in-out infinite; }
@keyframes ram { 0%, 100% { translate: 0 0; } 45% { translate: 0 10px; } 52% { translate: 0 7px; } }

.swing { transform-box: view-box !important; transform-origin: 200px 0; animation: swing 4s ease-in-out infinite alternate; }
@keyframes swing { from { rotate: -5deg; } to { rotate: 5deg; } }
.flicker { transform-box: view-box !important; animation: flicker 3s steps(1) infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 40% { opacity: .2; } 43% { opacity: 1; } 46% { opacity: .3; } 48% { opacity: 1; } }

.scribble { animation: scribble .5s ease-in-out infinite alternate; }
@keyframes scribble { from { translate: -3px 1px; } to { translate: 3px -1px; } }

.drip { stroke-dasharray: 6 10; animation: drip 1.8s linear infinite; }
@keyframes drip { to { stroke-dashoffset: -16; } }

/* ---------- The cold one: crack it for the email ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.crack-cta { cursor: pointer; }

.beer-spot {
  --w: clamp(80px, 7.5cqw, 120px);
  position: absolute;
  left: calc(var(--mx) + 13cqw);
  bottom: calc(var(--belt-clear, 15svh) + 26px);
  width: var(--w);
  height: calc(var(--w) * 2);
  z-index: 3;
}
.beer {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 12px;
}
.beer-can { display: block; width: 100%; height: 100%; overflow: visible; }
/* Can and tab move as one: the wobble and the jolt go on the wrapper, not on the can drawing */
.beer-body { position: relative; display: block; width: 100%; height: 100%; transform-origin: 50% 100%; }
.beer-body.idle { animation: nudge 5s ease-in-out infinite; }
@keyframes nudge { 0%, 84%, 100% { rotate: 0deg; } 88% { rotate: -4deg; } 92% { rotate: 3deg; } 96% { rotate: -1deg; } }
.beer:hover .beer-body { animation-duration: .6s; }
.beer-name { font: 900 12.5px Archivo, sans-serif; font-stretch: 100%; fill: var(--ink); text-anchor: middle; }
.beer-sub { font: 800 8px Archivo, sans-serif; letter-spacing: .2em; fill: var(--paper); text-anchor: middle; }
.sweat circle { fill: var(--paper); opacity: .55; }

/* The pull tab sits on the lid and flips up when cracked */
.beer-tab {
  position: absolute;
  left: 34%;
  top: 9%;
  width: 40%;
  transform-origin: 90% 50%;
  transition: rotate .18s cubic-bezier(.3, 1.6, .5, 1);
}
.beer-tab path { fill: var(--tin); stroke: var(--ink); stroke-width: 2.5; }
.open .beer-tab { rotate: -70deg; }

/* Foam wells up and over the lip; spray bursts out on the crack */
.foam { position: absolute; left: 12%; right: 12%; top: 2%; height: 16%; pointer-events: none; }
.foam i {
  position: absolute;
  bottom: 0;
  width: 46%;
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #FFFCF4;
  scale: 0;
  transform-origin: 50% 100%;
  transition: scale .5s cubic-bezier(.3, 1.5, .5, 1);
}
.foam i:nth-child(1) { left: 0; }
.foam i:nth-child(2) { left: 27%; width: 52%; bottom: 20%; transition-delay: .08s; }
.foam i:nth-child(3) { right: 0; transition-delay: .16s; }
.open .foam i { scale: 1; }

.spray { position: absolute; left: 50%; top: 12%; pointer-events: none; }
.spray i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); opacity: 0; }
.open .spray i { animation: spray .7s ease-out both; }
.spray i:nth-child(1) { --dx: -38px; --dy: -46px; }
.spray i:nth-child(2) { --dx: -14px; --dy: -64px; }
.spray i:nth-child(3) { --dx: 12px; --dy: -58px; }
.spray i:nth-child(4) { --dx: 36px; --dy: -40px; }
.spray i:nth-child(5) { --dx: -26px; --dy: -20px; }
.spray i:nth-child(6) { --dx: 28px; --dy: -24px; }
@keyframes spray { 0% { opacity: 1; translate: 0 0; } 100% { opacity: 0; translate: var(--dx) var(--dy); } }
.cracking .beer-body { animation: jolt .3s ease-out; }
@keyframes jolt { 30% { translate: 0 4px; scale: 1.02 .97; } }

/* The note slides out from behind the can */
.beer-note {
  position: absolute;
  right: -8px;
  bottom: calc(100% + 18px);
  width: max-content;
  max-width: 80cqw;
  padding: 14px 16px 16px;
  border: var(--line);
  background: #FFFCF4;
  box-shadow: 6px 6px 0 var(--ink);
  rotate: 2deg;
  opacity: 0;
  translate: 0 16px;
  visibility: hidden;
  transition: opacity .25s, translate .35s cubic-bezier(.3, 1.4, .5, 1), visibility 0s .35s;
}
.open-note .beer-note { opacity: 1; translate: 0 0; visibility: visible; transition-delay: .35s, .35s, 0s; }
.beer-note p { margin: 0 0 6px; font-family: Caveat, cursive; font-size: 22px; font-weight: 700; color: var(--tomato-ink); }
.beer-note a { display: block; margin-bottom: 10px; color: var(--ink); font-size: 19px; font-weight: 800; font-stretch: 110%; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.copy {
  padding: 6px 14px;
  border: var(--line);
  border-radius: 999px;
  background: var(--mustard);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .06em;
  cursor: pointer;
}

@media (max-width: 640px) {
  .beer-spot { --w: 60px; left: 70%; }
  /* The packed stack sits lower and to the left so it clears the card on short phones */
  .station.out .machine { left: 36%; width: min(56cqw, 26svh * 1.23); }
  .station.out .can:nth-of-type(6) { display: none; }
}

/* Reduced motion: nothing idles */
@media (prefers-reduced-motion: reduce) {
  .spray, .foam { display: none; }
  .beer-tab, .beer-note { transition: none; }
  .idle, .belt { animation: none !important; }
  .station .belt { display: block; }
  .belt-run { display: none; }
  .puff { display: none; }
}


/* ---------- The 3D line (line3d.js). Classes are l3-* so they never collide with the rest ---------- */
.cannery .inside-hero { opacity: calc(var(--reveal) * (1 - min(1, var(--t, 0) * 30))); }
.l3-scene { position: absolute; inset: 0; }
.l3-scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.l3-count { position: absolute; top: 20px; right: var(--gutter); margin: 0; z-index: 3; font-size: 12px; font-weight: 750; font-stretch: 80%; letter-spacing: .14em; }
.l3-tin-name { position: absolute; z-index: 3; margin: 0; color: var(--tomato-ink); font-family: Caveat, cursive; font-size: 26px; font-weight: 700; translate: -50% 0; pointer-events: none; }
.l3-count { opacity: min(1, calc(var(--t, 0) * 30)); }
.l3-tin-name { transition: opacity .4s; }
.l3-card {
  position: absolute; top: 12svh; left: 7vw; z-index: 3;
  width: min(34vw, 440px);
  padding: 18px 24px 22px 40px;
  border: var(--line); background: #FFFCF4; box-shadow: 8px 8px 0 var(--ink);
  rotate: -1deg;
  opacity: 0; translate: 0 16px; visibility: hidden;
  transition: opacity .3s, translate .3s, visibility 0s .3s;
}
.l3-card.on { opacity: 1; translate: 0 0; visibility: visible; transition: opacity .3s, translate .3s; }
.l3-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 16px; background: var(--tomato); border-right: var(--line); }
.l3-strip { display: flex; justify-content: space-between; padding-bottom: 8px; border-bottom: 2px solid var(--ink); font-size: 11px; font-weight: 750; font-stretch: 80%; letter-spacing: .14em; text-transform: uppercase; }
.l3-strip b { color: var(--tomato-ink); }
.l3-card h2 { margin: 12px 0 10px; font-size: clamp(22px, 2.4vw, 32px); font-weight: 800; font-stretch: 110%; line-height: 1.05; }
.l3-card p { margin: 0 0 16px; font-size: 16px; }
.l3-hint { font-family: Caveat, cursive; font-size: 24px !important; font-weight: 700; color: var(--tomato-ink); margin: 0 !important; }
.l3-pick {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px 9px 12px;
  border: var(--line); border-radius: 999px; background: var(--mustard); box-shadow: 4px 4px 0 var(--ink);
  color: var(--ink); font: inherit; font-size: 15px; font-weight: 800; cursor: pointer;
}
.l3-pick:active { translate: 3px 3px; box-shadow: 1px 1px 0 var(--ink); }
.l3-plus { display: grid; place-items: center; width: 20px; height: 20px; border: 2px solid var(--ink); border-radius: 50%; background: #FFFCF4; font-size: 15px; line-height: 1; }
.l3-pick[aria-pressed="true"] { background: #FFFCF4; }
.l3-pick[aria-pressed="true"] .l3-plus { background: var(--dill); color: #FFFCF4; }
.l3-list { margin: 0 0 16px; padding: 0; list-style: none; }
.l3-list li { padding: 5px 0; border-top: 1.5px dashed rgba(23, 33, 29, .35); font-weight: 650; }
.l3-list li::before { content: "✦ "; color: var(--tomato-ink); }
.l3-mail { display: inline-block; margin: 8px 0 0 14px; color: var(--ink); font-size: 14px; text-underline-offset: 3px; }
/* the note slides out from behind the can, as the old line's did; line3d.js keeps it above the can */
.l3-note { position: absolute; z-index: 5; left: 0; top: 0; width: max-content; max-width: 86vw; padding: 14px 16px 16px; border: var(--line); background: #FFFCF4; box-shadow: 6px 6px 0 var(--ink); rotate: 2deg; opacity: 0; translate: 0 16px; visibility: hidden; transition: opacity .25s, translate .35s cubic-bezier(.3, 1.4, .5, 1), visibility 0s .35s; }
.l3-note.open-note { opacity: 1; translate: 0 0; visibility: visible; transition-delay: .35s, .35s, 0s; }
.l3-note a { display: block; margin: 4px 0 12px; color: var(--ink); font-size: 19px; font-weight: 800; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.l3-copy { padding: 6px 14px; border: var(--line); border-radius: 999px; background: #FFFCF4; font: inherit; font-weight: 700; cursor: pointer; color: var(--ink); }
.l3-note .l3-hint { margin: 0 28px 0 0 !important; }
.l3-close { position: absolute; top: 6px; right: 10px; border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink); }
@media (max-width: 640px) {
  .l3-card { top: 8svh; left: 5vw; right: 5vw; width: auto; padding: 14px 16px 16px 30px; }
  .l3-card::before { width: 12px; }
  .l3-card h2 { font-size: 22px; }
  .l3-card p { font-size: 15px; }
}

/* No 3D (no WebGL, or reduced motion): nothing pins; the headline and the station cards stack as a
   plain list, and the last card keeps the email. */
.l3-flat { height: auto; margin-top: 0; opacity: 1 !important; pointer-events: auto !important; }
.l3-flat .line-stage { position: static; height: auto; overflow: visible; background: var(--oil-soft); padding-bottom: 8svh; }
.l3-flat .inside-hero { position: static; padding: 16svh var(--gutter) 10svh; opacity: 1; translate: none; }
.l3-flat .l3-card { position: static; width: auto; max-width: 560px; margin: 0 auto 28px; opacity: 1; visibility: visible; translate: none; transition: none; }
.l3-flat .l3-pick, .l3-flat #card-intro, .l3-flat .l3-count, .l3-flat .l3-tin-name, .l3-flat .l3-note, .l3-flat .l3-scene { display: none; }
.l3-flat .l3-mail { margin-left: 0; font-size: 17px; font-weight: 700; }
@media (max-width: 640px) { .l3-flat .l3-card { margin: 0 var(--gutter) 24px; } }
@media (prefers-reduced-motion: reduce) {
  .l3-card, .l3-note { transition: none; }
}

/* Knock the open can over and the beer pours off the end of the line and fills the footer (line3d.js
   raises --beer slowly while it pours; it stays full until the page is reloaded) */
.foot { position: relative; isolation: isolate; overflow: hidden; }
.foot::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: calc(var(--beer, 0) * 100%);
  background:
    radial-gradient(circle at 20% 70%, rgb(255 248 230 / .5) 0 2px, transparent 3px) 0 0 / 46px 38px,
    radial-gradient(circle at 70% 30%, rgb(255 248 230 / .4) 0 1.5px, transparent 2.5px) 0 0 / 62px 44px,
    #E0A83E;
  animation: fizz 3s linear infinite;
  z-index: -1;
}
/* the head: a scalloped foam line riding the top of the beer */
.foot::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--beer, 0) * 100% - 4px);
  height: 12px;
  background: radial-gradient(circle at 8px 12px, #FFF8E6 0 8px, transparent 8.5px) 0 0 / 16px 12px repeat-x;
  opacity: min(1, calc(var(--beer, 0) * 40));
  z-index: -1;
  pointer-events: none;
}
@keyframes fizz { to { background-position: 0 -38px, 0 -44px, 0 0; } }
@media (prefers-reduced-motion: reduce) { .foot::before { animation: none; } }
