/* How to Cook — a plain, precise, typography-first design.
 *
 * The whole look rests on a few strict rules: two type families (one for text,
 * one for titles), one spacing scale, one narrow content column, one border
 * color, one primary and one secondary text color, no shadows, nearly-square
 * corners, underlined text links. Food photography is the only strong color.
 * Nothing calls attention to itself. */

/* ---------- Fonts ----------
 *
 * Self-hosted from /fonts (copied out of src/fonts by build.js) — the same files
 * the print book embeds, so the blog and the book read as one book. Nothing is
 * fetched from a font CDN.
 *
 * "Cookbook Helvetica" → Helvetica Neue (Roman 400 / Medium 500 / Bold 700 +
 *                        italics): body copy, ingredients, method, navigation,
 *                        labels, subheadings, captions, tables — everything that
 *                        does a job.
 * "Cookbook Serif"     → Source Serif 4 Semibold (600 + its italic), the static
 *                        instances rather than the variable font: titles only.
 *
 * Weights are pinned to the faces below wherever these families are set, so the
 * browser never synthesises a bold or an oblique. */
@font-face {
  font-family: "Cookbook Helvetica";
  src: url("/fonts/HelveticaNeueRoman.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cookbook Helvetica";
  src: url("/fonts/HelveticaNeueItalic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Cookbook Helvetica";
  src: url("/fonts/HelveticaNeueMedium.otf") format("opentype");
  /* Helvetica Neue has no semibold, and the design asks for Medium in exactly
   * the places that used to ask for 600 — small labels, eyebrows, card titles —
   * so the Medium face answers for both. 700 stays Bold. */
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cookbook Helvetica";
  src: url("/fonts/HelveticaNeueBold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cookbook Helvetica";
  src: url("/fonts/HelveticaNeueBoldItalic.otf") format("opentype");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Cookbook Serif";
  src: url("/fonts/SourceSerif4-Semibold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cookbook Serif";
  src: url("/fonts/SourceSerif4-SemiboldIt.ttf") format("truetype");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

:root {
  /* One spacing scale — use these, never arbitrary margins. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  /* One palette. */
  --bg: #f8f8f6;
  --surface: #ffffff;
  --ink: #20201e;
  --ink-soft: #5d5d58;
  --line: #d9d9d4;

  /* One family for text, one for titles (see the @font-face block above). */
  --font: "Cookbook Helvetica", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "Cookbook Serif", "Source Serif 4", Georgia, serif;

  /* One narrow article column; a slightly wider bound for grids. */
  --measure: 720px;
  --maxw: 1080px;

  /* Golden ratio — used to split recipe pages (article : related rails). */
  --phi: 1.618;

  --radius: 2px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-7);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 19px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

/* Underlined text links, in the primary ink color. Navigation and cards opt
   out explicitly below. */
a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: var(--line);
}
a:hover {
  text-decoration-color: var(--ink);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

/* ---------- Titles ----------
 *
 * The serif is reserved for titles: the page heading, the section headings that
 * open a chapter or a landing page, and every recipe title. Navigation, labels,
 * eyebrows, card and rail titles, captions, and tables stay in Helvetica, so the
 * serif marks where the writing starts rather than decorating the furniture.
 *
 * Title case, no tracking, and Semibold — the one serif weight the site loads.
 * The sizes are unchanged from the sans-serif design. */
.hero h1,
.section-title,
.chapter-head h1,
.recipe-head h1,
.recipe-title {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0;
}

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #000;
  border-bottom: 1px solid #000;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-4) 0;
}

.brand {
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  text-decoration: none;
  line-height: 1.1;
  display: flex;
  flex-direction: column;
  white-space: nowrap;
}
.brand:hover {
  text-decoration: none;
}
.brand span {
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
}

.site-nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}
.site-nav a {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
}
.site-nav a:hover {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.site-nav a[aria-current="page"] {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 0.62rem;
  line-height: 1;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.nav-toggle:hover {
  color: #fff;
}
.nav-toggle-icon {
  display: block;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.nav-toggle-label {
  display: block;
}

/* Mobile-only search affordance: a compact icon with a small "Search" label
   stacked beneath it. Hidden on desktop, where the inline search bar shows. */
.search-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 0.62rem;
  line-height: 1;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.search-toggle:hover {
  color: #fff;
}
.search-toggle-icon {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.search-toggle-label {
  display: block;
}

/* ---------- Header search + autocomplete ---------- */

.site-search {
  position: relative;
  flex: 0 0 auto;
}
/* The in-menu copy only exists for the mobile dropdown; on desktop the inline
   bar is the search, so this one stays out of the flow. */
.site-search--menu {
  display: none;
}
.site-search input {
  font: inherit;
  font-size: 0.9rem;
  width: 200px;
  max-width: 40vw;
  padding: var(--space-2) var(--space-3);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.site-search input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}
.site-search input:focus {
  outline: 2px solid #fff;
  outline-offset: 1px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.14);
}
/* Autocomplete dropdown — a plain bordered panel (no shadows, per the design),
   floating just under the input. */
.site-search-suggest {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 280px;
  max-width: 88vw;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-height: 60vh;
  overflow: auto;
  z-index: 60;
}
.site-search-suggest li {
  margin: 0;
}
.site-search-suggest a {
  display: block;
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
  color: var(--ink);
  border-radius: var(--radius);
}
.site-search-suggest a:hover,
.site-search-suggest li.is-active a {
  background: var(--bg);
  text-decoration: none;
}
.site-search-suggest .sugg-title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}
.site-search-suggest .sugg-cat {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.site-search-suggest .sugg-empty {
  padding: var(--space-2) var(--space-3);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ---------- Hero ---------- */

/* A compact page intro, not a banner: the H1 stays for semantics/SEO but the
   section is left-aligned to the content column, small, and low on whitespace.
   The bottom divider is inset to the content column (matching .section-divider)
   rather than spanning the full page width. */
.hero {
  position: relative;
}
.hero-inner {
  position: relative;
  padding: var(--space-6) var(--space-5);
  max-width: var(--maxw);
}
.hero-inner::after {
  content: "";
  position: absolute;
  left: var(--space-5);
  right: var(--space-5);
  bottom: 0;
  border-top: 1px solid var(--line);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 var(--space-4);
}
.hero .eyebrow {
  margin-bottom: var(--space-2);
}
.hero h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  line-height: 1.15;
  margin: 0 0 var(--space-3);
}
.hero-lede {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0 0 var(--space-5);
  max-width: 60ch;
}
.hero-actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  text-decoration: none;
  border-radius: var(--radius);
}
.btn:hover {
  background: #000;
  color: var(--surface);
  text-decoration: none;
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover {
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Home / landing sections ---------- */

.section {
  padding: var(--space-8) var(--space-5);
}
/* The compact hero already sets the top rhythm and draws its own divider, so
   the first section under it doesn't need the full section top padding. */
.hero + .section {
  padding-top: var(--space-6);
}
.section-title {
  font-size: 1.5rem;
  margin: 0 0 var(--space-2);
}
.section-intro {
  color: var(--ink-soft);
  margin: 0 0 var(--space-6);
}
.section-divider {
  border: 0;
  border-top: 1px solid var(--line);
  width: calc(100% - var(--space-5) * 2);
  max-width: calc(var(--maxw) - var(--space-5) * 2);
  margin: 0 auto;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
}
/* The "Browse by category" grid packs more, smaller tiles: up to 5 per row on
   desktop, stepping down on narrower viewports. */
.chapter-grid--compact {
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}
@media (min-width: 640px) {
  .chapter-grid--compact {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 960px) {
  .chapter-grid--compact {
    grid-template-columns: repeat(5, 1fr);
  }
}
.chapter-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.chapter-card:hover {
  border-color: var(--ink-soft);
  text-decoration: none;
}
.chapter-card-media {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--bg);
  position: relative;
  border-bottom: 1px solid var(--line);
}
.chapter-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Collage tiles reuse the single-image media box untouched: the images stay
   absolutely positioned (so they contribute no height and the box keeps its
   16/9 aspect ratio), and are placed into quadrants instead of filling it. The
   2px seams are the card background showing through the calc() insets. */
.category-card-collage img {
  width: calc(50% - 1px);
  height: calc(50% - 1px);
}
.category-card-collage img:nth-child(1) {
  inset: 0 auto auto 0;
}
.category-card-collage img:nth-child(2) {
  inset: 0 0 auto auto;
}
.category-card-collage img:nth-child(3) {
  inset: auto auto 0 0;
}
.category-card-collage img:nth-child(4) {
  inset: auto 0 0 auto;
}
/* Two images: side-by-side halves. */
.category-card-collage--2 img {
  height: 100%;
}
/* Three images: one full-width image on top, two half-width below. */
.category-card-collage--3 img:nth-child(1) {
  width: 100%;
  height: calc(50% - 1px);
  inset: 0 0 auto 0;
}
.category-card-collage--3 img:nth-child(2) {
  inset: auto auto 0 0;
}
.category-card-collage--3 img:nth-child(3) {
  inset: auto 0 0 auto;
}
/* One image: fill the whole box (base .chapter-card-media img rule). */
.category-card-collage--1 img {
  width: 100%;
  height: 100%;
}
.card-media-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--line);
}
.chapter-card--soon {
  cursor: default;
  border-style: dashed;
}
.chapter-card--soon:hover {
  border-color: var(--line);
}
.chapter-card--soon .card-media-fallback,
.chapter-card--soon .chapter-card-title,
.chapter-card--soon .chapter-card-blurb {
  color: var(--ink-soft);
}

.chapter-card-body {
  padding: var(--space-4) var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.chapter-card-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}
.chapter-card-title {
  font-size: 1.3rem;
  font-weight: 700;
}
.chapter-card-blurb {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ---------- Search + recipe grid ---------- */

.search {
  margin: 0 0 var(--space-6);
  max-width: 420px;
}
.search input {
  width: 100%;
  font: inherit;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.search input:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
  border-color: transparent;
}
.search-empty {
  color: var(--ink-soft);
  margin: var(--space-4) 0 0;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-5);
}
.recipe-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.recipe-card:hover {
  border-color: var(--ink-soft);
  text-decoration: none;
}
.recipe-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.recipe-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.recipe-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  padding: var(--space-4) var(--space-4) var(--space-1);
  /* Push the title + category to the bottom so they align across a row of
     cards with differing title lengths. */
  margin-top: auto;
}
.recipe-card-part {
  font-size: 0.8rem;
  color: var(--ink-soft);
  padding: 0 var(--space-4) var(--space-4);
}

.section-more {
  margin: var(--space-6) 0 0;
}
.section-more a {
  font-weight: 600;
}

/* ---------- Category (by-ingredient) pill nav ---------- */

.cat-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-6);
}
.cat-pill {
  font-size: 0.9rem;
  line-height: 1;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  text-decoration: none;
}
.cat-pill:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
  text-decoration: none;
}
.cat-pill.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}
.cat-pill.is-active:hover {
  color: var(--surface);
}

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

