/* Pull: pull your own shot of espresso. */

@font-face {
  font-family: "Bodoni Moda";
  src: url("../fonts/bodoni-moda.woff2") format("woff2");
  font-weight: 400 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/hanken-grotesk.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --ink: #0c0907;
  --ink-2: #15100d;
  --ink-3: #1d1713;
  --roast: #2b1a10;
  --crema: #d4a15e;
  --crema-hi: #e6b779;
  --steel: #8e9296;
  --paper: #efe7dc;
  --paper-2: rgb(239 231 220 / 0.82);
  --paper-3: rgb(239 231 220 / 0.6);
  --line: rgb(239 231 220 / 0.78);
  --line-2: rgb(239 231 220 / 0.28);
  --display: "Bodoni Moda", "Didot", "Bodoni 72", serif;
  --text: "Hanken Grotesk", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-io: cubic-bezier(0.77, 0, 0.175, 1);
  --gutter: clamp(1.25rem, 0.6rem + 3vw, 3rem);
  --edge: clamp(1.5rem, 5vw, 6rem);
  --bar: 4rem;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scrollbar-color: rgb(212 161 94 / 0.55) var(--ink);
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0; background: var(--ink); color: var(--paper);
  font: 400 1rem/1.5 var(--text);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, p, dl, dd, ol, figure { margin: 0; padding: 0; }
ol { list-style: none; }
a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; }
button, a, [role="slider"] { touch-action: manipulation; }
button, [role="slider"] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
::selection { background: var(--crema); color: var(--ink); }
:focus-visible { outline: 2px solid var(--crema); outline-offset: 4px; border-radius: 3px; }
.num { font-variant-numeric: tabular-nums lining-nums; }
.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip {
  position: fixed; left: var(--gutter); top: 1rem; z-index: 200;
  padding: 0.75rem 1rem; background: var(--paper); color: var(--ink); transform: translateY(-300%);
}
.skip:focus-visible { transform: none; }

/* ---------- Preloader: the machine warming up ---------- */

