/* ------------------------------------------------------------------ *
 * Kennard Cooks.
 *
 * The tokens at the top are themes/personal/theme.css, unchanged --
 * that file is the brand and this one is the site built on it. Change
 * a colour there and change it here; do not invent a second palette.
 *
 * Three breakpoints: 640 (phone to tablet), 1024 (sidebar appears),
 * 1440 (fourth column). Everything between is fluid.
 * ------------------------------------------------------------------ */

/* The Manrope @import used to live here. It was moved to a <link> in
   the head: an @import is a chained request, so the font CSS could not
   even be discovered until this file had arrived. */

:root {
  /* Brand palette */
  --kc-white:  #FFFFFF;
  --kc-mist:   #F4F6F9;
  --kc-cobalt: #2F5BD3;
  --kc-sky:    #9DB9E8;
  --kc-navy:   #13293D;
  --kc-slate:  #5D6B7A;
  --kc-line:   #E1E6EC;

  /* Semantic tokens */
  --bg: var(--kc-mist);
  --surface: var(--kc-white);
  --surface-2: #FAFBFD;
  --text: var(--kc-navy);
  --text-muted: var(--kc-slate);
  --primary: var(--kc-cobalt);
  --on-primary: #FFFFFF;
  --accent: #E7EEFB;
  --on-accent: #1E3F9A;
  --link: var(--kc-cobalt);
  --border: var(--kc-line);
  --rating: var(--kc-cobalt);
  --tip-bg: #E7EEFB;
  --note-bg: #EEF1F5;

  /* Measured, not estimated. --text-muted (#5D6B7A) is 5.4:1 on
     --surface, 5.0:1 on --bg and 4.7:1 on --accent; --primary is
     5.9:1 on white both ways round; --on-accent is 8.1:1 on --accent.
     In dark mode the muted pair is 6.8:1 and the link 6.8:1. All clear
     WCAG 2.2 AA at every size used here, including the 13px metadata,
     which is the tightest case. */
  --warn-bg: #FCECEC;
  --warn-text: #8A2020;
  --ok-bg: #E6F4EA;
  --ok-text: #1B5E28;

  --font-display: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --weight-display: 800;

  --radius-card: 16px;
  --radius-control: 10px;

  --shadow-1: 0 1px 2px rgba(19, 41, 61, .06), 0 1px 3px rgba(19, 41, 61, .04);
  --shadow-2: 0 4px 16px rgba(19, 41, 61, .08), 0 1px 3px rgba(19, 41, 61, .05);

  --container: 1280px;
  --container-wide: 1440px;
  --measure: 70ch;
  --header-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1C2A;
    --surface: #152838;
    --surface-2: #1A2E40;
    --text: #EEF2F7;
    --text-muted: #9AA8B6;
    --primary: #7FA2EC;
    --on-primary: #0E1C2A;
    --accent: #1D3552;
    --on-accent: #C9D8F5;
    --link: #9DB9E8;
    --border: #243A4E;
    --rating: #9DB9E8;
    --tip-bg: #1D3552;
    --note-bg: #1A2E40;
    --warn-bg: #3A1F21;
    --warn-text: #F3B9B9;
    --ok-bg: #16301F;
    --ok-text: #A8DDB5;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2: 0 4px 16px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --bg: #0E1C2A;
  --surface: #152838;
  --surface-2: #1A2E40;
  --text: #EEF2F7;
  --text-muted: #9AA8B6;
  --primary: #7FA2EC;
  --on-primary: #0E1C2A;
  --accent: #1D3552;
  --on-accent: #C9D8F5;
  --link: #9DB9E8;
  --border: #243A4E;
  --rating: #9DB9E8;
  --tip-bg: #1D3552;
  --note-bg: #1A2E40;
  --warn-bg: #3A1F21;
  --warn-text: #F3B9B9;
  --ok-bg: #16301F;
  --ok-text: #A8DDB5;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, .35);
}

