:root {
  --paper: #f3f0ea;
  --field: #e8e2d8;
  --field-2: #ddd5c8;
  --ink: #1d1a16;
  --muted: #5a5348;
  --accent: #b8124f;
  --accent-ink: #fff8f2;
  --stage: #26211c;

  --font: "Zilla Slab", Georgia, "Times New Roman", serif;
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.125rem, 1.05rem + 0.3vw, 1.3125rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
  --step-display: clamp(2.75rem, 0.6rem + 5.2vw, 6.25rem);

  --margin: clamp(16px, 2.2vw, 32px);
  --gap: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.025em; line-height: 1.02; margin: 0; text-wrap: balance; }
p { margin: 0; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--margin); top: 8px; z-index: 50; background: var(--ink); color: var(--paper); padding: 8px 14px; }
.noscript { padding: var(--margin); }

/* ---------- bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 14px var(--margin);
  background: var(--paper);
}
.wordmark { font-weight: 600; font-size: var(--step-lead); letter-spacing: -0.02em; text-decoration: none; white-space: nowrap; }
.bar nav { display: flex; gap: clamp(14px, 2vw, 32px); font-size: var(--step-body); }
.bar nav a { text-decoration: none; position: relative; padding: 4px 0; }
.bar nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease);
}
.bar nav a:hover::after, .bar nav a[aria-current="page"]::after { transform: scaleX(1); }

/* ---------- buttons, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 26px; border: 0; border-radius: 0;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 500;
  cursor: pointer; transition: transform .2s var(--ease), background .2s;
}
.btn:hover { background: #9c0e43; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--ink); color: var(--paper); }
.btn.ghost:hover { background: #3a342c; }

.search {
  display: flex; width: 100%; background: var(--paper);
}
.search input {
  flex: 1; min-width: 0; min-height: 56px; padding: 0 18px; border: 0; border-radius: 0;
  background: var(--paper); font-size: var(--step-lead);
}
.search input::placeholder { color: var(--muted); }
.search input:focus-visible { outline-offset: -3px; }

/* ---------- split stage ---------- */
.stage {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap);
  padding: 0 var(--gap) var(--gap);
  min-height: calc(100svh - 64px);
}
.stage > *, .recipe > *, .browse > *, .finder-grid > *, .frame-wrap > * { min-width: 0; }
.stage-photo {
  position: sticky; top: 64px; height: calc(100svh - 64px - var(--gap));
  background: var(--stage); overflow: hidden;
}
.stage-photo img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 80%;
  opacity: 0; transition: opacity 1.6s ease;
}
.stage-photo img.on { opacity: 1; }
.stage-photo .caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 20px 16px;
  background: linear-gradient(transparent, rgba(20,16,12,.72)); /* taste-skill-ignore: scrim under caption */
  color: #f5efe5; font-size: var(--step-small);
}

.card {
  background: var(--field);
  display: flex; flex-direction: column;
}
.band { display: flex; height: 56px; flex: none; }
.band span { flex: 1; background: var(--accent); }
.band span:nth-child(even) { background: transparent; }
.card-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: clamp(28px, 5vw, 72px); gap: 28px; }
.card h1 { font-size: var(--step-display); max-width: 9ch; }
.card .lead { font-size: var(--step-lead); max-width: 34ch; line-height: 1.4; }
.card .search { max-width: 560px; }
.card-links { display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: var(--step-body); }
.figures { display: flex; gap: clamp(20px, 4vw, 56px); flex-wrap: wrap; }
.figures div { display: flex; flex-direction: column; }
.figures b { font-size: var(--step-head); font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.figures span { font-size: var(--step-body); color: var(--muted); }

/* ---------- sections ---------- */
.section { padding: clamp(96px, 12vw, 200px) var(--margin) 0; }
.section h2 { font-size: var(--step-head); margin-bottom: 40px; max-width: 18ch; }
.section .intro { max-width: 46ch; color: var(--ink); margin-bottom: 48px; }

/* category list with sticky page */
.catlist { display: grid; grid-template-columns: 5fr 1fr 6fr; align-items: start; }
.catlist-photo { grid-column: 1; position: sticky; top: 12vh; aspect-ratio: 4/5; background: var(--stage); overflow: hidden; }
.catlist-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; opacity: 0; transition: opacity .3s; }
.catlist-photo img.on { opacity: 1; }
.catlist-list { grid-column: 3; list-style: none; margin: 0; padding: 0; }
.catlist-list li a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 14px 0; text-decoration: none; font-size: clamp(1.375rem, 1rem + 1.2vw, 2rem); font-weight: 500;
  color: var(--muted); transition: color .25s, transform .25s var(--ease);
}
.catlist-list li a span { font-size: var(--step-body); font-weight: 400; font-variant-numeric: tabular-nums; }
.catlist-list li a:hover, .catlist-list li a:focus-visible, .catlist-list li.on a { color: var(--ink); transform: translateX(10px); }
.catlist-list li.on a span { color: var(--accent); }
.catlist-list .sub { display: block; font-size: var(--step-body); font-weight: 400; color: var(--muted); padding: 0 0 12px; max-width: 40ch; }

