/* ==========================================================================
   CulinaryVault — main stylesheet (deferred; critical.css is inlined)
   Sections: layout · buttons · cards · home · directory · recipe · forms ·
             footer · overlays · print
   ========================================================================== */

/* ------------------------------------------------------------ typography */
.lede { font-size: 1.18rem; color: var(--text-soft); max-width: 68ch; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .65rem;
  font-size: .73rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .85rem;
}
.eyebrow::before {
  content: ""; width: 26px; height: 2px;
  background: currentColor; border-radius: 2px; flex-shrink: 0;
}
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; margin-bottom: clamp(1.75rem, 3.2vw, 2.75rem); flex-wrap: wrap;
}
.section-head > div { max-width: 62ch; }
.section-head h2 { margin: 0; }
.section-head p { margin: .55rem 0 0; color: var(--text-soft); max-width: 56ch; }
.section { padding: clamp(2.75rem, 6vw, 5rem) 0; }
.section--sunken { background: var(--bg-sunken); }

/* Dark contrast band. Breaks up a long run of warm paper and makes the
   food photography pop; keeps its own tokens so it stays dark in both themes. */
.section--ink {
  background: var(--ink-bg);
  color: var(--ink-text);
  position: relative;
}
.section--ink h2, .section--ink h3 { color: var(--ink-text); }
.section--ink p, .section--ink .section-head p { color: var(--ink-soft); }
.section--ink .eyebrow { color: var(--highlight); }
.section--ink .card {
  background: rgba(255, 255, 255, .045);
  border-color: var(--ink-line);
}
.section--ink .card h3 a { color: var(--ink-text); }
.section--ink .card p { color: var(--ink-soft); }
.section--ink .card-foot { border-top-color: var(--ink-line); color: var(--ink-soft); }
.section--ink .card-kicker { color: var(--highlight); }
.section--ink .stars b { color: var(--ink-text); }
.section--ink .btn--ghost { border-color: rgba(255, 255, 255, .3); color: var(--ink-text); }
.section--ink .btn--ghost:hover { border-color: var(--highlight); color: var(--highlight); }
.section--ink .rail::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); }

/* Small ornament used to close a section */
.ornament {
  display: flex; align-items: center; justify-content: center; gap: .9rem;
  color: var(--line-strong); margin: clamp(2rem, 4vw, 3rem) 0 0;
}
.ornament::before, .ornament::after {
  content: ""; height: 1px; width: min(28vw, 210px); background: currentColor;
}
.ornament span { font-size: .9rem; color: var(--accent); }

.rule {
  height: 1px; border: 0; background: var(--line); margin: clamp(2rem, 5vw, 3.5rem) 0;
}

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .78rem 1.5rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-size: .92rem; font-weight: 600;
  cursor: pointer;
  transition: transform .18s var(--ease), background .18s, color .18s, border-color .18s, box-shadow .18s;
  text-align: center;
}
.btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.btn--ghost { border-color: var(--line-strong); color: var(--text); background: transparent; }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--light { background: rgba(255, 255, 255, .95); color: var(--charcoal); }
.btn--light:hover { background: #fff; }
.btn--sm { padding: .5rem 1rem; font-size: .82rem; }
.btn--block { width: 100%; }

/* ----------------------------------------------------------------- badge */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .26rem .6rem;
  border-radius: 999px;
  font-size: .655rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  background: var(--accent-soft); color: var(--accent-hover);
  white-space: nowrap;
}
.badge--sage   { background: color-mix(in srgb, var(--sage) 16%, transparent); color: var(--sage-d); }
.badge--brass  { background: color-mix(in srgb, var(--brass) 18%, transparent); color: var(--brass); }
.badge--solid  { background: var(--accent); color: #fff; }
.badge--glass  { background: rgba(20, 15, 11, .62); color: #fff; backdrop-filter: blur(6px); }
[data-theme="dark"] .badge--sage { color: #a8bd8c; }
[data-theme="dark"] .badge--brass { color: var(--highlight); }

/* ------------------------------------------------------------------ card */
.card-grid {
  display: grid;
  gap: clamp(1.1rem, 2.2vw, 1.9rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform .38s var(--ease-out), box-shadow .38s var(--ease-out), border-color .3s;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-sunken);
  flex: none;
}
.card-media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .8s var(--ease-out), opacity .5s;
}
.card:hover .card-media img { transform: scale(1.06); }
/* A soft scrim so white-ish badges and the time chip stay legible on any photo */
.card-media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(20, 15, 11, .28) 0%, transparent 26%,
                                       transparent 64%, rgba(20, 15, 11, .34) 100%);
}