/* ----------------------------- reset ------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  /* The page must never scroll sideways. Anything wide gets its own
     scroll container; this is the backstop that makes that a rule
     rather than an aspiration. */
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem); }
h2 { font-size: clamp(1.3rem, 1.1rem + .9vw, 1.75rem); }
h3 { font-size: 1.125rem; }

p { margin: 0 0 1em; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
/* Only for people who navigate by keyboard: a mouse click should not
   draw a ring, but a Tab must always be visible. */
:focus:not(:focus-visible) { outline: none; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--primary); color: var(--on-primary);
  padding: .75rem 1rem; border-radius: 0 0 var(--radius-control) 0;
}
.skip:focus { left: 0; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------------------------- layout ------------------------------ */

.wrap {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1rem;
}
@media (min-width: 640px)  { .wrap { padding-inline: 1.5rem; } }
@media (min-width: 1440px) { .wrap { max-width: var(--container-wide); padding-inline: 2rem; } }

main { display: block; min-height: 60vh; padding-block: 1.5rem 3rem; }
.measure { max-width: var(--measure); }
.stack > * + * { margin-top: 1rem; }

/* ---------------------------- header ------------------------------ */

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex; align-items: center; gap: .75rem;
  min-height: var(--header-h);
}

.brand { display: flex; align-items: center; flex: 0 1 auto; min-width: 0; margin-right: auto; }
.brand img, .brand svg { height: 26px; width: auto; max-width: 100%; display: block; }
@media (min-width: 640px) { .brand img, .brand svg { height: 30px; } }
/* The wordmark is a two-tone SVG, so there are two files rather than a
   filter: a hue-rotated logo is never the brand colour.

   These are img.logo-* and not .logo-*, because ".brand img" is
   specificity 0,1,1 and a bare class is 0,1,0 -- so the bare class
   lost, display:block won, and BOTH wordmarks rendered side by side.
   That is what pushed the header off the side of a 375px screen, and
   it downloaded two SVGs to show one. */
img.logo-dark { display: none; }
[data-theme="dark"] img.logo-light { display: none; }
[data-theme="dark"] img.logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img.logo-light { display: none; }
  :root:not([data-theme="light"]) img.logo-dark { display: block; }
}

.nav { display: none; gap: .25rem; align-items: center; }
@media (min-width: 1024px) { .nav { display: flex; } }
.nav a {
  padding: .5rem .7rem; border-radius: var(--radius-control);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.nav a:hover { background: var(--accent); color: var(--on-accent); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }

.header-actions { display: flex; align-items: center; gap: .25rem; flex: 0 0 auto; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  /* 44px is the smallest target that is reliably hittable with a
     thumb, and is the WCAG 2.2 AA minimum. */
  min-width: 44px; min-height: 44px;
  padding: .5rem; border: 0; border-radius: var(--radius-control);
  background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--accent); color: var(--on-accent); }
.icon-btn svg { width: 20px; height: 20px; }

@media (min-width: 1024px) { .menu-toggle { display: none; } }

.mobile-nav {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: .5rem 0 1rem;
}
.mobile-nav a {
  display: block; padding: .75rem 1rem; color: var(--text);
  text-decoration: none; font-weight: 600; border-radius: var(--radius-control);
}
.mobile-nav a:hover { background: var(--accent); }
@media (min-width: 1024px) { .mobile-nav { display: none !important; } }

/* --------------------------- buttons ------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .6rem 1.1rem;
  font: inherit; font-weight: 600; line-height: 1.2;
  border: 1px solid transparent; border-radius: var(--radius-control);
  background: var(--primary); color: var(--on-primary);
  text-decoration: none; cursor: pointer;
  transition: filter .15s ease;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--accent); color: var(--on-accent); }
.btn-sm { min-height: 36px; padding: .35rem .75rem; font-size: .875rem; }
.btn svg { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------------------------- cards ------------------------------- */

