/* Recipe-specific composition and layout */

/* The shared site shell (css/site.css) centres the header and footer on
   --site-max-width. A recipe page points it at the same width as the recipe
   column, so the shell and the recipe sit in one column. */
body {
  --site-max-width: var(--content-width-normal);
  --section-gap: var(--space-2xl);
}

main {
  margin: 0 auto;
  max-width: var(--content-width-normal);
  width: 100%;
}

article.recipe {
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-lg) min(var(--space-md), 4vw);
  margin-bottom: var(--space-xl);

  /* The recipe's multi-column states depend on how much room the article
     actually has, not on how wide the window is. Querying the container in
     `em` means an enlarged text size collapses the layout back to one column
     instead of starving a track to zero width. */
  container-type: inline-size;
  container-name: recipe;

  /* At 320 px with enlarged text a single long word can be wider than the
     column it sits in. `break-word` breaks such a word only when it cannot
     fit a line on its own, so ordinary wrapping is untouched and no text is
     clipped or scrolled away. */
  overflow-wrap: break-word;
}

/* Recipe header */
.recipe-header {
  margin-bottom: var(--space-xl);
  border-bottom: 2px solid var(--color-accent-soft);
  padding-bottom: var(--space-xl);
}

.recipe-header h1 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-md);
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
}

.recipe-description {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-md);
}

.recipe-yield-label {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-sm);
  display: block;
}

.recipe-yield-display {
  font-size: var(--font-size-lg);
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
}

/* Yield stepper (progressive enhancement, M1-S3) */
.yield-stepper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

/* Label for the editable canonical (dry-equivalent) batch value. It sits on
   its own row above the - / input / + controls and is only present after
   enhancement (the controls live in an inert <template>). */
.yield-input-label {
  flex-basis: 100%;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-xs);
}

.yield-btn {
  flex-shrink: 0;
  min-width: var(--control-height-lg);
  min-height: var(--control-height-lg);
  padding: 0;
  font-size: var(--font-size-lg);
  line-height: 1;
}

.yield-input {
  /* Wide enough for a three-digit canonical batch plus the native spinner;
     at 4rem the padding left only ~2ch of text and clipped "227" to "22". */
  width: 6rem;
  padding-inline: var(--space-sm);
  min-height: var(--control-height-lg);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.print-button {
  width: 100%;
  margin-top: var(--space-sm);
  min-height: var(--control-height-lg);
  background-color: var(--color-surface);
  border-color: var(--color-accent-soft);
  font-weight: var(--font-weight-semibold);
}

/* Display unit / alternate-form controls (progressive enhancement, M2-S2) */
.display-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin-top: var(--space-md);
}

.display-controls fieldset {
  border: none;
  margin: 0;
  padding: 0;
  /* A fieldset defaults to min-inline-size: min-content, which Chromium
     computes as every option side by side; allow it to shrink so the radio
     labels wrap inside the panel at large text sizes. */
  min-inline-size: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

/* recipe-page.js hides the Form group when a recipe declares a single form;
   the display: flex above must not override the hidden attribute. */
.display-controls fieldset[hidden] {
  display: none;
}

.display-controls legend {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  padding: 0;
  margin-right: var(--space-sm);
}

.display-controls label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--control-height-lg);
  padding: 0 var(--space-sm);
  color: var(--color-text);
  cursor: pointer;
}

.display-controls input[type="radio"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-accent);
}

@container recipe (min-width: 42em) {
  .yield-stepper {
    justify-content: flex-end;
  }
}

/* Ingredients section */
.recipe-section {
  margin-bottom: var(--section-gap);
}

.recipe-section h2 {
  font-family: var(--font-serif);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  margin-top: 0;
  margin-bottom: var(--space-lg);
  color: var(--color-text);
}

.recipe-section h2::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 3px;
  margin-bottom: var(--space-md);
  background-color: var(--color-accent);
}

.ingredients-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ingredient-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--space-md);
  row-gap: var(--space-xs);
  padding: var(--space-md) 0;
  margin-bottom: 0;
  background-color: transparent;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  align-items: baseline;
}

.ingredient-item:last-child {
  border-bottom: 0;
}

.ingredient-quantity,
.quantity-block {
  grid-column: 2;
  justify-self: end;
  min-width: 0;
  text-align: right;
}

