# Recreate this site as a single HTML file: KEMURI — Late-night Ramen Bar

You are an expert creative front-end developer. Produce a **single self-contained `index.html`**
(inline CSS, one inline classic `<script>` for the page and one `<script type="module">` for the 3D
hero), plus the local assets listed under **Assets**. No framework, no build step. three.js is the
only library. The steam is a hand-written WebGL1 shader, and everything else is DOM, CSS and Web
Animations. Every number below is a fixed constant.

## What it is

A one-page site for **Kemuri** (煙, "smoke"), a fictional late-night ramen bar with two counters in
Portland. Indigo night surfaces (`#0e1524`) alternate with warm broth-cream (`#f2e4c9`) blocks, with
one loud accent — chili vermilion `#ff5a36` — and a scallion green that only ever means "open".
Order: fixed header with a live open/closed pill → hero → menu board with dietary filters → the
**ticket machine** → two locations with live status and queue meter → story over a muted kitchen
video → vermilion footer with a fitted wordmark.

**Signature, three parts that serve the content:**
1. **A real 3D bowl sitting in a real render.** The hero background is a Blender Cycles render of
   a dark lacquered ramen counter: lantern bokeh, a warm key pool, a cup and dish out of focus. On
   top of it, three.js draws a textured GLB ramen bowl (chashu, egg, nori, chopsticks) through
   *the same camera that rendered the plate*, so the bowl stands in the pool of light with a real
   shadow. It drops in on a spring, leans toward the cursor, lifts on hover, can be dragged
   round with inertia, slowly turns when idle and sinks as you scroll away. A thin-film
   interference sheen moves across the lacquer under the cursor.
2. **Steam you can part.** A second WebGL shader draws domain-warped fBm steam rising from the
   bowl's projected screen position. The cursor (or finger) leaves a 10-point decaying trail
   that pushes the steam *away* and thins it.
3. **A Japanese meal-ticket machine (食券機) as the order builder.** Real radio/checkbox inputs
   styled as chunky cream keys that light up vermilion when pressed, a green dot-matrix LED with a
   rolling total and diet badges, dietary constraints that disable keys with a reason, validation,
   and a "Print ticket" button that feeds a numbered paper ticket out of a slot in jerky steps. The
   ticket can be downloaded as a PNG and survives a reload. Every "Build this bowl" button on the
   menu loads that bowl into the machine.

## Page shell & libraries

- `<html lang="en">`, viewport meta, `<meta name="theme-color" content="#0e1524">`, title
  `Kemuri — Late-night ramen in Portland`, a meta description.
- Google Fonts only (one request, `display=swap`):
  `Archivo:wdth,wght@62..125,400..900`, `IBM Plex Mono:wght@400;600`,
  `Zen Kaku Gothic New:wght@500;700`.
- Import map (exact versions):
  ```html
  <script type="importmap">{"imports":{
    "three":"https://cdn.jsdelivr.net/npm/three@0.180.0/build/three.module.min.js",
    "three/addons/":"https://cdn.jsdelivr.net/npm/three@0.180.0/examples/jsm/"}}</script>
  ```
  Module imports: `GLTFLoader` (`three/addons/loaders/GLTFLoader.js`), `MeshoptDecoder`
  (`three/addons/libs/meshopt_decoder.module.js`), `RoomEnvironment`
  (`three/addons/environments/RoomEnvironment.js`). Nothing else external.
- `<html class="no-js">`. The classic script removes the class. `scroll-behavior:smooth`, `scroll-padding-top:84px`.
- All script in one IIFE, `'use strict'`. Every `localStorage` access goes through a `store`
  helper wrapped in try/catch.

## Tokens

```
--ink #0e1524  --ink-2 #151f36  --ink-3 #1e2b4a  --ink-line rgba(242,228,201,.14)
--broth #f2e4c9  --broth-2 #e8d6b3  --broth-dim #bfb294  --broth-ink #5a4f3d (muted text on cream)
--chili #ff5a36 (accent on ink; ink text on chili = 5.7:1)  --chili-deep #b8321a (accent text on cream, 4.8:1)
--negi #a6d37a (open)  --negi-deep #3d6b1c  --led #9cff7a
radii: --r-s 8 · --r-m 14 · --r-l 26 · --r-xl 40 · pills 999px
gutter: clamp(16px,4vw,56px) · max width 1360px
ease: cubic-bezier(.2,.8,.2,1)
```
Type: **Archivo** for everything display and body. Headlines are uppercase, weight 850–900, width
axis `wdth` 64–78 (condensed); the footer wordmark uses `wdth` 125 (extended). **IBM Plex Mono**
uppercase 0.7–0.78rem, letter-spacing .06–.14em for eyebrows, prices, labels, the LED and the
ticket. **Zen Kaku Gothic New** for all kanji/katakana.
Scale: hero h1 `clamp(4.2rem,11.2vw,10.4rem)` / line-height .82; section h2
`clamp(2.6rem,6.4vw,6rem)` / .88; card h3 1.5rem; body 1rem–1.15rem.
Eyebrows have a 28px hairline before them. Buttons: pill, `.95em 1.5em`, weight 750, chili bg with
ink text; hover lifts 2px with a chili glow shadow; ghost variant has a 1.5px inset line.
Focus: `3px solid var(--chili)` outline, offset 3px, everywhere.

## Layout & structure

**Preloader**: fixed ink overlay with a line-drawn bowl (SVG, 132px) whose chili "broth" rect
rises inside a clip path, three dashed steam wisps looping 1.6s, "煙 KEMURI", and a green LED line
"FILLING THE POT 00%". The fill moves toward each finished part (fonts, the counter plate, the 3D
bowl). After at least 900ms (and at most 3.5s) it reads 100%, then wipes upward with
`clip-path: inset(0 0 100% 0)` in .9s `cubic-bezier(.76,0,.24,1)` and fires `kemuri:start`. With
reduced motion or no JS there is no preloader.

**Header** (fixed, 72px): hanko logo (34px chili square, `煙`, rotated −4°) + "KEMURI" (wdth 112,
tracking .06em); nav Menu / Ticket machine / Counters / Story; a live pill (pulsing green dot +
"Division St open · till 2 a.m." from the hours engine); a "Buy a ticket" button. After 30px
scroll it gets a translucent background + 14px backdrop blur + a hairline. **It recolours per
section**: every section carries `data-tone` (dark / light / chili). On scroll (rAF-throttled)
the section under y=36 sets `hdr.dataset.tone`, which swaps three custom properties (`--hfg`,
`--hbg`, `--hline`) with a .45s transition: dark = cream text on `rgba(14,21,36,.82)`, light = ink
on `rgba(242,228,201,.86)`, chili = ink on `rgba(255,90,54,.9)` with an ink CTA. ≤1100px: nav becomes a
burger (`aria-expanded`, `aria-controls`, Esc closes) opening a full-width panel of big condensed
links.

**Hero** (`min-height:max(100svh,720px)`, radial indigo glow centred at 72% 55%): two-column grid.
Left: eyebrow "Late-night ramen · Portland · since 2014", h1 three masked lines "BROTH / UNTIL /
3 A.M." (last line chili, with a small mono "FRI & SAT" superscript), lede, two CTAs. Behind the text: the **stage** (absolute,
inset 0) holds the plate `<img>` (`object-fit:cover`), the three.js canvas, a hidden fallback
photo bowl and an SVG-noise film grain (opacity .08, overlay). A scrim darkens the left 56% for
the text (`90deg`: .94 → .72 at 30% → 0 at 56%) plus top and bottom fades. The steam canvas
covers the whole hero above the stage (`pointer-events:none`). A vertical kanji strip
`深夜ラーメン・二店舗` on the right edge, a hint "Move through the steam", and a bottom info bar of 4
facts (bold value + mono label) over a hairline.

**Menu** (cream): heading row "FIVE BROTHS. / NO SHORTCUTS." + intro paragraph. A pill filter bar
(`role=group`) with three toggle chips — Vegan, Gluten-free, Spicy (`aria-pressed`, a tick circle
that fills chili when on) — a live count "N of 11" (`aria-live`) and a Clear link that appears
only when a filter is on. Filters combine with AND. Grid of 11 cards (3 / 2 / 1 columns, gap 22px):
4:3 photo on ink with a "No.01" pill, name (condensed uppercase) with kanji under it, mono price,
description, coloured diet tags (vegan green, GF sand, spicy pink), and a full-width ink button:
"Build this bowl →" for ramen, "Add to ticket +" for sides. One card (Jigoku Red) has no photo: its
panel is chili with a faint 23px vertical stripe and `地獄` huge in ink. Empty state: dashed box
"Nothing on the board matches all of those."
Items: Kemuri Tonkotsu $16 (gf) · Tantanmen $17 (spicy) · Forest Miso $15 (vegan, gf) · Yuzu Shio
$15 (gf, rice noodles) · Black Garlic Shoyu $16 · Jigoku Red $16 (vegan, spicy; = miso at heat 5)
· Pan Gyoza ×6 $9 · Karaage $10 (gf) · Smashed Cucumber $6 (vegan, gf, spicy) · Ajitama ×2 $4
(gf) · Matcha Soft Serve $6 (gf).

**Ticket machine** (ink→#101a30 gradient): grid `.8fr 1.5fr`. Left (sticky at 110px): eyebrow
"Shokken-ki · 食券機", h2 "PUSH THE / BUTTONS.", paragraph, 3 numbered steps (Choose / Print /
Slurp) with 44px ring numerals. Right: the machine — a `<form novalidate>` with a cream-metal
gradient body (`#e9dcc2→#d7c7a7`, radius 40, inner hairline at 10px inset, deep drop shadow).
- Top row: chili plate "食券 / KEMURI NO.2 MACHINE" + LED panel (`#0b1411`, inset shadow, green
  mono text with glow, 1px/3px scanlines). The LED shows a message line, three badges VEGAN /
  GLUTEN-FREE / SPICY (25% opacity off, 100% on) and the total (`clamp(1.7rem,3.2vw,2.6rem)`,
  tabular numerals).
- Six `<fieldset>` rows (legend left "01 Broth", hint right): Broth ×5 (Tonkotsu $16, Black garlic
  shoyu $16, Yuzu shio $15, Forest miso $15, Tantan $17), Noodle ×3 (Thin straight, Thick wavy,
  Rice noodle · GF +$1), Firmness ×4 (Barikata, Katame, Futsū, Yawame), Toppings ×8 checkboxes
  (Extra chashu +3, Ajitama +2, Crispy tofu +2.5, Nori ×3 +1, Roast corn +1.5, Menma +1, Mountain
  of negi +1, Kaedama refill +2.5), Heat 0–5 (None…Jigoku, chili glyphs), Sides ×5 checkboxes.
- Each key = `<label>` wrapping a visually hidden real input + a span: kanji in chili-deep, name,
  mono price. Unpressed: cream gradient, 3px bottom "key travel" shadow. `:active` sinks 3px.
  `:checked`: radial vermilion gradient, ink text, sinks 2px, 22px chili glow. `:disabled`: 38%
  opacity on a diagonal hatch with a red mono reason ("no · pork", "no · egg").
- Footer row: "Name on ticket" input (required), "Counter" select (Alder St / Division St), Bowls
  stepper 1–6 (− / output / +). Then the slot: a 20px black rounded mouth labelled "TICKET" and
  the big "Print ticket ▼" button (5px dark-red bottom shadow, presses down 4px).
- Below the machine: the feed — a clip box (`width:min(360px,92%)`, height 0) containing the paper
  ticket: off-white, mono, "KEMURI" heading, "食券 · ALDER ST COUNTER", huge "No.0411", timestamp,
  dashed rules, line items with sub-lines, TOTAL, diet flags, "Hand this to the counter", a
  pseudo-random SVG barcode seeded by the ticket number, and a scalloped bottom edge (CSS mask of
  6px circles every 16px). Under it "Keep ticket (.png)" and "New ticket".

**Locations** (cream): h2 "FIND A STOOL." with a right-aligned clock block ("Portland time · Wed",
the time large, "Your clock: 3:19 AM" if the visitor's local time differs). Two cards (2 cols →
1): 16:9 storefront photo with a frosted status chip bottom-left (dot + "Open now · till 1 a.m. ·
5h 41m left" / "Closed · opens today 5 p.m."); body grid: name, address, queue meter (label,
"~14 min", 10 segment bar, "8 people ahead · estimated from typical Wed nights"), "Copy address"
button; and an hours table Mon→Sun with today's row inverted to ink.

**Story**: full-bleed muted looping kitchen video (noodles lifted from a steaming pot) with a
left-to-right indigo scrim. Huge chili `煙`, eyebrow "Kemuri means smoke", h2 "THE POT NEVER /
GOES COLD.", paragraph, and 4 stats in a row (18 hours of simmer · 26 stools · 4,100 bowls a week ·
0 reservations). A 44px round pause/play button bottom-right.