/* Gradient placeholder shown when an image is missing or fails to load */
.img-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 1.25rem;
  text-align: center;
  background: linear-gradient(145deg, var(--ph-a, #c8763f), var(--ph-b, #8c5a3c));
  color: #fff;
}
.img-fallback span {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .3);
}
.img-fallback::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(75% 60% at 30% 20%, rgba(255, 255, 255, .22), transparent 70%);
}

.card-badges {
  position: absolute; top: .85rem; left: .85rem;
  /* Clears the favourite button, which is pinned to the same corner. Without
     this the second badge slides underneath it. */
  right: calc(.85rem + 46px);
  display: flex; gap: .35rem; align-items: flex-start; flex-wrap: wrap;
  pointer-events: none; z-index: 2;
}
.card-badges .badge { pointer-events: auto; }

.fav-btn {
  position: absolute; top: .8rem; right: .8rem;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .94);
  color: #4a4038;                       /* readable on the white pill */
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(20, 15, 11, .28);
  transition: transform .2s var(--ease), color .2s, background .2s;
  z-index: 3;
}
.fav-btn svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.fav-btn:hover { transform: scale(1.12); color: var(--accent); }
.fav-btn[aria-pressed="true"] { color: var(--accent); }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }

/* Time now lives in the meta row beside rating and difficulty rather than
   floating over the photograph, where it collided with the caption on
   overlay cards and obscured the food on every other one. */
.card-meta {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; font-weight: 500; white-space: nowrap;
}
.card-meta svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; opacity: .75; }
.card-meta i { font-style: normal; opacity: .45; }

.card-body { padding: 1.15rem 1.25rem 1.25rem; display: flex; flex-direction: column; flex: 1; }
.card-kicker {
  font-size: .69rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .45rem;
}
.card h3 {
  font-size: 1.24rem; margin: 0 0 .45rem; line-height: 1.22;
}
.card h3 a { background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0 1.5px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size .4s var(--ease-out); }
.card:hover h3 a { background-size: 100% 1.5px; }
.card h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card p {
  font-size: .9rem; color: var(--text-soft); margin: 0 0 1rem; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot {
  margin-top: auto; padding-top: .8rem;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  font-size: .8rem; color: var(--text-soft);
}

/* Star rating */
.stars { display: inline-flex; align-items: center; gap: .3rem; }
.stars-glyphs { position: relative; display: inline-block; color: var(--line-strong); font-size: .95rem; letter-spacing: .06em; }
.stars-glyphs span {
  position: absolute; inset: 0; overflow: hidden; color: var(--highlight); white-space: nowrap;
}
.stars b { font-weight: 700; color: var(--text); font-size: .82rem; }
.stars small { color: var(--text-soft); font-size: .76rem; }

/* Quick View hover panel */
.quick-view {
  position: absolute; inset: auto 0 0 0;
  background: linear-gradient(180deg, transparent, rgba(20, 15, 11, .92) 42%);
  color: #fff;
  padding: 2.6rem .95rem .95rem;
  transform: translateY(101%);
  transition: transform .38s var(--ease);
  z-index: 2;
}
.card:hover .quick-view, .card:focus-within .quick-view { transform: translateY(0); }
.quick-view dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 0 0 .7rem; }
.quick-view dt { font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; opacity: .72; }
.quick-view dd { margin: .15rem 0 0; font-size: .84rem; font-weight: 600; }
.quick-view .btn { width: 100%; }
@media (hover: none) { .quick-view { display: none; } }