.ingredient-quantity {
  flex-shrink: 0;
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  font-size: 1.375rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.ingredient-item[data-scaling="fixed"] .ingredient-quantity {
  color: var(--color-text-muted);
  font-weight: var(--font-weight-semibold);
}

/* Bounded spoon visual (progressive enhancement, M2-S2) */
.ingredient-measurement-visual {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
  color: var(--color-accent);
}

.ingredient-item > .ingredient-measurement-visual {
  grid-column: 1 / -1;
  justify-self: end;
  margin-top: var(--space-xs);
}

.spoon-marker {
  display: block;
}

.spoon-overflow {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
}

.ingredient-name {
  flex-grow: 1;
  color: var(--color-text);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
}

.ingredient-note {
  grid-column: 1 / -1;
  display: block;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin-top: var(--space-xs);
  line-height: var(--line-height-normal);
}

/* Instructions section */
.recipe-section:has(.instructions-list) {
  counter-reset: step-counter;
}

.instructions-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.instruction-item {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-lg);
  line-height: var(--line-height-relaxed);
  color: var(--color-text);
  position: relative;
}

.instruction-item::before {
  content: counter(step-counter);
  counter-increment: step-counter;
  position: absolute;
  left: 0;
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
  font-size: var(--font-size-base);
}

.instruction-text {
  display: block;
  margin-bottom: var(--space-sm);
}

.instruction-note {
  display: inline-block;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

/* Method phase grouping */
.instruction-phase {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.instruction-phase:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: var(--space-lg);
}

.instruction-phase h3 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 var(--space-md) 0;
  margin-top: var(--space-lg);
}

.instruction-phase:first-child h3 {
  margin-top: 0;
}

/* Critical callout for heat-off sequence */
.critical-callout {
  background-color: var(--color-surface-alt);
  border-left: 4px solid var(--color-accent);
  padding: var(--space-lg);
  margin: var(--space-lg) 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.critical-callout h3 {
  font-size: var(--font-size-lg);
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
  margin-top: 0;
  margin-bottom: var(--space-md);
}

.critical-callout ol {
  margin: var(--space-md) 0 0 0;
  padding-left: var(--space-lg);
}

.critical-callout li {
  margin-bottom: var(--space-md);
}

/* Nutrition section */
.nutrition-summary {
  background-color: var(--color-surface-alt);
  border-left: 4px solid var(--color-accent);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  border-radius: var(--radius-md);
}

.nutrition-summary h3 {
  margin-top: 0;
  margin-bottom: var(--space-lg);
}

.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(8rem, 100%), 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.nutrition-item {
  text-align: center;
}

.nutrition-value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  display: block;
  margin-bottom: var(--space-xs);
}

.nutrition-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nutrition-disclaimer {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-style: italic;
  line-height: var(--line-height-relaxed);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

/* Troubleshooting section */
.recipe-section dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
}

.recipe-section dt {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  margin: 0;
  padding: 0;
}

.recipe-section dd {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin: 0;
  padding: 0;
  line-height: var(--line-height-relaxed);
}

/* --- Authored guidance tables ------------------------------------------ */

.recipe-section table {
  width: 100%;
  table-layout: fixed;
}

.recipe-section th,
.recipe-section td {
  overflow-wrap: anywhere;
}

/* Recipe notes (general-purpose muted text for sections) */
.recipe-note {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: var(--line-height-normal);
  margin-bottom: var(--space-md);
}

/* Responsive adjustments */
@media (min-width: 768px) {
  article.recipe {
    padding: var(--space-2xl) var(--space-xl);
  }
}

/* Every side-by-side state below is gated on the article's own width in `em`.
   42em is the article width at the 768 px viewport step, so these states begin
   exactly where they did before — but an enlarged text size now makes the same
   article too narrow to qualify, and the layout stays in one column instead of
   collapsing a track to zero and spilling its content. */
@container recipe (min-width: 42em) {
  .recipe-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2xl);
  }

  .recipe-header h1 {
    flex: 1;
    min-width: 0;
  }

  .recipe-yield-group {
    flex-shrink: 0;
    text-align: right;
  }

  .nutrition-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Mobile-first typography adjustments */
@media (max-width: 374px) {
  article.recipe {
    padding: min(var(--space-md), 4vw);
  }

  .recipe-header h1 {
    font-size: var(--font-size-xl);
  }

  .ingredient-quantity {
    min-width: 4rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ingredient-item,
  .nutrition-item {
    transition: none;
  }
}

/* ===========================================================================
   Shared recipe UI system (M3-S2)

   Every component below is generic: it is driven by class/data hooks and the
   accent role tokens, never by which recipe is being rendered. A recipe opts
   in by using the markup; its personality comes from data-recipe-accent.
   =========================================================================== */

/* --- Hero -------------------------------------------------------------- */

.recipe-hero {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.recipe-kicker {
  margin: 0 0 var(--space-sm) 0;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent-strong);
}

.recipe-hero .recipe-title {
  font-family: var(--font-serif);
  font-size: var(--font-size-display);
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--color-text);
  max-width: 46rem;
  margin-bottom: var(--space-md);
  text-wrap: balance;
}