.chapter {
  padding: var(--space-7) 0 var(--space-8);
}
.chapter-layout {
  display: grid;
  /* Parts nav · base-technique body · recipe rail. Kept within --maxw so the
     columns line up with the site header and footer. The rails are trimmed a
     touch so the reading column in the middle gets a little more room. */
  grid-template-columns: 200px minmax(0, 1fr) 248px;
  gap: var(--space-5);
  align-items: start;
}

.chapter-aside {
  position: sticky;
  top: var(--space-7);
  align-self: start;
  font-size: 0.95rem;
}

.series-nav {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--line);
}
.series-nav .chapter-nav-title a {
  color: inherit;
  text-decoration: none;
}
.series-nav .chapter-nav-title a:hover {
  text-decoration: underline;
}
/* The parts list reuses the recipe rail's card look (thumbnail + title) so both
   sidebars read the same way. Tighter gap + smaller thumbs keep 10 parts compact. */
.series-parts {
  gap: var(--space-2);
}
.series-part-card {
  grid-template-columns: 60px minmax(0, 1fr);
}
.series-part-card .rail-card-media {
  width: 60px;
  height: 60px;
}
.series-part-card .rail-card-text {
  padding: var(--space-2) var(--space-3);
}
.series-part-card .rail-card-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.series-part-card:hover .rail-card-title {
  color: var(--ink);
}
.series-part-card.is-active {
  border-color: var(--ink);
}
.series-part-card.is-active .rail-card-title {
  color: var(--ink);
  font-weight: 700;
}