/* ingredient finder: full width field */
.finder { margin-top: clamp(96px, 12vw, 200px); background: var(--ink); color: var(--paper); padding: clamp(64px, 8vw, 120px) var(--margin); }
.finder h2 { font-size: var(--step-head); margin-bottom: 20px; max-width: 16ch; }
.finder .intro { max-width: 52ch; margin-bottom: 40px; color: #d9d0c1; }
.finder-grid { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(32px, 5vw, 80px); align-items: start; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; text-decoration: none;
  border: 0; border-radius: 999px; padding: 8px 16px; min-height: 44px; cursor: pointer;
  background: #3a332b; color: var(--paper); font-size: var(--step-body);
  transition: background .2s, transform .15s var(--ease);
}
.chip:hover { background: #4b4237; }
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.chip small { opacity: .7; font-size: var(--step-small); margin-left: 4px; }
.light .chip { background: var(--field); color: var(--ink); }
.light .chip:hover { background: var(--field-2); }
.light .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.finder-results h3 { font-size: var(--step-lead); font-weight: 500; letter-spacing: -0.01em; margin-bottom: 16px; }
.finder-results ol { list-style: none; margin: 0; padding: 0; columns: 2 260px; column-gap: 32px; }
.finder-results li { break-inside: avoid; padding: 6px 0; }
.finder-results a { text-decoration: none; }
.finder-results a:hover { color: #ff9cc1; text-decoration: underline; }
.finder-results .meta { display: block; font-size: var(--step-small); color: #b9ae9c; }
.finder .search { margin-bottom: 16px; }
.finder .search input { background: #3a332b; color: var(--paper); font-size: var(--step-body); }
.finder .search input::placeholder { color: #b9ae9c; }

/* gallery: one frame */
.frame-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 5vw, 80px); align-items: center; }
.frame { position: relative; aspect-ratio: 4/5; width: min(100%, 36vw); background: var(--stage); overflow: hidden; cursor: pointer; justify-self: end; }
.frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s; }
.frame img.on { opacity: 1; }
.frame-text p + p { margin-top: 1em; }
.frame-text .cap { font-size: var(--step-lead); font-style: italic; margin-top: 24px; min-height: 3em; }

/* letter */
.letter { max-width: 620px; margin: 0 auto; padding: clamp(96px, 12vw, 200px) var(--margin) 0; }
.letter h2 { font-size: var(--step-head); margin-bottom: 32px; }
.letter p { margin-bottom: 1em; }
.letter .sign { font-style: italic; font-size: var(--step-lead); }

/* footer */
.foot { display: grid; grid-template-columns: 1fr 1fr; min-height: 90svh; margin-top: clamp(96px, 12vw, 200px); }
.foot-photo { position: relative; overflow: hidden; background: var(--stage); }
.foot-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; transform: scale(1.25); transform-origin: 30% 40%; }
.foot-menu { background: var(--accent); color: var(--accent-ink); padding: 80px clamp(32px, 6vw, 96px) 32px; display: flex; flex-direction: column; }
.foot-menu .wordmark { font-size: var(--step-body); margin-bottom: 40px; }
.foot-menu ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.foot-menu ul a { font-size: clamp(2rem, 1rem + 2.6vw, 3.25rem); font-weight: 600; letter-spacing: -0.025em; text-decoration: none; display: inline-block; transition: transform .25s var(--ease), opacity .25s; }
.foot-menu ul:hover a { opacity: .6; }
.foot-menu ul a:hover { opacity: 1; transform: translateX(12px); }
.foot-menu .legal { margin-top: auto; padding-top: 64px; font-size: var(--step-small); }

/* ---------- browse view ---------- */
.browse { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: clamp(32px, 4vw, 64px); padding: 32px var(--margin) 0; align-items: start; }
.browse-side { position: sticky; top: 80px; max-height: calc(100svh - 96px); overflow: auto; padding-right: 8px; overscroll-behavior: contain; }
.browse-side h2 { font-size: var(--step-lead); letter-spacing: -0.01em; margin: 28px 0 12px; }
.browse-side h2:first-child { margin-top: 0; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree a { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; text-decoration: none; transition: background .2s; }
.tree a:hover { background: var(--field); }
.tree a[aria-current="true"] { background: var(--ink); color: var(--paper); }
.tree a span { color: var(--muted); font-variant-numeric: tabular-nums; }
.tree a[aria-current="true"] span { color: #cfc5b4; }
.tree .tree { padding-left: 16px; }
.browse-main h1 { font-size: var(--step-head); margin-bottom: 16px; }
.browse-main .count { color: var(--muted); margin-bottom: 24px; }
.browse-main .search { background: var(--field); margin-bottom: 32px; }
.browse-main .search input { background: var(--field); }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -12px 0 28px; }
.side-search { width: 100%; min-height: 44px; padding: 0 12px; border: 0; background: var(--field); margin-bottom: 12px; font-size: var(--step-body); }

.results { list-style: none; margin: 0; padding: 0; }
.results > li > a {
  display: grid; border-radius: 0; grid-template-columns: 1fr auto; gap: 4px 24px; padding: 22px 0; text-decoration: none;
  transition: transform .25s var(--ease);
}
.results > li > a:hover { transform: translateX(8px); }
.results > li > a:hover .t { color: var(--accent); }
.results .t { font-size: var(--step-lead); font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; transition: color .2s; }
.results .p { color: var(--muted); font-size: var(--step-body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.results .i { grid-column: 1 / -1; color: var(--muted); font-size: var(--step-body); max-width: 75ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.results mark { background: #f6c7d8; color: inherit; }
.results .group { font-size: var(--step-head); padding: 48px 0 8px; }
.empty { padding: 48px 0; font-size: var(--step-lead); max-width: 40ch; }
.more { margin: 32px 0; }
.filters-toggle { display: none; }

/* ---------- recipe view ---------- */
.recipe { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); padding: 0 var(--gap); }
.recipe-pages { position: sticky; top: 64px; height: calc(100svh - 64px - var(--gap)); background: var(--stage); overflow: auto; overscroll-behavior: contain; }
.recipe-pages img { width: 100%; height: auto; }
.recipe-pages figure { margin: 0; position: relative; }
.recipe-pages figcaption { position: sticky; bottom: 0; background: rgba(20,16,12,.8); color: #f5efe5; font-size: var(--step-small); padding: 8px 14px; }
.zoom { position: absolute; right: 12px; top: 12px; z-index: 2; background: var(--paper); border: 0; min-height: 44px; padding: 0 14px; cursor: pointer; }
.recipe-text { padding: clamp(28px, 5vw, 72px) clamp(20px, 5vw, 72px) 96px; max-width: 760px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: var(--step-body); color: var(--muted); margin-bottom: 24px; }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.recipe-text h1 { font-size: var(--step-head); color: var(--accent); margin-bottom: 16px; }
.recipe-text .serves { color: var(--muted); margin-bottom: 48px; }
.recipe-text h2 { font-size: var(--step-lead); letter-spacing: -0.01em; margin: 48px 0 16px; }
.ing { list-style: none; margin: 0; padding: 0; }
.ing li { display: flex; gap: 14px; align-items: flex-start; padding: 7px 0; cursor: pointer; }
.ing input { flex: none; width: 22px; height: 22px; margin: 4px 0 0; accent-color: var(--accent); cursor: pointer; }
.ing li.done label { text-decoration: line-through; color: var(--muted); }
.steps h3 { font-size: var(--step-body); font-weight: 600; letter-spacing: 0; margin: 28px 0 8px; color: var(--accent); }
.cat-intro { max-width: 62ch; margin-bottom: 28px; font-style: italic; }
.steps p { margin-bottom: 1em; max-width: 62ch; hyphens: auto; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tags a { text-decoration: none; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-top: 72px; }
.pager a { display: block; background: var(--field); padding: 20px 22px; text-decoration: none; transition: background .2s, transform .2s var(--ease); }
.pager a:hover { background: var(--field-2); }
.pager a:active { transform: scale(.98); }
.pager a.next { text-align: right; }
.pager small { display: block; color: var(--muted); font-size: var(--step-small); }
.pager b { font-weight: 600; font-size: var(--step-body); }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(15,12,9,.94); overflow: auto; display: none; }
.lightbox.open { display: block; }
.lightbox img { width: min(1200px, 100%); margin: 0 auto; }
.lightbox button { position: fixed; top: 12px; right: 12px; min-height: 44px; padding: 0 16px; border: 0; background: var(--paper); cursor: pointer; }

/* ---------- reveal ---------- */
.rv { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: calc(var(--i, 0) * 75ms); }
.rv.in { opacity: 1; transform: none; }
.view-enter { animation: viewIn .5s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.kb { animation: kb 24s ease-in-out infinite alternate; }
@keyframes kb { from { transform: scale(1.02); } to { transform: scale(1.12) translate(-1.5%, -1.5%); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; transition: none; }
  .view-enter, .kb { animation: none; }
  .stage-photo img, .frame img, .catlist-photo img { transition: none; }
}

/* ---------- phone ---------- */
@media (max-width: 900px) {
  .bar { flex-wrap: wrap; gap: 6px 20px; padding: 10px var(--margin); position: static; }
  .bar nav { gap: 6px 18px; flex-wrap: wrap; }
  .stage, .recipe { grid-template-columns: 1fr; }
  .stage-photo { position: relative; top: 0; height: 30svh; order: -1; }
  .stage-photo .caption { display: none; }
  .catlist-list { max-width: 560px; }
  .card-body { padding: 28px 20px; gap: 20px; }
  .bar nav { font-size: 0.9375rem; gap: 14px; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .bar nav a { white-space: nowrap; }
  .wordmark { font-size: 1.25rem; }
  .search input { font-size: 1.0625rem; padding: 0 12px; }
  .search .btn { padding: 0 16px; }
  .stage .card { margin-top: -24px; position: relative; }
  .card h1 { font-size: clamp(2.75rem, 12vw, 4rem); }
  .band { height: 40px; }
  .catlist { grid-template-columns: 1fr; }
  .catlist-photo { display: none; }
  .catlist-list { grid-column: 1; }
  .finder-grid, .frame-wrap { grid-template-columns: 1fr; }
  .frame { width: 72vw; justify-self: center; }
  .foot { grid-template-columns: 1fr; min-height: 0; }
  .foot-photo { height: 50svh; }
  .foot-menu { padding: 48px var(--margin) 24px; }
  .browse { grid-template-columns: 1fr; padding-top: 16px; }
  .browse-side { position: static; max-height: none; overflow: visible; display: none; }
  .browse-side.open { display: block; }
  .filters-toggle { display: inline-flex; margin-bottom: 24px; }
  .recipe-pages { position: relative; top: 0; height: 70svh; order: 2; margin-bottom: 48px; }
  .recipe-text { padding: 32px 8px 72px; }
  .results .i { -webkit-line-clamp: 3; }
}
