/* CookSimple. One stylesheet, no web fonts, mobile first. */

:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f2eee6;
  --text: #1c1a17;
  --muted: #625c53;
  --line: #e2dbcf;
  --accent: #1f6b4f;
  --accent-strong: #185740;
  --accent-ink: #ffffff;
  --accent-soft: #e2efe8;
  --warn: #9a3412;
  --warn-soft: #fdf0e6;
  --danger: #b42318;
  --focus: #1d4ed8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 26, 23, 0.06), 0 4px 16px rgba(28, 26, 23, 0.06);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --wrap: 1180px;
  --gutter: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --surface: #1f1e1b;
    --surface-2: #292724;
    --text: #efebe4;
    --muted: #b3aca1;
    --line: #3a3733;
    --accent: #5cc392;
    --accent-strong: #7fd4aa;
    --accent-ink: #0f1f18;
    --accent-soft: #1d3329;
    --warn: #f3a46b;
    --warn-soft: #33241a;
    --danger: #ff8a7f;
    --focus: #93b4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--font);
  overflow-wrap: break-word;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--accent-strong);
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.9rem, 1.4rem + 2.4vw, 2.8rem);
}

h2 {
  font-size: clamp(1.35rem, 1.2rem + 0.7vw, 1.7rem);
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0 0 1em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

main:focus {
  outline: none;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  z-index: 100;
}

.skip-link:focus {
  top: 8px;
}

.muted {
  color: var(--muted);
}

/* Things that only work with JavaScript stay hidden without it. */
html:not(.js) .needs-js {
  display: none !important;
}

/* US / metric: both versions are in the HTML, CSS shows one. */
.u-metric {
  display: none;
}

html[data-units='metric'] .u-us {
  display: none;
}

html[data-units='metric'] .u-metric {
  display: inline;
}

.print-only {
  display: none;
}

/* ---------- Header and footer ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  min-height: 60px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.logo .logo-bg {
  fill: var(--accent);
}

.logo .logo-fg {
  fill: var(--accent-ink);
}

.logo .logo-steam {
  stroke: var(--accent-ink);
}

.main-nav ul {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-weight: 550;
  font-size: 0.95rem;
}

.main-nav a:hover {
  background: var(--surface-2);
}

.main-nav a[aria-current='page'] {
  color: var(--accent);
}

.nav-short {
  display: none;
}

.nav-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

@media (max-width: 560px) {
  .header-row {
    padding-bottom: 4px;
  }

  .main-nav {
    width: 100%;
  }

  .main-nav ul {
    justify-content: space-between;
    margin: 0 -10px;
  }

  .main-nav a {
    font-size: 0.92rem;
  }
}

@media (max-width: 760px) {
  .nav-long {
    display: none;
  }

  .nav-short {
    display: inline;
  }

  .main-nav a {
    padding: 0 7px;
  }
}

.site-footer {
  margin-top: 56px;
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 0.95rem;
}

.footer-row {
  display: grid;
  gap: 12px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--text);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-block;
  padding: 6px 0;
}

.footer-note {
  margin: 0;
}

/* ---------- Buttons and form controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.97rem;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.btn:hover {
  border-color: var(--muted);
  color: var(--text);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}

.btn-danger {
  color: var(--danger);
}

.link-btn {
  min-height: 36px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

input[type='search'],
input[type='text'],
input[type='number'],
input:not([type]),
select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

input:focus-visible,
select:focus-visible {
  border-color: var(--focus);
}

.search-row {
  display: flex;
  gap: 8px;
}

.search-row input {
  flex: 1;
  min-width: 0;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 650;
}

.field-error {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.hint {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.notice {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
}

/* Segmented radio controls (servings, units). */
.seg {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.seg legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.seg-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.seg-row input[type='radio'] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.seg-row input[type='radio'] + label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.seg-row input[type='radio'] + label.is-base {
  border-style: dashed;
}

.seg-row input[type='radio']:checked + label {
  background: var(--accent);
  border-color: var(--accent);
  border-style: solid;
  color: var(--accent-ink);
}

.seg-row input[type='radio']:focus-visible + label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.srv-custom input {
  width: 5.2em;
  border-radius: 999px;
  text-align: center;
}

.srv-custom input[aria-invalid='true'] {
  border-color: var(--danger);
}

/* ---------- Home ---------- */

.hero {
  padding: 40px 0 28px;
  background: linear-gradient(180deg, var(--accent-soft), transparent);
}

.hero-title {
  max-width: 16ch;
  margin-bottom: 12px;
}

.hero-lede {
  max-width: 44ch;
  color: var(--muted);
  font-size: 1.1rem;
}

.hero-search {
  max-width: 640px;
  margin-top: 20px;
}

.hero-label {
  display: block;
  margin-bottom: 8px;
  font-size: 1.15rem;
  font-weight: 700;
}

.hero-search input {
  min-height: 52px;
  font-size: 1.05rem;
  border-radius: 999px;
  padding: 0 20px;
}

.hero-search .btn {
  min-height: 52px;
  padding: 0 22px;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.pill-link,
.pill-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.pill-count {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

/* Spoken by screen readers ("73 recipes"), hidden on screen. */
.pill-count-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.pill-link:hover,
.pill-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.home-section {
  padding: 28px 0 8px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin-bottom: 4px;
}

.section-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.more-link {
  flex: none;
  font-weight: 650;
  font-size: 0.95rem;
  padding: 8px 0;
}

.home-promise {
  margin-top: 36px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.promise-grid {
  display: grid;
  gap: 20px;
}

.promise-grid h2 {
  font-size: 1.2rem;
}

.promise-grid p {
  margin: 0;
  color: var(--muted);
}

@media (min-width: 760px) {
  .promise-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

/* On phones, home rows scroll sideways so the page stays short. */
.card-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(78%, 280px);
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 2px 2px 12px;
  margin: 0 -2px;
  overscroll-behavior-x: contain;
}

.card-row > .card {
  scroll-snap-align: start;
}

@media (min-width: 760px) {
  .card-row {
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    overflow: visible;
    padding: 0;
    margin: 0;
  }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.card:hover {
  border-color: var(--muted);
}

.card-img {
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
}

.card-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 12px 14px 14px;
}

.card-title {
  margin: 0 0 4px;
  font-family: var(--font);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.3;
}

.card-title a {
  color: var(--text);
  text-decoration: none;
}

/* The whole card is clickable through the title link. */
.card-title a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.card-title a:focus-visible {
  outline: none;
}

.card:has(.card-title a:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.card-meta {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.card-desc {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.93rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: auto 0 0;
  padding: 0;
  list-style: none;
}

.card-tags li {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 650;
}

.match {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 0.92rem;
}

.match p {
  margin: 0 0 4px;
}

.match-ready {
  color: var(--accent-strong);
}

.match-missing {
  color: var(--warn);
}

.match-staples {
  color: var(--muted);
}

/* ---------- Page heads (search, tools, about) ---------- */

.page-head {
  padding-top: 28px;
  padding-bottom: 8px;
}

.page-lede {
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.results {
  margin-top: 20px;
}

.results-count {
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.results-note {
  color: var(--muted);
}

.empty-state {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty-state p:last-child {
  margin-bottom: 0;
}

/* ---------- Search ---------- */

.search-form {
  display: grid;
  gap: 14px;
}

.filters {
  display: grid;
  gap: 12px;
}

.chip-set {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.chip-set legend {
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chips input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.chips label {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.chips input:checked + label {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.chips input:checked + label::before {
  content: '✓';
  margin-right: 6px;
}

.chips input:focus-visible + label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.select-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
}

.select-row label {
  display: grid;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--muted);
}

.select-row select {
  color: var(--text);
  min-width: 8.5em;
}

/* ---------- What can I make? ---------- */

.discover-form {
  max-width: 760px;
}

.have-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.have-box:focus-within {
  border-color: var(--focus);
  outline: 3px solid color-mix(in srgb, var(--focus) 30%, transparent);
}

.have-box input {
  flex: 1 1 12em;
  min-width: 0;
  border: 0;
  background: transparent;
}

.have-box input:focus-visible {
  outline: none;
}

.have-chips {
  display: contents;
  margin: 0;
  padding: 0;
  list-style: none;
}

.have-chips li {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-left: 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 650;
}

.have-chips button {
  min-width: 36px;
  min-height: 36px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.check-row input,
.ing input[type='checkbox'],
.shop-item input,
.cook-ing-list input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 10px;
}

.try-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.93rem;
}

.discover-results {
  margin-top: 24px;
}

/* ---------- Recipe page ---------- */

.page-recipe {
  font-size: 18px;
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 14px 0 8px;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
  color: var(--muted);
}

.crumbs li + li::before {
  content: '›';
  margin-right: 4px;
}

.crumbs li[aria-current] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 22ch;
}

.recipe-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.recipe-head h1 {
  margin-bottom: 8px;
}

.recipe-desc {
  max-width: 60ch;
  color: var(--muted);
  margin-bottom: 14px;
}

.recipe-img {
  margin: 0;
  order: -1;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  max-height: 180px;
  background: var(--surface-2);
}

.recipe-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 759px) {
  /* Keep ingredients near the top on phones: a short image band, compact facts. */
  .recipe-img {
    aspect-ratio: auto;
    height: 110px;
  }

  .recipe-head {
    gap: 12px;
  }

  .recipe-desc {
    font-size: 1rem;
    margin-bottom: 10px;
  }

  .facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
    gap: 6px;
  }

  .facts div {
    padding: 5px 7px;
  }

  .facts dt {
    font-size: 0.68rem;
  }

  .facts dd {
    font-size: 0.92rem;
  }

  .recipe-actions .btn:not(.btn-cook) {
    flex: 1 1 0;
    padding: 0 10px;
  }
}

@media (min-width: 760px) {
  .recipe-head {
    grid-template-columns: 1fr minmax(260px, 38%);
    gap: 28px;
  }

  .recipe-img {
    order: 0;
    max-height: none;
  }
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.facts div {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.facts dt {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.facts dd {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
}

.tag-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.tag-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 650;
  text-decoration: none;
}

.label-check {
  max-width: 60ch;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  font-size: 0.93rem;
}

.recipe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 8px;
}

.recipe-actions .btn svg {
  flex: none;
}

.btn-cook {
  flex: 1 1 100%;
  min-height: 52px;
  font-size: 1.05rem;
}

@media (min-width: 560px) {
  .btn-cook {
    flex: 0 1 auto;
  }
}

.recipe-body {
  display: grid;
  gap: 24px;
  margin-top: 20px;
}

@media (min-width: 900px) {
  .recipe-body {
    grid-template-columns: minmax(300px, 5fr) 7fr;
    gap: 40px;
    align-items: start;
  }
}

.ingredients,
.instructions {
  min-width: 0;
}

.ingredients {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.controls {
  display: grid;
  gap: 12px;
  margin: 4px 0 14px;
}

.scale-status {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 0.93rem;
}

.scale-status p {
  margin: 0 0 6px;
}

.fixed-notes {
  margin: 0 0 6px;
  padding-left: 18px;
}

.ing-group {
  margin: 16px 0 6px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.ing-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ing {
  border-bottom: 1px solid var(--line);
}

.ing:last-child {
  border-bottom: 0;
}

.ing label {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  cursor: pointer;
}

.ing-text {
  flex: 1;
  min-width: 0;
}

.ing .amt {
  font-weight: 750;
}

.ing .alt,
.ing .note,
.ing .opt {
  color: var(--muted);
}

.ing .note {
  display: block;
  font-size: 0.9em;
}

.flag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: 0.1em;
}

.ing.is-checked .ing-text {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.equipment {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.equipment ul {
  margin: 0;
  padding-left: 20px;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.step {
  position: relative;
  padding: 0 0 20px 48px;
  counter-increment: step;
}

.step::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 750;
  line-height: 34px;
  text-align: center;
}

.step-text {
  margin: 4px 0 8px;
}

.t-temp,
.t-time,
.t-qty {
  font-weight: 700;
}

.step-timers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timer-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.timer-btn.is-running {
  background: var(--accent);
  color: var(--accent-ink);
}

.notes {
  margin-top: 12px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.notes h2 {
  font-size: 1.2rem;
}

.notes ul {
  margin: 0;
  padding-left: 20px;
}

.notes li + li {
  margin-top: 6px;
}

.recipe-foot {
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.9rem;
}

.related {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* ---------- Timer tray (outside Cook Mode) ---------- */

.timer-tray {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 40;
  max-width: 440px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

.timer-tray[hidden] {
  display: none;
}

body.has-timers {
  padding-bottom: 120px;
}

.timer-list {
  margin: 0;
  padding: 4px 12px;
  list-style: none;
  max-height: 40vh;
  overflow: auto;
}

.timer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.timer:last-child {
  border-bottom: 0;
}

.timer-label {
  font-size: 0.85rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-clock {
  grid-row: span 2;
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.timer-actions {
  display: flex;
  gap: 6px;
}

.tbtn {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 650;
  cursor: pointer;
}

.tbtn-strong {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.timer.is-done {
  background: var(--warn-soft);
  margin: 0 -12px;
  padding: 8px 12px;
}

.timer.is-done .timer-clock {
  color: var(--danger);
  font-size: 1.2rem;
  animation: pulse 1s ease-in-out infinite;
}

.timer.is-paused .timer-clock {
  color: var(--muted);
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 60;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-size: 0.95rem;
  transform: translateX(-50%);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.toast a {
  color: inherit;
  font-weight: 700;
}

.toast[hidden] {
  display: none;
}

body.has-timers .toast {
  bottom: 140px;
}

/* ---------- Cook Mode ---------- */

html.cooking {
  overflow: hidden;
}

dialog.cook {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  overscroll-behavior: contain;
}

dialog.cook::backdrop {
  background: var(--bg);
}

.cook-shell {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  grid-template-columns: minmax(0, 1fr);
  height: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 16px max(10px, env(safe-area-inset-bottom));
}

.cook-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cook-recipe {
  min-width: 0;
  margin: 0;
  font-weight: 700;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cook-top-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

.cook-exit,
.cook-icon-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.cook-progress {
  margin-top: 10px;
}

.cook-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}

.cook-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}

.cook-count {
  margin: 6px 0 0;
  font-weight: 700;
  font-size: 0.95rem;
}

.cook-main {
  overflow-y: auto;
  padding: 18px 0;
  touch-action: pan-y;
}

.cook-step-label {
  margin: 0 0 6px;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.95rem;
}

.cook-text {
  margin: 0 0 18px;
  font-size: clamp(1.5rem, 1.1rem + 2.2vw, 2.4rem);
  line-height: 1.4;
  font-weight: 500;
}

.cook.size-m .cook-text {
  font-size: clamp(1.25rem, 1rem + 1.4vw, 1.8rem);
}

.cook.size-xl .cook-text {
  font-size: clamp(1.9rem, 1.4rem + 3vw, 3.1rem);
}

.cook-uses {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 1.1rem;
}

.cook-uses-label {
  margin: 0 0 4px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cook-uses ul {
  margin: 0;
  padding-left: 20px;
}

.cook-step-timers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-timer {
  min-height: 56px;
  padding: 0 22px;
  border-color: var(--accent);
  color: var(--accent);
  font-size: 1.1rem;
}

.btn-timer.is-running {
  background: var(--accent);
  color: var(--accent-ink);
}

.cook-timers {
  border-top: 1px solid var(--line);
}

.cook-timers[hidden] {
  display: none;
}

.cook-timers .timer-list {
  padding: 4px 0;
  max-height: 30vh;
}

.cook-nav {
  display: grid;
  grid-template-columns: 1fr auto 1.4fr;
  gap: 8px;
  padding-top: 10px;
}

.cook-nav-btn {
  min-height: 60px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.cook-nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.cook-next {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.cook-awake {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.cook-sheet {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
}

.cook-sheet[hidden] {
  display: none;
}

.cook-sheet-inner {
  position: absolute;
  inset: auto 0 0 0;
  max-height: 88%;
  max-width: 900px;
  margin: 0 auto;
  overflow-y: auto;
  padding: 16px 16px max(16px, env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
}

.cook-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cook-sheet-head h2 {
  margin: 0;
}

.cook-sheet-servings {
  color: var(--muted);
  margin: 4px 0 8px;
}

.cook-ing-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 1.15rem;
}

.cook-ing-list label {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.cook-ing-list input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
}

.cook-ing-group {
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.cook-ing-list .amt {
  font-weight: 750;
}

.cook-ing-list .note,
.cook-ing-list .alt {
  color: var(--muted);
}

.cook-finish-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 420px) {
  .cook-nav {
    grid-template-columns: 1fr 1fr;
  }

  .cook-ing-btn {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 48px;
  }
}

/* ---------- Shopping list ---------- */

.shop {
  max-width: 760px;
}

.shop-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.shop-toolbar[hidden] {
  display: none;
}

.shop-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.add-item {
  margin-bottom: 20px;
}

.shop-h {
  margin: 20px 0 6px;
  font-family: var(--font);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.shop-recipe-list {
  margin: 0;
  padding-left: 20px;
}

.shop-items {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.shop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.shop-item:last-child {
  border-bottom: 0;
}

.shop-item label {
  display: flex;
  flex: 1;
  gap: 12px;
  padding: 12px 0;
  cursor: pointer;
}

.shop-text {
  font-weight: 600;
}

.shop-sub {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.shop-item.is-checked .shop-text {
  color: var(--muted);
  text-decoration: line-through;
}

.is-staples .shop-items {
  background: var(--surface-2);
}

/* ---------- About / prose ---------- */

.prose {
  max-width: 760px;
  padding-top: 28px;
}

.prose h2 {
  margin-top: 1.6em;
}

.prose li + li {
  margin-top: 6px;
}

.list-section {
  margin-top: 24px;
}

.not-found .search-row {
  max-width: 520px;
  margin-bottom: 16px;
}

/* ---------- Photos ---------- */

.recipe-img.has-photo {
  display: flex;
  flex-direction: column;
  aspect-ratio: auto;
  max-height: none;
  background: none;
  overflow: visible;
}

.recipe-img.has-photo img {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
}

.recipe-img figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

@media (max-width: 759px) {
  .recipe-img.has-photo {
    height: auto;
  }

  .recipe-img.has-photo img {
    aspect-ratio: 16 / 7;
  }
}

/* ---------- Save / plan / share ---------- */

.btn[aria-pressed='true'] {
  border-color: var(--danger);
  color: var(--danger);
}

.btn[aria-pressed='true'] .heart {
  fill: currentColor;
}

.plan-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.plan-panel[hidden] {
  display: none;
}

.plan-panel label {
  display: grid;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--muted);
}

.plan-panel input {
  width: 6em;
}

.plan-panel a {
  align-self: center;
  font-size: 0.93rem;
}

/* ---------- My notes and nutrition ---------- */

.my-notes,
.nutrition {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.my-notes h2,
.nutrition h2 {
  font-size: 1.2rem;
}

.my-notes textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  resize: vertical;
}

.my-notes .hint,
.nutrition .hint {
  margin-bottom: 0;
}

.nutri {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
}

.nutri div {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  text-align: center;
}

.nutri dt {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  overflow-wrap: normal;
}

@media (max-width: 420px) {
  .nutri div {
    padding: 8px 4px;
  }

  .nutri dt {
    font-size: 0.625rem;
    letter-spacing: 0.02em;
  }
}

.nutri dd {
  margin: 0;
  font-weight: 750;
}

.saved-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Collections ---------- */

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.collection-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.collection-tile:hover {
  border-color: var(--muted);
  color: var(--text);
}

.collection-thumbs {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.collection-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.collection-thumbs img:first-child {
  grid-row: span 2;
}

.collection-name {
  font-weight: 750;
  font-size: 1.08rem;
}

.collection-count {
  color: var(--muted);
  font-size: 0.9rem;
}

.more-collections {
  margin-top: 32px;
}

/* ---------- Meal planner ---------- */

.planner-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.planner-days {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.plan-day {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.plan-day h2 {
  font-family: var(--font);
  font-size: 1.05rem;
}

.plan-list {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.plan-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.plan-item a {
  grid-column: 1 / -1;
  font-weight: 650;
}

.plan-servings {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

.plan-empty {
  padding: 6px 0;
  font-size: 0.93rem;
}

.plan-add {
  display: flex;
  gap: 6px;
}

.plan-add input {
  flex: 1;
  min-width: 0;
}

.offline-list {
  padding-left: 20px;
}

/* ---------- Motion ---------- */

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

/* ---------- Print ---------- */

/* Ads (off unless site.config.json turns them on; rules in ADS.md).
   One slim, labelled banner below the recipe. The box has a fixed size so
   the space is reserved before the ad loads and nothing moves. */
.ad-slot {
  margin: 8px auto 28px;
  padding: 0 16px;
  text-align: center;
}
.ad-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.ad-box {
  display: inline-block;
  width: 320px;
  height: 50px;
  max-width: 100%;
  overflow: hidden;
  vertical-align: top;
}
@media (min-width: 768px) {
  .ad-box {
    width: 728px;
    height: 90px;
  }
}
.ad-box iframe {
  display: block;
  border: 0;
}

@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #fff;
    --text: #000;
    --muted: #333;
    --line: #bbb;
    --accent: #000;
    --accent-soft: #fff;
    --accent-strong: #000;
    --warn-soft: #fff;
  }

  body {
    font-size: 11.5pt;
    line-height: 1.45;
  }

  .site-header,
  .site-footer,
  .skip-link,
  .crumbs,
  .recipe-actions,
  .controls,
  .step-timers,
  .related,
  .timer-tray,
  .toast,
  .link-btn,
  .tag-links,
  .recipe-img,
  .ad-slot,
  .needs-js,
  .shop-toolbar,
  .add-item,
  .plan-panel,
  .my-notes h2,
  .my-notes textarea,
  .my-notes .hint,
  .nutrition .hint a,
  .empty-state,
  .page-lede,
  .search-form,
  .scale-status button {
    display: none !important;
  }

  .print-only {
    display: block;
  }

  .wrap {
    max-width: none;
    padding: 0;
  }

  h1 {
    font-size: 20pt;
    margin: 0 0 4pt;
  }

  h2 {
    font-size: 13pt;
    margin: 10pt 0 4pt;
  }

  .recipe-desc {
    margin-bottom: 6pt;
  }

  .facts {
    gap: 4pt 14pt;
    margin-bottom: 6pt;
  }

  .facts div {
    padding: 0;
  }

  .facts dt {
    display: inline;
    font-size: 9pt;
  }

  .facts dt::after {
    content: ': ';
  }

  .facts dd {
    display: inline;
    font-size: 10.5pt;
  }

  .recipe-body {
    display: block;
    margin-top: 6pt;
  }

  .ingredients {
    padding: 0;
    border: 0;
    margin-bottom: 8pt;
  }

  .ing-list {
    columns: 2;
    column-gap: 20pt;
  }

  .ing {
    border: 0;
    break-inside: avoid;
  }

  .ing label {
    padding: 1.5pt 0;
    gap: 6pt;
  }

  .ing input[type='checkbox'] {
    appearance: none;
    width: 9pt;
    height: 9pt;
    margin-top: 3pt;
    border: 1px solid #000;
    border-radius: 2px;
  }

  .ing.is-checked .ing-text {
    text-decoration: none;
    color: #000;
  }

  .flag {
    border: 1px solid #999;
  }

  .step {
    padding: 0 0 6pt 22pt;
    break-inside: avoid;
  }

  .step::before {
    width: auto;
    height: auto;
    background: none;
    color: #000;
    line-height: inherit;
    content: counter(step) '.';
  }

  .step-text {
    margin: 0;
  }

  .notes {
    padding: 0;
    break-inside: avoid;
  }

  .recipe-foot {
    margin-top: 10pt;
    font-size: 9pt;
  }

  .shop-items {
    border: 0;
  }

  .shop-item {
    padding: 0;
    border: 0;
  }

  .shop-item label {
    padding: 2pt 0;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  @page {
    margin: 14mm;
  }
}