**Footer** (chili bg, ink text): "Get on the late list" + email form, two link columns, then
"KEMURI" in Archivo wdth 125 fitted by JS to the exact content width, then a legal line ("a
fictional restaurant").

## Behaviour & interaction

- **Intro**: at `kemuri:start` add `.ready` to `<html>`. The plate fades in over 1.2s. h1 lines slide up from 105% in 1.1s
  ease, delays 150 / 260 / 370ms; eyebrow, lede and CTAs fade-up 16px at 100 / 600 / 720ms; bowl
  fades in over 1.4s.
- **Reveals**: `.rv` elements fade up 28px, .9s ease, per-element `--d` delay, via one
  IntersectionObserver (threshold .12, rootMargin bottom −6%), unobserved after firing.
- **3D bowl** (module). Plate render = 1600×880, Blender camera at (−0.13, 0.4259, 0.8808) m in
  three's Y-up space, pitched −22°, vertical FOV 24°, bowl spot at the world origin on the counter
  (≈67% across the plate). `PerspectiveCamera(24, 1600/880)` at that pose. On every resize,
  cover-fit the plate into the stage box (`dw,dh`). Pick the crop (`px` = .5 on desktop; on ≤900 px,
  `px` puts the bowl spot at the box centre), write it to the img's `object-position`, and give
  the camera the same crop with `setViewOffset(dw,dh,px*(dw-w),py*(dh-h),w,h)`. That keeps the live
  bowl glued to the render at every width. Renderer: antialias, alpha, DPR ≤1.75,
  `AgXToneMapping` exposure 1.05, PCF soft shadows, `RoomEnvironment` PMREM at
  `environmentIntensity .45`. Lights mirror the Blender rig: warm key `#ffd6a8` 2.6 from
  (−.25,1.15,.05) casting a 1024² shadow, orange rim `#ff7a45` 2.2 from behind-right, a cool
  hemisphere at .35. Contact: a `ShadowMaterial` plane (opacity .5) plus a radial-gradient
  blob (1.35× bowl width). GLB `assets/ramen-bowl.glb` (meshopt), scaled so its widest side is
  .17 m, feet on y=0. Rig: root (intro drop + scroll) › lean (spring) › spin (turntable/drag).
  Lean spring k 70, c 12 toward `yaw=(x−.6)·.42`, `pitch=(y−.55)·.16` from the smoothed
  pointer. Hover lift +12 mm (spring 120/14). Idle turntable .12 rad/s. Mouse drag .008 rad/px,
  release velocity decays ×.94 per frame. The intro drops from +22 cm on a 90/11 spring at
  `kemuri:start`. On scroll the bowl sinks 12 cm and turns .9 rad over one hero height. Each frame
  the bowl's rim centre and radius are projected to screen and published as
  `window.__bowlScreen` for the steam.
- **Thin-film sheen**: a fullscreen additive quad in the same scene (alpha 0, so it only adds
  light). The film thickness is 4-octave fBm in a perspective-stretched counter space below the
  plate's horizon, plus a Gaussian bump (σ²≈.025) and a ring ripple `sin(d·40−3t)` at the
  smoothed pointer. Colour comes from `.5+.5cos(2π(th·1.6+[0,.33,.67]))`, cooled ×(.7,.75,1). Strength
  is .05 ambient up to +.22 under a moving cursor, decaying ×.985 per frame.
- **Steam shader** (WebGL1, one fullscreen triangle, premultiplied alpha, blend `ONE,
  ONE_MINUS_SRC_ALPHA`). Canvas resolution = hero size × `min(dpr,2) × 0.5` (×0.42 under 700px) —
  steam is soft, so half-res is invisible and cheap. Uniforms: `uBowl` (from `__bowlScreen`,
  radius ×.62, in canvas px, y flipped; falls back to the photo bowl's box), `uTime`, `uTrail[10]` (x, y,
  strength). In the shader: for each trail point, `f = s·exp(−|d|²/r²)` with `r = 0.42R`;
  accumulate `disp += d/|d| · f · r · 1.1` and `carve += f`; sample at `q = px − disp`. In bowl
  units `b`: width `w = .62 + .42·max(b.y+.3,0)`, envelope `exp(−(b.x/w)²·1.6)`, fades in from
  `b.y −.75→.1` and out `1.2→3.4`. Density = 5-octave fBm (rotation mat2(1.6,1.2,−1.2,1.6)) on
  `(b.x·1.25, b.y·.85 − t·.32)`, domain-warped by two more fBm calls (×1.8), `smoothstep(.42,.86)`,
  modulated by `.8 + .35·sin(b.x·5 + n·7 − .8t)`, multiplied by `1 − clamp(carve·.6, 0, .85)`.
  Colour blends cool `(.78,.83,.96)` low to warm `(1,.97,.92)` high. Output is premultiplied
  `col·a` with alpha `a·.45`, so the steam half-adds and stays bright over the lantern glow
  (`a = clamp(dens·1.05,0,.85)`). The top fade is scaled ×.6 under 900px.
  Trail: on pointermove/pointerdown, if within 14 css px of the last point, move it and add .08
  strength; else write a new point (ring buffer of 10) at strength 1. Each frame every strength
  ×= .955.
- **Steam lifecycle**: the rAF loop runs only while the hero intersects the viewport, the tab is
  visible and reduced motion is off. ResizeObserver on the hero re-measures. `webglcontextlost` →
  stop and show the CSS fallback.
- **Menu filters (FLIP)**: record every card's rect, toggle `hidden`, then: staying cards animate
  `translate(dx,dy)→none` 560ms ease; entering cards `opacity 0, scale .92 → 1` 450ms with 80ms
  delay; leaving cards are cloned as absolutely positioned inert ghosts at their old rect that fade
  to `scale .9` in 320ms and are removed.
- **Menu → machine**: "Build this bowl" sets broth (and noodle/heat where the dish implies it:
  Yuzu Shio → rice noodle, Jigoku → heat 5), smooth-scrolls to the machine, focuses the broth key
  after 700ms and toasts "Tantanmen loaded into the machine". "Add to ticket" ticks the side and
  toasts without scrolling.
- **Machine logic**: bowl = broth + noodle + toppings; total = bowl × bowls + sides. Forest miso
  (vegan) disables and unticks chashu and ajitama with the reason visible. Tantan disables heat
  0–1 and lifts heat to 2 ("tantan starts at 2"). Badges: VEGAN when broth and every topping/side
  is vegan; GLUTEN-FREE when broth is GF (tonkotsu, shio, miso) + rice noodle + GF sides; SPICY
  when heat > 0 or a spicy side. The LED total rolls from the shown value to the new value in
  380ms ease-out-cubic. The LED message summarises "1× Tantan · Thin straight · Katame · +1 top".
- **Validation**: print with no broth → LED "Error — choose a broth first" (in red), the broth row
  shakes ±6px in 280ms, focus moves to the first broth key. Name empty / <2 chars / non-letters →
  inline error under the field, `aria-invalid`, LED error, focus. Errors re-validate on input.
- **Printing**: ticket number = stored counter + 1 (seeded 400–479, zero-padded to 4). The button
  disables, LED "Printing… do not pull", the clip height grows in 22 steps over ~1.5s with
  randomised step gaps (0.6–1.4× of 68ms) along `(i/22)^1.15` — a thermal-printer jerk. Then the
  actions fade in, LED "Ticket No.0411 printed — see you at Alder St", focus moves to "Keep
  ticket". The ticket object is saved; on reload it is shown fully printed with a red "KEPT"
  stamp and the LED says "Welcome back". "Keep ticket" redraws the ticket on a 600px canvas (same
  text, dashed rules, the same seeded barcode) and downloads `kemuri-ticket-0411.png`. "New
  ticket" resets the form, collapses the feed and clears storage.
- **Hours engine**: Portland time via `Intl.DateTimeFormat({timeZone:'America/Los_Angeles',
  hourCycle:'h23'})`; spans are minutes from each weekday's midnight and may pass 1440 (Alder:
  Sun 17:00–24:00, Mon–Thu 17:00–01:00, Fri–Sat 17:00–03:00; Division: Mon closed, Tue–Thu
  18:00–02:00, Fri–Sat 18:00–03:00, Sun 18:00–24:00). Open if the week-minute falls in a span
  (including last week's wrap); otherwise the next opening with "today/tomorrow/Wed". Before 4 a.m.
  the highlighted hours row is still the previous business day. Re-runs every 30s. The header
  pill shows the open counter that closes latest, or "Closed · opens 5 p.m.".
- **Queue estimate**: an hourly demand curve {17:.3, 18:.55, 19:.85, 20:1, 21:.9, 22:.7, 23:.6,
  0:.72, 1:.82, 2:.5, 3:.2} interpolated by minute, ×1.35 on Fri/Sat nights, × a deterministic
  jitter (.88–1.13) per 15-minute slot; people ahead = curve × seats × .6; wait = ahead × 1.8 min
  (min 2); meter fills 1–10 segments and turns chili-deep at ≥8. Always labelled "estimated".
- **Copy address**: Clipboard API, toast "Address copied" (fallback toast shows the address).
- **Stats** count up over 1.6s (ease-out-quart) when 60% visible.
- **Video**: `preload="none"`, plays only while ≥15% visible, tab visible and not paused by the
  user; the button toggles and its label swaps play/pause.
- **Newsletter**: regex email check; messages "Type your email first." / "That email looks off" /
  "You're on the late list. See you after midnight." in an `aria-live` paragraph.
- **Toast**: bottom-centre pill, slides up 450ms, hides after 2.6s, `visibility:hidden` when off.

## Responsive

- **1440**: as described; bowl bleeds off the right edge; machine broth row is 5 keys wide.
- **≤1100**: burger nav; the machine stacks under its copy (copy no longer sticky); location
  bodies become one column.
- **≤900 (768)**: hero is a flex column — headline first, then the stage in flow
  (`height:min(150vw,820px)`, pulled up 22vw under the CTAs, fading from ink at the top 10–42% and
  back to ink at the bottom), bowl re-centred by the crop, the info bar becomes 2×2 under it; vertical kanji and steam hint hide; menu 2
  columns; locations 1 column; stats 2×2; footer 2 columns.
- **≤640 (390)**: menu 1 column; every key row 2 columns (heat 3); machine plate becomes a row;
  name field full width; slot stacks above a full-width print button; header hides its CTA and
  the pill shortens to "Alder St open"; story scrim becomes bottom-up. No horizontal scroll at any
  width.

## Accessibility & reduced motion

Skip link; one h1; every section has `aria-label(ledby)`; the machine uses real radio/checkbox
inputs inside fieldsets with legends, so arrow keys and Space work natively; visible focus ring on
every key (outline on the key face); LED is `role=status`; filter chips use `aria-pressed`; counts,
status chips, ticket feed and toast are `aria-live=polite`; kanji decorations are `aria-hidden`
and Japanese names carry `lang="ja"`; all photos have descriptive alt text. Contrast: cream on ink
13:1, ink on chili 5.7:1, chili-deep on cream 4.8:1, muted `#5a4f3d` on cream 6.9:1.
`prefers-reduced-motion`: no intro or reveals (content shown), no bowl spin, the steam draws one
still frame (and redraws on pointer move without animation), the LED total and stats jump to their
values, the ticket appears fully printed, the video does not autoplay, smooth scrolling is off.

## Fallbacks

three.js, the GLB or WebGL fails (CDN down, decode error, context lost) → the Cycles plate stays,
and a circular-masked overhead photo of the bowl (`hero-bowl.webp`, turning once every 160s) appears
on the bowl spot. The preloader stops waiting after 3.5s. No WebGL for the steam → `.no-webgl` shows three blurred CSS
radial "puffs" rising over 9s. Reduced motion → one still 3D frame (pointer lean only), static
steam frame, no preloader. No `localStorage` → everything works, nothing
persists. No Clipboard API → the toast shows the address. Video missing → the poster stays.
Print stylesheet prints only the ticket.

## Assets

All local, relative to `index.html` (total ≈ 1.1 MB images + ≈ 2 MB video):
| path | shows |
|---|---|
| `assets/counter-plate.webp` 1600×880 | Blender Cycles render (40 spp, denoised, AgX): dark indigo lacquered counter, warm key pool at the bowl spot, lantern bokeh, tiled indigo wall, red noren, an out-of-focus cup and dish. Camera as in the 3D-bowl spec |
| `assets/ramen-bowl.glb` 0.98 MB | image→3D (Meshy v7) tonkotsu bowl with chopsticks and nori, 41k tris, PBR, meshopt + webp textures ≤1024 |
| `assets/hero-bowl.webp` 1200² | overhead tonkotsu bowl on an indigo counter (3D fallback + menu card 1) |
| `assets/menu-tantan.webp` 720² | overhead tantanmen, red sesame-chili broth |
| `assets/menu-miso.webp` | vegan miso: tofu, corn, shiitake, sprouts |
| `assets/menu-shio.webp` | clear yuzu shio with chicken chashu |
| `assets/menu-shoyu.webp` | black garlic shoyu in a red lacquer bowl |
| `assets/menu-gyoza.webp` | gyoza with a lace skirt in an iron pan |
| `assets/menu-karaage.webp` | karaage with lemon and mayo |
| `assets/menu-cucumber.webp` | smashed cucumber with chili oil |
| `assets/menu-ajitama.webp` | two halved marinated eggs |
| `assets/menu-matcha.webp` | matcha soft serve swirl |
| `assets/store-alder.webp` 1200w | night brick storefront, red curtain, wet street |
| `assets/store-division.webp` | narrow wooden storefront with a paper lantern |
| `assets/kitchen-poster.webp` 1600w | cook's hands lifting noodles over a steaming pot |
| `assets/kitchen.webm` / `.mp4` | 5s muted 720p loop of the same shot |

All food shots share one art direction: top-down, deep indigo cloth/wood, single warm spotlight,
dark vignette, no text.

## Make it yours

This prompt rebuilds one exact design. If everyone ships it unchanged, the sites will look alike.
Before you paste it, change these lines so the result is yours. Each change is one edit to the
prompt; the structure and the interactions stay intact.

1. **Brand and offer.** Swap Kemuri, Portland and the two counters for your own late-night food
   place: a pho shop, a dumpling bar, a taqueria, a hot-pot room. Keep 8–12 menu items (so the
   3-column grid ends cleanly), exactly two locations, and 5 base choices in the machine's first
   row so the keys stay square at 1440.
2. **The hero object and its set.** Replace the GLB with your own dish or product (photo → image-to-3D,
   then `gltf-transform optimize --compress meshopt --texture-compress webp --texture-size 1024`).
   Re-render the plate in Blender with *your* surface: marble bar, steel counter, picnic table.
   Keep the camera numbers identical in Blender and three.js, or the object will float.
3. **The steam.** The steam shader is the other half of the signature. Re-theme it and keep the cursor trail. Tea house:
   paler, slower steam (`t·.18`) over a teapot. Taqueria: warm orange smoke (`col` toward
   `(1,.7,.45)`) rising off a comal. Hot pot: two plumes (two `uBowl` envelopes added together).
   Cocktail bar: dry-ice fog that *falls* (flip the `b.y` time sign and the envelope).
4. **The machine.** Keep the lit keys, LED and printed ticket, but change what it sells and how it
   looks: a pho slip with "broth / cut / herbs", a dumpling tally card, a deli number tag. Swap the
   cream-metal body for brushed steel, red lacquer or wood; give the LED amber or blue glow; change
   the ticket's mask from scallops to a straight tear.
   Then rewrite its rules for your food: halal/kosher keys that disable pork, a "max 2 sauces" limit, a dish that forces a minimum heat. These rules are
   what makes the machine feel like a real counter, not a form.
5. **Palette.** Replace `--ink`, `--broth` and `--chili` with your own night/day/accent trio, and
   `--negi` with your "open" colour. Keep accent text on the light surface ≥ 4.5:1 (darken it like
   `--chili-deep`) and ink text on the accent button ≥ 4.5:1.
6. **Type pairing.** Swap Archivo's condensed/extended axis for another variable grotesk with a
   width axis (e.g. Bricolage Grotesque, Anybody, Big Shoulders), keep a mono for every price and
   ticket line, and use the script your cuisine uses for the decorative glyphs (Noto Sans KR,
   Noto Sans Thai, or none).
7. **Photos.** Regenerate the overhead set in one consistent art direction — top-down, your own
   surface colour, one warm spotlight, no text — and keep the hero dish centred with a dark edge
   so the 3D fallback's circular mask still lines up. Replace the two storefronts and the
   kitchen loop with your own places.
8. **Copy.** Rewrite the headline and every label in your own late-night voice: what time you
   close, what you are known for, how people actually order.

Tell your AI: *"Build exactly as specified, but with these changes: …"*, then list your edits.

---

## Reference implementation (use verbatim)

The complete working `index.html`. Every number in the spec above is in this file; if the two ever seem to differ, the code wins. Images and models referenced as `assets/...` can be downloaded from https://copytheprompt.design/demos/ramen-bar-restaurant-site/assets/ or replaced with your own (see Make it yours).

````html
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Kemuri — Late-night ramen in Portland</title>
<meta name="description" content="Kemuri is a late-night ramen bar with two counters in Portland. 18-hour tonkotsu, noodles cut daily, broth until 3 a.m. on weekends. Buy your ticket ahead.">
<meta name="theme-color" content="#0e1524">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@62..125,400..900&family=IBM+Plex+Mono:wght@400;600&family=Zen+Kaku+Gothic+New:wght@500;700&display=swap" rel="stylesheet">
<style>
:root{
  --ink:#0e1524; --ink-2:#151f36; --ink-3:#1e2b4a; --ink-line:rgba(242,228,201,.14);
  --broth:#f2e4c9; --broth-2:#e8d6b3; --broth-dim:#bfb294; --broth-ink:#5a4f3d;
  --chili:#ff5a36; --chili-deep:#b8321a; --negi:#a6d37a; --negi-deep:#3d6b1c;
  --led:#9cff7a;
  --r-s:8px; --r-m:14px; --r-l:26px; --r-xl:40px;
  --gut:clamp(16px,4vw,56px);
  --max:1360px;
  --f-d:"Archivo",system-ui,sans-serif;
  --f-m:"IBM Plex Mono",ui-monospace,monospace;
  --f-j:"Zen Kaku Gothic New","Hiragino Sans",sans-serif;
  --ease:cubic-bezier(.2,.8,.2,1);
  --ease-io:cubic-bezier(.65,0,.35,1);
}
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth;scroll-padding-top:84px}
body{margin:0;background:var(--ink);color:var(--broth);font-family:var(--f-d);font-variation-settings:"wdth" 100;line-height:1.5;-webkit-font-smoothing:antialiased;overflow-x:hidden}
img,video,canvas,svg{display:block;max-width:100%}
button,input,select{font:inherit;color:inherit}
a{color:inherit}
:focus-visible{outline:3px solid var(--chili);outline-offset:3px;border-radius:6px}
.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.skip{position:fixed;left:12px;top:-60px;z-index:100;background:var(--chili);color:var(--ink);padding:10px 16px;border-radius:8px;font-weight:700;text-decoration:none}
.skip:focus{top:12px}
.wrap{max-width:var(--max);margin:0 auto;padding:0 var(--gut)}
.mono{font-family:var(--f-m);font-size:.78rem;letter-spacing:.06em;text-transform:uppercase}
.jp{font-family:var(--f-j)}
.eyebrow{font-family:var(--f-m);font-size:.75rem;letter-spacing:.14em;text-transform:uppercase;display:flex;align-items:center;gap:.6em;margin:0 0 1.2rem}
.eyebrow::before{content:"";width:28px;height:1px;background:currentColor;opacity:.6}
.h2{font-size:clamp(2.6rem,6.4vw,6rem);line-height:.88;font-weight:850;font-variation-settings:"wdth" 70;text-transform:uppercase;letter-spacing:-.01em;margin:0}
.btn{--bg:var(--chili);--fg:var(--ink);display:inline-flex;align-items:center;gap:.6em;border:0;border-radius:999px;background:var(--bg);color:var(--fg);padding:.95em 1.5em;font-weight:750;font-size:.95rem;text-decoration:none;cursor:pointer;transition:transform .3s var(--ease),box-shadow .3s var(--ease),background .2s}
.btn:hover{transform:translateY(-2px);box-shadow:0 10px 30px -10px rgba(255,90,54,.7)}
.btn:active{transform:translateY(1px)}
.btn--ghost{--bg:transparent;--fg:var(--broth);box-shadow:inset 0 0 0 1.5px var(--ink-line)}
.btn--ghost:hover{box-shadow:inset 0 0 0 1.5px var(--broth)}
.btn svg{width:1em;height:1em}

/* reveal */
.rv{opacity:0;transform:translateY(28px);transition:opacity .9s var(--ease),transform .9s var(--ease);transition-delay:var(--d,0ms)}
.rv.in{opacity:1;transform:none}

