/* ---------- Fonts (self-hosted, SIL OFL) ---------- */
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-var.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-var-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-var.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --paper: #f8f1e7;
  --paper-2: #f1e6d6;
  --card: #fffcf7;
  --ink: #2a1f17;
  --ink-2: #5a4a3d;        /* 7.9:1 on paper */
  --muted: #6e5c4d;        /* 5.6:1 on paper */
  --accent: #a6461f;       /* terracotta, 5.6:1 on paper */
  --accent-ink: #fffaf3;
  --sage: #4d6346;
  --line: #e3d5c1;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(60, 35, 15, .06), 0 8px 24px -12px rgba(60, 35, 15, .18);
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --wrap: 1180px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 17px/1.65 var(--sans); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(circle at 15% -10%, #fbe3cc 0, transparent 45%),
                    radial-gradient(circle at 110% 10%, #e9eedc 0, transparent 40%);
  background-repeat: no-repeat;
}
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 12px; }
[hidden] { display: none !important; }

/* ---------- Header / footer ---------- */
.site-header, .site-footer, main { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(18px, 4vw, 40px); }
.site-header { padding-top: 22px; padding-bottom: 6px; }
.brand { font: 600 1.15rem/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: .01em; display: inline-flex; align-items: center; gap: .5em; }
.brand-mark { color: var(--accent); font-size: 1.1em; }
.site-footer { margin-top: 72px; padding-top: 28px; padding-bottom: 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }

/* ---------- Index ---------- */
.hero { padding: clamp(36px, 7vw, 84px) 0 28px; }
.eyebrow { margin: 0 0 10px; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--accent); }
.hero h1 { margin: 0; font: 500 clamp(3rem, 9vw, 6.2rem)/.95 var(--serif); letter-spacing: -.025em; font-variation-settings: "SOFT" 100, "opsz" 144; }
.lede { margin: 18px 0 0; font: italic 400 clamp(1.15rem, 2.2vw, 1.45rem)/1.4 var(--serif); color: var(--ink-2); max-width: 36ch; }

.tools { position: sticky; top: 0; z-index: 5; padding: 14px 0 16px; margin-bottom: 18px; transition: background .2s, box-shadow .2s; clip-path: inset(0 -100vmax -40px); }
.tools.is-stuck { background: color-mix(in srgb, var(--paper) 92%, transparent);
  box-shadow: 0 0 0 100vmax color-mix(in srgb, var(--paper) 92%, transparent), 0 10px 20px -18px rgba(60,35,15,.5);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.search { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 0 18px; box-shadow: var(--shadow); max-width: 560px; color: var(--muted); }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; border: 0; background: transparent; font: inherit; color: var(--ink); padding: 13px 0; min-width: 0; }