.preload { display: none; }
.live .preload {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-content: center; justify-items: center; gap: 1.25rem;
  background: var(--ink);
  transition: clip-path 900ms var(--ease-io), visibility 0s 900ms;
  clip-path: inset(0 0 0 0);
}
.live .preload.is-done { clip-path: inset(0 0 100% 0); visibility: hidden; pointer-events: none; }
.preload-gauge { width: min(42vw, 11rem); }
.pg-face { fill: #090706; stroke: var(--line-2); stroke-width: 1.5; }
.pg-ticks { fill: none; stroke: var(--line-2); stroke-width: 10; stroke-dasharray: 0.12 1.88; }
.pg-mark { stroke: var(--crema); stroke-width: 5; }
.pg-needle { transform-origin: 100px 100px; transform: rotate(-135deg); animation: warm 1500ms var(--ease-out) 150ms forwards; }
.pg-needle line { stroke: var(--crema); stroke-width: 3.5; stroke-linecap: round; }
.pg-needle circle { fill: var(--paper); }
@keyframes warm { to { transform: rotate(67.5deg); } }
.preload-word { font: 500 1.125rem var(--display); color: var(--paper-2); letter-spacing: 0.02em; }
.preload-skip {
  position: absolute; right: var(--gutter); bottom: calc(1.5rem + env(safe-area-inset-bottom));
  background: none; border: 0; color: var(--paper-3); font-size: 0.9375rem; padding: 0.75rem; cursor: pointer;
  text-decoration: underline; text-underline-offset: 0.25em; text-decoration-color: var(--line-2);
}

/* ---------- Top bar ---------- */

.bar {
  position: fixed; z-index: 60; left: 0; right: 0; top: 0;
  height: calc(var(--bar) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) var(--gutter) 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
/* ---------- Hero ---------- */


.hero { position: relative; height: 100svh; min-height: 36rem; overflow: hidden; isolation: isolate; }
.hero-media { position: absolute; inset: 0; z-index: -1; }
.hero-media picture, .hero-media img, .loop, .ripple { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-media img, .loop { object-fit: cover; object-position: 60% 55%; }
.loop { opacity: 0; transition: opacity 1200ms ease; }
.loop.is-playing { opacity: 1; }
.ripple { opacity: 0; transition: opacity 900ms ease; }
.ripple.is-on { opacity: 1; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to top, rgb(12 9 7 / 0.9), rgb(12 9 7 / 0.35) 45%, rgb(12 9 7 / 0) 70%);
}
.hero-copy {
  position: absolute; left: var(--edge); right: var(--edge);
  bottom: calc(env(safe-area-inset-bottom) + clamp(2rem, 8vh, 5rem));
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 1.5rem 2rem;
}
.kinetic {
  grid-column: 1 / -1;
  font: 500 clamp(3.75rem, 1rem + 11vw, 12rem)/0.86 var(--display);
  letter-spacing: -0.035em;
}
.kinetic .line { display: block; }
.kinetic .ch { display: inline-block; transform-origin: 50% 100%; }
.lede { font-size: clamp(1.0625rem, 0.98rem + 0.4vw, 1.375rem); color: var(--paper-2); max-width: 30ch; }

/* ---------- Interludes: photographs as materials between steps ---------- */

.interlude { position: relative; padding: clamp(3rem, 10vh, 7rem) var(--gutter); display: grid; justify-items: center; gap: 2rem; }
.interlude figure { width: min(100%, 68rem); aspect-ratio: 16 / 8; overflow: hidden; border-radius: 4px; }
.interlude figure picture, .interlude figure img { width: 100%; height: 100%; }
.interlude figure img { object-fit: cover; }
.interlude-line {
  font: 500 clamp(1.75rem, 1rem + 3vw, 3.75rem)/1.05 var(--display); letter-spacing: -0.015em;
  text-align: center; max-width: 22ch; text-wrap: balance;
}
@media (max-width: 47.99em) { .interlude figure { aspect-ratio: 4 / 5; } }

/* ---------- Scenes ---------- */

.scene {
  position: relative; min-height: 100svh;
  padding: calc(var(--bar) + env(safe-area-inset-top) + clamp(1.5rem, 6vh, 4rem)) var(--gutter) clamp(3rem, 10vh, 6rem);
  display: grid; gap: 2.5rem; align-content: center;
  border-top: 1px solid var(--line-2);
}
.scene h2 {
  font: 500 clamp(2.75rem, 1.4rem + 5vw, 6.5rem)/0.92 var(--display);
  letter-spacing: -0.025em; margin-bottom: clamp(1rem, 2.5vh, 1.75rem); text-wrap: balance;
}
.scene h2 .n { font-size: 0.36em; color: var(--crema); vertical-align: 1.35em; margin-right: 0.35em; }
.scene-copy > p { font-size: clamp(1.0625rem, 0.98rem + 0.4vw, 1.3125rem); color: var(--paper-2); max-width: 34ch; text-wrap: pretty; }
.status { margin-top: 1rem; min-height: 1.5em; color: var(--crema); font-size: 1rem; }


/* Drawn rigs */
.rig { position: relative; width: min(100%, 34rem); justify-self: center; }
.rig > svg { display: block; width: 100%; height: auto; overflow: visible; }
.steel { fill: #1c1916; stroke: var(--line); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.steel--light { fill: #2c2824; }
.slot { fill: #090706; stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.slab { fill: #17120f; stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.screen { fill: #070504; stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.glass { fill: rgb(239 231 220 / 0.035); stroke: var(--line); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.glint { fill: none; stroke: rgb(255 255 255 / 0.18); stroke-width: 4; stroke-linecap: round; }
.ln2 { fill: none; stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.walnut { fill: #6a4229; stroke: var(--line); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.grain { fill: none; stroke: rgb(0 0 0 / 0.28); stroke-width: 2; }
.ticks { fill: none; stroke: var(--line-2); stroke-width: 8; stroke-dasharray: 0.12 1.88; }
.mark { stroke: var(--crema); stroke-width: 4; }
.needle line { stroke: var(--crema); stroke-width: 3; stroke-linecap: round; }
.needle circle { fill: var(--paper); }
.gauge-label { font: 500 13px var(--text); fill: var(--paper-3); text-anchor: middle; }
.grate { stroke: var(--line-2); stroke-width: 16; stroke-dasharray: 3 11; }
.digits { font: 600 18px var(--text); fill: var(--crema-hi); text-anchor: end; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.bed, .mound { transform-box: fill-box; transform-origin: 50% 100%; }

@media (min-width: 56em) {
  .scene { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: center; gap: var(--edge); padding-left: var(--edge); padding-right: var(--edge); }
}

/* ---------- 1 · Grind: a dial you turn, a loupe that shows the result ---------- */

.grinder { position: relative; justify-self: center; width: min(80vw, 30rem); aspect-ratio: 1; }
.dial { position: absolute; inset: 0; border-radius: 50%; cursor: grab; touch-action: none; }
.dial:active { cursor: grabbing; }
.dial:focus-visible { outline-offset: 8px; border-radius: 50%; }
.dial svg { width: 100%; height: 100%; overflow: visible; }
.dial-shadow { fill: #050403; }
.dial-face { fill: #23201c; stroke: var(--line-2); stroke-width: 1; }
.dial-knurl { fill: none; stroke: #3a3530; stroke-width: 14; stroke-dasharray: 0.45 0.55; }
.dial-zone { fill: none; stroke: var(--crema); stroke-width: 6; stroke-linecap: round; opacity: 0.85; }
.dial-ticks line { stroke: var(--line-2); stroke-width: 2; }
.dial-ticks line.major { stroke: var(--paper-2); stroke-width: 2.5; }
.dial-ticks text { font: 600 15px var(--text); fill: var(--paper-2); text-anchor: middle; dominant-baseline: middle; }
.dial-ring { transform-origin: 200px 200px; }
.dial-hub { fill: #15120f; stroke: var(--line-2); stroke-width: 1; }
.dial-teeth { fill: none; stroke: #6d7174; stroke-width: 12; stroke-dasharray: 0.5 0.5; }
.dial-core { fill: #2a2622; stroke: var(--line); stroke-width: 1; }
.dial-pin { fill: var(--paper); }
.dial-pointer { fill: var(--crema); }
.dial-hub-pass { display: none; }
@media (pointer: coarse) {
  .dial-hub-pass { display: block; position: absolute; left: 21%; top: 21%; width: 58%; height: 58%; border-radius: 50%; touch-action: pan-y; }
}
.loupe {
  position: absolute; width: 44%; aspect-ratio: 1; right: -6%; bottom: -4%;
  border-radius: 50%; overflow: hidden; border: 1.5px solid var(--paper);
  box-shadow: 0 1.25rem 3rem rgb(0 0 0 / 0.6); pointer-events: none;
}
.loupe canvas { width: 100%; height: 100%; display: block; }
.dial-hint { position: absolute; left: 50%; bottom: -2.5rem; transform: translateX(-50%); font-size: 0.875rem; color: var(--paper-3); white-space: nowrap; }
.grind-word { margin-top: 1.75rem; font: 500 clamp(2.25rem, 1.5rem + 3vw, 4rem)/1 var(--display) !important; color: var(--crema) !important; }
.grind-note { margin-top: 0.4rem; color: var(--paper-2); }

/* ---------- 2 · Dose and tamp: PRESS is the plunger ---------- */

.scene--tamp { grid-template-areas: "copy" "rig" "press"; }
.scene--tamp .scene-copy { grid-area: copy; }
.scene--tamp .rig { grid-area: rig; }
.press { grid-area: press; }
@media (min-width: 56em) {
  .scene--tamp { grid-template-areas: "copy rig" "press press"; row-gap: 1rem; }
}
.dose-stream { opacity: 0; }
.dose-stream circle { fill: #7a4a2b; }
.dose-stream.run { opacity: 1; }
.live .dose-stream.run circle { animation: dosefall 520ms linear infinite; }
.dose-stream circle:nth-child(2n) { animation-delay: -260ms; }
@keyframes dosefall { from { transform: translateY(-40px); } to { transform: translateY(40px); } }
.vial {
  position: absolute; left: 50%; top: 6%; transform: translateX(-50%);
  width: 11rem; height: 1.75rem; border-radius: 1rem;
  border: 1.5px solid var(--line); background: rgb(160 190 150 / 0.12);
  opacity: 0; transition: opacity 300ms ease;
}
.vial.is-on { opacity: 1; }
.vial-mark { position: absolute; left: 50%; top: 15%; bottom: 15%; width: 2.2rem; transform: translateX(-50%); border-left: 1px solid var(--paper-3); border-right: 1px solid var(--paper-3); }
.vial-bubble {
  position: absolute; left: 50%; top: 50%; width: 1.7rem; height: 1rem; margin: -0.5rem 0 0 -0.85rem;
  border-radius: 50%; background: radial-gradient(circle at 35% 35%, rgb(255 255 255 / 0.9), rgb(225 235 220 / 0.55) 60%, rgb(200 215 195 / 0.3));
}
.vial-word { position: absolute; left: calc(100% + 0.75rem); top: 50%; transform: translateY(-50%); font-size: 0.875rem; color: var(--crema); opacity: 0; transition: opacity 300ms ease; }
.vial.is-level .vial-word { opacity: 1; }
.press {
  position: relative; justify-self: center; display: grid; justify-items: center; gap: 0.5rem;
  background: none; border: 0; padding: 0.5rem 1rem 0; cursor: pointer; touch-action: none;
  color: var(--paper);
}
.press-word {
  display: block; font: 900 min(1rem + 19vw, 30svh)/0.78 var(--display); letter-spacing: -0.04em;
  transform-origin: 50% 100%; transform: scaleY(var(--squash, 1));
  transition: color 300ms ease;
}
.press:disabled { cursor: default; }
.press:disabled .press-word { color: rgb(239 231 220 / 0.18); }
.press.is-level .press-word { color: var(--crema); }
.press-hint { font-size: 0.9375rem; color: var(--paper-3); }
.press:focus-visible { outline-offset: 0; }

/* ---------- 3 · Lock in ---------- */

.purge { opacity: 0; }
.purge ellipse { fill: rgb(200 214 224 / 0.65); }
.purge.run { opacity: 1; }
.live .purge.run ellipse { animation: drip 520ms linear infinite; }
.purge ellipse:nth-child(2n) { animation-delay: -200ms; }
.purge ellipse:nth-child(3n) { animation-delay: -360ms; }
@keyframes drip { from { transform: translateY(-30px); opacity: 1; } to { transform: translateY(170px); opacity: 0; } }
.lock-handle { transform-box: fill-box; transform-origin: 0 50%; }

/* ---------- 4 · Pull: hold, watch the clock and the scale ---------- */

.scene--brew {
  grid-template-areas: "copy" "rig" "read" "hold";
  justify-items: center; text-align: center; overflow: hidden;
}
.scene--brew .scene-copy { grid-area: copy; }
.scene--brew .scene-copy > p { margin: 0 auto; }
.scene--brew .rig { grid-area: rig; width: min(72vw, 21rem); z-index: 1; }
.brew-read { grid-area: read; width: min(100%, 22rem); z-index: 1; }
.btn--pull { grid-area: hold; }
.pull-hint { grid-area: hold; align-self: end; margin-top: 9.5rem; font-size: 0.875rem; color: var(--paper-3); }
.clock {
  display: flex; align-items: baseline; margin-bottom: 0.4rem;
  font: 400 clamp(4.5rem, 2rem + 6vw, 9rem)/0.85 var(--display); letter-spacing: -0.035em;
  color: var(--paper-3); white-space: nowrap; transition: color 300ms ease;
}
.clock-t { font-size: 0.42em; }
.clock-u { font-size: 0.32em; margin-left: 0.06em; color: var(--crema); }
.scene--brew.is-pulling .clock { color: var(--paper); }
.scene--brew.in-window .clock { color: var(--crema); }
.rig--brew { aspect-ratio: 3 / 4; }
.rig--brew > svg, .rig--brew > canvas, .stream-2d { position: absolute; inset: 0; width: 100%; height: 100%; }
.stream { opacity: 0; }
.stream.is-on { opacity: 1; }
.stream.is-on + .stream-2d { display: none; }
.stream-2d i {
  position: absolute; top: 45.5%; width: 1%; height: 0;
  background: linear-gradient(#e3b26b, #9a5a2a 45%, #c98b47); border-radius: 2px;
  transform-origin: 50% 0; transform: scaleY(var(--flow, 0));
}
.stream-2d i:nth-child(1) { left: 47.3%; height: calc(var(--surface, 81%) - 45.5%); }
.stream-2d i:nth-child(2) { left: 51.8%; height: calc(var(--surface, 81%) - 45.5%); }
.stream-2d b {
  position: absolute; left: 34%; right: 34%; top: 59%; bottom: 17.5%;
  clip-path: polygon(0 0, 100% 0, 94% 100%, 6% 100%);
  background: linear-gradient(#d9a865 0 0.5rem, #4a2812 0.5rem, #22110a);
  transform-origin: 50% 100%; transform: scaleY(var(--fill, 0));
}
.yield { font: 400 clamp(2.5rem, 1.6rem + 3vw, 4rem)/1 var(--display); }
.yield .of { font-size: 0.4em; color: var(--paper-3); font-family: var(--text); }
.yield-bar { position: relative; height: 3px; margin-top: 0.9rem; background: var(--line-2); border-radius: 2px; }
.yield-bar span { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: var(--crema); transform-origin: left; transform: scaleX(0); border-radius: 2px; }
.yield-bar i { position: absolute; left: 80%; top: -6px; bottom: -6px; width: 1px; background: var(--paper); }
@media (min-width: 56em) {
  .scene--brew {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "copy rig read" "copy rig hold";
    text-align: left; justify-items: start; align-items: center;
  }
  .scene--brew .scene-copy > p { margin: 0; }
  .scene--brew .rig { justify-self: center; width: min(100%, 24rem); }
  .brew-read { align-self: end; }
  .btn--pull { align-self: start; margin-top: 2rem; --size: 8.5rem; }
  .pull-hint { grid-area: hold; align-self: start; margin-top: 11.5rem; }
}

/* ---------- Result ---------- */

.scene--result { justify-items: center; }
.scene--result[hidden] { display: none; }
.cup-top { width: min(78vw, 26rem); }
.cup-top svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 1.5rem 2.5rem rgb(0 0 0 / 0.55)); }
.mottle { opacity: var(--c-mottle, 0.35); fill: var(--c-dark, #6a3a1b); }
.tiger path { fill: none; stroke: var(--c-dark, #6a3a1b); stroke-width: 9; stroke-linecap: round; opacity: var(--c-tiger, 0.45); filter: blur(3px); }
.bubbles circle { fill: rgb(255 240 215 / 0.55); opacity: var(--c-bub, 0.6); }
.crema-edge { stroke: var(--c-rim, #8a5229); stroke-width: 3; opacity: 0.7; }
[data-crema] { --c-hi: #e8b977; --c-mid: #c98b47; --c-rim: #7e4a24; --c-dark: #6a3a1b; }
.scene--result[data-kind="sour"] [data-crema] { --c-hi: #f2d39b; --c-mid: #e0b46e; --c-rim: #b98446; --c-dark: #b78a52; --c-mottle: 0.15; --c-tiger: 0.1; --c-bub: 1; }
.scene--result[data-kind="bitter"] [data-crema] { --c-hi: #8a5228; --c-mid: #5a3017; --c-rim: #2e170b; --c-dark: #1d0e06; --c-mottle: 0.6; --c-tiger: 0.2; --c-bub: 0.25; }
.result-copy { max-width: 32rem; }
.verdict { font: 500 clamp(4rem, 2rem + 8vw, 9rem)/0.9 var(--display); letter-spacing: -0.03em; }
.scene--result[data-kind="balanced"] .verdict { color: var(--crema); }
.taste { margin-top: 1.25rem; font-size: clamp(1.125rem, 1rem + 0.5vw, 1.5rem); color: var(--paper); max-width: 30ch; }
.fix { margin-top: 0.6rem; font: 500 clamp(1.5rem, 1.1rem + 1.6vw, 2.5rem)/1.1 var(--display); color: var(--crema); }
.stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 0.25rem 2rem; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line-2); }
.stats dt { font-size: 0.8125rem; color: var(--paper-3); }
.stats dd { font: 400 1.75rem/1.1 var(--display); font-variant-numeric: lining-nums; }
.result-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
@media (min-width: 56em) { .scene--result { justify-items: stretch; } .cup-top { justify-self: center; } }

/* ---------- Method, recipe, footer ---------- */

.recipe { position: relative; padding: clamp(5rem, 14vh, 10rem) var(--gutter) 0; border-top: 1px solid var(--line-2); }
.recipe-inner { max-width: 62rem; margin: 0 auto; }
.recipe h2 { font: 500 clamp(3.25rem, 1.5rem + 8vw, 8.5rem)/0.9 var(--display); letter-spacing: -0.025em; margin-bottom: clamp(2.5rem, 7vh, 4.5rem); }
.sheet > div {
  display: grid; grid-template-columns: minmax(5rem, 9rem) 1fr; gap: 1rem; align-items: baseline;
  padding: clamp(1rem, 2.5vh, 1.5rem) 0; border-top: 1px solid rgb(142 146 150 / 0.35);
}
.sheet > div:last-child { border-bottom: 1px solid rgb(142 146 150 / 0.35); }
@media (max-width: 24em) { .sheet > div { grid-template-columns: 4.25rem 1fr; gap: 0.75rem; } .sheet .v { font-size: 2.25rem; } }
.sheet dt { font-size: 1rem; color: var(--paper-3); }
.sheet dd { font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem); color: var(--paper-2); }
.sheet .v { font: 400 clamp(2.5rem, 1.4rem + 4.5vw, 5rem)/1 var(--display); color: var(--paper); letter-spacing: -0.02em; margin-right: 0.2em; }
.foot { max-width: 62rem; margin: 0 auto; padding: clamp(5rem, 12vh, 8rem) 0 calc(2rem + env(safe-area-inset-bottom)); font-size: 0.9375rem; color: var(--paper-3); }
.foot a { display: inline-flex; align-items: center; min-height: 2.75rem; text-decoration-color: rgb(239 231 220 / 0.35); }
@media (hover: hover) and (pointer: fine) { .foot a:hover { color: var(--paper); text-decoration-color: currentColor; } }
@media (min-width: 56em) {
  .recipe-inner { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 2rem var(--edge); align-items: start; max-width: 76rem; }
  .recipe h2 { position: sticky; top: 14vh; }
  .recipe .sheet, .recipe .print { grid-column: 2; }
  .recipe .print { justify-self: start; }
  .foot { max-width: 76rem; }
}

/* ---------- Polish layer (motion welcome only) ---------- */

/* Coffee-drop cursor: fine pointers only. */
.drop { display: none; }
.has-drop, .has-drop * { cursor: none !important; }
.has-drop .drop {
  display: block; position: fixed; left: 0; top: 0; z-index: 300; pointer-events: none;
  width: 1.1rem; height: 1.45rem; margin: -0.15rem 0 0 -0.55rem;
  transition: width 220ms var(--ease-out), height 220ms var(--ease-out), margin 220ms var(--ease-out), opacity 200ms ease;
}
.drop svg { width: 100%; height: 100%; display: block; overflow: visible; }
.drop path { fill: var(--crema); stroke: var(--ink); stroke-width: 1.2; transition: fill 200ms ease; }
.has-drop .drop.is-over { width: 2.1rem; height: 2.75rem; margin: -0.3rem 0 0 -1.05rem; }
.has-drop .drop.is-over path { fill: rgb(212 161 94 / 0.55); }
.has-drop .drop.is-down path { fill: var(--crema-hi); }


@media (prefers-reduced-motion: no-preference) {
  /* Mask wipes: each photograph and rig opens from a narrow aperture as it enters. */
  @supports (animation-timeline: view()) {
    .live .reveal, .live .rig {
      animation: wipe linear both; animation-timeline: view(); animation-range: entry 0% cover 38%;
    }
    .live .reveal img { animation: settle-in linear both; animation-timeline: view(); animation-range: entry 0% cover 60%; }
    .live .scene h2, .live .interlude-line {
      animation: lift-in var(--ease-out) both; animation-timeline: view(); animation-range: entry 10% cover 30%;
    }
  }
  .live .hero-media { animation: settle 1800ms var(--ease-out) both; }
}
@keyframes wipe { from { clip-path: inset(16% 10% 16% 10% round 2rem); } to { clip-path: inset(0 0 0 0 round 0.25rem); } }
@keyframes settle-in { from { transform: scale(1.18); } to { transform: none; } }
@keyframes lift-in { from { opacity: 0; transform: translateY(1.75rem); } to { opacity: 1; transform: none; } }
@keyframes settle { from { opacity: 0; transform: scale(1.05); } to { opacity: 1; transform: none; } }

/* Still mode: no shader, no wipes, no stagger. Controls stay. */
.still .kinetic .ch { transform: none !important; opacity: 1 !important; }

/* ---------- Print: the recipe, alone ---------- */

@media print {
  @page { margin: 18mm; }
  body { background: #fff; color: #000; }
  .preload, .skip, .bar, .hero, .interlude, .scene, .print, .drop, .defs { display: none !important; }
  .recipe { padding: 0; border: 0; }
  .recipe-inner { display: block; }
  .recipe h2 { position: static; color: #000; font-size: 40pt; margin-bottom: 14pt; }
  .recipe h2::after { content: ": espresso"; }
  .sheet > div { border-color: #000 !important; padding: 9pt 0; break-inside: avoid; }
  .sheet dt { color: #444; font-size: 11pt; }
  .sheet dd { color: #000; font-size: 12pt; }
  .sheet .v { color: #000; font-size: 28pt; }
  .foot { padding: 18pt 0 0; color: #444; font-size: 9pt; }
  .foot a { display: inline; text-decoration: none; }
  .foot a::after { content: " · jamesh.studio"; }
}

/* ---------- Phones: each step's drawing and its control share one screen ---------- */

@media (max-width: 55.99em) {
  .scene { gap: 1.25rem; padding-top: calc(var(--bar) + env(safe-area-inset-top) + 0.75rem); padding-bottom: 2.5rem; }
  .scene h2 { font-size: clamp(2.4rem, 1.6rem + 4vw, 3.5rem); margin-bottom: 0.75rem; }
  .scene-copy > p { font-size: 1rem; }
  .scene--tamp .rig { width: min(70vw, 34svh); }
  .scene--tamp .btn--hold { margin-top: 1.1rem; }
  .status:empty { display: none; }
  .vial { top: 0; width: 9rem; }
  .scene--brew {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "copy copy" "rig rig" "read hold" "hint hint";
    text-align: left; justify-items: stretch; align-items: center; row-gap: 1rem;
  }
  .scene--brew .scene-copy > p { margin: 0; }
  .scene--brew .rig { width: min(62vw, 29svh); justify-self: center; }
  .btn--pull { --size: 6.5rem; margin: 0 0.6rem 0 0; }
  .pull-hint { grid-area: hint; margin-top: 0; }
  .clock { font-size: 3.75rem; margin-bottom: 0.2rem; }
  .yield { font-size: 1.75rem; }
}
/* The bar sits on the hero photograph: a soft shade keeps it legible. */
.hero::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 9rem; z-index: -1; pointer-events: none;
  background: linear-gradient(rgb(12 9 7 / 0.7), rgb(12 9 7 / 0));
}

/* ======================================================================
   One button system. Every control is at least 48px tall (44px in the bar),
   answers on press with scale(0.97), and has one focus ring.
   ====================================================================== */

.btn {
  --size: auto;
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  min-height: 3rem; padding: 0 1.4rem; margin: 0;
  border-radius: 999px; border: 1px solid var(--crema);
  font: 600 1rem/1.1 var(--text); letter-spacing: 0.005em; text-decoration: none; white-space: nowrap;
  cursor: pointer; touch-action: manipulation;
  transition: transform 140ms var(--ease-out), background-color 200ms ease, color 200ms ease, border-color 200ms ease, opacity 200ms ease;
}
.btn:active, .btn.is-holding { transform: scale(0.97); }
.btn--primary { background: var(--crema); color: var(--ink); }
.btn--ghost { background: transparent; color: var(--crema); }
.btn--next::after { content: ""; width: 0.45rem; height: 0.45rem; margin-left: 0.15rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-0.12rem) rotate(45deg); }
.btn--round { width: var(--size); height: var(--size); padding: 0 1rem; white-space: normal; text-align: center; border-radius: 50%; }
.btn:disabled { cursor: default; }
@media (hover: hover) and (pointer: fine) {
  .btn--primary:not(:disabled):hover { background: var(--crema-hi); border-color: var(--crema-hi); }
  .btn--ghost:not(:disabled):hover { background: rgb(212 161 94 / 0.12); }
}
.btn:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }

/* Done: the step's button settles into a quiet confirmation instead of a greyed-out pill. */
.tick { display: none; width: 1rem; height: 1rem; flex: none; }
.tick path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.is-done { background: transparent; border-color: transparent; color: var(--crema); padding-left: 0; opacity: 1; }
.btn.is-done .tick { display: block; }
.btn.is-done .btn-over { display: none; }

/* Hold-to-fill: a second label in ink on crema, clipped to the progress, so text stays readable. */
.btn--hold { touch-action: none; -webkit-user-select: none; user-select: none; }
.btn-over {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--crema); color: var(--ink);
  clip-path: inset(0 calc(100% - var(--p, 0) * 100%) 0 0);
}
.btn--pull { touch-action: none; overflow: visible; }
.btn--pull .btn-label { max-width: 5.5rem; }

/* Rings around the pull button: progress toward 30 s. */
.hold-ring { position: absolute; inset: -0.6rem; pointer-events: none; }
.hold-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.ring-fill { fill: none; stroke: var(--crema); stroke-width: 2.5; stroke-dasharray: 1 1; stroke-dashoffset: 1; }

.hero-copy .btn--round { --size: 7.5rem; justify-self: end; font-size: 1.0625rem; }
.btn--pull { --size: 7.5rem; }
.scene-copy .btn { margin-top: 1.75rem; }
.scene-copy .status + .btn--next { margin-top: 1rem; }
[hidden] { display: none !important; }

/* ---------- Top bar: transparent on the hero, solid once you scroll ---------- */

.bar::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: rgb(12 9 7 / 0.88);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line-2);
  opacity: 0; transition: opacity 300ms ease;
}
.bar.is-solid::before { opacity: 1; }
@media (prefers-reduced-transparency: reduce) { .bar::before { background: var(--ink); -webkit-backdrop-filter: none; backdrop-filter: none; } }
.mark {
  justify-self: start; display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 0.25rem;
  font: 600 1.375rem/1 var(--display); text-decoration: none; letter-spacing: -0.01em;
}
.track { display: flex; align-items: center; }
.track ol { display: flex; }
.track-now { display: none; }
.track a {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.5rem;
  text-decoration: none; font-size: 0.875rem; color: var(--paper-3); transition: color 300ms ease;
}
.track a::before {
  content: ""; width: 0.6rem; height: 0.6rem; border-radius: 50%; flex: none;
  border: 1.5px solid var(--paper-3);
  transition: background-color 300ms ease, border-color 300ms ease, transform 300ms var(--ease-out);
}
.track li.is-done a { color: var(--paper); }
.track li.is-done a::before { background: var(--crema); border-color: var(--crema); }
.track li.is-here a { color: var(--paper); }
.track li.is-here a::before { transform: scale(1.3); border-color: var(--paper); }
.bar-end { justify-self: end; display: flex; align-items: center; }
.bar-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.6rem;
  background: none; border: 0; border-radius: 999px; cursor: pointer;
  font-size: 0.9375rem; color: var(--paper-2); text-decoration: none;
  transition: color 200ms ease, transform 140ms var(--ease-out);
}
.bar-btn:active { transform: scale(0.95); }
@media (hover: hover) and (pointer: fine) { .bar-btn:hover, .track a:hover { color: var(--paper); } }
.speaker { width: 1.35rem; height: 1.35rem; flex: none; }
.speaker path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.speaker .speaker-body { fill: currentColor; }
.sound .speaker-wave { display: none; }
.sound[aria-pressed="true"] { color: var(--crema); }
.sound[aria-pressed="true"] .speaker-wave { display: inline; }
.sound[aria-pressed="true"] .speaker-off { display: none; }
@media (max-width: 47.99em) {
  .track-word, .bar-word { display: none; }
  .track-now { display: inline; font-size: 0.875rem; color: var(--paper-2); margin-left: 0.15rem; min-width: 2.25rem; }
  .bar { padding-left: max(0.75rem, env(safe-area-inset-left)); padding-right: max(0.5rem, env(safe-area-inset-right)); gap: 0.25rem; }
  .track a { padding: 0; }
}
@media (max-width: 25em) { .to-recipe { display: none; } }

/* Programmatic focus on the result heading is for screen readers, not a visible box. */
[tabindex="-1"]:focus { outline: none; }

/* ---------- Cleanup: tighter spacing, one obvious action per step ---------- */

.scene-copy > p { max-width: 32ch; }
.status { font-size: 0.9375rem; margin-top: 0.75rem; min-height: 0; }
.dial-hint { bottom: -2.25rem; }
.verdict-row { display: flex; }
@media (max-width: 55.99em) {
  .hero-copy .btn--round { --size: 6rem; }
  .hero-copy { grid-template-columns: minmax(0, 1fr) auto; }
}
/* At display sizes the font's optical axis thins hairlines until y and w break up over the photo:
   a lower optical size keeps every stroke visible. */
.kinetic { font-variation-settings: "opsz" 22; }