.chapter-nav-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  font-weight: 600;
  margin: 0 0 var(--space-3);
}
.chapter-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.chapter-nav > ul {
  border-left: 1px solid var(--line);
}
.chapter-nav li {
  margin: 0;
}
.chapter-nav a {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-left: 1px solid transparent;
  margin-left: -1px;
}
.chapter-nav a:hover {
  color: var(--ink);
}
.chapter-nav a.is-active {
  color: var(--ink);
  border-left-color: var(--ink);
  font-weight: 600;
}
.chapter-nav ul ul a {
  padding-left: var(--space-5);
  font-size: 0.85rem;
}

.chapter-body {
  min-width: 0;
  max-width: var(--measure);
}

/* ---------- Chapter recipe rail (right-hand tiles) ---------- */

.chapter-recipes {
  position: sticky;
  top: var(--space-7);
  align-self: start;
  min-width: 0;
}
.rail-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
/* Short, wide tile: square thumbnail flush-left, title beside it. */
.rail-card {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
/* Author display rules beat the UA [hidden] stylesheet, so restate it. */
.rail-card[hidden] {
  display: none;
}
.rail-card:hover {
  border-color: var(--ink-soft);
  text-decoration: none;
}
.rail-card-media {
  position: relative;
  width: 80px;
  height: 80px;
  background: var(--bg);
  border-right: 1px solid var(--line);
}
.rail-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rail-card .card-media-fallback {
  font-size: 1.75rem;
}
.rail-card-text {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
}
.rail-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
}