/* Skeleton loading shimmer */
.skeleton {
  background: linear-gradient(100deg, var(--bg-sunken) 30%, var(--line) 50%, var(--bg-sunken) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius);
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ home: bento */
.bento {
  display: grid;
  gap: clamp(.85rem, 1.6vw, 1.35rem);
  grid-template-columns: repeat(4, 1fr);
  /* Fixed row height. With `auto` rows the tall feature cell inherited the
     combined height of its neighbours and cropped an 800x600 photo into an
     extreme portrait; explicit rows keep every crop close to the source. */
  grid-auto-rows: clamp(190px, 20vw, 248px);
}

/* Every cell in this block is an overlay card: the photo fills the cell and
   the caption sits on a gradient over it. Uniform, no dead space, and it
   reads like a magazine spread rather than a row of boxes. */
.bento .card { position: relative; }
.bento .card .card-media { position: absolute; inset: 0; aspect-ratio: auto; }
.bento .card .card-body {
  position: relative; z-index: 2;
  margin-top: auto;
  flex: 0 0 auto;          /* hug the caption; do not fill the cell */
  padding: 4.5rem 1.25rem 1.15rem;
  background: linear-gradient(180deg, transparent, rgba(16, 12, 9, .74) 40%, rgba(16, 12, 9, .96));
  color: #fff;
}
.bento .card h3 a, .bento .card h3 { color: #fff; }
.bento .card .card-kicker { color: var(--gold); }
.bento .card p { display: none; }
.bento .card .card-foot {
  border-top-color: rgba(255, 255, 255, .22);
  color: rgba(255, 255, 255, .78);
  margin-top: .75rem;      /* not auto, or it is pushed away from the title */
  padding-top: .7rem;
}
.bento .card .stars b { color: #fff; }
.bento .card .quick-view { display: none; }
.bento .card .card-media::after { background: none; }

.bento .card:nth-child(1) { grid-column: span 2; grid-row: span 2; }
.bento .card:nth-child(1) h3 { font-size: clamp(1.6rem, 2.5vw, 2.1rem); }
.bento .card:nth-child(1) p {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; color: rgba(255, 255, 255, .82); margin-bottom: .9rem;
}
.bento .card:nth-child(1) .card-body { padding: 6rem 1.6rem 1.5rem; }
.bento .card:nth-child(2), .bento .card:nth-child(3) { grid-column: span 2; }
.bento .card:nth-child(4) { grid-column: span 4; }
.bento .card:nth-child(4) h3 { font-size: clamp(1.35rem, 2vw, 1.75rem); }

@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .bento .card:nth-child(1) { grid-column: span 2; grid-row: span 2; }
  .bento .card:nth-child(2), .bento .card:nth-child(3),
  .bento .card:nth-child(4) { grid-column: span 2; grid-row: span 1; }
}
@media (max-width: 560px) {
  .bento { grid-auto-rows: clamp(180px, 46vw, 230px); }
}

/* Horizontal rail */
.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(268px, 1fr);
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 1rem;
  scrollbar-width: thin;
}
.rail > * { scroll-snap-align: start; }
.rail::-webkit-scrollbar { height: 8px; }
.rail::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }
@media (min-width: 1100px) { .rail { grid-auto-columns: minmax(0, 1fr); overflow: visible; grid-auto-flow: dense; grid-template-columns: repeat(4, 1fr); } }

/* Category tiles */
.tile-grid {
  display: grid; gap: clamp(.9rem, 2vw, 1.4rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
}
.tile {
  position: relative;
  display: block;
  aspect-ratio: 3 / 2;
  border-radius: var(--radius-lg);
  overflow: hidden;
  isolation: isolate;
  background: var(--bg-sunken);
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.tile:hover img { transform: scale(1.1); }
.tile::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20, 15, 11, .12) 25%, rgba(20, 15, 11, .78));
  transition: background .35s;
}
.tile:hover::after { background: linear-gradient(180deg, rgba(184, 73, 44, .3) 15%, rgba(20, 15, 11, .8)); }
.tile-label {
  position: absolute; inset: auto 0 0 0; z-index: 1;
  padding: 1rem 1.1rem;
  color: #fff;
}
.tile-label strong { display: block; font-family: var(--font-display); font-size: 1.28rem; line-height: 1.2; }
.tile-label span { font-size: .78rem; opacity: .82; }