/* ---------- header ---------- */
.hdr{position:fixed;inset:0 0 auto 0;z-index:50;transition:background .3s,backdrop-filter .3s,transform .4s var(--ease)}
.hdr{--hfg:var(--broth);--hbg:rgba(14,21,36,.82);--hline:var(--ink-line);color:var(--hfg);transition:background .45s var(--ease),color .45s var(--ease),box-shadow .45s}
.hdr.scrolled{background:var(--hbg);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);box-shadow:0 1px 0 var(--hline)}
.hdr[data-tone="light"]{--hfg:var(--ink);--hbg:rgba(242,228,201,.86);--hline:rgba(14,21,36,.14)}
.hdr[data-tone="chili"]{--hfg:var(--ink);--hbg:rgba(255,90,54,.9);--hline:rgba(14,21,36,.2)}
.hdr[data-tone="chili"] .btn{--bg:var(--ink);--fg:var(--broth)}
.hdr .livepill{box-shadow:inset 0 0 0 1px var(--hline)}
.hdr .nav a:hover{background:color-mix(in srgb,var(--hfg) 9%,transparent)}
/* preloader */
.pre{position:fixed;inset:0;z-index:200;background:var(--ink);display:grid;place-items:center;clip-path:inset(0 0 0 0);transition:clip-path .9s cubic-bezier(.76,0,.24,1)}
.pre.out{clip-path:inset(0 0 100% 0)}
.pre__in{display:grid;justify-items:center;gap:18px;text-align:center}
.pre svg{width:132px;height:auto;overflow:visible}
.pre .wisp{fill:none;stroke:var(--broth-dim);stroke-width:2.2;stroke-linecap:round;stroke-dasharray:40;stroke-dashoffset:40;animation:wisp 1.6s ease-in-out infinite}
.pre .wisp:nth-of-type(2){animation-delay:.3s}.pre .wisp:nth-of-type(3){animation-delay:.6s}
@keyframes wisp{0%{stroke-dashoffset:40;opacity:0}40%{opacity:1}100%{stroke-dashoffset:-40;opacity:0}}
.pre__pct{font-family:var(--f-m);font-size:.74rem;letter-spacing:.2em;color:var(--led);text-shadow:0 0 8px rgba(156,255,122,.5);font-variant-numeric:tabular-nums}
.pre__t{font-family:var(--f-j);font-weight:700;font-size:1.1rem;letter-spacing:.4em;color:var(--broth)}
.no-js .pre{display:none}
.stage{position:absolute;inset:0;z-index:0;overflow:hidden;pointer-events:none}
.plate{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:50% 50%;opacity:0;transition:opacity 1.2s ease}
.ready .plate{opacity:1}
.stage::after{content:"";position:absolute;inset:0;z-index:2;pointer-events:none;background:linear-gradient(90deg,rgba(14,21,36,.94) 0%,rgba(14,21,36,.72) 30%,rgba(14,21,36,0) 56%),linear-gradient(180deg,rgba(14,21,36,.8) 0%,rgba(14,21,36,0) 22%,rgba(14,21,36,0) 78%,rgba(14,21,36,.9) 100%)}
.grain{position:absolute;inset:0;z-index:2;pointer-events:none;opacity:.08;mix-blend-mode:overlay;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")}
.bowl3d{position:absolute;inset:0;z-index:1;width:100%;height:100%;display:block;opacity:0;transition:opacity .6s ease}
.bowl3d.on{opacity:1}
.has-3d .bowl{visibility:hidden}
.hero.grab{cursor:grab}.hero.grabbing{cursor:grabbing}
.hdr__in{display:flex;align-items:center;gap:24px;height:72px}
.logo{display:flex;align-items:center;gap:10px;text-decoration:none;font-weight:900;font-variation-settings:"wdth" 112;letter-spacing:.06em;font-size:1.15rem}
.hanko{width:34px;height:34px;border-radius:7px;background:var(--chili);color:var(--ink);display:grid;place-items:center;font-family:var(--f-j);font-weight:700;font-size:1.15rem;transform:rotate(-4deg)}
.nav{display:flex;gap:4px;margin-left:auto}
.nav a{text-decoration:none;font-size:.92rem;font-weight:600;padding:.5em .9em;border-radius:999px;transition:background .2s}
.nav a:hover{background:rgba(242,228,201,.08)}
.livepill{display:flex;align-items:center;gap:8px;font-family:var(--f-m);font-size:.72rem;letter-spacing:.06em;text-transform:uppercase;padding:.55em 1em;border-radius:999px;box-shadow:inset 0 0 0 1px var(--ink-line);white-space:nowrap;text-decoration:none}
.dot{width:8px;height:8px;border-radius:50%;background:var(--broth-dim);flex:none}
.dot.open{background:var(--negi);box-shadow:0 0 0 0 rgba(166,211,122,.6);animation:pulse 2s infinite}
.dot.closed{background:var(--chili)}
@keyframes pulse{70%{box-shadow:0 0 0 8px rgba(166,211,122,0)}100%{box-shadow:0 0 0 0 rgba(166,211,122,0)}}
.hdr .btn{padding:.7em 1.2em;font-size:.88rem}
.burger{display:none;width:44px;height:44px;border-radius:50%;border:0;background:color-mix(in srgb,var(--hfg) 9%,transparent);cursor:pointer;position:relative}
.burger span{position:absolute;left:13px;right:13px;height:2px;background:var(--hfg,var(--broth));transition:transform .3s var(--ease),top .3s var(--ease)}
.burger span:nth-child(1){top:17px}.burger span:nth-child(2){top:25px}
.burger[aria-expanded="true"] span:nth-child(1){top:21px;transform:rotate(45deg)}
.burger[aria-expanded="true"] span:nth-child(2){top:21px;transform:rotate(-45deg)}
.mnav{position:fixed;inset:72px 0 auto 0;z-index:49;background:var(--ink);padding:16px var(--gut) 28px;border-bottom:1px solid var(--ink-line);display:none}
.mnav.open{display:block}
.mnav a{display:block;font-size:2rem;font-weight:850;font-variation-settings:"wdth" 72;text-transform:uppercase;text-decoration:none;padding:.35em 0;border-bottom:1px solid var(--ink-line)}

/* ---------- hero ---------- */
.hero{position:relative;min-height:max(100svh,720px);overflow:hidden;isolation:isolate;background:radial-gradient(120% 90% at 72% 55%,#1b2848 0%,var(--ink) 58%)}
.hero__grid{position:relative;z-index:3;display:grid;grid-template-columns:minmax(0,1.05fr) minmax(0,1fr);align-items:center;min-height:max(100svh,720px);padding-top:96px;padding-bottom:120px;gap:24px}
.hero h1{margin:0;font-weight:900;text-transform:uppercase;font-variation-settings:"wdth" 64;font-size:clamp(4.2rem,11.2vw,10.4rem);line-height:.82;letter-spacing:-.015em}
.hero h1 .ln{display:block;overflow:hidden;padding-bottom:.04em}
.hero h1 .ln>span{display:inline-block;transform:translateY(105%);transition:transform 1.1s var(--ease);transition-delay:var(--d)}
.ready .hero h1 .ln>span{transform:none}
.hero h1 em{font-style:normal;color:var(--chili)}
.hero h1 sup{font-size:.16em;font-variation-settings:"wdth" 100;font-weight:600;letter-spacing:.08em;vertical-align:top;position:relative;top:1.4em;margin-left:.4em;color:var(--broth-dim);font-family:var(--f-m)}
.hero__lede{max-width:30rem;font-size:clamp(1rem,1.25vw,1.15rem);color:#d9ccb2;margin:1.8rem 0 2rem}
.hero__ctas{display:flex;flex-wrap:wrap;gap:12px}
.fade-in{opacity:0;transform:translateY(16px);transition:opacity .9s var(--ease),transform .9s var(--ease);transition-delay:var(--d,0ms)}
.ready .fade-in{opacity:1;transform:none}
.bowl{position:absolute;z-index:1;left:67%;top:57%;width:min(30vw,460px);aspect-ratio:1;transform:translate(-50%,-50%);pointer-events:none}
.bowl__img{width:100%;height:100%;border-radius:50%;-webkit-mask:radial-gradient(closest-side,#000 70%,transparent 100%);mask:radial-gradient(closest-side,#000 70%,transparent 100%);animation:spin 160s linear infinite;opacity:0;transition:opacity 1.4s ease}
.ready .bowl__img{opacity:1}
@keyframes spin{to{transform:rotate(360deg)}}
.steam{position:absolute;inset:0;z-index:2;width:100%;height:100%;pointer-events:none}
.steam-fb{position:absolute;inset:0;z-index:2;pointer-events:none;display:none;overflow:hidden}
.no-webgl .steam-fb{display:block}
.steam-fb i{position:absolute;width:30vw;height:30vw;max-width:440px;max-height:440px;border-radius:50%;background:radial-gradient(closest-side,rgba(235,238,248,.22),transparent);filter:blur(30px);animation:rise 9s ease-in infinite}
.steam-fb i:nth-child(2){animation-delay:-3s;margin-left:6vw}
.steam-fb i:nth-child(3){animation-delay:-6s;margin-left:-5vw}
@keyframes rise{0%{transform:translateY(0) scale(.6);opacity:0}25%{opacity:1}100%{transform:translateY(-70vh) scale(1.5);opacity:0}}
.vert{position:absolute;z-index:3;right:var(--gut);top:110px;writing-mode:vertical-rl;font-family:var(--f-j);font-weight:700;font-size:.95rem;letter-spacing:.5em;color:var(--broth-dim)}
.hero__bar{position:absolute;z-index:3;left:0;right:0;bottom:0;border-top:1px solid var(--ink-line);background:linear-gradient(transparent,rgba(14,21,36,.7))}
.hero__bar ul{list-style:none;margin:0 auto;padding:18px var(--gut);display:grid;grid-template-columns:repeat(4,1fr);gap:16px}
.hero__bar li{font-family:var(--f-m);font-size:.74rem;letter-spacing:.08em;text-transform:uppercase;color:var(--broth-dim)}
.hero__bar b{display:block;color:var(--broth);font-family:var(--f-d);font-size:1.05rem;letter-spacing:0;text-transform:none;font-weight:700}
.steam-hint{position:absolute;z-index:3;font-family:var(--f-m);font-size:.7rem;letter-spacing:.1em;text-transform:uppercase;color:var(--broth-dim);right:var(--gut);bottom:96px;display:flex;align-items:center;gap:8px}
.steam-hint::before{content:"";width:16px;height:16px;border:1.5px solid currentColor;border-radius:50%}

/* ---------- menu ---------- */
.light{background:var(--broth);color:var(--ink)}
.menu{padding:clamp(80px,11vw,150px) 0}
.menu__head{display:grid;grid-template-columns:1.1fr 1fr;gap:32px;align-items:end;margin-bottom:44px}
.menu__head p{margin:0;max-width:34rem;color:var(--broth-ink);font-size:1.05rem}
.filters{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-bottom:34px;padding:12px;border-radius:999px;background:var(--broth-2);width:fit-content;max-width:100%}
.chip{display:inline-flex;align-items:center;gap:8px;border:0;cursor:pointer;border-radius:999px;padding:.7em 1.15em;font-weight:700;font-size:.92rem;background:transparent;color:var(--ink);transition:background .25s,color .25s,transform .25s var(--ease)}
.chip:hover{background:rgba(14,21,36,.07)}
.chip[aria-pressed="true"]{background:var(--ink);color:var(--broth)}
.chip .tick{width:16px;height:16px;border-radius:50%;box-shadow:inset 0 0 0 1.5px currentColor;display:grid;place-items:center;font-size:10px}
.chip[aria-pressed="true"] .tick{background:var(--chili);box-shadow:none;color:var(--ink)}
.chip[aria-pressed="true"] .tick::after{content:"✓"}
.filters__count{font-family:var(--f-m);font-size:.74rem;letter-spacing:.06em;text-transform:uppercase;padding:0 12px;color:var(--broth-ink)}
.clear{background:none;border:0;cursor:pointer;font-family:var(--f-m);font-size:.74rem;letter-spacing:.06em;text-transform:uppercase;text-decoration:underline;color:var(--chili-deep);padding:.5em}
.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px;position:relative}
.card{position:relative;background:#fbf4e6;border-radius:var(--r-l);overflow:hidden;display:flex;flex-direction:column;box-shadow:0 1px 0 rgba(14,21,36,.06);transition:box-shadow .35s var(--ease)}
.card:hover{box-shadow:0 24px 50px -28px rgba(14,21,36,.45)}
.card[hidden]{display:none}
.card__ph{position:relative;aspect-ratio:4/3;background:var(--ink);overflow:hidden}
.card__ph img{width:100%;height:100%;object-fit:cover;transform:scale(1.06);transition:transform 1.2s var(--ease)}
.card:hover .card__ph img{transform:scale(1.13) rotate(2deg)}
.card__ph .kj{position:absolute;inset:0;display:grid;place-items:center;font-family:var(--f-j);font-weight:700;font-size:clamp(4rem,8vw,7rem);color:var(--ink);background:repeating-linear-gradient(90deg,transparent 0 22px,rgba(14,21,36,.08) 22px 23px),var(--chili)}
.card__no{position:absolute;left:16px;top:14px;font-family:var(--f-m);font-size:.7rem;letter-spacing:.1em;color:var(--broth);background:rgba(14,21,36,.65);padding:.35em .7em;border-radius:999px}
.card__b{padding:20px 22px 22px;display:flex;flex-direction:column;gap:8px;flex:1}
.card__t{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.card h3{margin:0;font-size:1.5rem;line-height:1;font-weight:850;font-variation-settings:"wdth" 78;text-transform:uppercase}
.card h3 small{display:block;font-family:var(--f-j);font-size:.8rem;font-weight:500;color:var(--broth-ink);margin-top:6px;letter-spacing:.1em}
.price{font-family:var(--f-m);font-weight:600;font-size:1rem}
.card p{margin:0;color:var(--broth-ink);font-size:.94rem}
.tags{display:flex;gap:6px;flex-wrap:wrap;margin-top:auto;padding-top:10px}
.tag{font-family:var(--f-m);font-size:.66rem;letter-spacing:.08em;text-transform:uppercase;padding:.35em .7em;border-radius:999px;box-shadow:inset 0 0 0 1px rgba(14,21,36,.25)}
.tag--v{background:#dcebc8;box-shadow:none;color:var(--negi-deep)}
.tag--gf{background:#e9dcc0;box-shadow:none;color:#5d4a1f}
.tag--s{background:#ffd9cf;box-shadow:none;color:var(--chili-deep)}
.card__go{display:flex;align-items:center;justify-content:space-between;margin-top:12px;padding:.85em 1.1em;border-radius:12px;border:0;cursor:pointer;background:var(--ink);color:var(--broth);font-weight:700;font-size:.9rem;transition:background .25s}
.card__go:hover{background:var(--chili-deep)}
.empty{grid-column:1/-1;padding:60px 20px;text-align:center;border:1.5px dashed rgba(14,21,36,.25);border-radius:var(--r-l);color:var(--broth-ink)}
.empty[hidden]{display:none}

/* ---------- machine ---------- */
.order{padding:clamp(80px,11vw,150px) 0;background:linear-gradient(180deg,var(--ink) 0%,#101a30 100%);position:relative;overflow:hidden}
.order__grid{display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1.5fr);gap:clamp(32px,5vw,80px);align-items:start}
.order__copy{position:sticky;top:110px}
.order__copy p{color:#d9ccb2;max-width:26rem}
.steps{list-style:none;padding:0;margin:32px 0 0;display:grid;gap:14px;counter-reset:s}
.steps li{display:grid;grid-template-columns:44px 1fr;gap:14px;align-items:start;color:#d9ccb2;font-size:.95rem}
.steps li::before{counter-increment:s;content:"0" counter(s);font-family:var(--f-m);font-size:.75rem;width:44px;height:44px;border-radius:50%;display:grid;place-items:center;box-shadow:inset 0 0 0 1px var(--ink-line);color:var(--broth)}
.steps b{display:block;color:var(--broth)}
.machine{position:relative;background:linear-gradient(180deg,#e9dcc2,#d7c7a7);color:var(--ink);border-radius:var(--r-xl);padding:clamp(14px,2vw,26px);box-shadow:inset 0 2px 0 rgba(255,255,255,.6),inset 0 -6px 0 rgba(0,0,0,.12),0 40px 80px -30px rgba(0,0,0,.8)}
.machine::before{content:"";position:absolute;inset:10px;border-radius:calc(var(--r-xl) - 8px);box-shadow:inset 0 0 0 1px rgba(14,21,36,.12);pointer-events:none}
.m__top{display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:stretch;margin-bottom:18px}
.m__plate{background:var(--chili);border-radius:16px;padding:12px 16px;display:flex;flex-direction:column;justify-content:center;box-shadow:inset 0 -3px 0 rgba(0,0,0,.18)}
.m__plate .jp{font-size:1.6rem;font-weight:700;line-height:1}
.m__plate .mono{font-size:.64rem;margin-top:4px}
.led{background:#0b1411;border-radius:16px;padding:12px 18px;display:flex;align-items:center;justify-content:space-between;gap:12px;box-shadow:inset 0 3px 12px rgba(0,0,0,.8),0 1px 0 rgba(255,255,255,.5);color:var(--led);font-family:var(--f-m);text-shadow:0 0 8px rgba(156,255,122,.55);min-height:78px;overflow:hidden;position:relative}
.led::after{content:"";position:absolute;inset:0;background:repeating-linear-gradient(0deg,rgba(0,0,0,.25) 0 1px,transparent 1px 3px);pointer-events:none}
.led__msg{font-size:.72rem;letter-spacing:.12em;text-transform:uppercase;line-height:1.5;min-width:0}
.led__msg .bad{color:#ff8a6a;text-shadow:0 0 8px rgba(255,120,90,.6)}
.led__sum{font-size:clamp(1.7rem,3.2vw,2.6rem);font-weight:600;letter-spacing:.02em;white-space:nowrap;font-variant-numeric:tabular-nums}
.badges{display:flex;gap:6px;margin-top:4px;flex-wrap:wrap}
.badges span{font-size:.62rem;padding:.15em .5em;border:1px solid currentColor;border-radius:4px;opacity:.25;transition:opacity .3s}
.badges span.on{opacity:1}
.m__row{border:0;margin:0 0 14px;padding:14px;border-radius:20px;background:rgba(255,255,255,.28);box-shadow:inset 0 0 0 1px rgba(14,21,36,.08);min-width:0}
.m__row legend{float:left;width:100%;display:flex;justify-content:space-between;align-items:baseline;font-family:var(--f-m);font-size:.7rem;letter-spacing:.1em;text-transform:uppercase;margin-bottom:10px;padding:0 4px;color:var(--broth-ink)}
.m__row legend b{color:var(--ink)}
.keys{clear:both;display:grid;gap:8px;grid-template-columns:repeat(var(--cols,4),minmax(0,1fr))}
.key{position:relative;display:block;cursor:pointer}
.key input{position:absolute;opacity:0;inset:0;width:100%;height:100%;margin:0;cursor:pointer}
.key>span{display:flex;flex-direction:column;gap:2px;height:100%;padding:10px 12px 11px;border-radius:12px;background:linear-gradient(180deg,#fffaf0,#efe4cc);box-shadow:0 3px 0 #b9a98a,0 4px 8px -2px rgba(0,0,0,.25),inset 0 0 0 1px rgba(14,21,36,.1);transition:transform .12s,box-shadow .12s,background .25s,color .25s;font-size:.86rem;font-weight:700;line-height:1.2;user-select:none}
.key .k{font-family:var(--f-j);font-size:1.25rem;line-height:1.1;color:var(--chili-deep)}
.key .p{font-family:var(--f-m);font-size:.7rem;font-weight:400;color:var(--broth-ink);margin-top:auto}
.key:hover>span{background:linear-gradient(180deg,#fff,#f4ebd6)}
.key input:active+span{transform:translateY(3px);box-shadow:0 0 0 #b9a98a,inset 0 0 0 1px rgba(14,21,36,.1)}
.key input:checked+span{background:radial-gradient(120% 140% at 50% 0%,#ff7a57,var(--chili) 55%,#e2401f);color:var(--ink);transform:translateY(2px);box-shadow:0 1px 0 #8f2a14,0 0 22px -2px rgba(255,90,54,.75),inset 0 1px 0 rgba(255,255,255,.4)}
.key input:checked+span .k,.key input:checked+span .p{color:var(--ink)}
.key input:focus-visible+span{outline:3px solid var(--ink);outline-offset:2px}
.key input:disabled+span{opacity:.38;cursor:not-allowed;background:repeating-linear-gradient(135deg,#efe4cc 0 6px,#e5d8bc 6px 12px);box-shadow:inset 0 0 0 1px rgba(14,21,36,.12)}
.key input:disabled{cursor:not-allowed}
.key .why{font-family:var(--f-m);font-size:.6rem;font-weight:400;color:var(--chili-deep);text-transform:uppercase;letter-spacing:.06em}
.spice .key>span{align-items:center;text-align:center}
.m__foot{display:grid;grid-template-columns:1fr 1fr auto;gap:12px;align-items:end;margin-top:6px}
.field label{display:block;font-family:var(--f-m);font-size:.7rem;letter-spacing:.1em;text-transform:uppercase;margin:0 0 6px 4px;color:var(--broth-ink)}
.field input,.field select{width:100%;height:52px;border-radius:12px;border:0;padding:0 14px;background:#fffaf0;box-shadow:inset 0 2px 4px rgba(0,0,0,.12),inset 0 0 0 1px rgba(14,21,36,.14);font-size:1rem;color:var(--ink)}
.field input[aria-invalid="true"]{box-shadow:inset 0 0 0 2px var(--chili-deep)}
.field .err{display:block;min-height:1.1em;font-size:.76rem;color:var(--chili-deep);margin:4px 0 0 4px;font-weight:600}
.qty{display:flex;align-items:center;height:52px;border-radius:12px;background:#fffaf0;box-shadow:inset 0 0 0 1px rgba(14,21,36,.14)}
.qty button{width:44px;height:52px;border:0;background:none;cursor:pointer;font-size:1.3rem;font-weight:700;border-radius:12px}
.qty button:hover{background:rgba(14,21,36,.06)}
.qty output{min-width:28px;text-align:center;font-family:var(--f-m);font-weight:600}
.slot{margin-top:18px;display:grid;grid-template-columns:1fr auto;gap:16px;align-items:center}
.slot__mouth{height:20px;border-radius:10px;background:#141414;box-shadow:inset 0 4px 6px rgba(0,0,0,.9),0 1px 0 rgba(255,255,255,.6);position:relative}
.slot__mouth::after{content:"TICKET";position:absolute;left:50%;top:-18px;transform:translateX(-50%);font-family:var(--f-m);font-size:.6rem;letter-spacing:.3em;color:var(--broth-ink)}
.print{font-size:1.05rem;padding:1.05em 1.7em;box-shadow:0 5px 0 #8f2a14,0 12px 24px -8px rgba(0,0,0,.4)}
.print:hover{box-shadow:0 5px 0 #8f2a14,0 16px 30px -8px rgba(255,90,54,.6)}
.print:active{transform:translateY(4px);box-shadow:0 1px 0 #8f2a14}
.print[disabled]{filter:grayscale(.6);opacity:.7;cursor:progress}
.feed{position:relative;display:flex;flex-direction:column;align-items:center;margin-top:-8px}
.feed__clip{overflow:hidden;width:min(360px,92%);height:0;transition:height 0s}
.ticket{width:100%;background:#fffdf7;color:#1a1a1a;font-family:var(--f-m);font-size:.8rem;padding:26px 22px 18px;position:relative;box-shadow:0 20px 40px -20px rgba(0,0,0,.7);-webkit-mask:radial-gradient(circle 6px at 50% 100%,transparent 98%,#000) 0 0/16px 100% repeat-x;mask:radial-gradient(circle 6px at 50% 100%,transparent 98%,#000) 0 0/16px 100% repeat-x;padding-bottom:28px}
.ticket h3{margin:0 0 2px;font-family:var(--f-d);font-weight:900;font-variation-settings:"wdth" 110;letter-spacing:.12em;font-size:1.3rem;text-align:center}
.ticket .c{text-align:center;color:#555;font-size:.7rem;letter-spacing:.08em}
.ticket .no{text-align:center;font-size:2.4rem;font-weight:600;margin:12px 0 4px;letter-spacing:.06em}
.ticket hr{border:0;border-top:1.5px dashed #999;margin:12px 0}
.ticket .l{display:flex;justify-content:space-between;gap:12px;margin:3px 0}
.ticket .l span:last-child{text-align:right;white-space:nowrap}
.ticket .sub{color:#666;font-size:.72rem;padding-left:10px}
.ticket .tot{font-weight:600;font-size:1.05rem}
.ticket svg{width:100%;height:46px;margin-top:12px}
.ticket .kept{position:absolute;right:12px;top:12px;font-size:.6rem;letter-spacing:.1em;color:var(--chili-deep);border:1px solid currentColor;padding:2px 6px;border-radius:3px;transform:rotate(6deg)}
.feed__acts{display:flex;gap:10px;flex-wrap:wrap;justify-content:center;margin-top:18px;opacity:0;transition:opacity .5s}
.feed__acts.on{opacity:1}
.feed__acts[hidden]{display:none}
.toast{position:fixed;left:50%;bottom:24px;z-index:60;transform:translate(-50%,140%);background:var(--broth);color:var(--ink);padding:.9em 1.3em;border-radius:999px;font-weight:700;box-shadow:0 20px 40px -10px rgba(0,0,0,.5);transition:transform .45s var(--ease),visibility 0s .45s;visibility:hidden;max-width:calc(100vw - 32px);text-align:center;font-size:.92rem}
.toast.on{transform:translate(-50%,0);visibility:visible;transition:transform .45s var(--ease)}

/* ---------- locations ---------- */
.locs{padding:clamp(80px,11vw,150px) 0}
.locs__head{display:flex;justify-content:space-between;align-items:end;gap:24px;flex-wrap:wrap;margin-bottom:44px}
.clock{font-family:var(--f-m);font-size:.78rem;letter-spacing:.06em;text-transform:uppercase;color:var(--broth-ink);text-align:right}
.clock b{display:block;font-size:2rem;color:var(--ink);font-family:var(--f-d);letter-spacing:0;font-variant-numeric:tabular-nums}
.loc-grid{display:grid;grid-template-columns:1fr 1fr;gap:22px}
.loc{background:#fbf4e6;border-radius:var(--r-l);overflow:hidden;display:grid;grid-template-rows:auto 1fr}
.loc__ph{position:relative;aspect-ratio:16/9;overflow:hidden;background:var(--ink)}
.loc__ph img{width:100%;height:100%;object-fit:cover}
.status{position:absolute;left:16px;bottom:16px;display:flex;align-items:center;gap:10px;background:rgba(14,21,36,.86);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);color:var(--broth);padding:.6em 1em;border-radius:999px;font-weight:700;font-size:.9rem}
.status small{font-family:var(--f-m);font-weight:400;font-size:.72rem;color:#d9ccb2;letter-spacing:.04em}
.loc__b{padding:24px;display:grid;grid-template-columns:1fr 1fr;gap:24px}
.loc h3{margin:0 0 6px;font-size:2.1rem;line-height:.95;font-weight:900;font-variation-settings:"wdth" 70;text-transform:uppercase}
.loc address{font-style:normal;color:var(--broth-ink);margin-bottom:14px}
.queue{margin-top:6px}
.queue__lbl{display:flex;justify-content:space-between;font-family:var(--f-m);font-size:.72rem;letter-spacing:.06em;text-transform:uppercase;color:var(--broth-ink);margin-bottom:8px}
.queue__lbl b{color:var(--ink);font-size:.95rem}
.bowls{display:flex;gap:4px}
.bowls i{flex:1;height:10px;border-radius:3px;background:rgba(14,21,36,.12);transition:background .4s}
.bowls i.on{background:var(--ink)}
.bowls i.on.hot{background:var(--chili-deep)}
.queue small{display:block;margin-top:8px;color:var(--broth-ink);font-size:.78rem}
.hours{width:100%;border-collapse:collapse;font-family:var(--f-m);font-size:.78rem}
.hours th,.hours td{text-align:left;padding:6px 8px;border-bottom:1px solid rgba(14,21,36,.1);font-weight:400}
.hours td{text-align:right}
.hours tr.today{background:var(--ink);color:var(--broth)}
.hours tr.today th,.hours tr.today td{border-color:transparent}
.hours tr.today th{border-radius:6px 0 0 6px}.hours tr.today td{border-radius:0 6px 6px 0}
.copy{margin-top:16px;background:none;border:0;cursor:pointer;padding:.6em 0;font-weight:700;text-decoration:underline;text-underline-offset:4px;color:var(--chili-deep)}

/* ---------- story ---------- */
.story{position:relative;min-height:min(92vh,880px);display:grid;align-items:end;overflow:hidden;isolation:isolate}
.story__media{position:absolute;inset:0;z-index:-1}
.story__media video,.story__media img{width:100%;height:100%;object-fit:cover}
.story__media::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(14,21,36,.94) 0%,rgba(14,21,36,.6) 45%,rgba(14,21,36,.1) 100%),linear-gradient(0deg,rgba(14,21,36,.9),transparent 40%)}
.story__in{width:100%;padding:clamp(80px,10vw,140px) 0 clamp(48px,6vw,80px)}
.story__txt{max-width:40rem}
.story__txt p{font-size:clamp(1.05rem,1.4vw,1.25rem);color:#e2d6bd}
.story .kanji{font-family:var(--f-j);font-weight:700;font-size:clamp(5rem,12vw,11rem);line-height:.9;color:var(--chili);margin:0 0 .1em}
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-top:56px;border-top:1px solid var(--ink-line);padding-top:24px}
.stats b{display:block;font-size:clamp(2.2rem,4vw,3.6rem);font-weight:900;font-variation-settings:"wdth" 70;line-height:1;font-variant-numeric:tabular-nums}
.stats span{font-family:var(--f-m);font-size:.72rem;letter-spacing:.08em;text-transform:uppercase;color:#cfc2a6}
.vidctl{position:absolute;right:var(--gut);bottom:24px;z-index:2;width:44px;height:44px;border-radius:50%;border:0;cursor:pointer;background:rgba(14,21,36,.6);color:var(--broth);display:grid;place-items:center;backdrop-filter:blur(6px)}
.vidctl svg{width:16px;height:16px}

/* ---------- footer ---------- */
.foot{background:var(--chili);color:var(--ink);padding:clamp(60px,8vw,100px) 0 28px;overflow:hidden}
.foot__grid{display:grid;grid-template-columns:1.3fr 1fr 1fr;gap:40px}
.foot h2{margin:0 0 12px;font-size:clamp(1.8rem,3vw,2.6rem);font-weight:900;font-variation-settings:"wdth" 72;text-transform:uppercase;line-height:.95}
.foot p{margin:0 0 16px;max-width:28rem}
.nl{display:flex;gap:8px;flex-wrap:wrap;max-width:30rem}
.nl input{flex:1 1 200px;height:52px;border-radius:999px;border:0;padding:0 20px;background:var(--broth);color:var(--ink);font-size:1rem}
.nl input[aria-invalid="true"]{box-shadow:inset 0 0 0 2.5px var(--ink)}
.nl .btn{--bg:var(--ink);--fg:var(--broth)}
.nl__msg{flex-basis:100%;min-height:1.4em;font-weight:700;font-size:.88rem;margin:4px 0 0 12px}
.foot h4{font-family:var(--f-m);font-size:.72rem;letter-spacing:.12em;text-transform:uppercase;margin:0 0 12px;font-weight:600}
.foot ul{list-style:none;margin:0;padding:0;display:grid;gap:6px}
.foot ul a{text-decoration:none;font-weight:600}
.foot ul a:hover{text-decoration:underline}
.foot .wordmark{font-weight:900;font-variation-settings:"wdth" 125;font-size:13vw;line-height:.8;letter-spacing:-.02em;margin:60px auto 18px;white-space:nowrap;width:max-content;max-width:none}
.legal{display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap;font-family:var(--f-m);font-size:.72rem;letter-spacing:.04em;border-top:1.5px solid var(--ink);padding-top:18px}

/* ---------- responsive ---------- */
@media (max-width:1100px){
  .nav{display:none}
  .burger{display:block}
  .hdr__in .livepill{margin-left:auto}
  .order__grid{grid-template-columns:1fr}
  .order__copy{position:static}
  .loc__b{grid-template-columns:1fr}
}
@media (max-width:900px){
  .hero__grid{grid-template-columns:1fr;align-content:start;padding-top:120px;padding-bottom:0;min-height:0}
  .hero{min-height:0;display:flex;flex-direction:column;background:var(--ink)}
  .hero__grid{order:1;width:100%}
  .stage{order:2;position:relative;inset:auto;height:min(150vw,820px);margin-top:-22vw;width:100%}
  .stage::after{background:linear-gradient(180deg,var(--ink) 0%,var(--ink) 10%,rgba(14,21,36,0) 42%,rgba(14,21,36,0) 80%,var(--ink) 100%)}
  .bowl{left:50%;width:62vw}
  .hero__bar{order:3}
  .hero h1{font-size:clamp(4.2rem,21vw,8rem)}
  .hero__bar{position:relative;background:none}
  .hero__bar ul{grid-template-columns:1fr 1fr}
  .vert,.steam-hint{display:none}
  .menu__head{grid-template-columns:1fr}
  .grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .loc-grid{grid-template-columns:1fr}
  .foot__grid{grid-template-columns:1fr 1fr}
  .foot__grid>div:first-child{grid-column:1/-1}
  .stats{grid-template-columns:1fr 1fr}
}
@media (max-width:640px){
  .hdr .btn{display:none}
  .hdr__in{gap:12px}
  .livepill{font-size:.66rem;padding:.55em .8em}
  .livepill .lp-long{display:none}
  .grid{grid-template-columns:1fr}
  .filters{border-radius:22px}
  .keys{--cols:2!important}
  .spice .keys{--cols:3!important}
  .m__top{grid-template-columns:1fr}
  .m__plate{flex-direction:row;align-items:center;gap:10px}
  .m__foot{grid-template-columns:1fr 1fr}
  .m__foot .field:first-child{grid-column:1/-1}
  .slot{grid-template-columns:1fr}
  .print{justify-content:center}
  .loc__b{padding:18px}
  .hero h1 sup{display:block;top:0;margin:.8em 0 0}
  .story__media::after{background:linear-gradient(0deg,rgba(14,21,36,.96) 40%,rgba(14,21,36,.5))}
}
@media (max-width:420px){.logo .lt{display:none}}
@media (prefers-reduced-motion:reduce){
  .pre{display:none}
  html{scroll-behavior:auto}
  *,*::before,*::after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important;transition-delay:0ms!important}
  .rv,.fade-in{opacity:1;transform:none}
  .hero h1 .ln>span{transform:none}
  .bowl__img{opacity:1}
}
@media print{
  body *{visibility:hidden}
  #ticketOut,#ticketOut *{visibility:visible}
  #ticketOut{position:absolute;left:0;top:0}
}
</style>
<script type="importmap">
{"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.180.0/build/three.module.min.js","three/addons/":"https://cdn.jsdelivr.net/npm/three@0.180.0/examples/jsm/"}}
</script>
</head>
<body>
<div class="pre" id="pre" aria-hidden="true">
  <div class="pre__in">
    <svg viewBox="0 0 120 96" aria-hidden="true">
      <defs><clipPath id="preClip"><path d="M8 40h104c0 26-22 46-52 46S8 66 8 40z"/></clipPath></defs>
      <path class="wisp" d="M44 30c-6-8 6-12 0-22"/><path class="wisp" d="M60 30c-6-8 6-12 0-22"/><path class="wisp" d="M76 30c-6-8 6-12 0-22"/>
      <g clip-path="url(#preClip)"><rect id="preFill" x="0" y="40" width="120" height="50" fill="#ff5a36" style="transform:translateY(46px)"/></g>
      <path d="M8 40h104c0 26-22 46-52 46S8 66 8 40z" fill="none" stroke="#f2e4c9" stroke-width="3"/>
      <path d="M44 86l-4 8h40l-4-8" fill="none" stroke="#f2e4c9" stroke-width="3" stroke-linejoin="round"/>
    </svg>
    <span class="pre__t">煙 KEMURI</span>
    <span class="pre__pct" id="prePct">FILLING THE POT 00%</span>
  </div>
</div>
<a class="skip" href="#main">Skip to content</a>

<header class="hdr" id="hdr">
  <div class="wrap hdr__in">
    <a class="logo" href="#top" aria-label="Kemuri, back to top"><span class="hanko" aria-hidden="true">煙</span><span class="lt">KEMURI</span></a>
    <nav class="nav" aria-label="Primary">
      <a href="#menu">Menu</a><a href="#ticket">Ticket machine</a><a href="#locations">Counters</a><a href="#story">Story</a>
    </nav>
    <a class="livepill" href="#locations" id="livePill"><span class="dot" id="liveDot"></span><span id="liveTxt">Checking hours…</span></a>
    <a class="btn" href="#ticket">Buy a ticket</a>
    <button class="burger" id="burger" aria-expanded="false" aria-controls="mnav" aria-label="Open menu"><span></span><span></span></button>
  </div>
</header>
<nav class="mnav" id="mnav" aria-label="Mobile">
  <a href="#menu">Menu</a><a href="#ticket">Ticket machine</a><a href="#locations">Counters</a><a href="#story">Story</a>
</nav>

<main id="main">
<!-- HERO -->
<section class="hero" id="top" aria-label="Kemuri late-night ramen" data-tone="dark">
  <div class="stage" id="stage" role="img" aria-label="A steaming bowl of Kemuri tonkotsu on a dark lacquered counter, lanterns glowing behind; with a mouse you can drag the bowl to turn it">
    <img class="plate" src="assets/counter-plate.webp" width="1600" height="880" alt="" fetchpriority="high">
    <canvas class="bowl3d" id="bowl3d" aria-hidden="true"></canvas>
    <div class="bowl" id="bowl" aria-hidden="true"><img class="bowl__img" src="assets/hero-bowl.webp" width="1200" height="1200" alt="" loading="lazy"></div>
    <div class="grain" aria-hidden="true"></div>
  </div>
  <canvas class="steam" id="steam" aria-hidden="true"></canvas>
  <div class="steam-fb" aria-hidden="true"><i style="left:62%;top:58%"></i><i style="left:62%;top:58%"></i><i style="left:62%;top:58%"></i></div>
  <div class="vert" aria-hidden="true">深夜ラーメン・二店舗</div>

  <div class="wrap hero__grid">
    <div>
      <p class="eyebrow fade-in" style="--d:100ms">Late-night ramen · Portland · since 2014</p>
      <h1>
        <span class="ln"><span style="--d:150ms">Broth</span></span>
        <span class="ln"><span style="--d:260ms">until</span></span>
        <span class="ln"><span style="--d:370ms"><em>3 a.m.</em><sup>Fri&nbsp;&amp;&nbsp;Sat</sup></span></span>
      </h1>
      <p class="hero__lede fade-in" style="--d:600ms">Two counters, twenty-six stools, one pot of tonkotsu that never stops rolling. Push the buttons on our ticket machine, take a seat, and slurp loudly — it's polite here.</p>
      <div class="hero__ctas fade-in" style="--d:720ms">
        <a class="btn" href="#ticket">Buy a ticket <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M3 8h10M9 4l4 4-4 4"/></svg></a>
        <a class="btn btn--ghost" href="#menu">See the board</a>
      </div>
    </div>
  </div>
  <p class="steam-hint" aria-hidden="true">Move through the steam</p>
  <div class="hero__bar">
    <ul class="wrap">
      <li><b>18-hour</b>pork bone broth</li>
      <li><b>Cut at 4 p.m.</b>noodles, daily</li>
      <li><b>Vegan &amp; GF</b>bowls on every night</li>
      <li><b>Last ticket 2:45</b>weekends</li>
    </ul>
  </div>
</section>

<!-- MENU -->
<section class="light menu" id="menu" data-tone="light" aria-labelledby="menuH">
  <div class="wrap">
    <div class="menu__head">
      <div>
        <p class="eyebrow rv">The board · 献立</p>
        <h2 class="h2 rv" id="menuH" style="--d:80ms">Five broths.<br>No shortcuts.</h2>
      </div>
      <p class="rv" style="--d:160ms">Every broth starts the day before. Filter for what you eat, then send a bowl straight to the ticket machine — it remembers your choice.</p>
    </div>
    <div class="filters rv" role="group" aria-label="Dietary filters">
      <button class="chip" type="button" aria-pressed="false" data-f="vegan"><span class="tick" aria-hidden="true"></span>Vegan</button>
      <button class="chip" type="button" aria-pressed="false" data-f="gf"><span class="tick" aria-hidden="true"></span>Gluten-free</button>
      <button class="chip" type="button" aria-pressed="false" data-f="spicy"><span class="tick" aria-hidden="true"></span>Spicy</button>
      <span class="filters__count" id="count" aria-live="polite">11 of 11</span>
      <button class="clear" type="button" id="clearF" hidden>Clear</button>
    </div>
    <div class="grid" id="grid"></div>
  </div>
</section>

<!-- TICKET MACHINE -->
<section class="order" id="ticket" aria-labelledby="ticketH">
  <div class="wrap order__grid">
    <div class="order__copy">
      <p class="eyebrow rv">Shokken-ki · 食券機</p>
      <h2 class="h2 rv" id="ticketH" style="--d:80ms">Push the<br>buttons.</h2>
      <p class="rv" style="--d:160ms">Like the noodle shops of Tokyo, you order at the machine. Build your bowl, the machine prints a ticket — hand it over at the counter or show it on your phone for pickup.</p>
      <ol class="steps rv" style="--d:240ms">
        <li><span><b>Choose</b>Broth, noodle, firmness, toppings, heat.</span></li>
        <li><span><b>Print</b>The machine prints a numbered ticket. Keep it as an image.</span></li>
        <li><span><b>Slurp</b>We call your number in about the time on the queue meter.</span></li>
      </ol>
    </div>

    <div>
      <form class="machine rv" id="machine" novalidate aria-describedby="ledMsg">
        <div class="m__top">
          <div class="m__plate"><span class="jp" aria-hidden="true">食券</span><span class="mono">Kemuri No.2 machine</span></div>
          <div class="led" role="status">
            <div class="led__msg" id="ledMsg">Insert choice — pick a broth<div class="badges" aria-hidden="true"><span id="bV">VEGAN</span><span id="bG">GLUTEN-FREE</span><span id="bS">SPICY</span></div></div>
            <div class="led__sum" id="ledSum" aria-label="Total">$0.00</div>
          </div>
        </div>

        <fieldset class="m__row" id="rowBroth"><legend><b>01 Broth</b><span>pick one</span></legend><div class="keys" style="--cols:5" id="kBroth"></div></fieldset>
        <fieldset class="m__row"><legend><b>02 Noodle</b><span>pick one</span></legend><div class="keys" style="--cols:3" id="kNoodle"></div></fieldset>
        <fieldset class="m__row"><legend><b>03 Firmness</b><span>hari-gane to yawa</span></legend><div class="keys" style="--cols:4" id="kFirm"></div></fieldset>
        <fieldset class="m__row"><legend><b>04 Toppings</b><span>as many as you like</span></legend><div class="keys" style="--cols:4" id="kTop"></div></fieldset>
        <fieldset class="m__row spice"><legend><b>05 Heat</b><span id="spiceNote">0 to jigoku</span></legend><div class="keys" style="--cols:6" id="kSpice"></div></fieldset>
        <fieldset class="m__row"><legend><b>06 On the side</b><span>optional</span></legend><div class="keys" style="--cols:5" id="kSide"></div></fieldset>

        <div class="m__foot">
          <div class="field"><label for="tName">Name on ticket</label><input id="tName" name="name" autocomplete="given-name" maxlength="18" placeholder="e.g. Mika" aria-describedby="tNameErr"><span class="err" id="tNameErr"></span></div>
          <div class="field"><label for="tLoc">Counter</label><select id="tLoc" name="loc"><option value="alder">Alder St</option><option value="division">Division St</option></select><span class="err"></span></div>
          <div class="field"><label id="qtyL">Bowls</label><div class="qty" role="group" aria-labelledby="qtyL"><button type="button" id="qMinus" aria-label="One bowl fewer">−</button><output id="qty" aria-live="polite">1</output><button type="button" id="qPlus" aria-label="One bowl more">+</button></div><span class="err"></span></div>
        </div>
        <div class="slot">
          <div class="slot__mouth" aria-hidden="true"></div>
          <button class="btn print" type="submit" id="printBtn">Print ticket <span aria-hidden="true">▼</span></button>
        </div>
      </form>
      <div class="feed" aria-live="polite">
        <div class="feed__clip" id="feedClip"><div class="ticket" id="ticketOut"></div></div>
        <div class="feed__acts" id="feedActs" hidden>
          <button class="btn" type="button" id="saveT">Keep ticket (.png)</button>
          <button class="btn btn--ghost" type="button" id="newT">New ticket</button>
        </div>
      </div>
    </div>
  </div>
</section>

<!-- LOCATIONS -->
<section class="light locs" id="locations" data-tone="light" aria-labelledby="locH">
  <div class="wrap">
    <div class="locs__head">
      <div>
        <p class="eyebrow rv">Two counters · 二店舗</p>
        <h2 class="h2 rv" id="locH" style="--d:80ms">Find a stool.</h2>
      </div>
      <div class="clock rv" style="--d:160ms" aria-live="off"><span id="clockLbl">Portland time</span><b id="clockNow">--:--</b><span id="clockYou"></span></div>
    </div>
    <div class="loc-grid" id="locGrid"></div>
  </div>
</section>

<!-- STORY -->
<section class="story" id="story" aria-labelledby="storyH">
  <div class="story__media">
    <video id="kitchenVid" muted loop playsinline preload="none" poster="assets/kitchen-poster.webp" aria-hidden="true">
      <source src="assets/kitchen.webm" type="video/webm">
      <source src="assets/kitchen.mp4" type="video/mp4">
    </video>
  </div>
  <button class="vidctl" id="vidctl" type="button" aria-label="Pause background video"><svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><rect x="3" y="2" width="3.5" height="12" rx="1"/><rect x="9.5" y="2" width="3.5" height="12" rx="1"/></svg></button>
  <div class="wrap story__in">
    <div class="story__txt">
      <p class="kanji rv" aria-hidden="true">煙</p>
      <p class="eyebrow rv">Kemuri means smoke</p>
      <h2 class="h2 rv" id="storyH" style="--d:80ms">The pot never<br>goes cold.</h2>
      <p class="rv" style="--d:160ms">Ren and Ami opened the first counter on Alder Street in 2014 with eight stools, one stock pot and a second-hand ticket machine from Osaka. The tonkotsu is topped up, never restarted — every bowl carries a little of the night before.</p>
    </div>
    <div class="stats rv" style="--d:240ms">
      <div><b data-count="18">0</b><span>hours of simmer</span></div>
      <div><b data-count="26">0</b><span>stools, two counters</span></div>
      <div><b data-count="4100">0</b><span>bowls a week</span></div>
      <div><b data-count="0">0</b><span>reservations, ever</span></div>
    </div>
  </div>
</section>
</main>

<footer class="foot" aria-label="Footer" data-tone="chili">
  <div class="wrap">
    <div class="foot__grid">
      <div>
        <h2>Get on the late list</h2>
        <p>One email a month: the off-menu bowl, the night we stay open till dawn, and nothing else.</p>
        <form class="nl" id="nl" novalidate>
          <label class="sr-only" for="nlEmail">Email address</label>
          <input id="nlEmail" type="email" placeholder="you@example.com" autocomplete="email" aria-describedby="nlMsg">
          <button class="btn" type="submit">Join</button>
          <p class="nl__msg" id="nlMsg" aria-live="polite"></p>
        </form>
      </div>
      <div>
        <h4>Counters</h4>
        <ul><li>412 SW Alder St</li><li>3318 SE Division St</li><li><a href="#locations">Hours &amp; queue</a></li></ul>
      </div>
      <div>
        <h4>Around</h4>
        <ul><li><a href="#menu">The board</a></li><li><a href="#ticket">Ticket machine</a></li><li><a href="#story">Our story</a></li><li><a href="#top">Back to top ↑</a></li></ul>
      </div>
    </div>
    <p class="wordmark" aria-hidden="true">KEMURI</p>
    <div class="legal"><span>© 2026 Kemuri Ramen Bar — a fictional restaurant.</span><span>Slurp responsibly.</span></div>
  </div>
</footer>
<div class="toast" id="toast" role="status" aria-live="polite"></div>

<script>
(()=>{
'use strict';
const $=(s,r=document)=>r.querySelector(s), $$=(s,r=document)=>[...r.querySelectorAll(s)];
const RM=matchMedia('(prefers-reduced-motion: reduce)');
const store={get(k,d){try{const v=localStorage.getItem(k);return v==null?d:JSON.parse(v)}catch(e){return d}},set(k,v){try{localStorage.setItem(k,JSON.stringify(v))}catch(e){}}};
const money=n=>'$'+n.toFixed(2);
let toastT;
function toast(msg){const t=$('#toast');t.textContent=msg;t.classList.add('on');clearTimeout(toastT);toastT=setTimeout(()=>t.classList.remove('on'),2600)}

/* ---------- header ---------- */
const hdr=$('#hdr');
const toned=$$('[data-tone]').filter(e=>e!==hdr);
let toneRaf=0;
const onScroll=()=>{hdr.classList.toggle('scrolled',scrollY>30);if(toneRaf)return;toneRaf=requestAnimationFrame(()=>{toneRaf=0;const y=36;let t='dark';for(const el of toned){const r=el.getBoundingClientRect();if(r.top<=y&&r.bottom>y){t=el.dataset.tone;break}}if(hdr.dataset.tone!==t)hdr.dataset.tone=t})};
addEventListener('scroll',onScroll,{passive:true});onScroll();
const burger=$('#burger'),mnav=$('#mnav');
function setNav(o){burger.setAttribute('aria-expanded',o);burger.setAttribute('aria-label',o?'Close menu':'Open menu');mnav.classList.toggle('open',o)}
burger.addEventListener('click',()=>setNav(burger.getAttribute('aria-expanded')!=='true'));
$$('a',mnav).forEach(a=>a.addEventListener('click',()=>setNav(false)));
addEventListener('keydown',e=>{if(e.key==='Escape'&&mnav.classList.contains('open')){setNav(false);burger.focus()}});

/* ---------- reveals ---------- */
const io=new IntersectionObserver(es=>es.forEach(e=>{if(e.isIntersecting){e.target.classList.add('in');io.unobserve(e.target)}}),{threshold:.12,rootMargin:'0px 0px -6% 0px'});
$$('.rv').forEach(el=>io.observe(el));
document.documentElement.classList.remove('no-js');
/* ---------- preloader: waits for fonts, the bowl photo and the 3D bowl (min 900ms, max 3500ms) ---------- */
const pre=$('#pre'),preFill=$('#preFill'),prePct=$('#prePct');
let preShown=0,preTarget=0,preDone=false;
const preParts=[
  document.fonts?document.fonts.ready:Promise.resolve(),
  new Promise(r=>{const i=$('.plate');if(i.complete)r();else{i.addEventListener('load',r,{once:true});i.addEventListener('error',r,{once:true})}}),
  new Promise(r=>{if(window.__kemuri3d!=null)r();addEventListener('kemuri:3d',r,{once:true})}),
];
preParts.forEach(pr=>pr.then(()=>{preTarget+=1/preParts.length}));
function preTick(){preShown+=(Math.min(1,preTarget+.06)-preShown)*.1;
  prePct.textContent='FILLING THE POT '+String(Math.min(99,Math.round(preShown*100))).padStart(2,'0')+'%';preFill.style.transform=`translateY(${46-46*preShown}px)`;
  if(!preDone)requestAnimationFrame(preTick)}
function start(){document.documentElement.classList.add('ready');window.__kemuriStarted=true;dispatchEvent(new Event('kemuri:start'))}
if(RM.matches){pre.hidden=true;requestAnimationFrame(start)}
else{
  requestAnimationFrame(preTick);
  const t0=performance.now();
  Promise.race([Promise.all(preParts),new Promise(r=>setTimeout(r,3500))]).then(()=>{
    const wait=Math.max(0,900-(performance.now()-t0));
    setTimeout(()=>{preDone=true;prePct.textContent='FILLING THE POT 100%';preFill.style.transform='translateY(0)';setTimeout(()=>{pre.classList.add('out');start();setTimeout(()=>{pre.hidden=true},1000)},280)},wait);
  });
}

/* ---------- data ---------- */
const MENU=[
 {id:'tonkotsu',n:'Kemuri Tonkotsu',j:'豚骨',p:16,img:'assets/hero-bowl.webp',d:'Our 18-hour pork bone broth, chashu belly, ajitama, wood ear, black garlic oil.',t:['gf'],gfNote:'GF on rice noodles',broth:'tonkotsu'},
 {id:'tantan',n:'Tantanmen',j:'担々麺',p:17,img:'assets/menu-tantan.webp',d:'Sesame and chili broth, spiced pork mince, bok choy, Sichuan pepper numbness.',t:['spicy'],broth:'tantan'},
 {id:'miso',n:'Forest Miso',j:'味噌',p:15,img:'assets/menu-miso.webp',d:'Three-miso and kombu-shiitake broth, crispy tofu, roasted corn, sprouts.',t:['vegan','gf'],gfNote:'GF on rice noodles',broth:'miso'},
 {id:'shio',n:'Yuzu Shio',j:'塩',p:15,img:'assets/menu-shio.webp',d:'Clear chicken and sea-salt broth, yuzu peel, chicken chashu, mitsuba — served on rice noodles.',t:['gf'],broth:'shio',noodle:'rice'},
 {id:'shoyu',n:'Black Garlic Shoyu',j:'醤油',p:16,img:'assets/menu-shoyu.webp',d:'Aged soy tare on a chicken-pork base, mayu oil swirl, menma, nori.',t:[],broth:'shoyu'},
 {id:'jigoku',n:'Jigoku Red',j:'地獄',p:16,img:null,d:'Forest Miso taken to level five with our fermented chili paste. Signed waiver optional.',t:['vegan','spicy'],broth:'miso',spice:5},
 {id:'gyoza',n:'Pan Gyoza ×6',j:'餃子',p:9,img:'assets/menu-gyoza.webp',d:'Pork and cabbage, crisp lace skirt, chili vinegar.',t:[],side:'gyoza'},
 {id:'karaage',n:'Karaage',j:'唐揚げ',p:10,img:'assets/menu-karaage.webp',d:'Tamari-marinated thigh in potato starch, lemon, kewpie.',t:['gf'],side:'karaage'},
 {id:'cucumber',n:'Smashed Cucumber',j:'胡瓜',p:6,img:'assets/menu-cucumber.webp',d:'Chili oil, black vinegar, toasted sesame, raw garlic.',t:['vegan','gf','spicy'],side:'cucumber'},
 {id:'ajitama',n:'Ajitama ×2',j:'味玉',p:4,img:'assets/menu-ajitama.webp',d:'Soy-mirin marinated eggs, six-and-a-half-minute yolks, flaky salt.',t:['gf'],side:'ajitama'},
 {id:'matcha',n:'Matcha Soft Serve',j:'抹茶',p:6,img:'assets/menu-matcha.webp',d:'Uji matcha, kinako dust, black sesame. The 2 a.m. finish.',t:['gf'],side:'matcha'},
];
const BROTH=[
 {v:'tonkotsu',n:'Tonkotsu',k:'豚骨',p:16,vegan:false,gf:true},
 {v:'shoyu',n:'Black garlic shoyu',k:'醤油',p:16,vegan:false,gf:false},
 {v:'shio',n:'Yuzu shio',k:'塩',p:15,vegan:false,gf:true},
 {v:'miso',n:'Forest miso',k:'味噌',p:15,vegan:true,gf:true},
 {v:'tantan',n:'Tantan',k:'担々',p:17,vegan:false,gf:false,minSpice:2},
];
const NOODLE=[{v:'thin',n:'Thin straight',k:'細麺',p:0,gf:false},{v:'wavy',n:'Thick wavy',k:'太麺',p:0,gf:false},{v:'rice',n:'Rice noodle · GF',k:'米麺',p:1,gf:true}];
const FIRM=[{v:'barikata',n:'Barikata',k:'バリカタ',p:0,s:'very firm'},{v:'katame',n:'Katame',k:'カタ',p:0,s:'firm'},{v:'futsu',n:'Futsū',k:'普通',p:0,s:'regular'},{v:'yawa',n:'Yawame',k:'ヤワ',p:0,s:'soft'}];
const TOP=[
 {v:'chashu',n:'Extra chashu',k:'叉焼',p:3,vegan:false,why:'pork'},
 {v:'ajitama',n:'Ajitama egg',k:'味玉',p:2,vegan:false,why:'egg'},
 {v:'tofu',n:'Crispy tofu',k:'豆腐',p:2.5,vegan:true},
 {v:'nori',n:'Nori ×3',k:'海苔',p:1,vegan:true},
 {v:'corn',n:'Roast corn',k:'コーン',p:1.5,vegan:true},
 {v:'menma',n:'Menma',k:'メンマ',p:1,vegan:true},
 {v:'negi',n:'Mountain of negi',k:'ネギ',p:1,vegan:true},
 {v:'kaedama',n:'Kaedama refill',k:'替玉',p:2.5,vegan:true},
];
const SPICE=[0,1,2,3,4,5].map(i=>({v:String(i),n:['None','Mild','Warm','Hot','Very hot','Jigoku'][i],k:i?'🌶'.repeat(Math.min(i,3))+(i>3?'+':''):'—'}));
const SIDE=[{v:'gyoza',n:'Pan gyoza ×6',k:'餃子',p:9,vegan:false,gf:false},{v:'karaage',n:'Karaage',k:'唐揚げ',p:10,vegan:false,gf:true},{v:'cucumber',n:'Smashed cucumber',k:'胡瓜',p:6,vegan:true,gf:true,spicy:true},{v:'ajitama',n:'Ajitama ×2',k:'味玉',p:4,vegan:false,gf:true},{v:'matcha',n:'Matcha soft serve',k:'抹茶',p:6,vegan:false,gf:true}];
const LOCS=[
 {id:'alder',n:'Alder St',full:'Kemuri Alder',addr:'412 SW Alder St, Portland',img:'assets/store-alder.webp',alt:'Night exterior of the Alder Street counter on a rainy corner, warm window and red noren curtain',seats:14,
  // per weekday 0=Sun..6=Sat : [open, close] minutes from that day's midnight; null = closed
  h:[[1020,1440],[1020,1500],[1020,1500],[1020,1500],[1020,1500],[1020,1620],[1020,1620]]},
 {id:'division',n:'Division St',full:'Kemuri Division',addr:'3318 SE Division St, Portland',img:'assets/store-division.webp',alt:'Night exterior of the narrow wooden-fronted Division Street counter with a paper lantern by the door',seats:12,
  h:[[1080,1440],null,[1080,1560],[1080,1560],[1080,1560],[1080,1620],[1080,1620]]},
];
const DAYS=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];

/* ---------- menu render + filters (FLIP) ---------- */
const grid=$('#grid');
const tagLbl={vegan:['Vegan','tag--v'],gf:['Gluten-free','tag--gf'],spicy:['Spicy','tag--s']};
grid.innerHTML=MENU.map((m,i)=>`<article class="card" data-id="${m.id}" data-tags="${m.t.join(' ')}">
  <div class="card__ph">${m.img?`<img src="${m.img}" alt="Overhead photo of ${m.n}" loading="lazy" width="720" height="720">`:`<div class="kj" aria-hidden="true">${m.j}</div>`}<span class="card__no">No.${String(i+1).padStart(2,'0')}</span></div>
  <div class="card__b">
    <div class="card__t"><h3>${m.n}<small lang="ja">${m.j}</small></h3><span class="price">${money(m.p).replace('.00','')}</span></div>
    <p>${m.d}</p>
    <div class="tags">${m.t.map(t=>`<span class="tag ${tagLbl[t][1]}">${tagLbl[t][0]}${t==='gf'&&m.gfNote?' · '+m.gfNote.replace('GF ',''):''}</span>`).join('')}</div>
    <button class="card__go" type="button" data-go="${m.id}">${m.side?'Add to ticket':'Build this bowl'} <span aria-hidden="true">${m.side?'+':'→'}</span></button>
  </div></article>`).join('')+`<p class="empty" id="empty" hidden>Nothing on the board matches all of those. Try removing a filter.</p>`;
const cards=$$('.card',grid), active=new Set();
function applyFilters(){
  const first=new Map(cards.map(c=>[c,c.getBoundingClientRect()]));
  const wasHidden=new Map(cards.map(c=>[c,c.hidden]));
  let n=0;
  cards.forEach(c=>{const tags=c.dataset.tags.split(' ');const ok=[...active].every(f=>tags.includes(f));c.hidden=!ok;if(ok)n++});
  $('#count').textContent=`${n} of ${cards.length}`;
  $('#empty').hidden=n>0;
  $('#clearF').hidden=active.size===0;
  if(RM.matches) return;
  cards.forEach(c=>{
    if(c.hidden){return}
    const last=c.getBoundingClientRect();
    if(wasHidden.get(c)){c.animate([{opacity:0,transform:'scale(.92)'},{opacity:1,transform:'none'}],{duration:450,easing:'cubic-bezier(.2,.8,.2,1)',delay:80});return}
    const f=first.get(c),dx=f.left-last.left,dy=f.top-last.top;
    if(dx||dy)c.animate([{transform:`translate(${dx}px,${dy}px)`},{transform:'none'}],{duration:560,easing:'cubic-bezier(.2,.8,.2,1)'});
  });
  // ghost the leaving cards
  cards.forEach(c=>{if(c.hidden&&!wasHidden.get(c)){const f=first.get(c),g=c.cloneNode(true),gr=grid.getBoundingClientRect();g.hidden=false;g.setAttribute('aria-hidden','true');g.inert=true;Object.assign(g.style,{position:'absolute',left:(f.left-gr.left)+'px',top:(f.top-gr.top)+'px',width:f.width+'px',height:f.height+'px',margin:0,pointerEvents:'none',zIndex:0});grid.appendChild(g);g.animate([{opacity:1,transform:'none'},{opacity:0,transform:'scale(.9)'}],{duration:320,easing:'ease-in',fill:'forwards'}).onfinish=()=>g.remove()}});
}
$$('.chip').forEach(b=>b.addEventListener('click',()=>{const f=b.dataset.f,on=b.getAttribute('aria-pressed')!=='true';b.setAttribute('aria-pressed',on);on?active.add(f):active.delete(f);applyFilters()}));
$('#clearF').addEventListener('click',()=>{active.clear();$$('.chip').forEach(b=>b.setAttribute('aria-pressed','false'));applyFilters();$('.chip').focus()});

/* ---------- ticket machine ---------- */
const form=$('#machine');
function keys(el,name,list,type){
  el.innerHTML=list.map(o=>`<label class="key"><input type="${type}" name="${name}" value="${o.v}"><span>${o.k?`<span class="k" lang="ja" aria-hidden="true">${o.k}</span>`:''}${o.n}${o.s?`<span class="p">${o.s}</span>`:''}${o.p!=null?`<span class="p">${o.p?'+'+money(o.p).replace('.00',''):name==='broth'?'':'incl.'}</span>`:''}${o.why?`<span class="why" hidden>no · ${o.why}</span>`:''}</span></label>`).join('');
}
keys($('#kBroth'),'broth',BROTH.map(b=>({...b,p:null,s:money(b.p).replace('.00','')})),'radio');
keys($('#kNoodle'),'noodle',NOODLE,'radio');
keys($('#kFirm'),'firm',FIRM.map(f=>({...f,p:null})),'radio');
keys($('#kTop'),'top',TOP,'checkbox');
keys($('#kSpice'),'spice',SPICE.map(s=>({...s,p:null})),'radio');
keys($('#kSide'),'side',SIDE,'checkbox');
form.noodle.value='thin';form.firm.value='katame';form.spice.value='0';
let qty=1;
const byV=(l,v)=>l.find(o=>o.v===v);
function state(){
  const b=byV(BROTH,form.broth.value), nd=byV(NOODLE,form.noodle.value), fi=byV(FIRM,form.firm.value);
  const tops=$$('input[name=top]:checked',form).map(i=>byV(TOP,i.value));
  const sides=$$('input[name=side]:checked',form).map(i=>byV(SIDE,i.value));
  const spice=+form.spice.value;
  const bowl=b?(b.p+nd.p+tops.reduce((a,t)=>a+t.p,0)):0;
  const total=bowl*qty+sides.reduce((a,s)=>a+s.p,0);
  const vegan=!!b&&b.vegan&&tops.every(t=>t.vegan)&&sides.every(s=>s.vegan);
  const gf=!!b&&b.gf&&nd.gf&&sides.every(s=>s.gf);
  const spicy=spice>0||sides.some(s=>s.spicy);
  return {b,nd,fi,tops,sides,spice,bowl,total,vegan,gf,spicy,qty};
}
let shown=0,rollRaf;
function rollTo(v){
  const el=$('#ledSum');cancelAnimationFrame(rollRaf);
  if(RM.matches){shown=v;el.textContent=money(v);return}
  const from=shown,t0=performance.now();
  const step=t=>{const k=Math.min(1,(t-t0)/380),e=1-Math.pow(1-k,3);shown=from+(v-from)*e;el.textContent=money(shown);if(k<1)rollRaf=requestAnimationFrame(step);else shown=v};
  rollRaf=requestAnimationFrame(step);
}
function sync(){
  const s=state();
  // constraints: vegan broth disables pork/egg
  $$('input[name=top]',form).forEach(i=>{const t=byV(TOP,i.value);const off=!!s.b&&s.b.vegan&&!t.vegan;i.disabled=off;if(off)i.checked=false;const w=i.nextElementSibling.querySelector('.why');if(w)w.hidden=!off});
  $$('input[name=spice]',form).forEach(i=>{const off=!!s.b&&s.b.minSpice&&+i.value<s.b.minSpice;i.disabled=off});
  if(s.b&&s.b.minSpice&&+form.spice.value<s.b.minSpice) form.spice.value=String(s.b.minSpice);
  $('#spiceNote').textContent=s.b&&s.b.minSpice?'tantan starts at 2':'0 to jigoku';
  const f=state();
  rollTo(f.total);
  $('#bV').classList.toggle('on',f.vegan);$('#bG').classList.toggle('on',f.gf);$('#bS').classList.toggle('on',f.spicy);
  const txt=f.b?`${f.qty}× ${f.b.n} · ${f.nd.n.replace(' · GF','')} · ${f.fi.n}${f.tops.length?` · +${f.tops.length} top`:''}`:'Insert choice — pick a broth';
  writeLed(txt);
}
function writeLed(txt,bad){const m=$('#ledMsg');const first=m.firstChild;if(first&&first.nodeType===3){first.nodeValue=''}let s=m.querySelector('.m');if(!s){s=document.createElement('span');s.className='m';m.prepend(s)}s.className='m'+(bad?' bad':'');s.textContent=txt}
form.addEventListener('change',sync);
$('#qMinus').addEventListener('click',()=>{qty=Math.max(1,qty-1);$('#qty').textContent=qty;sync()});
$('#qPlus').addEventListener('click',()=>{qty=Math.min(6,qty+1);$('#qty').textContent=qty;sync()});
const nameI=$('#tName');
function validName(show){const v=nameI.value.trim();let e='';if(!v)e='Add a name so we can call you.';else if(v.length<2)e='At least 2 letters.';else if(!/^[\p{L} .'\-]+$/u.test(v))e='Letters only, please.';if(show){$('#tNameErr').textContent=e;nameI.setAttribute('aria-invalid',e?'true':'false')}return !e}
nameI.addEventListener('input',()=>{if(nameI.getAttribute('aria-invalid')==='true')validName(true)});
sync();

// menu -> machine
grid.addEventListener('click',e=>{
  const b=e.target.closest('[data-go]');if(!b)return;
  const m=MENU.find(x=>x.id===b.dataset.go);
  if(m.side){const i=$(`input[name=side][value=${m.side}]`,form);i.checked=true;sync();toast(`${m.n} added to your ticket`);return}
  form.broth.value=m.broth;sync();
  if(m.noodle)form.noodle.value=m.noodle;
  if(m.spice!=null)form.spice.value=String(m.spice);
  sync();
  $('#ticket').scrollIntoView({behavior:RM.matches?'auto':'smooth'});
  setTimeout(()=>$(`input[name=broth][value=${m.broth}]`,form).focus({preventScroll:true}),RM.matches?0:700);
  toast(`${m.n} loaded into the machine`);
});

// print
const LOCNAME={alder:'Alder St',division:'Division St'};
function ticketHTML(t,kept){
  const lines=[];
  lines.push(`<div class="l"><span>${t.qty}× ${t.broth}</span><span>${money(t.bp*t.qty)}</span></div>`);
  lines.push(`<div class="sub">${t.noodle} · ${t.firm} · heat ${t.spice}</div>`);
  t.tops.forEach(x=>lines.push(`<div class="l sub"><span>+ ${x.n}</span><span>${money(x.p*t.qty)}</span></div>`));
  if(t.np)lines.push(`<div class="l sub"><span>+ rice noodle</span><span>${money(t.np*t.qty)}</span></div>`);
  t.sides.forEach(x=>lines.push(`<div class="l"><span>${x.n}</span><span>${money(x.p)}</span></div>`));
  return `${kept?'<span class="kept">KEPT</span>':''}<h3>KEMURI</h3><div class="c">食券 · ${LOCNAME[t.loc].toUpperCase()} COUNTER</div>
  <div class="no">No.${t.no}</div><div class="c">${t.when}</div><hr>
  <div class="l"><span>NAME</span><span>${esc(t.name).toUpperCase()}</span></div><hr>${lines.join('')}<hr>
  <div class="l tot"><span>TOTAL</span><span>${money(t.total)}</span></div>
  ${t.flags?`<div class="c" style="margin-top:6px">${t.flags}</div>`:''}
  <div class="c" style="margin-top:10px">Hand this to the counter · Thank you</div>${barcode(t.no)}`;
}
function esc(s){return s.replace(/[&<>"']/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]))}
function bars(no){let seed=0;for(const c of String(no))seed=seed*31+c.charCodeAt(0);const out=[];let x=0;const rnd=()=>{seed=(seed*1103515245+12345)&0x7fffffff;return seed/0x7fffffff};while(x<300){const w=1+Math.floor(rnd()*3.2),g=1+Math.floor(rnd()*2.5);out.push([x,w]);x+=w+g}return out}
function barcode(no){return `<svg viewBox="0 0 300 46" preserveAspectRatio="none" aria-hidden="true">${bars(no).map(([x,w])=>`<rect x="${x}" y="0" width="${w}" height="46" fill="#1a1a1a"/>`).join('')}</svg>`}
let current=null;
const clip=$('#feedClip'),out=$('#ticketOut'),acts=$('#feedActs'),printBtn=$('#printBtn');
function showTicket(t,kept,animate){
  out.innerHTML=ticketHTML(t,kept);current=t;
  const H=out.offsetHeight;acts.hidden=false;
  if(!animate||RM.matches){clip.style.height=H+'px';acts.classList.add('on');return Promise.resolve()}
  clip.style.height='0px';acts.classList.remove('on');
  return new Promise(res=>{
    const STEPS=22,DUR=1500;let i=0;
    const tick=()=>{i++;clip.style.height=Math.round(H*Math.pow(i/STEPS,1.15))+'px';if(i<STEPS)setTimeout(tick,DUR/STEPS*(0.6+Math.random()*0.8));else{clip.style.height=H+'px';acts.classList.add('on');res()}};
    tick();
  });
}
form.addEventListener('submit',async e=>{
  e.preventDefault();
  const s=state();
  if(!s.b){writeLed('Error — choose a broth first',true);$('#rowBroth').animate?.([{transform:'translateX(0)'},{transform:'translateX(-6px)'},{transform:'translateX(6px)'},{transform:'translateX(0)'}],{duration:280});$('input[name=broth]',form).focus();return}
  if(!validName(true)){writeLed('Error — name on ticket',true);nameI.focus();return}
  const n=store.get('kemuri-no',400+Math.floor(Math.random()*80))+1;store.set('kemuri-no',n);
  const now=new Date();
  const t={no:String(n).padStart(4,'0'),when:now.toLocaleString('en-US',{weekday:'short',month:'short',day:'numeric',hour:'numeric',minute:'2-digit'}),name:nameI.value.trim(),loc:form.loc.value,
    broth:s.b.n,bp:s.b.p,noodle:s.nd.n.replace(' · GF',''),np:s.nd.p,firm:s.fi.n,spice:`${s.spice} (${SPICE[s.spice].n.toLowerCase()})`,tops:s.tops.map(x=>({n:x.n,p:x.p})),sides:s.sides.map(x=>({n:x.n,p:x.p})),qty:s.qty,total:s.total,
    flags:[s.vegan&&'VEGAN',s.gf&&'GLUTEN-FREE'].filter(Boolean).join(' · ')};
  printBtn.disabled=true;writeLed('Printing… do not pull');
  await showTicket(t,false,true);
  store.set('kemuri-ticket',t);
  printBtn.disabled=false;writeLed(`Ticket No.${t.no} printed — see you at ${LOCNAME[t.loc]}`);
  if(!RM.matches)clip.scrollIntoView({behavior:'smooth',block:'nearest'});
  $('#saveT').focus({preventScroll:true});
});
$('#newT').addEventListener('click',()=>{form.reset();form.noodle.value='thin';form.firm.value='katame';form.spice.value='0';qty=1;$('#qty').textContent=1;nameI.setAttribute('aria-invalid','false');$('#tNameErr').textContent='';clip.style.height='0px';acts.hidden=true;store.set('kemuri-ticket',null);sync();$('input[name=broth]',form).focus()});
$('#saveT').addEventListener('click',()=>{if(!current)return;saveImage(current)});
function saveImage(t){
  const W=600,lh=30,rows=[];
  rows.push(['c','KEMURI',40,'900']);rows.push(['c',`食券 · ${LOCNAME[t.loc].toUpperCase()} COUNTER`,18]);rows.push(['c',`No.${t.no}`,64,'600']);rows.push(['c',t.when,18]);rows.push(['hr']);
  rows.push(['l','NAME',t.name.toUpperCase()]);rows.push(['hr']);rows.push(['l',`${t.qty}× ${t.broth}`,money(t.bp*t.qty)]);rows.push(['s',`${t.noodle} · ${t.firm} · heat ${t.spice}`]);
  t.tops.forEach(x=>rows.push(['l','+ '+x.n,money(x.p*t.qty),1]));if(t.np)rows.push(['l','+ rice noodle',money(t.np*t.qty),1]);t.sides.forEach(x=>rows.push(['l',x.n,money(x.p)]));
  rows.push(['hr']);rows.push(['l','TOTAL',money(t.total),0,1]);if(t.flags)rows.push(['c',t.flags,18]);rows.push(['c','Hand this to the counter · Thank you',18]);rows.push(['bar']);
  const H=60+rows.reduce((a,r)=>a+(r[0]==='c'&&r[2]>30?r[2]+18:r[0]==='bar'?110:r[0]==='hr'?24:lh),0);
  const cv=document.createElement('canvas');cv.width=W;cv.height=H;const g=cv.getContext('2d');
  g.fillStyle='#fffdf7';g.fillRect(0,0,W,H);g.fillStyle='#1a1a1a';let y=50;const mono='"IBM Plex Mono",monospace';
  rows.forEach(r=>{
    if(r[0]==='c'){g.textAlign='center';g.font=`${r[3]||400} ${r[2]}px ${r[2]>30&&r[1]==='KEMURI'?'Archivo,sans-serif':mono}`;g.fillText(r[1],W/2,y+(r[2]>30?r[2]-20:0));y+=r[2]>30?r[2]+18:lh}
    else if(r[0]==='hr'){g.setLineDash([6,5]);g.strokeStyle='#999';g.beginPath();g.moveTo(36,y);g.lineTo(W-36,y);g.stroke();g.setLineDash([]);y+=24}
    else if(r[0]==='l'){g.font=`${r[4]?600:400} ${r[4]?24:19}px ${mono}`;g.fillStyle=r[3]?'#666':'#1a1a1a';g.textAlign='left';g.fillText(r[1],r[3]?52:36,y);g.textAlign='right';g.fillText(r[2],W-36,y);g.fillStyle='#1a1a1a';y+=lh}
    else if(r[0]==='s'){g.font=`400 16px ${mono}`;g.fillStyle='#666';g.textAlign='left';g.fillText(r[1],52,y);g.fillStyle='#1a1a1a';y+=lh}
    else if(r[0]==='bar'){bars(t.no).forEach(([x,w])=>g.fillRect(36+x*1.76,y,w*1.76,80));y+=110}
  });
  cv.toBlob(b=>{if(!b)return;const a=document.createElement('a');a.href=URL.createObjectURL(b);a.download=`kemuri-ticket-${t.no}.png`;document.body.appendChild(a);a.click();a.remove();setTimeout(()=>URL.revokeObjectURL(a.href),2000);toast(`Ticket No.${t.no} saved`)},'image/png');
}
const keptT=store.get('kemuri-ticket',null);
if(keptT&&keptT.no){showTicket(keptT,true,false);writeLed(`Welcome back — ticket No.${keptT.no} is still yours`)}

/* ---------- hours / queue ---------- */
const TZ='America/Los_Angeles';
function pdxNow(d=new Date()){
  const p=Object.fromEntries(new Intl.DateTimeFormat('en-US',{timeZone:TZ,weekday:'short',hour:'numeric',minute:'numeric',hourCycle:'h23'}).formatToParts(d).map(x=>[x.type,x.value]));
  const day=DAYS.indexOf(p.weekday),h=+p.hour%24,m=+p.minute;return {day,h,m,wk:day*1440+h*60+m};
}
function fmtMin(min){min=((min%1440)+1440)%1440;if(min===0)return'midnight';const h=Math.floor(min/60),m=min%60,ap=h<12?'a.m.':'p.m.',hh=h%12||12;return `${hh}${m?':'+String(m).padStart(2,'0'):''} ${ap}`}
function dur(m){const h=Math.floor(m/60),mm=m%60;return h?`${h}h ${mm}m`:`${mm}m`}
function status(loc,now){
  const spans=[];loc.h.forEach((s,d)=>{if(s){spans.push([d*1440+s[0],d*1440+s[1]]);spans.push([d*1440+s[0]-10080,d*1440+s[1]-10080])}});
  const cur=spans.find(([a,b])=>now.wk>=a&&now.wk<b);
  if(cur)return {open:true,closesAt:cur[1],left:cur[1]-now.wk};
  const nexts=[];loc.h.forEach((s,d)=>{if(s){let a=d*1440+s[0];if(a<=now.wk)a+=10080;nexts.push(a)}});
  const nx=Math.min(...nexts);const dd=Math.floor(nx/1440)%7;
  return {open:false,opensAt:nx,until:nx-now.wk,dayLbl:dd===now.day&&nx-now.wk<1440?'today':(dd===(now.day+1)%7?'tomorrow':DAYS[dd])};
}
const CURVE={17:.3,18:.55,19:.85,20:1,21:.9,22:.7,23:.6,0:.72,1:.82,2:.5,3:.2};
function queue(loc,now,st){
  if(!st.open)return null;
  const hr=now.h+now.m/60,a=Math.floor(hr),b=(a+1)%24;const ca=CURVE[a]??.2,cb=CURVE[b]??.2;const c=ca+(cb-ca)*(hr-a);
  const wkend=(now.day===5||now.day===6)||(now.day===6&&now.h<4)||(now.day===0&&now.h<4)?1.35:1;
  const slot=Math.floor(now.wk/15);const jit=((slot*9301+49297+loc.seats*7)%233280)/233280*.25+.88;
  const ahead=Math.max(0,Math.round(c*wkend*jit*loc.seats*.6));const wait=Math.max(2,Math.round(ahead*1.8));
  return {ahead,wait,lvl:Math.max(1,Math.min(10,Math.round(c*wkend*jit*7.5)))};
}
const locGrid=$('#locGrid');
locGrid.innerHTML=LOCS.map((l,i)=>`<article class="loc rv" style="--d:${i*120}ms" aria-labelledby="loc-${l.id}">
  <div class="loc__ph"><img src="${l.img}" alt="${l.alt}" loading="lazy" width="1200" height="900"><p class="status" id="st-${l.id}" aria-live="polite"><span class="dot"></span><span></span></p></div>
  <div class="loc__b"><div><h3 id="loc-${l.id}">${l.n}</h3><address>${l.addr}</address>
    <div class="queue"><div class="queue__lbl"><span>Queue now</span><b id="qw-${l.id}">—</b></div><div class="bowls" id="qb-${l.id}" aria-hidden="true">${'<i></i>'.repeat(10)}</div><small id="qs-${l.id}">Estimated from typical nights.</small></div>
    <button class="copy" type="button" data-copy="${l.addr}">Copy address</button></div>
    <table class="hours" aria-label="${l.n} opening hours"><tbody>${[1,2,3,4,5,6,0].map(d=>`<tr data-d="${d}"><th scope="row">${DAYS[d]}</th><td>${l.h[d]?fmtMin(l.h[d][0])+' – '+fmtMin(l.h[d][1]):'Closed'}</td></tr>`).join('')}</tbody></table>
  </div></article>`).join('');
$$('.loc',locGrid).forEach(el=>io.observe(el));
locGrid.addEventListener('click',async e=>{const b=e.target.closest('[data-copy]');if(!b)return;try{await navigator.clipboard.writeText(b.dataset.copy);toast('Address copied')}catch(err){toast(b.dataset.copy)}});
function tickHours(){
  const d=new Date(),now=pdxNow(d);
  $('#clockNow').textContent=new Intl.DateTimeFormat('en-US',{timeZone:TZ,hour:'numeric',minute:'2-digit'}).format(d);
  const youTz=Intl.DateTimeFormat().resolvedOptions().timeZone;
  const pdxStr=new Intl.DateTimeFormat('en-US',{timeZone:TZ,hour:'numeric',minute:'2-digit'}).format(d);
  const youStr=new Intl.DateTimeFormat('en-US',{hour:'numeric',minute:'2-digit'}).format(d);
  $('#clockLbl').textContent=`Portland time · ${DAYS[now.day]}`;
  $('#clockYou').textContent=youStr!==pdxStr?`Your clock: ${youStr}`:'Same as your clock';
  let anyOpen=null;
  LOCS.forEach(l=>{
    const st=status(l,now),q=queue(l,now,st),el=$('#st-'+l.id);
    el.querySelector('.dot').className='dot '+(st.open?'open':'closed');
    el.lastElementChild.innerHTML=st.open?`Open now <small>till ${fmtMin(st.closesAt)} · ${dur(st.left)} left</small>`:`Closed <small>opens ${st.dayLbl} ${fmtMin(st.opensAt)}</small>`;
    $$('#qb-'+l.id+' i').forEach((b,i)=>{b.className=q&&i<q.lvl?'on'+(q.lvl>=8?' hot':''):''});
    $('#qw-'+l.id).textContent=q?`~${q.wait} min`:'—';
    $('#qs-'+l.id).textContent=q?`${q.ahead} ${q.ahead===1?'person':'people'} ahead · estimated from typical ${DAYS[now.day]} nights`:`Queue meter starts when we open (in ${dur(st.until)}).`;
    $$(`#locGrid .loc:nth-child(${LOCS.indexOf(l)+1}) tr`).forEach(tr=>{
      // "today" = the business day: before 4 a.m. counts as the previous day
      const bd=now.h<4?(now.day+6)%7:now.day;tr.classList.toggle('today',+tr.dataset.d===bd)});
    if(st.open&&(!anyOpen||st.left>anyOpen.left))anyOpen={...st,l};
  });
  const dot=$('#liveDot'),txt=$('#liveTxt');
  if(anyOpen){dot.className='dot open';txt.innerHTML=`${anyOpen.l.n} open<span class="lp-long"> · till ${fmtMin(anyOpen.closesAt)}</span>`}
  else{const s=status(LOCS[0],now);dot.className='dot closed';txt.innerHTML=`Closed<span class="lp-long"> · opens ${fmtMin(s.opensAt)}</span>`}
}
tickHours();setInterval(tickHours,30000);

/* ---------- story: counters + video ---------- */
const sio=new IntersectionObserver(es=>es.forEach(e=>{if(!e.isIntersecting)return;sio.unobserve(e.target);const el=e.target,to=+el.dataset.count;if(RM.matches||!to){el.textContent=to.toLocaleString('en-US');return}const t0=performance.now();const f=t=>{const k=Math.min(1,(t-t0)/1600),v=Math.round(to*(1-Math.pow(1-k,4)));el.textContent=v.toLocaleString('en-US');if(k<1)requestAnimationFrame(f)};requestAnimationFrame(f)}),{threshold:.6});
$$('[data-count]').forEach(el=>sio.observe(el));
const vid=$('#kitchenVid'),vc=$('#vidctl');let userPaused=RM.matches,vidVisible=false;
const ICON_P='<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><rect x="3" y="2" width="3.5" height="12" rx="1"/><rect x="9.5" y="2" width="3.5" height="12" rx="1"/></svg>',ICON_PL='<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M4 2.5v11l9-5.5z"/></svg>';
function vidSync(){const play=vidVisible&&!userPaused&&!document.hidden;if(play){if(vid.preload==='none'){vid.preload='auto'}const p=vid.play();if(p)p.catch(()=>{})}else vid.pause();vc.innerHTML=userPaused?ICON_PL:ICON_P;vc.setAttribute('aria-label',userPaused?'Play background video':'Pause background video')}
new IntersectionObserver(es=>{vidVisible=es[0].isIntersecting;vidSync()},{threshold:.15}).observe(vid);
vc.addEventListener('click',()=>{userPaused=!userPaused;vidSync()});
document.addEventListener('visibilitychange',vidSync);vidSync();

/* ---------- wordmark fit ---------- */
const wm=$('.wordmark');
function fitWM(){wm.style.fontSize='100px';const w=wm.offsetWidth,avail=wm.parentElement.clientWidth-parseFloat(getComputedStyle(wm.parentElement).paddingLeft)*2;wm.style.fontSize=Math.max(40,Math.floor(100*avail/w))+'px'}
document.fonts&&document.fonts.ready.then(fitWM);fitWM();addEventListener('resize',fitWM);

/* ---------- newsletter ---------- */
$('#nl').addEventListener('submit',e=>{e.preventDefault();const i=$('#nlEmail'),m=$('#nlMsg'),v=i.value.trim();const ok=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(v);i.setAttribute('aria-invalid',!ok);m.textContent=!v?'Type your email first.':ok?`You're on the late list. See you after midnight.`:'That email looks off — check the @ and the dot.';if(ok){store.set('kemuri-nl',v);i.value=''}else i.focus()});

/* ---------- steam (WebGL) ---------- */
const hero=$('.hero'),cv=$('#steam'),bowlEl=$('#bowl');
const gl=cv.getContext('webgl',{premultipliedAlpha:true,alpha:true,antialias:false,powerPreference:'low-power'});
if(!gl){hero.classList.add('no-webgl');return}
const VS='attribute vec2 p;void main(){gl_Position=vec4(p,0.,1.);}';
const FS=`precision mediump float;
uniform vec2 uRes;uniform float uTime;uniform vec3 uBowl;uniform vec3 uTrail[10];uniform float uTop;
float hash(vec2 p){p=fract(p*vec2(123.34,456.21));p+=dot(p,p+45.32);return fract(p.x*p.y);}
float noise(vec2 p){vec2 i=floor(p),f=fract(p);vec2 u=f*f*(3.-2.*f);return mix(mix(hash(i),hash(i+vec2(1,0)),u.x),mix(hash(i+vec2(0,1)),hash(i+vec2(1,1)),u.x),u.y);}
float fbm(vec2 p){float v=0.,a=.5;mat2 m=mat2(1.6,1.2,-1.2,1.6);for(int i=0;i<5;i++){v+=a*noise(p);p=m*p;a*=.5;}return v;}
void main(){
  vec2 px=gl_FragCoord.xy;float R=uBowl.z;
  vec2 disp=vec2(0.);float carve=0.;
  for(int i=0;i<10;i++){vec3 t=uTrail[i];vec2 d=px-t.xy;float r=R*.42;float f=t.z*exp(-dot(d,d)/(r*r));disp+=d/(length(d)+1.)*f*r*1.1;carve+=f;}
  vec2 q=px-disp;
  vec2 b=(q-uBowl.xy)/R;
  float w=.62+.42*max(b.y+.3,0.);
  float env=exp(-pow(b.x/w,2.)*1.6);
  env*=smoothstep(-1.05,-.15,b.y);
  env*=1.-smoothstep(1.5*uTop,3.8*uTop,b.y);
  float t=uTime;
  vec2 sp=vec2(b.x*1.25,b.y*.85-t*.32);
  vec2 wv=vec2(fbm(sp*1.1+vec2(0.,t*.08)),fbm(sp*1.1+vec2(5.2,1.3)-t*.05));
  float n=fbm(sp*1.7+wv*1.8+vec2(sin(b.y*1.4-t*.5)*.35,0.));
  float dens=smoothstep(.34,.8,n)*env;
  dens*=.8+.35*sin(b.x*5.+n*7.-t*.8);
  dens*=1.-clamp(carve*.6,0.,.85);
  vec3 col=mix(vec3(.78,.83,.96),vec3(1.,.97,.92),clamp(b.y*.35+.45,0.,1.));
  float a=clamp(dens*1.05,0.,.85);
  gl_FragColor=vec4(col*a,a*.45);
}`;
function sh(type,src){const s=gl.createShader(type);gl.shaderSource(s,src);gl.compileShader(s);if(!gl.getShaderParameter(s,gl.COMPILE_STATUS)){throw new Error(gl.getShaderInfoLog(s))}return s}
let prog;
try{prog=gl.createProgram();gl.attachShader(prog,sh(gl.VERTEX_SHADER,VS));gl.attachShader(prog,sh(gl.FRAGMENT_SHADER,FS));gl.linkProgram(prog);if(!gl.getProgramParameter(prog,gl.LINK_STATUS))throw new Error('link')}catch(err){hero.classList.add('no-webgl');cv.remove();return}
gl.useProgram(prog);
const buf=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,buf);gl.bufferData(gl.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),gl.STATIC_DRAW);
const loc=gl.getAttribLocation(prog,'p');gl.enableVertexAttribArray(loc);gl.vertexAttribPointer(loc,2,gl.FLOAT,false,0,0);
const U={res:gl.getUniformLocation(prog,'uRes'),time:gl.getUniformLocation(prog,'uTime'),bowl:gl.getUniformLocation(prog,'uBowl'),trail:gl.getUniformLocation(prog,'uTrail'),top:gl.getUniformLocation(prog,'uTop')};
gl.enable(gl.BLEND);gl.blendFunc(gl.ONE,gl.ONE_MINUS_SRC_ALPHA);
let S=.5,W=0,H=0,bowl={x:0,y:0,r:1},heroH=1;
const trail=Array.from({length:10},()=>({x:-9999,y:-9999,s:0}));let ti=0,last=null;
function resize(){
  const r=hero.getBoundingClientRect();S=Math.min(devicePixelRatio||1,2)*(innerWidth<700?.42:.5);
  W=Math.max(1,Math.round(r.width*S));H=Math.max(1,Math.round(r.height*S));cv.width=W;cv.height=H;gl.viewport(0,0,W,H);
  const b=bowlEl.getBoundingClientRect();bowl={x:(b.left-r.left+b.width/2)*S,y:H-(b.top-r.top+b.height*.47)*S,r:b.width*.36*S};heroH=r.height;
  if(RM.matches||!running)draw(performance.now());
}
function onPointer(e){
  const r=hero.getBoundingClientRect();const x=(e.clientX-r.left)*S,y=H-(e.clientY-r.top)*S;
  if(last&&Math.hypot(x-last.x,y-last.y)<14*S){last.x=x;last.y=y;last.s=Math.min(1,last.s+.08);}
  else{ti=(ti+1)%trail.length;last=trail[ti];last.x=x;last.y=y;last.s=1;}
  if(RM.matches)draw(performance.now());
}
hero.addEventListener('pointermove',onPointer,{passive:true});
hero.addEventListener('pointerdown',onPointer,{passive:true});
const arr=new Float32Array(30);const T0=performance.now();
function draw(now){
  const t=RM.matches?12:(now-T0)/1000;
  const bs=window.__bowlScreen;if(bs){bowl={x:bs.x*S,y:H-bs.y*S,r:Math.max(bs.r*.62,20)*S}}
  trail.forEach((p,i)=>{if(!RM.matches)p.s*=.955;arr[i*3]=p.x;arr[i*3+1]=p.y;arr[i*3+2]=p.s});
  gl.clearColor(0,0,0,0);gl.clear(gl.COLOR_BUFFER_BIT);
  gl.uniform2f(U.res,W,H);gl.uniform1f(U.time,t);gl.uniform3f(U.bowl,bowl.x,bowl.y,bowl.r);gl.uniform3fv(U.trail,arr);gl.uniform1f(U.top,innerWidth<900?.6:1);
  gl.drawArrays(gl.TRIANGLES,0,3);
}
let running=false,raf=0,heroVisible=true;
function loop(now){draw(now);raf=requestAnimationFrame(loop)}
function runSync(){const want=heroVisible&&!document.hidden&&!RM.matches;if(want&&!running){running=true;raf=requestAnimationFrame(loop)}else if(!want&&running){running=false;cancelAnimationFrame(raf)}}
new IntersectionObserver(es=>{heroVisible=es[0].isIntersecting;runSync()}).observe(hero);
document.addEventListener('visibilitychange',runSync);
RM.addEventListener?.('change',()=>{runSync();draw(performance.now())});
cv.addEventListener('webglcontextlost',e=>{e.preventDefault();running=false;cancelAnimationFrame(raf);hero.classList.add('no-webgl');cv.style.display='none'});
new ResizeObserver(resize).observe(hero);
resize();runSync();
})();
</script>
<script type="module">
/* ---------- live 3D bowl over the Cycles counter plate ----------
   Camera = the Blender camera that rendered assets/counter-plate.webp:
   position (-0.13, 0.4259, 0.8808) m, pitched down 22°, vertical FOV 24°, plate 1600×880.
   The bowl stands on the counter at the world origin, so it sits IN the render. */
import * as THREE from 'three';
import {GLTFLoader} from 'three/addons/loaders/GLTFLoader.js';
import {MeshoptDecoder} from 'three/addons/libs/meshopt_decoder.module.js';
import {RoomEnvironment} from 'three/addons/environments/RoomEnvironment.js';

const PLATE={w:1600,h:880,bowlX:.67};
const CAM={pos:[-0.13,0.4259,0.8808],pitch:-22,fov:24};
const BOWL={size:.17,yaw:-.35};                       // metres across, resting yaw
const SPRING={k:70,c:12};                              // lean spring stiffness / damping
const LEAN={yaw:.42,pitch:.16};                         // max lean toward the pointer (rad)
const IDLE=.12, DRAG=.008, FRICTION=.94;                // turntable rad/s, drag rad/px, spin decay per frame
const hero=document.querySelector('.hero'),stage=document.getElementById('stage'),cv=document.getElementById('bowl3d'),plate=document.querySelector('.plate');
const RM=matchMedia('(prefers-reduced-motion: reduce)');
const done=ok=>{window.__kemuri3d=ok;dispatchEvent(new CustomEvent('kemuri:3d',{detail:ok}))};
const canGL=(()=>{if(hero.classList.contains('no-webgl'))return false;try{const c=document.createElement('canvas');return !!(c.getContext('webgl2')||c.getContext('webgl'))}catch(e){return false}})();
if(!canGL){done(false)}else try{
  const renderer=new THREE.WebGLRenderer({canvas:cv,antialias:true,alpha:true,powerPreference:'high-performance'});
  renderer.setPixelRatio(Math.min(devicePixelRatio||1,1.75));
  renderer.toneMapping=THREE.AgXToneMapping;renderer.toneMappingExposure=1.05;
  renderer.shadowMap.enabled=true;renderer.shadowMap.type=THREE.PCFSoftShadowMap;
  renderer.setClearColor(0x000000,0);
  const scene=new THREE.Scene();
  const pmrem=new THREE.PMREMGenerator(renderer);
  scene.environment=pmrem.fromScene(new RoomEnvironment(),.04).texture;scene.environmentIntensity=.45;
  const camera=new THREE.PerspectiveCamera(CAM.fov,PLATE.w/PLATE.h,.05,20);
  camera.position.set(...CAM.pos);camera.rotation.set(THREE.MathUtils.degToRad(CAM.pitch),0,0);

  // lights mirror the Blender rig: warm key spot upper-left, orange rim behind-right, cool fill
  const key=new THREE.DirectionalLight(0xffd6a8,2.6);key.position.set(-.25,1.15,.05);key.castShadow=true;
  key.shadow.mapSize.set(1024,1024);Object.assign(key.shadow.camera,{left:-.6,right:.6,top:.6,bottom:-.6,near:.2,far:3});key.shadow.radius=6;key.shadow.bias=-.0005;
  scene.add(key);
  const rim=new THREE.DirectionalLight(0xff7a45,2.2);rim.position.set(.4,.3,-.5);scene.add(rim);
  scene.add(new THREE.HemisphereLight(0x8aa0ff,0x120c08,.35));

  // contact shadow: real shadow map on a ShadowMaterial plane + a soft baked blob for occlusion
  const ground=new THREE.Mesh(new THREE.PlaneGeometry(3,3),new THREE.ShadowMaterial({opacity:.5}));
  ground.rotation.x=-Math.PI/2;ground.receiveShadow=true;scene.add(ground);
  const bc=document.createElement('canvas');bc.width=bc.height=128;const g=bc.getContext('2d');
  const gr=g.createRadialGradient(64,64,0,64,64,64);gr.addColorStop(0,'rgba(0,0,0,.85)');gr.addColorStop(.45,'rgba(0,0,0,.45)');gr.addColorStop(1,'rgba(0,0,0,0)');g.fillStyle=gr;g.fillRect(0,0,128,128);
  const blob=new THREE.Mesh(new THREE.PlaneGeometry(BOWL.size*1.35,BOWL.size*1.35),new THREE.MeshBasicMaterial({map:new THREE.CanvasTexture(bc),transparent:true,depthWrite:false,toneMapped:false}));
  blob.rotation.x=-Math.PI/2;blob.position.y=.0005;scene.add(blob);

  // thin-film "lacquer sheen": an additive interference layer on the counter that the cursor thickens
  const film=new THREE.Mesh(new THREE.PlaneGeometry(2,2),new THREE.ShaderMaterial({
    transparent:true,depthTest:false,depthWrite:false,blending:THREE.AdditiveBlending,toneMapped:false,
    uniforms:{uTime:{value:0},uMouse:{value:new THREE.Vector3(.5,.5,0)},uRes:{value:new THREE.Vector2(1,1)},uHorizon:{value:.62}},
    vertexShader:'varying vec2 v;void main(){v=uv;gl_Position=vec4(position.xy,0.,1.);}',
    fragmentShader:`precision highp float;varying vec2 v;uniform float uTime;uniform vec3 uMouse;uniform vec2 uRes;uniform float uHorizon;
    float h(vec2 p){p=fract(p*vec2(123.34,456.21));p+=dot(p,p+45.32);return fract(p.x*p.y);}
    float n(vec2 p){vec2 i=floor(p),f=fract(p);vec2 u=f*f*(3.-2.*f);return mix(mix(h(i),h(i+vec2(1,0)),u.x),mix(h(i+vec2(0,1)),h(i+vec2(1,1)),u.x),u.y);}
    float fbm(vec2 p){float s=0.,a=.5;for(int i=0;i<4;i++){s+=a*n(p);p=p*2.03+vec2(1.7,9.2);a*=.5;}return s;}
    void main(){
      vec2 a=vec2(uRes.x/uRes.y,1.);vec2 p=v*a;float t=uTime;
      // perspective-ish stretch so the film lies on the counter, not the screen
      float depth=max(uHorizon-v.y,.0)+.08;vec2 q=vec2(p.x/(depth*2.2),1./depth);
      float th=fbm(q*.9+vec2(t*.03,-t*.05))+.4*fbm(q*2.3-t*.04);
      vec2 m=uMouse.xy*a;float d=distance(p,m);
      th+=uMouse.z*.9*exp(-d*d/.025)+uMouse.z*.12*sin(d*40.-t*3.)*exp(-d*d/.05);
      vec3 film=.5+.5*cos(6.2831*(th*1.6+vec3(0.,.33,.67)));
      float mask=smoothstep(uHorizon,uHorizon-.25,v.y)*(.35+.65*smoothstep(.15,.8,v.x));
      float k=mask*(.05+.22*uMouse.z*exp(-d*d/.04));
      gl_FragColor=vec4(film*vec3(.7,.75,1.)*k,0.);
    }`}));
  film.frustumCulled=false;film.renderOrder=-1;scene.add(film);

  // bowl rig: root (position, intro drop, scroll sink) > lean (spring) > spin (turntable / drag)
  const root=new THREE.Group(),lean=new THREE.Group(),spin=new THREE.Group();root.add(lean);lean.add(spin);scene.add(root);
  let ready=false;
  const loader=new GLTFLoader();loader.setMeshoptDecoder(MeshoptDecoder);
  loader.load('assets/ramen-bowl.glb',gltf=>{
    const m=gltf.scene;const box=new THREE.Box3().setFromObject(m),sz=box.getSize(new THREE.Vector3()),c=box.getCenter(new THREE.Vector3());
    const s=BOWL.size/Math.max(sz.x,sz.z);m.scale.setScalar(s);m.position.set(-c.x*s,-box.min.y*s,-c.z*s);
    m.traverse(o=>{if(o.isMesh){o.castShadow=true;o.receiveShadow=true;if(o.material){o.material.envMapIntensity=.9}}});
    spin.add(m);spin.rotation.y=BOWL.yaw;ready=true;layout();renderOnce();cv.classList.add('on');hero.classList.add('has-3d');done(true);
  },undefined,()=>{done(false)});

  // ---------- layout: cover-fit the plate and give the camera the same crop ----------
  let box={w:1,h:1,x:0,y:0},heroBox={x:0,y:0};
  const proj=new THREE.Vector3();
  function layout(){
    const r=stage.getBoundingClientRect(),hr=hero.getBoundingClientRect();box={w:r.width,h:r.height};heroBox={x:r.left-hr.left,y:r.top-hr.top};
    const A=PLATE.w/PLATE.h;let dw,dh;if(box.w/box.h>A){dw=box.w;dh=box.w/A}else{dh=box.h;dw=box.h*A}
    const narrow=innerWidth<=900;
    let px=narrow?(PLATE.bowlX*dw-box.w/2)/(dw-box.w||1):.5;px=Math.min(1,Math.max(0,px));const py=.5;
    plate.style.objectPosition=`${(px*100).toFixed(2)}% ${py*100}%`;
    camera.aspect=A;camera.setViewOffset(dw,dh,px*(dw-box.w),py*(dh-box.h),box.w,box.h);camera.updateProjectionMatrix();
    renderer.setSize(box.w,box.h,false);
    film.material.uniforms.uRes.value.set(box.w,box.h);
    film.material.uniforms.uHorizon.value=1-((.62*dh-py*(dh-box.h))/box.h);
  }
  // publish where the bowl is on screen so the steam shader rises from it
  function publishBowl(){
    const top=new THREE.Vector3(0,BOWL.size*.42,0);root.localToWorld(top);proj.copy(top).project(camera);
    const x=(proj.x*.5+.5)*box.w,y=(-proj.y*.5+.5)*box.h;
    const edge=new THREE.Vector3(BOWL.size*.5,BOWL.size*.42,0);root.localToWorld(edge);edge.project(camera);
    const r=Math.abs((edge.x*.5+.5)*box.w-x);
    window.__bowlScreen={x:heroBox.x+x,y:heroBox.y+y,r};
  }

  // ---------- interaction ----------
  const ptr={x:.5,y:.5,tx:.5,ty:.5,film:0,over:false};
  let drag=null,spinV=0,lastT=performance.now(),t0=lastT;
  const sp={yaw:0,vy:0,pitch:0,vp:0,lift:0,vl:0};
  let intro=RM.matches?1:0,introV=0,introOn=RM.matches||!!window.__kemuriStarted;
  addEventListener('kemuri:start',()=>{introOn=true});
  hero.addEventListener('pointermove',e=>{
    const r=stage.getBoundingClientRect();ptr.tx=(e.clientX-r.left)/r.width;ptr.ty=(e.clientY-r.top)/r.height;ptr.film=1;
    const b=window.__bowlScreen,hr=hero.getBoundingClientRect();
    ptr.over=!!b&&Math.hypot(e.clientX-hr.left-b.x,e.clientY-hr.top-b.y)<b.r*1.25;
    hero.classList.toggle('grab',ptr.over&&e.pointerType==='mouse'&&!drag);
    if(drag){const dx=e.clientX-drag.x;drag.x=e.clientX;spin.rotation.y+=dx*DRAG;spinV=dx*DRAG*60}
    if(!running)renderOnce();
  },{passive:true});
  hero.addEventListener('pointerdown',e=>{if(e.pointerType==='mouse'&&ptr.over&&e.button===0&&!e.target.closest('a,button')){drag={x:e.clientX};hero.classList.add('grabbing');e.preventDefault()}});
  addEventListener('pointerup',()=>{if(drag){drag=null;hero.classList.remove('grabbing')}});
  hero.addEventListener('pointerleave',()=>{ptr.tx=.5;ptr.ty=.5;ptr.over=false});

  function step(now){
    const dt=Math.max(0,Math.min(.1,(now-lastT)/1000));lastT=now;
    ptr.x+=(ptr.tx-ptr.x)*.08;ptr.y+=(ptr.ty-ptr.y)*.08;ptr.film*=.985;
    const tyaw=(ptr.x-.6)*LEAN.yaw,tpitch=(ptr.y-.55)*LEAN.pitch,tlift=ptr.over?.012:0;
    if(RM.matches){sp.yaw=tyaw;sp.pitch=tpitch;sp.lift=tlift}
    else{
      // fixed 1/120 s substeps keep the springs stable on slow frames
      const n=Math.max(1,Math.ceil(dt*120)),h=dt/n;
      for(let i=0;i<n;i++){
        sp.vy+=(SPRING.k*(tyaw-sp.yaw)-SPRING.c*sp.vy)*h;sp.yaw+=sp.vy*h;
        sp.vp+=(SPRING.k*(tpitch-sp.pitch)-SPRING.c*sp.vp)*h;sp.pitch+=sp.vp*h;
        sp.vl+=(120*(tlift-sp.lift)-14*sp.vl)*h;sp.lift+=sp.vl*h;
        if(introOn&&intro<1){introV+=(90*(1-intro)-11*introV)*h;intro+=introV*h;if(Math.abs(1-intro)<.0005&&Math.abs(introV)<.001)intro=1}
      }
      if(!drag){spin.rotation.y+=(IDLE+spinV)*dt;spinV*=FRICTION}
    }
    lean.rotation.set(sp.pitch,sp.yaw,0);
    // scroll: the bowl sinks and turns as the hero leaves
    const hr=hero.getBoundingClientRect();const sc=Math.min(1,Math.max(0,-hr.top/hr.height));
    root.position.set(0,(introOn?(1-intro):1)*.22+sp.lift-sc*.12,0);root.rotation.y=sc*.9;
    blob.material.opacity=Math.max(0,1-root.position.y*8);ground.material.opacity=.5*blob.material.opacity;
    const u=film.material.uniforms;u.uTime.value=RM.matches?8:(now-t0)/1000;u.uMouse.value.set(ptr.x,1-ptr.y,ptr.film);
  }
  function renderOnce(){if(!ready)return;step(performance.now());publishBowl();renderer.render(scene,camera)}
  let running=false,raf=0,visible=true;
  function loop(now){step(now);publishBowl();renderer.render(scene,camera);raf=requestAnimationFrame(loop)}
  function sync(){const want=ready&&visible&&!document.hidden&&!RM.matches;if(want&&!running){running=true;lastT=performance.now();raf=requestAnimationFrame(loop)}else if(!want&&running){running=false;cancelAnimationFrame(raf)}}
  new IntersectionObserver(es=>{visible=es[0].isIntersecting;sync()}).observe(hero);
  document.addEventListener('visibilitychange',sync);RM.addEventListener?.('change',()=>{sync();renderOnce()});
  new ResizeObserver(()=>{layout();renderOnce()}).observe(stage);
  cv.addEventListener('webglcontextlost',e=>{e.preventDefault();running=false;cancelAnimationFrame(raf);hero.classList.remove('has-3d');cv.classList.remove('on')});
  layout();
  const iv=setInterval(()=>{if(ready){clearInterval(iv);sync()}},50);
}catch(err){done(false)}
</script>

</body>
</html>

````
