:root {
  --bg: #fbf6ee;
  --bg-2: #f3eadb;
  --surface: #fffdf9;
  --ink: #2a1a14;
  --ink-2: #6b5548;
  --line: #e6d8c4;
  --accent: #7a1f26;
  --accent-ink: #fff7ef;
  --gold: #c8862e;
  --gold-soft: #f6e2bf;
  --ok: #4f7a3a;
  --board-1: #b98a5e;
  --board-2: #8f6440;
  --shadow: 0 1px 2px rgba(60, 30, 10, .06), 0 8px 30px rgba(60, 30, 10, .08);
  --radius: 18px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17100d; --bg-2: #201612; --surface: #231915; --ink: #f4e9dc; --ink-2: #bba795;
    --line: #3b2c24; --accent: #e07a6f; --accent-ink: #1b0f0c; --gold: #e2a04a; --gold-soft: #3a2a17;
    --ok: #8fbf6a; --board-1: #6e4c31; --board-2: #4c321f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17100d; --bg-2: #201612; --surface: #231915; --ink: #f4e9dc; --ink-2: #bba795;
  --line: #3b2c24; --accent: #e07a6f; --accent-ink: #1b0f0c; --gold: #e2a04a; --gold-soft: #3a2a17;
  --ok: #8fbf6a; --board-1: #6e4c31; --board-2: #4c321f;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.1; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); }
h3 { font-size: 1.2rem; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 600; color: var(--gold); margin: 0 0 .8rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid var(--accent); border-radius: 999px;
  padding: .8em 1.4em; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-small { padding: .45em 1em; font-size: .9rem; }
.iconbtn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; cursor: pointer;
}
.iconbtn svg { width: 18px; height: 18px; fill: var(--ink); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-weight: 600; font-size: 1.2rem; }
.brand svg { width: 28px; height: 28px; }
.topnav { display: flex; gap: 22px; margin-left: auto; }
.topnav a { color: var(--ink-2); text-decoration: none; font-size: .92rem; font-weight: 500; }
.topnav a:hover { color: var(--ink); }
.topactions { display: flex; gap: 10px; align-items: center; }
#cookModeToggle[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #2a1a14; }

/* Hero */
.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(24px, 5vw, 72px); align-items: center;
  max-width: 1240px; margin: 0 auto; padding: clamp(40px, 7vw, 96px) clamp(16px, 4vw, 48px) clamp(32px, 5vw, 64px);
}
.hero h1 { font-size: clamp(3rem, 8vw, 6.2rem); font-weight: 700; letter-spacing: -.035em; line-height: .95; }
.hero h1 em { font-style: italic; font-weight: 400; color: var(--accent); }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--ink-2); max-width: 36em; }
.meta { display: flex; flex-wrap: wrap; gap: 0; margin: 28px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.meta div { flex: 1 1 90px; padding: 12px 16px; border-right: 1px solid var(--line); }
.meta div:last-child { border-right: 0; }
.meta dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-2); }
.meta dd { margin: 2px 0 0; font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-art { margin: 0; position: relative; }
.hero-art::before {
  content: ""; position: absolute; inset: 6% 2% 14%; border-radius: 50%;
  background: radial-gradient(circle, var(--gold-soft), transparent 70%); z-index: -1;
}
.hero-art svg { width: 100%; height: auto; display: block; }
.hero-art figcaption { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; font-size: .82rem; color: var(--ink-2); margin-top: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: -1px; }

/* Recipe */
.recipe { max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px) 64px; }
.controls {
  position: sticky; top: 63px; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 20px; box-shadow: var(--shadow); margin-bottom: 36px;
}
.control { display: flex; align-items: center; gap: 12px; }
.control-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-2); font-weight: 600; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.stepper button { width: 36px; height: 34px; border: 0; background: transparent; cursor: pointer; font-size: 1.1rem; }
.stepper button:hover { background: var(--bg-2); }
.stepper output { min-width: 2.2em; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.segmented { display: flex; padding: 3px; background: var(--bg-2); border-radius: 999px; }
.segmented button { border: 0; background: transparent; padding: 5px 14px; border-radius: 999px; cursor: pointer; font-size: .9rem; color: var(--ink-2); }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.control-progress { flex: 1 1 240px; }
.progress { flex: 1; height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; min-width: 80px; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--accent)); border-radius: 99px; transition: width .4s ease; }
.progress-text { font-size: .85rem; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }

.recipe-grid { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: clamp(24px, 4vw, 56px); align-items: start; }