/* Cuisine chips */
.cuisine-grid { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.cuisine-chip {
  display: flex; align-items: center; gap: .8rem;
  padding: .85rem 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .22s var(--ease), border-color .22s, box-shadow .22s;
}
.cuisine-chip:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-sm); }
.cuisine-flag { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.cuisine-chip strong { display: block; font-size: .95rem; font-weight: 600; }
.cuisine-chip span { font-size: .78rem; color: var(--text-soft); }

/* Instagram-style gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(50%, 150px), 1fr));
  gap: .4rem;
}
.gallery a { position: relative; aspect-ratio: 1; overflow: hidden; display: block; background: var(--bg-sunken); }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease), filter .4s; }
.gallery a:hover img { transform: scale(1.09); filter: brightness(.75); }
.gallery a::after {
  content: attr(data-title);
  position: absolute; inset: auto 0 0 0;
  padding: 2rem .7rem .65rem;
  background: linear-gradient(transparent, rgba(20, 15, 11, .85));
  color: #fff; font-size: .74rem; font-weight: 600;
  opacity: 0; transition: opacity .3s;
}
.gallery a:hover::after { opacity: 1; }

/* ---------------------------------------------------------- search / nav */
.search-shell { position: relative; flex: 1; max-width: 340px; }
.search-shell input {
  width: 100%;
  padding: .58rem 1rem .58rem 2.4rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-raised);
  font-size: .88rem;
  transition: border-color .2s, box-shadow .2s;
}
.search-shell input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.search-shell > svg {
  position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; stroke: var(--text-soft); fill: none; stroke-width: 2; pointer-events: none;
}
.hero .search-shell { max-width: none; width: 100%; }
.hero .search-shell input {
  padding: .95rem 1.2rem .95rem 3rem;
  font-size: 1rem;
  border-color: var(--line-strong);
  background: var(--bg-raised);
  box-shadow: var(--shadow-sm);
}
.hero .search-shell > svg { left: 1.05rem; width: 18px; height: 18px; }

.autocomplete {
  position: absolute; top: calc(100% + .5rem); left: 0; right: 0;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: min(60vh, 420px);
  overflow-y: auto;
  z-index: 120;
  padding: .4rem;
  text-align: left;
}
.autocomplete:empty, .autocomplete[hidden] { display: none; }
.ac-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem .6rem;
  border-radius: 8px;
  cursor: pointer;
}
.ac-item:hover, .ac-item[aria-selected="true"] { background: var(--accent-soft); }
.ac-item img { width: 44px; height: 44px; border-radius: 7px; object-fit: cover; flex-shrink: 0; }
.ac-item .ac-ph { width: 44px; height: 44px; border-radius: 7px; flex-shrink: 0; background: linear-gradient(140deg, var(--terracotta), var(--brass)); }
.ac-item strong { display: block; font-size: .88rem; font-weight: 600; line-height: 1.3; }
.ac-item span { font-size: .74rem; color: var(--text-soft); }
.ac-empty { padding: 1rem; color: var(--text-soft); font-size: .88rem; text-align: center; }

/* Mega dropdown */
.nav-item { position: relative; }
.nav-panel {
  position: absolute; top: calc(100% + .6rem); left: 50%; transform: translateX(-50%) translateY(-6px);
  width: min(92vw, 560px);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.2rem;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem;
  opacity: 0; visibility: hidden;
  transition: opacity .2s, transform .2s var(--ease), visibility .2s;
  z-index: 120;
}
.nav-item[data-open="true"] .nav-panel { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.nav-panel a { padding: .5rem .6rem; border-radius: 8px; font-size: .88rem; color: var(--text); }
.nav-panel a:hover { background: var(--accent-soft); color: var(--accent); }
.nav-panel a span { display: block; font-size: .72rem; color: var(--text-soft); }
@media (max-width: 900px) { .nav-panel { grid-template-columns: repeat(2, 1fr); } }

/* Mobile nav */
.nav-toggle { display: none; }
@media (max-width: 860px) {
  .nav-toggle { display: grid; }
  .main-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--line);
    padding: 1rem var(--gutter) 1.6rem;
    gap: .2rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(-120%);
    transition: transform .32s var(--ease);
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  }
  .main-nav[data-open="true"] { transform: translateY(0); }
  .main-nav a, .nav-trigger { padding: .8rem .6rem; font-size: 1rem; text-align: left; }
  .nav-panel {
    position: static; transform: none; opacity: 1; visibility: visible;
    width: auto; box-shadow: none; border: 0; padding: .2rem 0 .6rem 1rem;
    background: transparent; display: none;
  }
  .nav-item[data-open="true"] .nav-panel { display: grid; }
  .header-search { display: none; }
}