.search input:focus { outline: none; }
.search input::placeholder { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { font: 500 .88rem/1 var(--sans); padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.count { margin: 10px 0 0; font-size: .88rem; color: var(--muted); min-height: 1.2em; }
.count:empty { display: none; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; display: flex; flex-direction: column; overflow: hidden; }
.card::before { content: ""; height: 6px; background: hsl(calc(18 + var(--hue) * .12) 58% 52%); opacity: .85; }
.card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(60,35,15,.06), 0 18px 36px -16px rgba(60,35,15,.28); }
.card-link { display: block; padding: 22px 22px 10px; color: inherit; text-decoration: none; flex: 1; }
.card-link::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.card-link:focus-visible { outline: none; }
.card:has(.card-link:focus-visible) { outline: 3px solid var(--accent); outline-offset: 3px; }
.card-initial { float: right; margin: -4px 0 6px 12px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font: italic 500 1.5rem/1 var(--serif); color: hsl(calc(18 + var(--hue) * .12) 55% 32%); background: hsl(calc(18 + var(--hue) * .12) 60% 92%); }
.card-title { margin: 0 0 8px; font: 550 1.38rem/1.2 var(--serif); letter-spacing: -.01em; font-variation-settings: "opsz" 48; }
.card-desc { margin: 0 0 12px; color: var(--ink-2); font-size: .95rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; clear: both; }
.card-desc--ings { color: var(--muted); font-size: .9rem; }
.card-desc--ings::before { content: "With "; }
.card-meta { margin: 0; font-size: .8rem; color: var(--muted); letter-spacing: .02em; }
.card-tags { list-style: none; margin: 0; padding: 0 22px 20px; display: flex; flex-wrap: wrap; gap: 6px; position: relative; }
.card-tags li { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--sage); background: #e6ecdf; padding: 4px 9px; border-radius: 999px; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; font: italic 1.2rem var(--serif); }

/* ---------- Recipe page ---------- */
.crumbs { padding: 22px 0 0; font-size: .92rem; }
.crumbs a { text-decoration: none; color: var(--ink-2); }
.crumbs a:hover { color: var(--accent); }
.recipe-head { padding: clamp(20px, 4vw, 44px) 0 30px; border-bottom: 1px solid var(--line); margin-bottom: 36px; }
.recipe-head .card-tags { padding: 0 0 14px; }
.recipe-head h1 { margin: 0; font: 500 clamp(2.4rem, 6.5vw, 4.6rem)/1.02 var(--serif); letter-spacing: -.022em; max-width: 18ch; font-variation-settings: "SOFT" 100, "opsz" 144; text-wrap: balance; }
.recipe-notes { margin-top: 18px; max-width: 62ch; }
.recipe-notes p { margin: 0 0 6px; font: italic 400 1.2rem/1.5 var(--serif); color: var(--ink-2); }
.badges { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.badges li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; font-weight: 600; font-size: .95rem; }
.badges .k { display: block; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 22px; }
.sources { display: flex; align-items: baseline; gap: 8px; font-size: .92rem; color: var(--muted); }
.sources ul { list-style: none; margin: 0; padding: 0; display: inline-flex; flex-wrap: wrap; gap: 10px; }
.btn { font: 600 .9rem/1 var(--sans); background: var(--ink); color: var(--paper); border: 0; padding: 11px 18px; border-radius: 999px; cursor: pointer; }
.btn:hover { background: var(--accent); }

.recipe-body { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: clamp(28px, 5vw, 72px); align-items: start; }
.recipe-body:has(> :only-child) { grid-template-columns: minmax(0, 760px); }
.col-ingredients { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 26px 18px; box-shadow: var(--shadow); position: sticky; top: 18px; max-height: calc(100vh - 36px); overflow: auto; }
.section-title { margin: 0 0 14px; font: 550 1.6rem/1.2 var(--serif); letter-spacing: -.01em; }
.col-ingredients .section-title + .group-title { margin-top: 4px; }
.group-title { margin: 22px 0 8px; font: 600 .78rem/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.group-note { margin: 4px 0 0; font-size: .88rem; color: var(--muted); font-style: italic; }
.ingredients, .equipment { list-style: none; margin: 0; padding: 0; }
.ingredients li { border-bottom: 1px dashed var(--line); }
.ingredients li:last-child { border-bottom: 0; }
.ingredients label { display: flex; gap: 12px; padding: 8px 0; cursor: pointer; line-height: 1.45; font-size: .98rem; }
.ingredients input { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin-top: .15em; border: 1.5px solid #b59f88; border-radius: 5px; background: #fff; cursor: pointer; display: grid; place-items: center; }
.ingredients input:checked { background: var(--sage); border-color: var(--sage); }
.ingredients input:checked::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.ingredients input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(90,74,61,.5); }
.ingredients a { color: inherit; text-decoration-style: dotted; }
.equipment li { padding: 6px 0 6px 18px; position: relative; font-size: .96rem; }
.equipment li::before { content: "–"; position: absolute; left: 0; color: var(--accent); }
.col-ingredients .equipment { margin-bottom: 8px; }
.col-ingredients .section-title:not(:first-child) { margin-top: 28px; font-size: 1.3rem; }

.col-method { max-width: 70ch; }
.col-method > .group-title:first-of-type { margin-top: 0; }
.steps { list-style: none; counter-reset: step; margin: 0 0 8px; padding: 0; }
.steps li { counter-increment: step; position: relative; padding: 14px 12px 18px 64px; margin: 0 -12px; border-radius: 12px; cursor: pointer; transition: background .15s, opacity .15s; }
.steps li:hover { background: rgba(255, 252, 247, .8); }
.steps li::before { content: counter(step); position: absolute; left: 12px; top: 10px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font: 600 1.05rem/1 var(--serif); color: var(--accent); border: 1.5px solid currentColor; background: var(--paper); }
.steps li.done { opacity: .5; }
.steps li.done::before { content: "✓"; background: var(--sage); color: #fff; border-color: var(--sage); font-family: var(--sans); }
.callout { margin-top: 30px; background: #eef1e6; border-radius: var(--radius); padding: 20px 24px; border-left: 4px solid var(--sage); }
.callout h3 { margin: 0 0 8px; font: 600 .78rem/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--sage); }
.callout p { margin: 0 0 8px; }
.callout p:last-child { margin-bottom: 0; }
.callout ul { margin: 0; padding-left: 1.1em; }
.callout--tips { background: #fbeee2; border-left-color: var(--accent); }
.callout--tips h3 { color: var(--accent); }

.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); }
.pn { display: block; text-decoration: none; color: var(--ink); padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.pn:hover { border-color: var(--accent); }
.pn--next { text-align: right; }
.pn-label { display: block; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.pn-title { font: 550 1.15rem/1.3 var(--serif); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .recipe-body { grid-template-columns: 1fr; }
  .col-ingredients { position: static; max-height: none; }
}
@media (max-width: 700px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; margin-right: calc(-1 * clamp(18px, 4vw, 40px)); padding-right: 18px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .cards { grid-template-columns: 1fr; }
  .steps li { padding-left: 56px; }
  .prevnext { grid-template-columns: 1fr; }
  .pn--next { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Print ---------- */
@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff; color: #000; font-size: 11pt; line-height: 1.45; }
  .site-header, .site-footer, .crumbs, .prevnext, .btn, .tools, .skip, .card-tags { display: none !important; }
  main { max-width: none; padding: 0; }
  .recipe-head { padding: 0 0 10pt; margin-bottom: 14pt; border-color: #999; }
  .recipe-head h1 { font-size: 26pt; max-width: none; }
  .recipe-notes p { font-size: 11.5pt; color: #222; }
  .badges { margin-top: 8pt; } .badges li { border-color: #999; padding: 3pt 8pt; background: none; }
  .sources, .sources a { color: #333; }
  .sources a::after { content: " (" attr(href) ")"; font-size: 8.5pt; word-break: break-all; }
  .recipe-body { display: grid; grid-template-columns: 34% 1fr; gap: 18pt; }
  .col-ingredients { position: static; max-height: none; overflow: visible; box-shadow: none; border: 0; padding: 0; background: none; }
  .ingredients label { padding: 2pt 0; font-size: 10.5pt; }
  .ingredients input { width: 10pt; height: 10pt; border-color: #666; }
  .ingredients input:checked + span { text-decoration: none; color: #000; }
  .ingredients li { border: 0; break-inside: avoid; }
  .steps li { padding: 4pt 0 6pt 28pt; margin: 0; opacity: 1 !important; break-inside: avoid; }
  .steps li::before { width: 18pt; height: 18pt; top: 3pt; left: 0; font-size: 10pt; color: #000; border-color: #000; background: none !important; }
  .steps li.done::before { content: counter(step); color: #000; }
  .group-title, .callout h3 { color: #000; }
  .callout { background: none; border: 1px solid #999; border-left-width: 3pt; break-inside: avoid; padding: 8pt 12pt; }
  a { color: #000; text-decoration: none; }
  .ingredients a::after { content: none; }
}

/* ---------- Variant (size) switcher ---------- */
.vb:not(.vb-default) { display: none; }          /* no-JS / no-:has fallback: default variant only */
.switcher { border: 0; margin: 26px 0 0; padding: 0; min-width: 0; }
.switcher legend { padding: 0; margin-bottom: 8px; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.segs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; }
.seg { position: relative; cursor: pointer; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 9px 18px; border-radius: 999px; font: 600 .92rem/1 var(--sans); color: var(--ink-2); transition: background .15s, color .15s, box-shadow .15s; white-space: nowrap; }
.seg:hover span { color: var(--accent); }
.seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(60,35,15,.12), 0 4px 10px -6px rgba(60,35,15,.35); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.has-variants .vb { animation: vb-in .35s ease; }
@keyframes vb-in { from { background-color: #f6dcc8; } to { background-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .has-variants .vb { animation: none; } }
@media (max-width: 520px) {
  .segs { display: flex; flex-wrap: nowrap; border-radius: 16px; }
  .seg { flex: 1; }
  .seg span { padding: 10px 6px; text-align: center; font-size: .86rem; border-radius: 12px; }
}
@media print {
  .switcher legend { display: inline; font-size: 9pt; color: #000; margin-right: 6pt; }
  .segs { display: inline; background: none; border: 0; padding: 0; }
  .seg:not(:has(input:checked)) { display: none; }
  .seg input:checked + span { display: inline; box-shadow: none; padding: 0; background: none; font-size: 11pt; }
  .switcher { margin-top: 8pt; }
  .has-variants .vb { animation: none; }
}
