/* Design language: greige ground, square paper panels with a double red rule,
   display grotesk + old-style serif, tiny all-caps labels, near-black accent panels. */

@font-face { font-family: "Inter Tight"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/inter-tight-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter Tight"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/inter-tight-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/newsreader-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 400; font-style: italic; font-display: swap; src: url("fonts/newsreader-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/newsreader-600-normal.woff2") format("woff2"); }

:root {
  --ground: #bab8ad;
  --paper: #d6d3c8;
  --ink: #1c1c1a;
  --muted: #4a4843;
  --red: #a51d2a;
  --red-bright: #d2303f;
  --red-on-ink: #e0525f;
  --blue: #1f4fe0;
  --hl: #c7c4b8;
  --grotesk: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --tap: 2.75rem;
  color-scheme: light;
}

/* Language: both are in the markup, only the active one is shown. */
html[data-lang="de"] .l-en,
html[data-lang="en"] .l-de { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 1.125rem/1.5 var(--serif);
  -webkit-text-size-adjust: 100%;
}
main { max-width: 46rem; margin: 0 auto; padding: 0 1rem 4rem; }
h1, h2, h3 { font-family: var(--grotesk); font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; }
a { color: var(--red); }
button { font: inherit; color: inherit; cursor: pointer; border-radius: 0; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Tiny all-caps grotesk label, the reference's "ABOUT THE FUND". */
.facet legend, .facets summary, .facts dt, .chip span, .tags a, .badge, .timer,
.cook-toggle, .link-button, .lang-switch button, .brand, .count, .timebox, .section-head h2,
.steps > h2, .notes h2, .log h2, .ingredients h3, .result-count, .scaler > span, .meta {
  font-family: var(--grotesk); font-weight: 700; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .04em; line-height: 1.2;
}

/* Paper panel with the double red rule on top. */
.panel {
  position: relative; background: var(--paper);
  border-top: 3px solid var(--red-bright);
  padding: calc(1.25rem + 5px) 1.25rem 1.25rem;
}
.panel::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--red); }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 46rem; margin: 0 auto; padding: .75rem 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .6rem; min-height: var(--tap);
  color: var(--ink); text-decoration: none; font-size: .85rem;
}
.brand svg { width: 1.1rem; height: 1.1rem; }
.lang-switch { display: flex; }
.lang-switch button {
  min-height: var(--tap); min-width: var(--tap); padding: 0 .75rem;
  background: var(--paper); border: 1px solid var(--ink);
}
.lang-switch button + button { border-left: 0; }
html[data-lang="de"] [data-set-lang="de"],
html[data-lang="en"] [data-set-lang="en"] { background: var(--ink); color: var(--paper); }

/* Index: search + filters */
.filters { margin: .5rem 0 1rem; }
.search input {
  width: 100%; min-height: 3rem; padding: .6rem .9rem; font: 400 1.125rem var(--serif); color: var(--ink);
  background: var(--paper); border: 1px solid var(--ink); border-radius: 0;
}
.search input::placeholder { color: var(--muted); }
.facets { margin-top: .75rem; }
.facets summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; gap: .5rem; }
.count { background: var(--red); color: var(--paper); padding: .2rem .4rem; }
.facet { border: 0; padding: 0; margin: .75rem 0; }
.facet legend { color: var(--ink); margin-bottom: .4rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip input { position: absolute; opacity: 0; }
.chip span {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 .8rem;
  background: var(--paper); border: 1px solid var(--ink); cursor: pointer;
}
.chip input:checked + span { background: var(--red); border-color: var(--red); color: var(--paper); }
.chip input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.link-button { border: 0; background: none; padding: 0; min-height: var(--tap); text-decoration: underline; text-underline-offset: 3px; }
.result-count { color: var(--ink); margin: 1rem 0 .6rem; }

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
/* Grid items won't shrink below their longest word by default; long German compounds need to. */
.cards > li { min-width: 0; }
.card h2, .recipe-head h1 { overflow-wrap: break-word; }
/* Hyphenate only where columns are narrow; on wide screens it breaks words that would fit. */
@media (max-width: 40rem) { .card h2, .recipe-head h1 { hyphens: auto; } }
.card { display: flex; flex-direction: column; }
/* Column flex so the meta row (time, rating, tags) sits at the bottom of equal-height cards. */
.card a { display: flex; flex-direction: column; flex: 1; color: inherit; text-decoration: none; }
.card .meta { margin-top: auto; }
.card a:hover h2 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.card h2 { margin: .1rem 0 .5rem; font-size: 1.6rem; line-height: 1.05; letter-spacing: -0.02em; }
.card .desc { margin: 0 0 .9rem; font-size: 1.05rem; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; margin: 0; }
.timebox { background: var(--red); color: var(--paper); padding: .2rem .4rem; }
.empty { text-align: center; padding: 2rem 0; }

/* Recipe head */
.recipe-head h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.02; letter-spacing: -0.025em; margin: .75rem 0; }
.lede { font-size: 1.3rem; line-height: 1.35; margin: 0 0 1.25rem; }
.facts { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: .2rem 0 0; font: 600 1.15rem var(--grotesk); }
.tags { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.tags a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 .75rem;
  background: var(--paper); border: 1px solid var(--ink); color: var(--ink); text-decoration: none;
}
.cook-toggle {
  display: flex; align-items: center; justify-content: center; width: 100%; max-width: 22rem;
  min-height: 3rem; border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
}
.cook-toggle[aria-pressed="true"] { background: var(--red); border-color: var(--red); }