/* Ingredients */
.ingredients {
  position: sticky; top: 150px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 24px; max-height: calc(100vh - 170px); overflow: auto;
}
.note { font-size: .85rem; color: var(--ink-2); margin: -4px 0 16px; }
.ing-group { margin-bottom: 20px; }
.ing-group h3 { font-family: var(--sans); font-size: .74rem; text-transform: uppercase; letter-spacing: .14em; color: var(--gold); margin-bottom: 6px; font-weight: 600; }
.ing-group ul { list-style: none; margin: 0; padding: 0; }
.ing { border-bottom: 1px dashed var(--line); }
.ing:last-child { border-bottom: 0; }
.ing label { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; cursor: pointer; }
.ing input { position: absolute; opacity: 0; pointer-events: none; }
.check {
  flex: none; width: 18px; height: 18px; border: 1.5px solid var(--line); border-radius: 5px;
  transform: translateY(3px); display: grid; place-items: center; transition: background .15s, border-color .15s;
}
.check::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
input:checked + .check { background: var(--ok); border-color: var(--ok); }
input:checked + .check::after { opacity: 1; }
input:focus-visible + .check { outline: 3px solid var(--gold); outline-offset: 2px; }
.qty { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ing-name { flex: 1; }
.ing-name small { display: block; color: var(--ink-2); font-size: .82rem; }
.ing input:checked ~ .ing-name, .ing input:checked ~ .ing-name .qty { color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--ink-2); }