/* 1 / 2 / 3 / 4 across the three breakpoints. */
.grid {
  display: grid; gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1440px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column;
  transition: box-shadow .18s ease, transform .18s ease;
}
.card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.card:focus-within { box-shadow: var(--shadow-2); }

/* The whole card is one link: the <a> covers it, and everything else
   sits above only where it needs to be clickable itself. One link per
   card also means one tab stop, which is what a keyboard user wants. */
.card-link::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
}
.card-link { text-decoration: none; color: inherit; }
.card-link:hover { text-decoration: none; }
.card h2, .card h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.card-link:hover h2, .card-link:hover h3 { color: var(--link); }

.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--accent);
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* The branded stand-in for an entry with no photo. A flat colour reads
   as a broken image; the mark reads as deliberate. */
.thumb-empty {
  display: grid; place-items: center;
  width: 100%; height: 100%;
  background:
    radial-gradient(120% 120% at 70% 0%, var(--accent) 0%, var(--surface-2) 70%);
}
.thumb-empty svg { width: 38%; max-width: 92px; height: auto; opacity: .38; }

.card-body { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.card-meta { color: var(--text-muted); font-size: .8125rem; }
.card-foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }

/* --------------------------- ratings ------------------------------ */

.ratings { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .8125rem; }
.rating { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.rating-label { color: var(--text-muted); }
.rating-value { font-weight: 600; }
.stars { display: inline-flex; gap: 1px; color: var(--rating); }
.stars svg { width: 14px; height: 14px; }
.rating-empty { color: var(--text-muted); font-style: italic; }

.tried { display: inline-flex; align-items: center; gap: .3rem; color: var(--text-muted); font-size: .8125rem; }
.tried svg { width: 15px; height: 15px; }

/* ---------------------------- badges ------------------------------ */

.badges { display: flex; flex-wrap: wrap; gap: .3rem; }
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  font-size: .75rem; font-weight: 600; line-height: 1.5;
  border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
}
.badge-quiet { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge-draft { background: var(--warn-bg); color: var(--warn-text); }

/* ----------------------------- hero ------------------------------- */

.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  margin-bottom: 2.5rem;
}
.hero-media { aspect-ratio: 4 / 3; background: var(--accent); }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-body { padding: 1.25rem; }
.hero-body h2 { font-size: clamp(1.4rem, 1.1rem + 1.6vw, 2.25rem); margin-bottom: .35rem; }
.eyebrow {
  font-size: .75rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--primary); margin-bottom: .5rem;
}
.hero-summary { color: var(--text-muted); max-width: 60ch; }

@media (min-width: 1024px) {
  .hero { display: grid; grid-template-columns: 1.1fr 1fr; align-items: stretch; }
  .hero-media { aspect-ratio: auto; height: 100%; min-height: 340px; }
  .hero-body { padding: 2rem; align-self: center; }
}

/* --------------------------- home rows ---------------------------- */

.row-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem;
}
.row-head h2 { margin: 0; }
.row-head a {
  font-weight: 600; font-size: .9rem; white-space: nowrap;
  display: inline-flex; align-items: center; gap: .2rem;
  /* 24px+ of target without changing how it looks. */
  padding-block: .35rem;
}
.section { margin-bottom: 2.75rem; }

.tiles { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.5rem; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-1);
  color: var(--text);
}
.tile:hover { box-shadow: var(--shadow-2); text-decoration: none; }
.tile strong { font-family: var(--font-display); font-size: 1.35rem; display: block; }
.tile span { color: var(--text-muted); font-size: .875rem; }

/* -------------------------- browse page --------------------------- */

.browse-head { margin-bottom: 1.25rem; }
.browse-head h1 { margin-bottom: .25rem; }
.result-count { color: var(--text-muted); font-size: .9375rem; margin: 0; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin: 1rem 0 .75rem;
}
.toolbar .spacer { flex: 1; }