.recipe-title-lead {
  display: block;
  font-size: 0.5em;
  letter-spacing: 0.02em;
  color: var(--color-accent-strong);
  margin-bottom: var(--space-xs);
}

.recipe-lede {
  max-width: 34rem;
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-muted);
  margin-bottom: 0;
}

/* Batch panel: the "what am I cooking right now" summary. */
.batch-panel {
  background-color: var(--color-accent-tint);
  border: 1px solid var(--color-accent-soft);
  border-radius: var(--radius-md);
  /* Capped like the page gutter, so the controls keep a usable width when
     enlarged text narrows the rail. */
  padding: min(var(--space-lg), 6vw);
}

.batch-panel-title {
  margin: 0 0 var(--space-md) 0;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent-strong);
}

.batch-panel .recipe-yield-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

.batch-panel .recipe-yield-display {
  font-size: clamp(2.25rem, 11vw, 3rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  display: block;
}

.batch-panel .recipe-yield-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  text-align: left;
}

.batch-panel .yield-stepper {
  justify-content: flex-start;
}

.recipe-yield-secondary {
  display: block;
  margin-top: var(--space-xs);
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}

.recipe-yield-secondary:empty {
  display: none;
}

/* Batch summary stats: the same live ingredient values as the ingredient
   list, surfaced where the batch is being chosen so a change is visible in
   two places at once. */
.batch-summary {
  list-style: none;
  margin: var(--space-lg) 0 0 0;
  padding: var(--space-lg) 0 0 0;
  border-top: 1px solid var(--color-accent-soft);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
}

.batch-stat {
  margin: 0;
  min-width: 0;
}

.batch-stat-label {
  display: block;
  font-size: var(--font-size-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

.batch-stat-value {
  display: block;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  line-height: 1.1;
  color: var(--color-accent-strong);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.batch-stat-value .ingredient-quantity {
  min-width: 0;
  font-size: inherit;
  color: inherit;
}

.batch-stat-note {
  display: block;
  margin-top: var(--space-xs);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-normal);
  color: var(--color-text-muted);
}

/* --- Quick-size presets ------------------------------------------------ */

.yield-presets {
  display: grid;
  /* Two-up when a preset can be at least 7.5rem wide, otherwise stacked. An
     explicit minimum keeps the buttons from overlapping when enlarged text
     makes the panel narrower than two fixed columns. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.5rem), 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.yield-preset {
  min-width: 0;
  min-height: var(--control-height-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.yield-preset-sub {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-muted);
}

.yield-preset[aria-pressed="true"] {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-on);
}

.yield-preset[aria-pressed="true"] .yield-preset-sub {
  color: inherit;
  opacity: 0.85;
}

/* --- Ingredient rows --------------------------------------------------- */

/* Quantity-forward emphasis: scaled numbers are the largest, most saturated
   text in the row so a batch change is unmistakable. */
.ingredient-item .ingredient-quantity {
  font-size: 1.375rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.ingredient-item .ingredient-name {
  font-weight: var(--font-weight-semibold);
  /* Shrinkable: at 320 px the row must wrap rather than push the quantity
     out of the card. */
  min-width: 6rem;
  overflow-wrap: anywhere;
}

/* An amount that is a ceiling, a range, or an approximation, not an exact
   addition. The prefix is static markup, so it stays true at every batch. */
.quantity-qualifier {
  align-self: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.ingredient-secondary {
  grid-column: 1 / -1;
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}

.ingredient-item[data-emphasis="caution"] {
  border-left: 4px solid var(--color-accent);
  background-color: var(--color-accent-tint);
  padding-left: var(--space-md);
}

/* --- Method phases ----------------------------------------------------- */

.instruction-phase-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.phase-index {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--color-accent);
  line-height: 1;
}

.instruction-phase-header h3 {
  margin: 0;
}

/* --- Critical callout -------------------------------------------------- */

.critical-callout--major {
  background-color: var(--color-accent-tint);
  border: 1px solid var(--color-accent-soft);
  border-left: 6px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.critical-callout--major h3 {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-tight);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--color-accent-strong);
}

.critical-callout-lead {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

/* --- Guided sequence (for an amount that must be added gradually) ------- */

.guide {
  background-color: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: var(--space-lg) 0;
}

.guide h3 {
  margin-top: 0;
}

.guide-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  /* Explicit, so the track is not sized by the longest step's min-content
     width — a grid item's automatic minimum would otherwise push the track,
     and the page, wider than the container at large text sizes. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
}

.guide-step {
  margin: 0;
  padding-left: var(--space-lg);
  position: relative;
  line-height: var(--line-height-relaxed);
  min-width: 0;
  overflow-wrap: anywhere;
}

.guide-step::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: var(--color-accent);
}

.guide-step strong {
  color: var(--color-accent-strong);
}

.guide-stop {
  margin: var(--space-lg) 0 0 0;
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

/* --- Checkpoints ------------------------------------------------------- */

.checkpoint-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
}

.checkpoint {
  margin: 0;
  min-width: 0;
  padding: var(--space-md);
  background-color: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.checkpoint-title {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent-strong);
  margin-bottom: var(--space-sm);
}

.checkpoint-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.checkpoint-list li {
  margin: 0 0 var(--space-xs) 0;
  padding-left: 1.25rem;
  position: relative;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  color: var(--color-text);
}

.checkpoint-list li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
}

.checkpoint-list li[data-check="avoid"]::before {
  content: "\00D7";
  color: var(--color-text-muted);
}

/* --- Rescue / troubleshooting cards ------------------------------------ */

.rescue-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
}

.rescue-card {
  min-width: 0;
  padding: var(--space-md);
  background-color: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent-soft);
  border-radius: var(--radius-md);
}