/* Method */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step {
  position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 0 20px;
  padding: 24px 0 28px; border-bottom: 1px solid var(--line);
}
.step:first-child { padding-top: 4px; }
.step-num {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.5rem; font-weight: 600;
  background: var(--gold-soft); color: var(--ink); border: 0; cursor: pointer; transition: background .2s, color .2s, transform .15s;
}
.step-num:hover { transform: scale(1.05); }
.step.done .step-num { background: var(--ok); color: #fff; }
.step.done .step-body > *:not(.step-actions) { opacity: .55; }
.step-phase { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--gold); font-weight: 600; margin: 4px 0 4px; }
.step h3 { font-size: 1.45rem; margin-bottom: .4em; }
.step p { margin: 0 0 .8em; }
.step .tipline { background: var(--bg-2); border-left: 3px solid var(--gold); padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: .93rem; color: var(--ink-2); }
.step-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 6px 14px; font-size: .88rem; font-weight: 500; cursor: pointer;
}
.chip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.chip:hover { border-color: var(--gold); }
.chip.running { background: var(--gold-soft); border-color: var(--gold); }
.chip-done { color: var(--ok); }
.step.done .chip-done { background: var(--ok); color: #fff; border-color: var(--ok); }

/* Timer dock */
.timer-dock { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 50; max-width: calc(100vw - 32px); }
.timer {
  display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--bg);
  padding: 12px 14px 12px 18px; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.3); min-width: 260px;
  animation: pop .25s ease;
}
.timer-time { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.timer-label { font-size: .8rem; opacity: .75; flex: 1; line-height: 1.3; }
.timer button { border: 0; background: rgba(255,255,255,.12); color: inherit; border-radius: 10px; padding: 6px 10px; cursor: pointer; font-size: .82rem; }
.timer.finished { background: var(--accent); color: var(--accent-ink); animation: pulse 1s ease-in-out infinite; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }
@keyframes pulse { 50% { transform: scale(1.03); } }

/* Bands & sections */
.band { background: var(--accent); color: var(--accent-ink); }
:root[data-theme="dark"] .band { background: #3a1416; color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .band { background: #3a1416; color: var(--ink); } }
.band .eyebrow { color: #f2c27d; }
.band-inner { max-width: 1240px; margin: 0 auto; padding: clamp(48px, 7vw, 88px) clamp(16px, 4vw, 48px); display: grid; grid-template-columns: 1fr 1.3fr; gap: clamp(24px, 5vw, 72px); }
.band-head p { opacity: .85; }
.planner-input { display: inline-flex; flex-direction: column; gap: 6px; margin-bottom: 24px; font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 600; }
.planner-input input {
  font: 600 2rem/1 var(--serif); padding: 10px 16px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: inherit; color-scheme: dark;
}
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 70px; top: 10px; bottom: 10px; width: 2px; background: rgba(255,255,255,.2); }
.timeline li { display: grid; grid-template-columns: 70px 1fr; gap: 24px; padding: 8px 0; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 65px; top: 16px; width: 12px; height: 12px; border-radius: 50%; background: #f2c27d; }
.timeline li.serve::before { background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.25); }
.timeline time { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.timeline span { opacity: .9; }
.timeline small { display: block; opacity: .65; font-size: .82rem; }

.section { max-width: 1240px; margin: 0 auto; padding: clamp(48px, 7vw, 96px) clamp(16px, 4vw, 48px) 0; }
.section-head { max-width: 640px; margin-bottom: 32px; }
.section-head p:not(.eyebrow) { color: var(--ink-2); }

.doneness { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.done-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.done-card.rec { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.done-swatch { height: 92px; display: grid; place-items: center; }
.done-swatch span { width: 70%; height: 56px; border-radius: 50%; background: radial-gradient(ellipse, var(--c1) 0 45%, var(--c2) 80%, #6e2a22 100%); box-shadow: 0 0 0 7px #4a3324, 0 0 0 11px #d98c34; }
.done-body { padding: 18px 16px 16px; }
.done-body h3 { font-size: 1.1rem; margin-bottom: 8px; }
.done-body dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: .88rem; }
.done-body dt { color: var(--ink-2); }
.done-body dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; font-size: .65rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; background: var(--gold); color: #2a1a14; padding: 2px 8px; border-radius: 99px; margin-left: 4px; vertical-align: 2px; }

.sauce-grid { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: clamp(24px, 4vw, 56px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 3vw, 36px); }
.sauce-ing { list-style: none; margin: 0; padding: 0; }
.sauce-ing li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.sauce-ing li:last-child { border-bottom: 0; }
.sauce-steps { margin: 0; padding-left: 1.3em; }
.sauce-steps li { padding: 6px 0 6px 6px; }
.sauce-steps li::marker { font-family: var(--serif); font-weight: 600; color: var(--gold); }

.tips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.tip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.tip-num { font-family: var(--serif); font-size: 2rem; font-style: italic; color: var(--gold); }
.tip h3 { margin-top: 6px; }
.tip p { margin: 0; color: var(--ink-2); }

.faq { max-width: 820px; margin: 56px 0 0; }
.faq h3 { font-size: 1.5rem; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 16px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--serif); font-size: 1.4rem; line-height: 1; color: var(--gold); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 16px; color: var(--ink-2); }

.footer { text-align: center; padding: 64px 16px 48px; color: var(--ink-2); font-size: .9rem; }

/* Cook mode: bigger type, focus on method */
body.cook .hero, body.cook .band, body.cook .section, body.cook .footer { display: none; }
body.cook .recipe { padding-top: 24px; }
body.cook .step h3 { font-size: 1.9rem; }
body.cook .step p { font-size: 1.2rem; line-height: 1.7; }
body.cook .ing label { font-size: 1.08rem; }

/* Responsive */
@media (max-width: 1000px) {
  .doneness { grid-template-columns: repeat(3, 1fr); }
  .tips { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .topnav { display: none; }
  .topactions { margin-left: auto; }
  .hero { grid-template-columns: 1fr; padding-top: 32px; }
  .hero-art { max-width: 520px; margin: 0 auto; width: 100%; }
  .recipe-grid { grid-template-columns: 1fr; }
  .ingredients { position: static; max-height: none; }
  .band-inner { grid-template-columns: 1fr; }
  .sauce-grid { grid-template-columns: 1fr; }
  .controls { top: 63px; padding: 12px 14px; gap: 12px 18px; }
}
@media (max-width: 560px) {
  .doneness { grid-template-columns: repeat(2, 1fr); }
  .tips { grid-template-columns: 1fr; }
  .step { grid-template-columns: 44px 1fr; gap: 0 14px; }
  .step-num { width: 44px; height: 44px; font-size: 1.2rem; }
  .meta div { flex-basis: 33%; border-bottom: 1px solid var(--line); }
  .controls { position: static; }
  .control-progress { flex-basis: 100%; }
  .timer { min-width: 0; width: 100%; }
  .timeline::before { left: 58px; }
  .timeline li { grid-template-columns: 58px 1fr; gap: 20px; }
  .timeline li::before { left: 53px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Print */
@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #000; --ink-2: #444; --line: #ccc; }
  .topbar, .controls, .hero-art, .hero-cta, .band, .timer-dock, .step-actions, .footer, .faq, .skip, #doneness { display: none !important; }
  body { font-size: 11pt; }
  .hero { display: block; padding: 0 0 12pt; }
  .hero h1 { font-size: 32pt; }
  .meta { margin: 8pt 0; }
  .recipe { padding: 0; }
  .recipe-grid { grid-template-columns: 34% 1fr; gap: 18pt; }
  .ingredients { position: static; max-height: none; border: 0; padding: 0; }
  .check { display: none; }
  .step { padding: 8pt 0; break-inside: avoid; grid-template-columns: 30pt 1fr; }
  .step-num { width: 26pt; height: 26pt; font-size: 13pt; background: #eee !important; color: #000 !important; }
  .step.done .step-body > * { opacity: 1 !important; }
  .step h3 { font-size: 13pt; }
  .section { padding: 18pt 0 0; break-inside: avoid; }
  .tips { grid-template-columns: repeat(2, 1fr); gap: 8pt; }
  .tip { padding: 8pt; }
}