/* "This recipe combines" — a tinted module on a combined recipe page (e.g.
   Steak Bordelaise, the merged Lasagna) linking out to the standalone recipes
   it folds together. Its tiles sit side by side, wrapping on narrow screens. */
.recipe-components {
  margin: 0 0 var(--space-6);
  padding: var(--space-5);
  background: #f1f1ec;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.recipe-components .rail-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}

/* ---------- Chapter / recipe headers ---------- */

.chapter-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-6);
}
.chapter-head h1 {
  font-size: clamp(1.9rem, 4vw, 2.4rem);
  line-height: 1.16;
  margin: 0 0 var(--space-3);
}
.chapter-head .lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- Prose / recipe sections ---------- */

.recipe {
  padding: var(--space-7) 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: var(--space-7);
}
.recipe:first-of-type {
  border-top: 0;
}
.recipe--sub {
  padding-left: var(--space-5);
  border-left: 1px solid var(--line);
}

.recipe-title {
  line-height: 1.25;
  margin: 0 0 var(--space-4);
  position: relative;
}
h2.recipe-title {
  font-size: 1.6rem;
}
h3.recipe-title {
  font-size: 1.25rem;
}
/* The hover "#" is an affordance, not part of the title — keep it in the sans. */
.recipe-title .anchor {
  position: absolute;
  left: -1.1em;
  top: 0;
  color: var(--line);
  text-decoration: none;
  font-family: var(--font);
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.recipe-title:hover .anchor {
  opacity: 1;
}
.recipe-title .anchor:hover {
  color: var(--ink);
}

.recipe p {
  margin: 0 0 var(--space-4);
}
.recipe .block-label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-soft);
  margin: var(--space-6) 0 var(--space-3);
}
.recipe ul,
.recipe ol {
  margin: 0 0 var(--space-5);
  padding-left: var(--space-5);
}
.recipe li {
  margin: 0 0 var(--space-2);
}
.recipe ol li {
  padding-left: var(--space-1);
}
/* Ingredient bullets are a checklist: tap the row to mark it off. */
.recipe ul.ingredient-list {
  list-style: none;
  padding-left: 0;
}
.recipe ul.ingredient-list label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
}
.recipe ul.ingredient-list input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin: 0;
  border: 1px solid var(--ink-soft);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.recipe ul.ingredient-list input:checked {
  background: var(--ink);
  border-color: var(--ink);
}
.recipe ul.ingredient-list input:checked::after {
  content: "";
  width: 0.28rem;
  height: 0.5rem;
  margin-top: -0.12rem;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.recipe ul.ingredient-list input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.recipe ul.ingredient-list input:checked + span {
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.recipe em {
  color: inherit;
}
/* A paragraph that is entirely italic (marked .aside at build time) is an
   aside / caption. Inline <em> inside prose stays inline (see .recipe em). */
.recipe p.aside {
  color: var(--ink-soft);
  border-left: 1px solid var(--line);
  padding-left: var(--space-4);
  font-size: 1rem;
}
/* An italic label sitting directly above a list (e.g. "For the meatballs:")
   is a group subheading, not a caption — hug it to the list, no aside border. */
.recipe p.list-label {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1rem;
  margin: var(--space-5) 0 var(--space-2);
}

/* Figures / images — the only strong color on the page. */
.recipe-figure {
  margin: var(--space-6) 0;
}
.recipe-figure img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.recipe-figure figcaption {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-top: var(--space-2);
}
.figure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin: var(--space-6) 0;
}
.figure-grid .recipe-figure {
  margin: 0;
}
/* A fixed two-column grid (e.g. a 2x2 sequence of process shots). */
.figure-grid--2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.figure-grid--2col .recipe-figure img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: var(--space-6) 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
  background: var(--surface);
}
th,
td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
}
th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 600;
}
tr:last-child td {
  border-bottom: 0;
}