/* --------------------------------------------------------- directory page */
.directory { display: grid; grid-template-columns: 268px 1fr; gap: clamp(1.5rem, 3vw, 2.75rem); align-items: start; }
@media (max-width: 980px) { .directory { grid-template-columns: 1fr; } }

.filters {
  position: sticky; top: calc(var(--header-h) + 1.25rem);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  max-height: calc(100vh - var(--header-h) - 3rem);
  overflow-y: auto;
}
@media (max-width: 980px) { .filters { position: static; max-height: none; } }
.filter-group { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1rem; }
.filter-group:last-of-type { border: 0; margin-bottom: 0; padding-bottom: 0; }
.filter-group > h3 {
  font-family: var(--font-body); font-size: .76rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--text-soft); margin-bottom: .7rem;
}
.filter-list { display: flex; flex-direction: column; gap: .1rem; max-height: 232px; overflow-y: auto; }
.check {
  display: flex; align-items: center; gap: .6rem;
  padding: .38rem .45rem; border-radius: 7px;
  font-size: .88rem; cursor: pointer;
  transition: background .16s;
}
.check:hover { background: var(--bg-sunken); }
.check input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.check .count { margin-left: auto; font-size: .74rem; color: var(--text-soft); font-variant-numeric: tabular-nums; }

.chip-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .38rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-raised);
  font-size: .8rem; cursor: pointer;
}
.chip[aria-pressed="true"], .chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip button { background: none; border: 0; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.toolbar select {
  padding: .5rem 2rem .5rem .8rem;
  border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--bg-raised);
  font-size: .86rem; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236d6459' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center;
}
.result-count { font-size: .88rem; color: var(--text-soft); }
.result-count strong { color: var(--text); }

.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-soft); }
.empty-state h3 { color: var(--text); }

/* ------------------------------------------------------------ recipe page */
.breadcrumbs { font-size: .82rem; color: var(--text-soft); padding: 1.25rem 0 .5rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; }
.breadcrumbs li::after { content: "/"; margin-left: .45rem; color: var(--line-strong); }
.breadcrumbs li:last-child::after { content: none; }
.breadcrumbs a:hover { color: var(--accent); }

/* Two-column masthead: the dish is visible without scrolling, and the copy
   column no longer leaves half the page empty. */
.recipe-masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr);
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: center;
  padding: clamp(.5rem, 2vw, 1.5rem) 0 clamp(1.5rem, 3vw, 2.5rem);
}
@media (max-width: 940px) {
  .recipe-masthead { grid-template-columns: 1fr; gap: 1.75rem; }
}
.recipe-head { max-width: 100%; }
.recipe-head h1 { margin-bottom: .3em; }
.recipe-head .lede { font-size: 1.08rem; }
.recipe-meta {
  display: flex; align-items: center; gap: 1rem 1.35rem; flex-wrap: wrap;
  font-size: .875rem; color: var(--text-soft);
  padding: .95rem 0; border-block: 1px solid var(--line); margin: 1.35rem 0 1.5rem;
}
.recipe-meta > span { display: inline-flex; align-items: center; gap: .4rem; }
.recipe-meta svg { width: 16px; height: 16px; stroke: var(--accent); fill: none; stroke-width: 1.8; }
.recipe-meta strong { color: var(--text); }

.action-bar { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; margin-bottom: 0; }
.fav-btn--inline {
  position: static;
  width: auto; height: auto;
  display: inline-flex; align-items: center;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  border: 1.5px solid var(--line-strong);
  color: var(--text);
}
.fav-btn--inline:hover { transform: translateY(-2px); background: transparent; }
.fav-btn--inline[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.fav-btn--inline svg { width: 17px; height: 17px; }

.recipe-hero {
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  width: 100%;
  /* aspect-ratio alone, with no max-height: combining the two makes the
     browser derive the WIDTH from the height and the hero comes out narrow. */
  aspect-ratio: 4 / 3;
  background: var(--bg-sunken);
  box-shadow: var(--shadow-lg);
}
@media (max-width: 940px) { .recipe-hero { aspect-ratio: 16 / 10; } }
.recipe-hero img { width: 100%; height: 100%; object-fit: cover; }

.recipe-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
  margin-top: clamp(2rem, 5vw, 3.5rem);
}
@media (max-width: 1000px) { .recipe-layout { grid-template-columns: 1fr; } }