select, input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], textarea {
  font: inherit; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: .55rem .7rem;
  min-height: 44px;
  width: 100%;
  max-width: 100%;
}
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
.field .hint { color: var(--text-muted); font-size: .8125rem; margin: .3rem 0 0; }

/* Category tabs scroll sideways on a phone rather than wrapping into
   three ragged lines or forcing the page to scroll. */
.tabs {
  display: flex; gap: .4rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: .25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto;
  padding: .55rem .9rem;
  border-radius: var(--radius-control) var(--radius-control) 0 0;
  text-decoration: none; color: var(--text-muted); font-weight: 600; font-size: .9375rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }

.active-filters { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .5rem .3rem .7rem;
  background: var(--accent); color: var(--on-accent);
  border: 1px solid transparent; border-radius: 999px;
  font-size: .8125rem; font-weight: 600; text-decoration: none;
}
.chip:hover { text-decoration: none; filter: brightness(.96); }
.chip svg { width: 13px; height: 13px; }
.chip-clear { background: transparent; color: var(--text-muted); border-color: var(--border); }

.layout-filters { display: block; }
@media (min-width: 1024px) {
  .layout-filters { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 2rem; align-items: start; }
  .filters-panel { display: block !important; position: sticky; top: calc(var(--header-h) + 1rem); max-height: calc(100vh - var(--header-h) - 2rem); overflow-y: auto; }
  .filters-open { display: none; }
}

.filters-panel fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; }
.filters-panel legend {
  font-size: .75rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 0; margin-bottom: .5rem;
}
.filter-option {
  display: flex; align-items: center; gap: .55rem;
  padding: .3rem 0; font-size: .9375rem; font-weight: 400; margin: 0;
  cursor: pointer; min-height: 32px;
}
.filter-option input { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); flex: 0 0 auto; margin: 0; }
.filter-option .count { margin-left: auto; color: var(--text-muted); font-size: .8125rem; }

/* On a phone the filters are a bottom sheet: thumb-reachable, and it
   does not push the results off the screen while you choose. */
@media (max-width: 1023px) {
  .filters-panel {
    display: none;
    position: fixed; inset: auto 0 0 0; z-index: 60;
    max-height: 85vh; overflow-y: auto;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    padding: 1rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 32px rgba(19, 41, 61, .22);
    transform: translateY(100%);
    transition: transform .22s ease;
  }
  .filters-panel[data-open] { display: block; transform: translateY(0); }
  .sheet-grip {
    width: 40px; height: 4px; border-radius: 2px;
    background: var(--border); margin: 0 auto 1rem;
  }
  .sheet-actions {
    position: sticky; bottom: 0; background: var(--surface);
    padding-top: .75rem; margin-top: .5rem; border-top: 1px solid var(--border);
    display: flex; gap: .5rem;
  }
  .sheet-actions .btn { flex: 1; }
  .scrim {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(19, 41, 61, .45);
  }
}

.empty {
  text-align: center; padding: 3rem 1rem;
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius-card);
}
.empty h2 { margin-bottom: .5rem; }
.empty p { color: var(--text-muted); }

.load-more { display: flex; justify-content: center; margin-top: 2rem; }

/* Skeletons: same box as the card that replaces them, so nothing
   jumps when the real content lands. */