/* Link from a chapter section out to its standalone recipe page */
.recipe-permalink {
  margin: 0 0 var(--space-5);
}
.recipe-permalink a {
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.recipe-permalink a:hover {
  color: var(--ink);
}

/* ---------- Standalone recipe pages ---------- */

.recipe-page {
  padding: var(--space-7) 0 var(--space-8);
}
/* Recipe left, related rails right — split by the golden ratio (φ : 1). */
.recipe-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr);
  gap: var(--space-7);
  align-items: start;
}
/* No ingredient-category rail (the technique siblings now live in the carousel
   under the base-technique link): collapse to a single article column. */
.recipe-layout:not(:has(.recipe-aside)) {
  grid-template-columns: minmax(0, 1fr);
  max-width: var(--measure);
}
/* Sized so the smaller (1) side can hold two ~250px rail columns:
   2 × 250 × (φ + 1) ≈ the full content width. */
.page-recipe .wrap {
  max-width: calc(250px * 2 * (1 + var(--phi)) + var(--space-7));
}
.recipe-article {
  min-width: 0;
}
.recipe-main {
  min-width: 0;
}

.recipe-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-6);
}
.recipe-head h1 {
  font-size: clamp(1.9rem, 4vw, 2.4rem);
  line-height: 1.16;
  margin: 0 0 var(--space-3);
}
.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-4) 0 0;
}
.recipe-chip {
  font-size: 0.8rem;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius);
}
.recipe-chip--link {
  text-decoration: none;
}
.recipe-chip--link:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
  text-decoration: none;
}

.recipe--page {
  border-top: 0;
  padding-top: 0;
}
.recipe--page:first-of-type {
  border-top: 0;
}

/* Cook mode utility — compact wake-lock + share strip on recipe pages, sitting
   between the intro and Ingredients. Dividers frame it; almost no bottom pad. */
.cook-mode-bar {
  margin: var(--space-5) 0 0;
  padding: var(--space-3) 0 0.2rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.cook-mode-bar + .block-label {
  margin-top: var(--space-5);
}
.cook-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.cook-mode-control {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
}
.cook-mode-switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 2.5rem;
  height: 1.45rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #d0d0cb;
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.15s ease;
}
.cook-mode-switch::before {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease;
}
.cook-mode-switch:checked {
  background: var(--ink);
}
.cook-mode-switch:checked::before {
  transform: translateX(1.05rem);
}
.cook-mode-switch:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.cook-mode-label {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
}
.cook-mode-hint {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--ink-soft);
}
.cook-mode-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-shrink: 0;
  margin: 0;
  padding: 0.45rem 0.75rem;
  border: 0;
  border-radius: 4px;
  background: #000;
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.cook-mode-share:hover,
.cook-mode-share:focus-visible {
  background: #1a1a1a;
}
.cook-mode-share:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.cook-mode-share-icon {
  display: block;
  flex-shrink: 0;
}

.recipe-back {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* Technique module: the base-technique link and the carousel of other recipes
   that share the technique are one idea, so they live in a single, lightly
   tinted container — just perceptibly different from the page — that sits above
   the recipe. */
.technique-module {
  margin: 0 0 var(--space-6);
  padding: var(--space-5);
  background: #f1f1ec;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.technique-module-label {
  margin: 0 0 var(--space-4);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--ink);
}

/* The base technique itself is the dominant call to action in the module: a
   full-width near-black button with an arrow pushed to the far right. */