.rescue-card h3 {
  margin: 0 0 var(--space-xs) 0;
  font-size: var(--font-size-base);
  color: var(--color-accent-strong);
}

.rescue-card p {
  margin: 0;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-muted);
}

/* --- Signature rule ---------------------------------------------------- */

.signature-rule {
  margin: var(--space-2xl) 0 0 0;
  padding: var(--space-xl) var(--space-lg);
  background-color: var(--color-accent);
  color: var(--color-accent-on);
  border-radius: var(--radius-md);
  text-align: center;
}

.signature-rule-kicker {
  display: block;
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.85;
}

.signature-rule-text {
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 7vw, 2.25rem);
  line-height: var(--line-height-tight);
  font-weight: var(--font-weight-bold);
  text-wrap: balance;
}

.signature-rule-note {
  display: block;
  margin: var(--space-md) auto 0;
  max-width: 32rem;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  opacity: 0.9;
}

/* --- Responsive -------------------------------------------------------- */

@container recipe (min-width: 26em) {
  .batch-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-lg);
  }

  .checkpoint-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
  }

  .rescue-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  }
}

@media (min-width: 768px) {
  main:has(.recipe-hero) {
    max-width: var(--content-width-page);
  }

  body {
    --site-max-width: var(--content-width-page);
    --section-gap: var(--space-3xl);
  }
}

@container recipe (min-width: 48em) {
  .batch-summary {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-md);
  }

  /* Ingredients rail beside the method lane at reading widths. */
  .recipe-columns {
    display: grid;
    /* Engages at 48em of article width (a viewport just under 900 px), so a
       768 px tablet keeps the single column: an 18rem rail there would leave
       the method lane — the lane a cook reads from — narrower than a phone.
       Wider containers relax the tracks below. */
    grid-template-columns: minmax(0, 18rem) minmax(0, 1fr);
    gap: var(--space-xl);
    align-items: start;
  }

  .recipe-rail,
  .recipe-main {
    min-width: 0;
  }

  .recipe-main .instruction-item,
  .recipe-main .recipe-note,
  .recipe-main .critical-callout p,
  .recipe-main .guide {
    max-width: 40rem;
  }
}

/* A wider window gives the rail a little more room. The container query above
   still governs whether the grid applies at all, so this only refines track
   widths once that state is already active — it cannot reintroduce an
   overflow at large text sizes. */
@container recipe (min-width: 56em) {
  .recipe-columns {
    grid-template-columns: minmax(0, 21rem) minmax(0, 1fr);
    column-gap: var(--space-3xl);
  }

  /* The title band becomes an editorial split: kicker and title on the left,
     lede seated bottom-right — the same composition the homepage hero uses,
     so both page types read as one product. DOM order is unchanged. */
  .recipe-hero-main {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    grid-template-areas:
      "kicker kicker"
      "title lede";
    column-gap: var(--space-3xl);
    align-items: end;
  }

  .recipe-hero-main .recipe-kicker {
    grid-area: kicker;
  }

  .recipe-hero-main .recipe-title {
    grid-area: title;
    margin-bottom: 0;
  }

  .recipe-hero-main .recipe-lede {
    grid-area: lede;
    /* Sit on the title's baseline rather than floating mid-band. */
    margin-bottom: 0.35em;
  }
}

/* Qualifier + quantity travel together as one unit, so the qualifier never
   drifts away from the number it qualifies when the row wraps. */
.quantity-block {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-xs);
  /* Shrinkable: the pair travels together, but at 320 px with enlarged text
     it must narrow and wrap rather than push the row past the viewport. */
  flex-shrink: 1;
  min-width: 0;
}

.recipe-hero-main {
  min-width: 0;
}

@media print {
  .quantity-block {
    display: inline;
  }
}