.recipe-aside { position: sticky; top: calc(var(--header-h) + 1.5rem); display: grid; gap: 1.25rem; }
@media (max-width: 1000px) { .recipe-aside { position: static; } }

.panel {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
}
.panel h3 { font-size: 1.15rem; margin-bottom: .9rem; }
.panel--accent { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
[data-theme="dark"] .panel--accent { background: var(--accent-soft); }

/* The cooking-science note is the site's signature, so it gets its own
   treatment rather than reading as another run of body copy. */
.why-panel {
  position: relative;
  background: var(--second-soft);
  border-radius: var(--radius-lg);
  padding: clamp(1.35rem, 2.6vw, 2rem) clamp(1.35rem, 2.6vw, 2.25rem);
  margin: 0 0 2.5rem;
  border-left: 4px solid var(--second);
}
.why-panel h2 {
  margin: 0 0 .6rem;
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  color: var(--text);
}
.why-panel p { margin: 0; color: var(--text); }
.why-panel p::first-letter {
  float: left;
  font-family: var(--font-display);
  font-size: 3.1em;
  line-height: .82;
  padding: .06em .12em 0 0;
  color: var(--second);
  font-weight: 700;
}
[data-theme="dark"] .why-panel p::first-letter { color: var(--second); }

.prose h2 { margin-top: 2.4rem; }
.prose h3 { margin-top: 1.8rem; }
.prose > :first-child { margin-top: 0; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .55rem; }

/* Ingredients */
.servings-control {
  display: flex; align-items: center; gap: .75rem;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .4rem .35rem 1rem;
  margin-bottom: 1.2rem;
  font-size: .86rem;
}
.servings-control span { margin-right: auto; color: var(--text-soft); }
.servings-control button {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--bg-raised);
  cursor: pointer; font-size: 1.05rem; line-height: 1; display: grid; place-items: center;
  transition: background .18s, color .18s, border-color .18s;
}
.servings-control button:hover:not(:disabled) { background: var(--accent); color: #fff; border-color: var(--accent); }
.servings-control button:disabled { opacity: .4; cursor: not-allowed; }
.servings-control output { font-weight: 700; min-width: 1.6ch; text-align: center; font-variant-numeric: tabular-nums; }

.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li { border-bottom: 1px dashed var(--line); }
.ingredients li:last-child { border-bottom: 0; }
.ingredients .ing-group {
  font-family: var(--font-body); font-size: .74rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
  padding: 1.1rem 0 .45rem; border: 0;
}
.ingredients .ing-group:first-child { padding-top: 0; }
.ing-check {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .6rem .3rem; cursor: pointer; font-size: .95rem;
  transition: opacity .2s;
}
.ing-check input { accent-color: var(--accent); width: 17px; height: 17px; margin-top: .25rem; flex-shrink: 0; cursor: pointer; }
.ing-check input:checked ~ .ing-text { opacity: .42; text-decoration: line-through; }
.ing-qty { font-weight: 700; color: var(--accent); white-space: nowrap; }

/* Method */
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 1.1rem 1rem 1.1rem 3.6rem;
  border-bottom: 1px solid var(--line);
  transition: background .25s, opacity .25s;
}
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: .95rem;
  width: 2.45rem; height: 2.45rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1.5px solid var(--line-strong);
  color: var(--accent);
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  transition: background .25s, color .25s, transform .25s, border-color .25s;
}
.steps li.is-done::before { background: var(--second); border-color: var(--second); color: #fff; content: "\2713"; }
.steps li.is-active::before { background: var(--accent); border-color: var(--accent); color: #fff; transform: scale(1.06); }
.steps li.is-active { background: var(--accent-soft); border-radius: var(--radius); border-bottom-color: transparent; }
.steps li.is-done .step-text { opacity: .5; }
.step-actions { display: flex; gap: .5rem; margin-top: .7rem; flex-wrap: wrap; }
.step-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--line-strong); background: var(--bg-raised);
  padding: .3rem .7rem; border-radius: 999px;
  font-size: .76rem; font-weight: 600; cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}