.recipe-technique {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0 0;
  padding: var(--space-4) var(--space-5);
  border: 1px solid #000000;
  border-radius: var(--radius);
  background: #000000;
  color: var(--surface);
  font-size: 1rem;
  text-decoration: none;
  transition: background 0.15s ease;
}
.recipe-technique:hover,
.recipe-technique:focus-visible {
  background: #1a1a1a;
}
.recipe-technique-title {
  font-weight: 600;
  color: var(--surface);
}
.recipe-technique-arrow {
  margin-left: auto;
  padding-left: var(--space-3);
  font-weight: 600;
  color: var(--surface);
  transition: transform 0.15s ease;
}
.recipe-technique:hover .recipe-technique-arrow,
.recipe-technique:focus-visible .recipe-technique-arrow {
  transform: translateX(3px);
}

/* Right-hand "more like this" rails on recipe pages. Each rail reuses the
   chapter rail's tiles, and there's one per place the recipe lives: its chapter
   siblings plus every ingredient category it belongs to. On desktop with two
   or more rails, they sit in a two-column grid (grid scrolls more reliably
   than CSS multi-column inside an overflow pane). */
.recipe-aside {
  min-width: 0;
}
.recipe-aside:has(.recipe-rail + .recipe-rail) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6) var(--space-5);
  align-content: start;
}
.recipe-rail {
  min-width: 0;
}
.rail-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  font-weight: 600;
  margin: 0 0 var(--space-3);
}
.rail-title a:not(.recipe-chip) {
  color: inherit;
  text-decoration: none;
}
.rail-title a:not(.recipe-chip):hover {
  color: var(--ink);
  text-decoration: underline;
}
/* Category chip inside a rail heading — inherits the title's uppercase. */
.rail-title .recipe-chip {
  letter-spacing: normal;
  font-weight: 500;
  font-size: 0.75rem;
  line-height: 1.2;
}
/* Technique carousel: the chapter/technique siblings shown as a horizontal,
   scroll-snapping strip, sitting inside the technique module beneath the
   base-technique button. */
.recipe-rail--carousel {
  margin: 0;
}
.rail-carousel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin: 0 0 var(--space-4);
}
.rail-carousel-head .technique-module-label {
  margin: 0;
}
.rail-carousel-nav {
  display: flex;
  gap: var(--space-2);
  margin: 0;
}
.rail-carousel-nav[hidden] {
  display: none;
}
.rail-carousel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  font: inherit;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.rail-carousel-btn:hover:not(:disabled) {
  border-color: var(--ink-soft);
  color: var(--ink);
}
.rail-carousel-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.rail-list--carousel {
  display: flex;
  flex-direction: row;
  gap: var(--space-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  /* Scrollbar hidden — the strip scrolls via wheel, drag, and the nav buttons.
     No scroll-snap: proximity snapping was fighting (and undoing) small wheel
     steps, so the strip scrolls freely instead. */
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* Full-bleed to both module borders. The leading padding keeps the first tile
     lined up with the button at rest, but scrolls away so tiles clip flush on
     the left too; the right edge sits on the border with no padding. */
  margin-left: calc(-1 * var(--space-5));
  margin-right: calc(-1 * var(--space-5));
  padding-left: var(--space-5);
  scroll-padding-left: var(--space-5);
}
.rail-list--carousel::-webkit-scrollbar {
  display: none;
}
/* Carousel tiles are poster-style: image on top in a fixed 4:3 frame, title
   beneath. Sized so ~3⅓ show (rightmost clipped). The image is absolutely
   positioned so its intrinsic height can't push the frame past 4:3 — every
   tile's image is therefore exactly the same height. */
.rail-list--carousel .rail-card {
  display: flex;
  flex-direction: column;
  flex: 0 0 calc((100% - 3 * var(--space-3)) / 3.333);
}
.rail-list--carousel .rail-card-media {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  border-right: 0;
  border-bottom: 1px solid var(--line);
}
.rail-list--carousel .rail-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Title pinned to the bottom so titles line up across tiles of differing
   height. */
.rail-list--carousel .rail-card-text {
  flex: 1;
  align-items: flex-end;
  padding: var(--space-3);
}

/* ---------- Pager ---------- */

.pager {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}
.pager a {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  max-width: 48%;
}
.pager a:hover {
  border-color: var(--ink-soft);
}
.pager a span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}
.pager-next {
  text-align: right;
  margin-left: auto;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: var(--space-8);
}
.site-footer .wrap {
  padding: var(--space-6) var(--space-5);
}
.site-footer p {
  margin: 0 0 var(--space-1);
}
.site-footer .muted {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ---------- Responsive ---------- */

/* The chapter's three columns get cramped before the recipe page's two do,
   so collapse them to a single stacked column a bit earlier. */
@media (max-width: 1080px) {
  .chapter-layout {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    max-width: var(--measure);
  }
  .chapter-aside {
    position: static;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--space-4) var(--space-5);
  }
  .chapter-nav > ul {
    border-left: 0;
  }
  .chapter-recipes {
    position: static;
  }
}