.skeleton { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.skeleton .sk-img { aspect-ratio: 4 / 3; }
.skeleton .sk-line { height: 12px; border-radius: 6px; margin: .6rem 1rem; }
.sk-img, .sk-line {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--accent) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* --------------------------- search ------------------------------- */

.searchbar { position: relative; max-width: 560px; }
.searchbar input { padding-left: 2.4rem; }
.searchbar .search-icon {
  position: absolute; left: .7rem; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-muted); pointer-events: none;
}
.typeahead {
  position: absolute; z-index: 40; inset: calc(100% + 4px) 0 auto 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-control); box-shadow: var(--shadow-2);
  max-height: 60vh; overflow-y: auto; padding: .25rem;
}
.typeahead a {
  display: flex; gap: .7rem; align-items: center;
  padding: .5rem; border-radius: 8px;
  text-decoration: none; color: var(--text);
}
.typeahead a:hover, .typeahead a[aria-selected="true"] { background: var(--accent); }
.typeahead img, .typeahead .ta-thumb {
  width: 48px; height: 36px; object-fit: cover; border-radius: 6px;
  background: var(--accent); flex: 0 0 auto;
}
.typeahead .ta-title { font-weight: 600; font-size: .9375rem; }
.typeahead .ta-meta { color: var(--text-muted); font-size: .8125rem; }
mark { background: var(--accent); color: var(--on-accent); padding: 0 .1em; border-radius: 3px; }

/* -------------------------- recipe page --------------------------- */

.breadcrumb { font-size: .8125rem; color: var(--text-muted); margin-bottom: 1rem; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: 0; margin: 0; }
.breadcrumb a { display: inline-block; padding-block: .3rem; }
.breadcrumb li::after { content: "›"; margin-left: .35rem; color: var(--border); }
.breadcrumb li:last-child::after { content: ""; }

.recipe-hero {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-card); overflow: hidden;
  background: var(--accent); margin-bottom: 1.25rem;
}
@media (min-width: 640px) { .recipe-hero { aspect-ratio: 16 / 9; } }
.recipe-hero img { width: 100%; height: 100%; object-fit: cover; }

.recipe-title { margin-bottom: .35rem; }
.recipe-summary { font-size: 1.0625rem; color: var(--text-muted); max-width: var(--measure); }

.signal-row {
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center;
  padding: .9rem 0; margin: 1rem 0;
  border-block: 1px solid var(--border);
}

.stats { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; margin: 0 0 1.25rem; padding: 0; }
.stats div { min-width: 0; }
.stats dt { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.stats dd { margin: 0; font-weight: 600; }

.recipe-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }

.intro { max-width: var(--measure); }

.video-wrap, .lite-yt {
  position: relative; aspect-ratio: 16 / 9;
  border-radius: var(--radius-card); overflow: hidden;
  background: #000; margin: 1.5rem 0;
}
.video-wrap iframe, .lite-yt iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}

/* The poster sits under a play button until someone asks for the
   player. Until then this costs one image instead of a megabyte of
   YouTube. */
.lite-yt img { width: 100%; height: 100%; object-fit: cover; }
.lite-yt-play {
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-items: center;
  width: 100%; height: 100%;
  border: 0; background: transparent; cursor: pointer;
}
.lite-yt-play svg { width: 68px; height: 48px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)); }
.lite-yt-play .lite-yt-bg { fill: #212121; fill-opacity: .8; transition: fill .15s ease, fill-opacity .15s ease; }
.lite-yt-play:hover .lite-yt-bg, .lite-yt-play:focus-visible .lite-yt-bg { fill: #f00; fill-opacity: 1; }
.lite-yt noscript { position: absolute; inset: auto 0 1rem 0; text-align: center; z-index: 2; }

/* On a card: the photo of the food stays, and this says there is also
   a video. */
.play-badge {
  position: absolute; left: .6rem; bottom: .6rem; z-index: 1;
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .5rem .2rem .4rem;
  border-radius: 999px;
  background: rgba(19, 41, 61, .78); color: #fff;
  font-size: .75rem; font-weight: 600; line-height: 1.5;
  backdrop-filter: blur(4px);
}
.play-badge svg { width: 14px; height: 14px; }

/* Ingredients above method on a phone, beside it from 1024 where there
   is room for both without either becoming a column of one word. */
.recipe-grid { display: block; }
@media (min-width: 1024px) {
  .recipe-grid {
    display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 2.5rem; align-items: start;
  }
  .ingredients-panel {
    position: sticky; top: calc(var(--header-h) + 1rem);
    max-height: calc(100vh - var(--header-h) - 2rem);
    overflow-y: auto;
  }
}

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 1.25rem;
}
.panel h2 { font-size: 1.125rem; }

.scaler { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-control); }
.stepper button {
  min-width: 40px; min-height: 40px; border: 0; background: transparent;
  color: var(--text); font-size: 1.1rem; cursor: pointer; border-radius: inherit;
}
.stepper button:hover { background: var(--accent); }
.stepper output { min-width: 2.5rem; text-align: center; font-weight: 600; }