.step-btn:hover { border-color: var(--accent); color: var(--accent); }
.step-btn.is-running { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Cook mode */
body.cook-mode { font-size: 1.22rem; }
body.cook-mode .site-header, body.cook-mode .site-footer,
body.cook-mode .recipe-aside, body.cook-mode .related,
body.cook-mode .reviews, body.cook-mode .newsletter { display: none; }
body.cook-mode .recipe-layout { grid-template-columns: 1fr; }
body.cook-mode .steps li { font-size: 1.16em; padding-left: 4rem; }
body.cook-mode .steps li:not(.is-active):not(.is-done) { opacity: .55; }
body.cook-mode .ing-check { font-size: 1.08em; }
.cook-exit {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 200;
  display: none;
}
body.cook-mode .cook-exit { display: inline-flex; }

/* Nutrition */
.nutrition { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: .6rem; }
.nutrition div {
  background: var(--bg-sunken); border-radius: var(--radius-sm);
  padding: .7rem .5rem; text-align: center;
}
.nutrition strong { display: block; font-size: 1.08rem; font-family: var(--font-display); color: var(--accent); }
.nutrition span { font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-soft); }

/* Tag pills */
.tag-row { display: flex; gap: .45rem; flex-wrap: wrap; }
.tag {
  font-size: .75rem; padding: .28rem .7rem; border-radius: 999px;
  background: var(--bg-sunken); border: 1px solid var(--line); color: var(--text-soft);
  transition: border-color .18s, color .18s;
}
a.tag:hover { border-color: var(--accent); color: var(--accent); }

/* Share */
.share-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.share-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong); background: var(--bg-raised);
  cursor: pointer; color: var(--text-soft);
  transition: transform .2s var(--ease), background .2s, color .2s, border-color .2s;
}
.share-btn:hover { transform: translateY(-3px); background: var(--accent); border-color: var(--accent); color: #fff; }
.share-btn svg { width: 17px; height: 17px; fill: currentColor; }
.share-btn--pin:hover { background: #bd081c; border-color: #bd081c; }

/* Reviews */
.review-form { display: grid; gap: .9rem; }
.star-input { display: flex; gap: .2rem; direction: rtl; justify-content: flex-end; }
.star-input input { position: absolute; opacity: 0; width: 0; height: 0; }
.star-input label { font-size: 1.6rem; color: var(--line-strong); cursor: pointer; transition: color .15s, transform .15s; line-height: 1; }
.star-input label:hover, .star-input label:hover ~ label,
.star-input input:checked ~ label { color: var(--highlight); }
.star-input label:hover { transform: scale(1.15); }
.review {
  border-bottom: 1px solid var(--line);
  padding: 1.2rem 0;
}
.review:last-child { border-bottom: 0; }
.review-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .5rem; flex-wrap: wrap; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(140deg, var(--terracotta), var(--brass));
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .9rem;
  flex-shrink: 0;
}
.review-head strong { font-size: .94rem; }
.review-head time { font-size: .78rem; color: var(--text-soft); margin-left: auto; }

/* Related */
.related-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }

/* ------------------------------------------------------------------ forms */
.field { display: grid; gap: .4rem; margin-bottom: 1.1rem; }
.field label { font-size: .84rem; font-weight: 600; }
.field input, .field textarea, .field select {
  padding: .75rem .95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  font-size: .95rem;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { min-height: 140px; resize: vertical; }
.field .error { font-size: .8rem; color: #c0392b; min-height: 1.1em; }
[data-theme="dark"] .field .error { color: #ff8a75; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: #c0392b; }
.form-note { font-size: .8rem; color: var(--text-soft); }
.form-status {
  padding: .85rem 1rem; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--sage) 16%, transparent);
  color: var(--sage-d); font-size: .9rem; font-weight: 500;
}
[data-theme="dark"] .form-status { color: #a8bd8c; }

.newsletter {
  background: linear-gradient(135deg, var(--terracotta), #8f3a24 60%, var(--brass));
  color: #fff;
  border-radius: var(--radius-xl);
  padding: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.newsletter::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 80% at 15% 10%, rgba(255, 255, 255, .18), transparent 60%);
}
.newsletter > * { position: relative; }
.newsletter h2 { color: #fff; }
.newsletter p { color: rgba(255, 255, 255, .88); max-width: 52ch; margin-inline: auto; }
.newsletter form { display: flex; gap: .6rem; max-width: 480px; margin: 1.75rem auto 0; flex-wrap: wrap; }
.newsletter input {
  flex: 1 1 220px; padding: .85rem 1.2rem;
  border: 0; border-radius: 999px; font-size: .95rem;
  background: rgba(255, 255, 255, .96); color: var(--charcoal);
}
.newsletter input:focus { outline: 3px solid rgba(255, 255, 255, .6); outline-offset: 2px; }
.newsletter .form-status { background: rgba(255, 255, 255, .18); color: #fff; margin-top: 1rem; }

/* ------------------------------------------------------------------ misc */
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 1.5rem; }
.team-card { text-align: center; }
.team-card .avatar { width: 92px; height: 92px; font-size: 1.7rem; margin: 0 auto .9rem; }
.team-card strong { display: block; font-family: var(--font-display); font-size: 1.15rem; }
.team-card em { font-style: normal; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.team-card p { font-size: .88rem; color: var(--text-soft); margin-top: .6rem; }

.faq details {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.2rem; margin-bottom: .75rem; background: var(--bg-raised);
}
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "\2013"; }
.faq details p { margin: .8rem 0 0; color: var(--text-soft); font-size: .95rem; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  background: var(--charcoal);
  color: #cdc1b1;
  padding: clamp(3rem, 6vw, 4.5rem) 0 2rem;
  margin-top: clamp(3rem, 7vw, 5.5rem);
}
[data-theme="dark"] .site-footer { background: var(--bg-sunken); border-top: 1px solid var(--line); }
.site-footer h2, .site-footer h3, .site-footer .brand { color: #fff; }
.footer-grid {
  display: grid; gap: 2rem;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  margin-bottom: 2.5rem;
}
@media (max-width: 820px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h3 { font-family: var(--font-body); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: #fff; margin-bottom: 1rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.site-footer a { font-size: .9rem; color: #cdc1b1; transition: color .18s; }
.site-footer a:hover { color: var(--gold); }
.site-footer p { font-size: .9rem; color: #a2968a; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .1);
  padding-top: 1.5rem;
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-size: .82rem; color: #8d8175;
}

/* ------------------------------------------------------------- overlays */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem;
  transform: translate(-50%, calc(100% + 3rem));
  background: var(--charcoal); color: #fff;
  padding: .85rem 1.4rem; border-radius: 999px;
  font-size: .88rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0; visibility: hidden;
  transition: transform .38s var(--ease), opacity .28s, visibility .38s;
  max-width: calc(100vw - 2rem);
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
[data-theme="dark"] .toast { background: var(--bg-raised); border: 1px solid var(--line); }

.modal {
  position: fixed; inset: 0; z-index: 250;
  display: grid; place-items: center;
  padding: var(--gutter);
  background: rgba(24, 18, 13, .62);
  backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.modal[data-open="true"] { opacity: 1; visibility: visible; }
.modal-card {
  background: var(--bg-raised);
  border-radius: var(--radius-xl);
  max-width: 520px; width: 100%;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(.98);
  transition: transform .28s var(--ease);
  max-height: 86vh; overflow-y: auto;
}
.modal[data-open="true"] .modal-card { transform: none; }
.modal-close { position: absolute; top: 1rem; right: 1rem; }

.back-to-top {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: #fff; border: 0;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .3s, visibility .3s, transform .3s var(--ease);
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.back-to-top svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2.2; }

/* --------------------------------------------------------------- print */
@media print {
  @page { margin: 15mm; }
  .site-header, .site-footer, .action-bar, .recipe-aside, .related, .reviews,
  .newsletter, .back-to-top, .fav-btn, .share-row, .breadcrumbs, .toast,
  .step-actions, .servings-control, .cook-exit, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; line-height: 1.5; }
  .recipe-layout { display: block; }
  .recipe-hero { max-height: 68mm; box-shadow: none; border-radius: 0; page-break-inside: avoid; }
  .panel { border: 1px solid #999; padding: 8pt; page-break-inside: avoid; background: #fff; }
  h1 { font-size: 22pt; } h2 { font-size: 14pt; } h3 { font-size: 12pt; }
  .steps li { padding-left: 26pt; page-break-inside: avoid; border-bottom: 1px solid #ddd; }
  .steps li::before { background: #eee !important; color: #000 !important; width: 18pt; height: 18pt; font-size: 9pt; }
  .ingredients li { page-break-inside: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
