/* The Impossible Menu — Book edition. A 9:16 film of a magical menu book; the text is printed live on its paper.
   Fonts are the self-hosted DABA copies of the Dark Kitchen edition (OFL 1.1). */
@font-face { font-family: 'Fraunces'; src: url('assets/fonts/fraunces-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('assets/fonts/instrument-serif-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('assets/fonts/instrument-serif-latin-400-italic.woff2') format('woff2'); font-style: italic; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('assets/fonts/archivo-latin-wdth-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --night: #0b0806;
  --cream: #efe2c4;
  --gold: #c9a25a;
  --ink: #2a1d14;
  --ink-soft: #5b4636;
  --ink-red: #7c3a1c;
  /* The film is a 9:16 window: full width on a phone, full height on a wide screen. */
  --film-w: min(100vw, calc(100dvh * 9 / 16));
  --film-h: min(100dvh, calc(100vw * 16 / 9));
  /* One unit of the film's width, so the print scales with the paper. */
  --u: calc(var(--film-w) / 100);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--night); color: var(--cream); font-family: 'Archivo', system-ui, sans-serif; overflow: hidden; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid #e3c47e; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 1rem; top: -4rem; z-index: 99; background: #111; color: var(--cream); padding: .6rem 1rem; }
.skip:focus { top: 1rem; }

/* ---------- Chrome ---------- */
.chrome { position: fixed; z-index: 20; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: max(.9rem, env(safe-area-inset-top)) 1rem .9rem; pointer-events: none; }
.chrome > * { pointer-events: auto; }
.brandline { margin: 0; font-size: .66rem; letter-spacing: .26em; text-transform: uppercase; color: #d9c7a3; text-shadow: 0 1px 6px rgba(0, 0, 0, .8); }
.demo-tag { margin-left: .5em; padding: .2em .55em; border: 1px solid rgba(215, 190, 140, .4); border-radius: 999px; font-size: .9em; letter-spacing: .16em; }
.chrome__actions { display: flex; gap: .4rem; }
.chip { background: rgba(11, 8, 6, .6); border: 1px solid rgba(215, 190, 140, .35); border-radius: 999px; padding: .55em 1em; font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--cream); transition: border-color .3s, background .3s; }
.chip:hover { border-color: rgba(227, 196, 126, .7); }
.chip[aria-pressed='true'] { background: rgba(215, 190, 140, .16); border-color: rgba(227, 196, 126, .7); }
@media (max-width: 420px) { .brandline__name { display: none; } }

/* ---------- The table ---------- */
.table { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.film, .print { position: absolute; left: 50%; top: 50%; width: var(--film-w); height: var(--film-h); transform: translate(-50%, -50%); }
.film { overflow: hidden; background: var(--night); opacity: 0; transition: opacity .8s ease; }
.is-ready .film { opacity: 1; }
/* Feather the film into the night around it on wide or tall screens. */
.film::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 5vmin 3vmin var(--night); }
.shot { position: absolute; inset: 0; will-change: transform, opacity; }
.shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.clip { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
/* The page's own warm light while a dish sinks back into the paper. */
.glow { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; mix-blend-mode: screen;
  background: radial-gradient(ellipse 34% 30% at 55% 42%, rgba(255, 196, 110, .55), rgba(255, 170, 80, .12) 60%, transparent 75%); }

/* ---------- The print: live text on the paper ---------- */
.print { z-index: 5; pointer-events: none; }
.panel { position: absolute; opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility 0s linear .3s; }
/* Ink appears once the dish has settled, slowly, as if soaking into the paper. */
.panel.is-shown { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .9s ease .1s, visibility 0s; }

/* The right-hand page spans about 27–82 % of the film's width and 25–76 % of its height. */
.panel--page { left: 30.5%; width: 48.5%; top: var(--top, 58%); color: var(--ink); mix-blend-mode: multiply; text-align: center; }
.eyebrow { margin: 0 0 calc(var(--u) * 1.2); font-size: calc(var(--u) * 2.15); letter-spacing: .26em; text-transform: uppercase; color: var(--ink-red); }
.dish-name, .page-title { margin: 0; font-family: 'Fraunces', serif; font-weight: 400; font-size: calc(var(--u) * 5.2); line-height: 1.04; letter-spacing: -.005em; }
.page-title { font-size: calc(var(--u) * 6.4); font-weight: 300; }
.page-title em { font-family: 'Instrument Serif', serif; font-weight: 400; }
.desc { margin: calc(var(--u) * 1.3) 0 0; font-family: 'Instrument Serif', serif; font-style: italic; font-size: calc(var(--u) * 2.9); line-height: 1.28; color: var(--ink-soft); }
.meta { display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * .6); margin: calc(var(--u) * 1.8) auto 0; padding-top: calc(var(--u) * 1.4); border-top: 1px solid rgba(42, 29, 20, .3); width: 70%; }
.price { font-family: 'Fraunces', serif; font-size: calc(var(--u) * 4); color: var(--ink-red); white-space: nowrap; }
.allergens { font-size: calc(var(--u) * 1.75); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.flourish { margin: calc(var(--u) * 2.4) 0 0; font-size: calc(var(--u) * 2.6); color: var(--ink-red); }
.colophon { margin: calc(var(--u) * 3) 0 0; font-size: calc(var(--u) * 1.9); line-height: 1.45; color: var(--ink-soft); }
.ink-button { margin-top: calc(var(--u) * 3); padding: calc(var(--u) * 1.2) calc(var(--u) * 3); border: 1px solid rgba(42, 29, 20, .45); border-radius: 999px; background: transparent; font-size: calc(var(--u) * 1.9); letter-spacing: .18em; text-transform: uppercase; color: var(--ink); }
.ink-button:hover { background: rgba(42, 29, 20, .07); }

/* The title in gold foil on the leather cover (Flow never prints it, so every restaurant can have its own). */
/* The cover's leather spans about 21–83 % of the film's width; "The / Impossible / Menu" sits centred on it. */
.panel--cover { left: 26%; width: 52%; top: 36%; text-align: center; }
.foil { margin: 0; font-family: 'Fraunces', serif; font-weight: 400; font-size: calc(var(--u) * 5.2); line-height: 1.12; letter-spacing: .1em; text-transform: uppercase;
  background: linear-gradient(115deg, #8a6628 8%, #d7b46b 32%, #f6e6b4 48%, #c2933f 62%, #7c5a22 88%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .7)); animation: foil 7s ease-in-out infinite alternate; }
.foil span { display: block; }
@keyframes foil { from { background-position: 100% 0; } to { background-position: 0 0; } }
/* The hint sits on the table below the book. */
.hint { position: absolute; left: -30%; right: -30%; top: calc(var(--film-h) * .46); display: flex; justify-content: center; align-items: center; gap: .7rem; margin: 0; font-size: .64rem; letter-spacing: .26em; text-transform: uppercase; color: rgba(239, 226, 196, .85); text-shadow: 0 1px 6px rgba(0, 0, 0, .9); }
.hint__line { width: 2.2rem; height: 1px; background: var(--gold); transform-origin: left; animation: hint 2.4s ease-in-out infinite; }
@keyframes hint { 0% { transform: scaleX(.2); } 50% { transform: scaleX(1); } 100% { transform: scaleX(.2); } }

/* ---------- Rail ---------- */
.rail { position: fixed; z-index: 15; right: max(.55rem, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); display: grid; gap: .2rem; }
.rail__dot { position: relative; width: 2rem; height: 2rem; border: 0; background: transparent; padding: 0; }
.rail__dot::before { content: ''; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; border-radius: 50%; transform: translate(-50%, -50%); background: rgba(239, 226, 196, .45); box-shadow: 0 0 4px rgba(0, 0, 0, .8); transition: background .3s, transform .3s; }
.rail__dot[aria-current='true']::before { background: var(--gold); transform: translate(-50%, -50%) scale(1.6); }
.rail__dot span { position: absolute; right: 2.2rem; top: 50%; transform: translateY(-50%); font-size: .6rem; letter-spacing: .2em; text-transform: uppercase; color: rgba(239, 226, 196, .8); white-space: nowrap; opacity: 0; transition: opacity .3s; pointer-events: none; }
.rail__dot:hover span, .rail__dot:focus-visible span { opacity: 1; }
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .chrome { padding: 1.2rem 2rem; }
  .rail { right: 2rem; }
  .rail__dot span { opacity: .55; }
  .rail__dot[aria-current='true'] span { opacity: 1; color: var(--gold); }
}

/* ---------- Menu as text ---------- */
.reading { overflow: auto; }
.reading .table { position: static; overflow: visible; touch-action: auto; user-select: text; -webkit-user-select: text; padding: 5rem 1.4rem 4rem; max-width: 34rem; margin: 0 auto; }
.reading .film, .reading .rail, .reading .hint { display: none; }
.reading .print { position: static; width: auto; height: auto; transform: none; }
.reading .panel { position: static; opacity: 1; visibility: visible; width: auto; text-align: left; mix-blend-mode: normal; color: var(--cream); padding: 0 0 2rem; margin-bottom: 2rem; border-bottom: 1px solid rgba(201, 162, 90, .2); --u: 4px; }
.reading .eyebrow, .reading .price, .reading .flourish { color: var(--gold); }
.reading .desc, .reading .allergens, .reading .colophon { color: #c9b99a; }
.reading .meta { align-items: flex-start; margin-left: 0; border-color: rgba(201, 162, 90, .3); }
.reading .foil { font-size: 2.2rem; }
.reading .ink-button { color: var(--cream); border-color: rgba(215, 190, 140, .4); }

/* ---------- Less motion ---------- */
.calm .hint__line, .calm .foil { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .hint__line, .foil { animation: none; }
}

/* The burger's plate and shadow reach low on the page: the course line would sit on the shadow, so the page leaves it out
   (it stays in Menu as text). */
.panel--tight .eyebrow { display: none; }
.reading .panel--tight .eyebrow { display: block; }

/* ---------- Text pages: a list of dishes or drinks with dotted leaders ---------- */
.panel--list { text-align: left; }
.panel--list .eyebrow, .panel--list .page-title { text-align: center; }
.panel--list .page-title { font-size: calc(var(--u) * 5.6); }
.list { list-style: none; margin: calc(var(--u) * 3) 0 0; padding: 0; }
.list li { margin: 0 0 calc(var(--u) * 1.7); }
.row { display: flex; align-items: baseline; gap: calc(var(--u) * .8); margin: 0; }
.item { font-family: 'Fraunces', serif; font-size: calc(var(--u) * 2.75); line-height: 1.2; }
.dots { flex: 1; min-width: calc(var(--u) * 2); border-bottom: 1px dotted rgba(42, 29, 20, .45); transform: translateY(calc(var(--u) * -.5)); }
.list .price { font-size: calc(var(--u) * 2.75); }
.list .allergens { margin: calc(var(--u) * .3) 0 0; font-size: calc(var(--u) * 1.5); }
.reading .item { color: var(--cream); }
.reading .dots { border-color: rgba(201, 162, 90, .4); }

/* Where the print starts on each page (below the dish), as a share of the film's height. Kept here rather than in
   style attributes, so the page also works under a strict Content-Security-Policy (style-src 'self'). */
.panel[data-node='welcome'] { --top: 33%; }
.panel[data-node='starters'], .panel[data-node='drinks'] { --top: 28%; }
.panel[data-node='steak'] { --top: 59%; }
.panel[data-node='burger'] { --top: 60.5%; --u: calc(var(--film-w) / 100 * .88); }
.panel[data-node='pizza'], .panel[data-node='dessert'] { --top: 55%; }
.panel[data-node='pasta'] { --top: 51.5%; }
.panel[data-node='end'] { --top: 30%; }
.reading .panel[data-node='burger'] { --u: 4px; }

/* Storefront accessibility: reading mode uses normal text sizes, independent of the cinematic page scale. */
.reading .desc, .reading .colophon, .reading .item { font-size: 1rem; line-height: 1.5; }
.reading .allergens, .reading .list .allergens { font-size: 1rem; line-height: 1.5; letter-spacing: .03em; }
.reading .price, .reading .list .price { font-size: 1.125rem; }
.reading .ink-button { font-size: 1rem; letter-spacing: .04em; }
.reading .eyebrow { font-size: .875rem; }