@media (max-width: 1100px) {
  .recipe-layout {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  .page-recipe .wrap {
    max-width: var(--maxw);
  }
  .recipe-aside:has(.recipe-rail + .recipe-rail) {
    display: block;
  }
  .recipe-rail + .recipe-rail {
    margin-top: var(--space-6);
  }
}

@media (max-width: 720px) {
  body {
    font-size: 18px;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    gap: 0;
    background: #1a1a1a;
    border-bottom: 1px solid #000;
    padding: var(--space-4) var(--space-4) var(--space-4);
  }
  .site-nav.is-open {
    display: flex;
  }
  .site-nav a {
    padding: var(--space-3) 0;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.72);
  }
  .site-nav a:hover,
  .site-nav a[aria-current="page"] {
    color: #fff;
  }
  .header-inner {
    position: relative;
    gap: var(--space-3);
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
  /* On small screens: hamburger far left, brand next, and the search icon+label
     pinned to the right. The full search bar and the nav both drop beneath the
     top bar when opened. */
  .nav-toggle {
    order: 0;
    margin-left: 0;
  }
  .brand {
    order: 1;
  }
  .search-toggle {
    display: inline-flex;
    order: 2;
    margin-left: auto;
  }
  /* The inline "bar" search becomes a panel that slides down under the header. */
  .site-search--bar {
    order: 3;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex: 0 0 auto;
    margin: 0;
    padding: 0 var(--space-4);
    background: #1a1a1a;
    border-bottom: 1px solid #000;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: visible;
    transition: transform 0.25s ease, opacity 0.22s ease, max-height 0.28s ease,
      padding 0.28s ease, visibility 0.28s;
  }
  .site-search--bar.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    max-height: 120px;
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
  }
  /* The in-menu search sits at the very top of the open hamburger panel. */
  .site-search--menu {
    display: block;
    order: -1;
    width: 100%;
    margin: 0 0 var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }
  .site-search input {
    width: 100%;
    max-width: none;
  }
  .site-search-suggest {
    right: auto;
    left: 0;
  }
  /* Both mobile search surfaces (the drop-down bar and the in-menu field) sit on
     a dark panel, so their suggestions get a light-on-dark treatment and run the
     full width of the field. */
  .site-search--menu .site-search-suggest,
  .site-search--bar .site-search-suggest {
    min-width: 0;
    max-width: none;
    background: #242424;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.14);
  }
  .site-search--menu .site-search-suggest a,
  .site-search--bar .site-search-suggest a {
    color: rgba(255, 255, 255, 0.92);
  }
  .site-search--menu .site-search-suggest a:hover,
  .site-search--menu .site-search-suggest li.is-active a,
  .site-search--bar .site-search-suggest a:hover,
  .site-search--bar .site-search-suggest li.is-active a {
    background: rgba(255, 255, 255, 0.1);
  }
  .site-search--menu .site-search-suggest .sugg-title,
  .site-search--bar .site-search-suggest .sugg-title {
    color: #fff;
  }
  .site-search--menu .site-search-suggest .sugg-cat,
  .site-search--menu .site-search-suggest .sugg-empty,
  .site-search--bar .site-search-suggest .sugg-cat,
  .site-search--bar .site-search-suggest .sugg-empty {
    color: rgba(255, 255, 255, 0.6);
  }
  /* In-menu: flow the list in place so it pushes the nav links down rather than
     floating over them. */
  .site-search--menu .site-search-suggest {
    position: static;
    width: 100%;
    margin-top: var(--space-2);
  }
  /* Top-bar: keep the list floating just under the drop-down panel, full width. */
  .site-search--bar .site-search-suggest {
    left: 0;
    right: 0;
  }
  .hero-inner {
    padding: var(--space-5) var(--space-5);
  }
  .recipe-title .anchor {
    display: none;
  }
  .pager a {
    max-width: 100%;
  }
  .pager {
    flex-direction: column;
  }
  .figure-grid--2col {
    grid-template-columns: 1fr;
  }
}