.toggle-group { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-control); overflow: hidden; }
.toggle-group button {
  min-height: 40px; padding: .35rem .75rem; border: 0;
  background: transparent; color: var(--text-muted);
  font: inherit; font-weight: 600; font-size: .875rem; cursor: pointer;
}
.toggle-group button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }

.ingredients { list-style: none; padding: 0; margin: 0; }
.ingredients li { border-top: 1px solid var(--border); }
.ingredients li:first-child { border-top: 0; }
.ingredients label {
  display: flex; gap: .7rem; align-items: baseline;
  padding: .6rem 0; margin: 0; font-weight: 400; font-size: .9375rem;
  cursor: pointer; min-height: 40px;
}
.ingredients input { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); flex: 0 0 auto; position: relative; top: 2px; }
.ingredients input:checked + .ing-text { color: var(--text-muted); text-decoration: line-through; }
.ing-amount { font-weight: 600; font-variant-numeric: tabular-nums; }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.5rem 3rem;
  max-width: var(--measure);
}
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 2rem; height: 2rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  font-family: var(--font-display); font-weight: 800; font-size: .875rem;
}
.step-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .25rem; }
.step-type { font-size: .75rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--primary); }
.step-meta { font-size: .8125rem; color: var(--text-muted); }
.step-do { margin: 0; }

.timer {
  display: inline-flex; align-items: center; gap: .4rem;
  margin-top: .5rem; padding: .3rem .7rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.timer:hover { background: var(--accent); }
.timer[data-running] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.timer svg { width: 14px; height: 14px; }

.callout {
  border-left: 3px solid var(--primary);
  background: var(--tip-bg);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  padding: .9rem 1rem; margin: 1.25rem 0;
  max-width: var(--measure);
}
.callout-warning { border-left-color: var(--warn-text); background: var(--warn-bg); }
.callout-type { font-size: .75rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; margin-bottom: .25rem; }
.callout p { margin: 0; }

/* Cook mode: bigger type, more room, and the screen stays awake. */
body[data-cook] { font-size: 19px; }
body[data-cook] .site-header, body[data-cook] .site-footer,
body[data-cook] .related, body[data-cook] .comments-section,
body[data-cook] .recipe-hero, body[data-cook] .breadcrumb { display: none; }
body[data-cook] .steps > li { padding-bottom: 2rem; }
body[data-cook] .ingredients label { font-size: 1.05rem; padding: .8rem 0; }
.cook-exit { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; box-shadow: var(--shadow-2); }

/* -------------------------- interactions -------------------------- */

.rate-widget { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.star-input { display: inline-flex; gap: .15rem; }
.star-input button {
  border: 0; background: transparent; cursor: pointer;
  padding: .2rem; min-width: 36px; min-height: 36px;
  color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center;
}
.star-input button[data-on] { color: var(--rating); }
.star-input button svg { width: 24px; height: 24px; }

.comments-section { margin-top: 3rem; max-width: var(--measure); }
.comment { padding: 1rem 0; border-top: 1px solid var(--border); }
.comment-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; font-size: .875rem; }
.comment-author { font-weight: 700; }
.comment-date { color: var(--text-muted); }
.comment p { margin: .35rem 0 0; }
.comment-hidden { opacity: .6; }

.related { margin-top: 3rem; }
.related .grid { gap: 1rem; }

.notice {
  padding: .8rem 1rem; border-radius: var(--radius-control);
  background: var(--accent); color: var(--on-accent);
  margin-bottom: 1rem;
}
.notice-warn { background: var(--warn-bg); color: var(--warn-text); }
.notice-ok { background: var(--ok-bg); color: var(--ok-text); }

/* ---------------------------- footer ------------------------------ */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-block: 2.5rem 2rem;
  margin-top: 4rem;
}
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1.5fr 1fr; align-items: start; } }
.footer-brand img, .footer-brand svg { height: 28px; width: auto; }
.footer-tagline { color: var(--text-muted); max-width: 40ch; margin: .75rem 0 1rem; }
.social { display: flex; gap: .35rem; flex-wrap: wrap; }
.social a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-control);
  color: var(--text-muted); border: 1px solid var(--border);
}
.social a:hover { color: var(--on-accent); background: var(--accent); border-color: transparent; }
.social svg { width: 20px; height: 20px; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: .1rem; }
.footer-links a {
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .9375rem;
  display: inline-block; padding-block: .4rem;
}
.footer-links a:hover { color: var(--link); text-decoration: underline; }
.footer-legal {
  margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: .8125rem;
}