.recipe-body { display: grid; gap: 1rem; margin-top: 1.5rem; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.section-head h2, .steps > h2 { margin: 0; font-size: .85rem; }
.steps > h2 { min-height: var(--tap); display: flex; align-items: center; }

/* Ingredients */
.scaler { display: flex; align-items: center; gap: .4rem; }
.scaler button {
  width: var(--tap); height: var(--tap); border: 1px solid var(--ink); background: var(--paper);
  font: 600 1.2rem var(--grotesk); line-height: 1;
}
.scaler output { font: 600 1.15rem var(--grotesk); min-width: 1.5em; text-align: center; }
/* Sits under the list with its space reserved, so nothing moves when it appears. */
.scale-note { font-size: .95rem; font-style: italic; color: var(--muted); margin: .75rem 0 0; }
.scale-note.is-hidden { visibility: hidden; }
.ingredients h3 { margin: 1.1rem 0 .2rem; color: var(--muted); }
.ingredients ul { list-style: none; padding: 0; margin: .25rem 0; }
.ingredients li {
  display: grid; grid-template-columns: .55rem 4.5rem 1fr; gap: .1rem .7rem; align-items: baseline;
  padding: .45rem .3rem; border-bottom: 1px solid var(--hl);
}
.ingredients li::before {
  content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: var(--red);
  align-self: start; margin-top: .5em; grid-row: 1;
}
.ingredients .amt { font: 600 1rem var(--grotesk); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.ingredients .sub { grid-column: 3; font-size: .95rem; color: var(--muted); }
.ingredients .optional .name, .ingredients .taste { color: var(--muted); }
.ingredients li.hl { background: var(--hl); box-shadow: inset 3px 0 var(--red); }

/* Steps */
.steps ol { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.step {
  counter-increment: step; display: grid; grid-template-columns: var(--tap) 1fr; gap: .9rem;
  padding: 1.1rem 0; border-bottom: 1px solid var(--hl);
}
.step:last-child { border-bottom: 0; }
.step-done { position: relative; }
.step-done input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.step-done::before {
  content: counter(step); display: grid; place-items: center; width: var(--tap); height: var(--tap);
  background: var(--red); color: var(--paper); font: 700 1rem var(--grotesk);
}
.step-done:has(input:checked)::before { content: "✓"; background: var(--ink); color: var(--paper); }
.step-done:has(input:focus-visible)::before { outline: 2px solid var(--ink); outline-offset: 2px; }
.step:has(.step-done input:checked) .step-body { opacity: .55; }
.step h3 { margin: .2rem 0 .45rem; font-size: 1.2rem; }
.step p { margin: .35rem 0; }
.badges { display: flex; flex-wrap: wrap; gap: .4rem; }
.badge { display: inline-block; padding: .3rem .5rem; border: 1px solid var(--ink); }
.ing {
  position: relative; font-weight: 600; border-bottom: 1px solid var(--red); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* Amount popover above a step's ingredient (app.js). --dx nudges it back on screen. */
.amt-pop {
  --dx: 0px;
  position: absolute; bottom: calc(100% + .45rem); left: 50%; transform: translateX(calc(-50% + var(--dx)));
  z-index: 2; width: max-content; max-width: min(22rem, calc(100vw - 16px)); padding: .25rem .5rem;
  background: var(--ink); color: var(--paper); font: 600 .9rem/1.3 var(--grotesk);
  font-variant-numeric: tabular-nums; text-align: center; pointer-events: none;
}
.amt-pop::after {
  content: ""; position: absolute; top: 100%; left: 50%; margin-left: calc(-.35rem - var(--dx));
  border: .35rem solid transparent; border-top-color: var(--ink);
}
.ing.hl { background: var(--hl); }
.timer {
  display: inline-flex; align-items: center; gap: .5rem; margin-top: .6rem;
  min-height: var(--tap); padding: 0 1rem; border: 1px solid var(--ink); background: transparent;
  font-variant-numeric: tabular-nums;
}
.timer .timer-left { font-size: .95rem; }
.timer.running { background: var(--ink); color: var(--paper); }
.timer.done { background: var(--red); border-color: var(--red); color: var(--paper); animation: pulse 1s ease-in-out 3; }
@keyframes pulse { 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .timer.done { animation: none; } }

/* Notes: the near-black panel from the reference. */
.notes { margin-top: 1rem; background: var(--ink); color: var(--paper); padding: 1.25rem; }
.notes h2 { margin: 0 0 .5rem; color: var(--paper); }
.notes-body p { margin: .7rem 0; font-size: 1.1rem; line-height: 1.45; }
.notes :focus-visible { outline-color: var(--paper); }

.log { margin-top: 1.5rem; }
.log ul { list-style: none; padding: 0; margin: .5rem 0 0; }
.log li { padding: .4rem 0; display: flex; flex-wrap: wrap; gap: .3rem .8rem; }
.log time { font: 600 .95rem var(--grotesk); font-variant-numeric: tabular-nums; }
.stars { color: var(--ink); letter-spacing: .1em; }
.source { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--ink); font-size: 1rem; }
.source a { color: var(--ink); }

/* Cook mode: the steps become a dark panel (low glare), text grows.
   Only what sits below the toggle changes, so the button doesn't jump under the finger. */
body.cooking .steps, body.cooking .ingredients { font-size: 1.15em; }
body.cooking .log, body.cooking .source { display: none; }
body.cooking .steps { background: var(--ink); color: var(--paper); }
body.cooking .steps .step { border-color: #3a3935; }
body.cooking .steps .ing { border-color: var(--red-on-ink); }
body.cooking .steps .ing.hl { background: #3a3935; }
body.cooking .steps .badge, body.cooking .steps .timer { border-color: var(--paper); }
body.cooking .steps .timer.running { background: var(--paper); color: var(--ink); }
body.cooking .steps .step-done:has(input:checked)::before { background: var(--paper); color: var(--ink); }
body.cooking .steps :focus-visible,
body.cooking .steps .step-done:has(input:focus-visible)::before { outline-color: var(--paper); }

@media (min-width: 40rem) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 52rem) {
  main, .site-header { max-width: 72rem; }
  .cards { grid-template-columns: repeat(3, 1fr); }
  /* The sticky list's containing block is .recipe-body, so it can't slide over the notes below. */
  .recipe-body { grid-template-columns: 24rem 1fr; gap: 1.5rem; align-items: start; }
  .ingredients.fits { position: sticky; top: 1rem; }  /* only when it fits the screen, see app.js */
  .recipe-head, .notes { max-width: 52rem; }
}

/* display:flex drops the native disclosure triangle; draw a plus/minus instead. */
.facets summary { list-style: none; }
.facets summary::-webkit-details-marker { display: none; }
.facets summary::before { content: "+"; display: inline-grid; place-items: center; width: 1.1rem; height: 1.1rem; border: 1px solid var(--ink); font-size: .8rem; }
.facets[open] summary::before { content: "−"; }