/* ---------------------------- /links ------------------------------ */

.linktree { max-width: 520px; margin-inline: auto; text-align: center; padding-block: 2rem; }
.linktree .avatar {
  width: 96px; height: 96px; border-radius: 50%;
  margin: 0 auto 1rem; object-fit: cover;
  border: 3px solid var(--surface); box-shadow: var(--shadow-2);
}
.linktree .social { justify-content: center; margin: 1.25rem 0 2rem; }
.link-list { display: grid; gap: .75rem; }
.link-btn {
  display: flex; align-items: center; gap: .9rem;
  padding: .9rem 1rem; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-1);
  color: var(--text); text-decoration: none; min-height: 60px;
}
.link-btn:hover { box-shadow: var(--shadow-2); text-decoration: none; transform: translateY(-1px); }
.link-btn img, .link-btn .link-thumb {
  width: 56px; height: 42px; border-radius: 8px; object-fit: cover;
  background: var(--accent); flex: 0 0 auto;
}
.link-btn strong { display: block; font-size: .9375rem; }
.link-btn span { color: var(--text-muted); font-size: .8125rem; }

/* ----------------------------- about ------------------------------ */

.about-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .about-grid { grid-template-columns: 240px minmax(0, 1fr); align-items: start; } }
.about-photo { border-radius: var(--radius-card); box-shadow: var(--shadow-1); width: 100%; }

/* ----------------------------- forms ------------------------------ */

.form-card {
  max-width: 460px; margin-inline: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 1.75rem; box-shadow: var(--shadow-1);
}
.form-card h1 { font-size: 1.5rem; }
.form-wide { max-width: 640px; }
.form-foot { margin-top: 1.25rem; font-size: .875rem; color: var(--text-muted); text-align: center; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--text-muted); font-size: .8125rem; margin: 1.25rem 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }

/* --------------------------- long tables -------------------------- */

/* Anything that cannot be made narrow scrolls inside itself. The page
   still does not scroll sideways. */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.scroll-x table { min-width: 560px; border-collapse: collapse; width: 100%; }
.scroll-x th, .scroll-x td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); font-size: .9375rem; }
.scroll-x th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }

/* ----------------------------- print ------------------------------ */

@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --text-muted: #444; --border: #bbb; }
  .site-header, .site-footer, .recipe-actions, .comments-section,
  .related, .rate-widget, .breadcrumb, .timer, .scaler .toggle-group,
  .skip, .cook-exit, .video-wrap { display: none !important; }
  body { font-size: 11pt; background: #fff; }
  main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .recipe-grid { display: block; }
  .panel { border: 0; padding: 0; }
  .recipe-hero { max-height: 6cm; }
  .steps > li { break-inside: avoid; page-break-inside: avoid; }
  .ingredients { columns: 2; column-gap: 1.5cm; }
  a[href]::after { content: ""; }
}
