/*
 * Global design tokens, typography, and shared UI patterns.
 *
 * Propshaft serves each stylesheet individually — no bundling. This file
 * is loaded in the application layout alongside navigation.css, editor.css,
 * nutrition.css, recipe.css, and print.css. Page-specific sheets (menu.css,
 * groceries.css, ingredients.css) load via content_for(:head).
 *
 * Conventions:
 * - Color tokens: all in :root below — check before inventing new names
 * - Icons: IconHelper#icon(name, size:) / JS buildIcon(name, size) — never raw SVG
 * - Inputs: .input-base + modifiers
 * - Buttons: .btn + modifiers
 * - Collapse: <details class="collapse-header"> pattern
 * - Section heading: .section-heading + --ledger modifier + __rule element (italic-serif H2 + ledger rule)
 * - Editor classes: editor- prefix
 * - [hidden] override: explicit CSS `display` values beat the HTML
 *   `hidden` attribute. Add `selector[hidden] { display: none }`
 *   when a custom display rule needs to coexist with the attribute.
 *
 * Responsive: page chrome uses @media queries (pantry.css's
 * @media (max-width: 640px) is the worked example).
 *
 * Collaborators: navigation.css, editor.css, nutrition.css (page-level peers),
 *   IconHelper, base layout (application.html.erb)
 */

/* Self-hosted webfonts (SIL OFL). Replaces Google Fonts to remove a
 * render-blocking cross-origin CSS request that gated first paint by
 * ~150ms on Slow 4G. Source: @fontsource/instrument-serif 5.2.8,
 * @fontsource-variable/outfit 5.2.8. The Instrument Serif latin subset is
 * preloaded by the application layout because it owns the H1 (LCP element). */
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/instrument-serif-latin-400-normal-af2fa92a.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/instrument-serif-latin-ext-400-normal-2a7fe9c0.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/instrument-serif-latin-400-italic-2b919920.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/instrument-serif-latin-ext-400-italic-4940d809.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/outfit-latin-wght-normal-c0a8d111.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/outfit-latin-ext-wght-normal-e51c1c3c.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* Universal border-box — every element sizes width/height inclusive of
   padding + border. Modern default; makes design-tool-generated components
   predictable. The per-element `box-sizing: border-box` patches elsewhere
   (.input-base, .pill, .editor-textarea, …) are now redundant but harmless. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Outfit", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;

  /* Canonical color tokens */
  --ground: #faf8f5;
  --text: #2d2a26;
  --text-soft: #706960;
  --text-light: #a09788;
  --text-faint: #c8bfb2; /* faintest text rung — struck-off groceries, meta counts */
  --red: #b33a3a;
  --red-light: rgba(179, 58, 58, 0.08);
  --tag-filter-active-bg: rgba(179, 58, 58, 0.15);
  --rule: #e4dfd8;
  --rule-faint: #eee9e3;

  --surface-alt: #f7f5f1;
  --hover-bg: var(--red-light);
  --hover-bg-strong: rgba(179, 58, 58, 0.15);

  --input-bg: white;
  --accent-hover: #993030;
  --scaled-highlight: rgba(255, 243, 205, 0.6);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-dialog: 0 4px 24px rgba(0, 0, 0, 0.15);
  --dialog-backdrop: rgba(0, 0, 0, 0.5);
  --aisle-renamed-bg: #fff8e1;
  --aisle-renamed-border: #ffe082;
  --aisle-new-bg: #e8f5e9;
  --aisle-new-border: #a5d6a7;
  --broken-reference-bg: #fdf6f0;
  --aisle-row-border: #e0e0e0;
  --danger-hover-bg: rgba(204, 0, 0, 0.08);

  /* Notification bar — upward-facing nav shadow */
  --shadow-nav-up: 0 -2px 4px rgba(0, 0, 0, 0.08), 0 -1px 2px rgba(0, 0, 0, 0.04);

  /* Tag/category pill colors */
  --tag-bg: #e8e3db;
  --tag-text: #4a4540;
  --cat-bg: #dde7d8;
  --cat-text: #3a4a35;

  /* Smart tag color groups */
  --smart-green-bg: #d4edda;    --smart-green-text: #1b5e20;
  --smart-amber-bg: #fff3cd;    --smart-amber-text: #7a5d00;
  --smart-blue-bg: #d6eaf8;     --smart-blue-text: #1a4a6e;
  --smart-rose-bg: #f5e0d0;     --smart-rose-text: #6e3222;
  --smart-purple-bg: #e8daf5;   --smart-purple-text: #4a2080;
  --smart-cuisine-bg: #f5ddd0;  --smart-cuisine-text: #6e3a22;

  /* Design-system semantic roles — kept neutral so the brand red carries
   * focus. --danger is the canonical danger role. */
  --positive: #4a7a4a;
  --warning:  #b8862a;
  --danger:   #c00;
  --info:     #4a6e8a;

  /* "Her" jewel-tone pigments — sparing use for tag color + illustration. */
  --pigment-rose:  #e6a896;
  --pigment-clay:  #c87a5a;
  --pigment-amber: #d9a847;
  --pigment-leaf:  #6b8a5a;
  --pigment-mint:  #a8c5a8;
  --pigment-sky:   #8aa7c0;
  --pigment-plum:  #a87c8c;
  --pigment-stone: #b8a995;

  /* Transition timing — use these instead of bare durations */
  --duration-fast: 0.12s;
  --duration-normal: 0.2s;
  --duration-slow: 0.35s;
  --duration-bloop: 0.25s;

  /* Page gutter — sole survivor of the gingham-tablecloth tokens (the
     tablecloth gradient is inlined in html{}, not token-driven). */
  --gingham-gap: 1.5rem;
  --content-card-bg: rgb(255, 252, 249);
  --paper-opacity: 0.06;
  --noise-tile: 200px;   /* reserved for Track B paper-texture (D4/#1388); inert today */

  /* Pantry pip-width scale — clamp()-scaled cadence pip widths; --pip-w is
     the active width, overridden per-row by [data-cadence] in pantry.css. */
  --pip-w-frequent:   clamp(2px, 0.6vw, 3px);
  --pip-w-regular:    clamp(3px, 1.0vw, 5px);
  --pip-w-occasional: clamp(5px, 1.7vw, 8px);
  --pip-w-rare:       clamp(7px, 2.5vw, 11px);
  --pip-w: var(--pip-w-regular);

  /* Pantry v2 design tokens — see docs/superpowers/specs/2026-05-03-ph2-background-tokens-design.md */

  /* Spacing scale */
  --space-0: 0;
  --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: 4rem;
  --space-9: 6rem;
  --gutter: 1.5rem;   /* design-system page gutter */

  /* Radius scale */
  --radius-xs: 2px;
  --radius-sm: 3px;
  --radius-md: 0.4rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1.25rem;
  --radius-pill: 999px;

  /* Stacking order, low -> high. Global chrome only; page-local stacks stay literal. */
  --z-raised: 10;
  --z-nav: 30;
  --z-nav-overflow: 80;
  --z-overlay: 90;
  --z-toast: 100;
  --z-progress: 2147483647;

  /* Type scale (root font-size = 18px) */
  --type-xs: 0.72rem;
  --type-sm: 0.85rem;
  --type-base: 1rem;
  --type-lg: 1.15rem;
  --type-xl: 1.3rem;
  --type-2xl: 1.4rem;
  --type-3xl: 2.6rem;
  --type-4xl: 3.8rem;
  --type-5xl: 5.6rem;       /* curtain-rise hero (rare) */

  /* Line-height scale — typographic leading tokens */
  --leading-flat: 1;        /* UI resets, single-line chrome */
  --leading-tight: 1.2;     /* large/display headings */
  --leading-snug: 1.35;     /* section headings */
  --leading-body: 1.4;      /* body default */
  --leading-relaxed: 1.5;   /* long-form copy */
  --leading-prose: 1.75;    /* recipe instructions / long prose */

  /* Letter-spacing scale */
  --tracking-normal: 0;
  --tracking-tight: -0.01em;
  --tracking-wide: 0.12em;  /* uppercase eyebrows */

  /* Easing curves */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-bloop: cubic-bezier(0.16, 0.75, 0.40, 1);

  /* Paper shadow — 3-layer with directional offset */
  --shadow-paper:
    0 1px 3px rgba(0, 0, 0, 0.07),
    0 4px 8px rgba(0, 0, 0, 0.05),
    3px 8px 14px rgba(0, 0, 0, 0.08);

  /* Pressed-state inset — recipe cards / pressable surfaces */
  --shadow-press: inset 0 1px 2px rgba(0, 0, 0, 0.06);

  /* ── Pantry surfaces (Ph3) ─────────────────────────────────── */
  --editor-panel-bg: #faf6ef;

  /* Nav button vocabulary — lifted from Mirepoix_Design_System-2026-05-27/colors_and_type.css.
   * Aliases first: design-system names mapped to existing tokens of the same value.
   * The originals stay where they are; aliases let nav CSS use design-system names.
   */
  --red-deep:    var(--accent-hover);             /* #993030 */
  --red-soft:    var(--red-light);                /* rgba(179, 58, 58, 0.08) */
  --red-soft-2:  var(--hover-bg-strong);          /* rgba(179, 58, 58, 0.15) */

  /* Genuinely new colors */
  --ground-deep: #f3ede4;
  --red-glow:    rgba(179, 58, 58, 0.42);

  /* Button vocabulary — interactive shadow recipes */
  --shadow-deboss:
    inset 0 1px 3px rgba(0, 0, 0, 0.12),
    inset 0 -1px 0 rgba(255, 255, 255, 0.30);
  --shadow-deboss-deep:
    inset 0 2px 5px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(0, 0, 0, 0.04),
    inset 0 -1px 0 rgba(255, 255, 255, 0.40);
  --shadow-deboss-modal:
    inset 0 1px 3px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.02),
    0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-emboss:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-emboss-bordered:
    inset 0 0 0 1px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.04);

  /* Halos — backlit-paper hover glow */
  --halo-text: 0 0 5px var(--red-glow);
  --halo-icon: drop-shadow(0 0 5px var(--red-glow));

  /* Pill chrome — frosted paper capsule */
  --pill-bg:     rgba(255, 252, 249, 0.72);
  --pill-border: rgba(0, 0, 0, 0.07);
  --pill-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -1px 0 rgba(0, 0, 0, 0.04),
    0 1px 3px rgba(0, 0, 0, 0.08),
    0 6px 14px rgba(0, 0, 0, 0.10),
    3px 12px 28px rgba(0, 0, 0, 0.14);

  /* Popovers — brand menu, search sheet */
  --shadow-popover:
    0 1px 3px rgba(0, 0, 0, 0.08),
    0 4px 10px rgba(0, 0, 0, 0.06),
    3px 8px 22px rgba(0, 0, 0, 0.14);
  --shadow-popover-lg:
    0 1px 3px rgba(0, 0, 0, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.14),
    3px 14px 36px rgba(0, 0, 0, 0.16);

  /* Additional motion */
  --ease-curtain:     cubic-bezier(0.22, 0.61, 0.36, 1);
  --duration-curtain: 0.6s;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Canonical dark-mode color tokens */
    --ground: #1e1b18;
    --text: #dcd7d0;
    --text-soft: #a09788;
    --text-light: #706960;
    --text-faint: #4a443d;
    --red: #c85050;
    --red-light: rgba(200, 80, 80, 0.12);
    --tag-filter-active-bg: rgba(200, 80, 80, 0.2);
    --rule: #3a3530;
    --rule-faint: #2e2a26;

    --surface-alt: #2a2724;
    --danger: #d05050;
    --hover-bg: rgba(255, 255, 255, 0.04);
    --hover-bg-strong: rgba(200, 80, 80, 0.22);

    --input-bg: #1a1816;
    --accent-hover: #a03838;
    --scaled-highlight: rgba(180, 140, 60, 0.2);

    /* Shadows — reduced opacity for dark backgrounds */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-dialog: 0 4px 24px rgba(0, 0, 0, 0.3);
    --dialog-backdrop: rgba(0, 0, 0, 0.65);
    --shadow-nav-up: 0 -2px 4px rgba(0, 0, 0, 0.16), 0 -1px 2px rgba(0, 0, 0, 0.08);

    /* Status indicators */
    --aisle-renamed-bg: rgba(180, 140, 40, 0.15);
    --aisle-renamed-border: rgba(180, 140, 40, 0.3);
    --aisle-new-bg: rgba(60, 140, 70, 0.15);
    --aisle-new-border: rgba(60, 140, 70, 0.3);
    --broken-reference-bg: rgb(42, 36, 32);
    --aisle-row-border: rgb(55, 52, 48);
    --danger-hover-bg: rgba(220, 60, 50, 0.12);

    /* Tag/category pill colors */
    --tag-bg: #3a3530;
    --tag-text: #c8c0b5;
    --cat-bg: #2e3a2b;
    --cat-text: #a8c8a0;

    /* Smart tag color groups */
    --smart-green-bg: #1a3a1e;    --smart-green-text: #a8d8a0;
    --smart-amber-bg: #3a3018;    --smart-amber-text: #d8c070;
    --smart-blue-bg: #1a2e3e;     --smart-blue-text: #90c0e0;
    --smart-rose-bg: #3a2420;     --smart-rose-text: #d8a890;
    --smart-purple-bg: #2a1e3a;   --smart-purple-text: #c0a8e0;
    --smart-cuisine-bg: #3a2820;  --smart-cuisine-text: #d8b0a0;

    --content-card-bg: rgb(30, 27, 24);
    --paper-opacity: 0.03;

    /* ── Pantry surfaces (Ph3) ─────────────────────────────────── */
    --editor-panel-bg: #1d1a14;

    /* Nav button vocabulary — dark counterparts (verbatim from
     * Mirepoix_Design_System-2026-05-27/colors_and_type.css:224-298). */
    --ground-deep: #181512;
    --red-glow:    rgba(200, 80, 80, 0.55);

    /* Aliases — point at the dark variants of existing tokens */
    --red-deep:    var(--accent-hover);              /* dark: #a03838 */
    --red-soft:    var(--red-light);                 /* dark: rgba(200, 80, 80, 0.12) */
    --red-soft-2:  var(--hover-bg-strong);           /* dark: rgba(200, 80, 80, 0.22) */

    /* Button vocabulary — white counter-highlights drop to warm-white at
     * lower opacity; black inset shadows deepen for paper depth. */
    --shadow-deboss:
      inset 0 1px 3px rgba(0, 0, 0, 0.45),
      inset 0 -1px 0 rgba(255, 252, 249, 0.04);
    --shadow-deboss-deep:
      inset 0 2px 5px rgba(0, 0, 0, 0.50),
      inset 0 1px 0 rgba(0, 0, 0, 0.30),
      inset 0 -1px 0 rgba(255, 252, 249, 0.06);
    --shadow-deboss-modal:
      inset 0 1px 3px rgba(0, 0, 0, 0.45),
      inset 0 1px 0 rgba(255, 252, 249, 0.04),
      inset 0 -1px 0 rgba(255, 252, 249, 0.02),
      0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-emboss:
      inset 0 1px 0 rgba(255, 252, 249, 0.08),
      0 1px 2px rgba(0, 0, 0, 0.35),
      0 2px 4px rgba(0, 0, 0, 0.25);
    --shadow-emboss-bordered:
      inset 0 0 0 1px rgba(255, 252, 249, 0.06),
      inset 0 1px 0 rgba(255, 252, 249, 0.08),
      0 1px 2px rgba(0, 0, 0, 0.35),
      0 2px 4px rgba(0, 0, 0, 0.25);

    /* Halos — the light values (0 0 5px var(--red-glow)) inherit via the
     * cascade; --red-glow's dark value gives a brighter halo against dark. */

    /* Pill chrome — warm-dark fill + low-opacity warm-white top highlight
     * (much subtler than the light recipe's 0.65 white). */
    --pill-bg:     rgba(34, 31, 28, 0.68);
    --pill-border: rgba(255, 252, 249, 0.08);
    --pill-shadow:
      inset 0 1px 0 rgba(255, 252, 249, 0.06),
      inset 0 -1px 0 rgba(0, 0, 0, 0.30),
      0 1px 3px rgba(0, 0, 0, 0.30),
      0 6px 14px rgba(0, 0, 0, 0.35),
      3px 12px 28px rgba(0, 0, 0, 0.45);

    /* Popovers — deeper shadows against the darker tablecloth. */
    --shadow-popover:
      0 1px 3px rgba(0, 0, 0, 0.40),
      0 4px 10px rgba(0, 0, 0, 0.30),
      3px 8px 22px rgba(0, 0, 0, 0.45);
    --shadow-popover-lg:
      0 1px 3px rgba(0, 0, 0, 0.40),
      0 8px 24px rgba(0, 0, 0, 0.40),
      3px 14px 36px rgba(0, 0, 0, 0.50);

    /* Paper/press shadows need more opacity to read on the dark surface */
    --shadow-paper:
      0 1px 3px rgba(0, 0, 0, 0.22),
      0 4px 8px rgba(0, 0, 0, 0.18),
      3px 8px 14px rgba(0, 0, 0, 0.26);
    --shadow-press: inset 0 1px 2px rgba(0, 0, 0, 0.22);
  }
}

/* Page background — applied directly to the root element so the browser
   paints it across the entire CSS canvas, including iOS Safari's
   overscroll regions and behind the status bar. background-attachment:
   fixed keeps it stationary on desktop; iOS falls back to scroll, but
   the 3px repeating period makes the movement imperceptible. */
html {
  color-scheme: light dark;
  font-size: 18px;
  touch-action: manipulation;
  scrollbar-gutter: stable;
  background-color: var(--ground-deep);
  background-attachment: fixed;
  background-image:
    repeating-linear-gradient(135deg,
      rgba(179, 58, 58, 0.05) 0,
      rgba(179, 58, 58, 0.05) 1.5px,
      transparent 1.5px,
      transparent 3px),
    repeating-linear-gradient(45deg,
      rgba(179, 58, 58, 0.05) 0,
      rgba(179, 58, 58, 0.05) 1.5px,
      transparent 1.5px,
      transparent 3px);
}

/* Dark-mode background overrides — the gradient pattern is inlined
   (Track B owns those color values); the base color uses --ground. */
@media (prefers-color-scheme: dark) {
  html {
    background-color: var(--ground);
    background-image:
      repeating-linear-gradient(135deg,
        rgba(200, 80, 80, 0.06) 0,
        rgba(200, 80, 80, 0.06) 1.5px,
        transparent 1.5px,
        transparent 3px),
      repeating-linear-gradient(45deg,
        rgba(200, 80, 80, 0.06) 0,
        rgba(200, 80, 80, 0.06) 1.5px,
        transparent 1.5px,
        transparent 3px);
  }
}



/* Turbo Drive progress bar — base styles defined here because Turbo's
   dynamic <style> injection is blocked by our strict CSP. The JS-driven
   width/opacity changes via CSSOM are not blocked. */
.turbo-progress-bar {
  position: fixed;
  display: block;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--text);
  z-index: var(--z-progress);
  transition: width 300ms ease-out, opacity 150ms 150ms ease-in;
  transform: translate3d(0, 0, 0);
}

body,
html {
  margin: 0;
  padding: 0;
}

body {
  padding: env(safe-area-inset-top, 0px) var(--gingham-gap) 0;
  font-family: var(--font-body);
  color: var(--text);
  line-height: var(--leading-relaxed);  /* was 1.65 — fold per fonts audit */
}


.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* Custom checkbox — shared base for menu and grocery pages */
.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1rem;
  height: 1rem;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-xs);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.custom-checkbox:checked {
  background-color: var(--red);
  border-color: var(--red);
}

.custom-checkbox:checked::after {
  content: '\2713';
  color: white;
  font-size: 0.75rem;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Buttons — the one shared interactive style across the site */
.btn {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.75rem;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  line-height: var(--leading-relaxed);
  transition: background-color var(--duration-fast) ease, border-color var(--duration-fast) ease, color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

@media (hover: hover) {
  .btn:hover {
    color: var(--text);
    border-color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }
}

/* Shared focus ring — one source of truth for .btn, .btn-ghost, .btn-link,
   and bare <button>. .btn-link is listed explicitly: its `all: unset` strips
   the outline, and it rides on <a> too, so neither button:focus-visible nor
   main a:focus-visible can be relied on to reach every call site. */
.btn:focus-visible,
.btn-ghost:focus-visible,
.btn-link:focus-visible,
button:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

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

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

@media (hover: hover) {
  .btn-danger:hover {
    background: var(--danger-hover-bg);
    color: var(--danger);
    border-color: var(--danger);
  }
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.btn-link {
  all: unset;
  cursor: pointer;
  color: var(--red);
  text-decoration: underline dotted;
  font-family: var(--font-body);
}

@media (hover: hover) {
  .btn-link:hover {
    text-decoration-style: solid;
  }
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  border: none;
  border-radius: var(--radius-md);
  background: none;
  color: var(--text-light);
  cursor: pointer;
  transition: color var(--duration-fast) ease, background var(--duration-fast) ease;
}

@media (hover: hover) {
  .btn-ghost:hover {
    color: var(--red);
    background: var(--hover-bg);
  }
}

.btn-icon-round {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1rem;
  line-height: var(--leading-flat);
  transition: color var(--duration-fast) ease, border-color var(--duration-fast) ease;
}

@media (hover: hover) {
  .btn-icon-round:hover {
    color: var(--text-soft);
    border-color: var(--rule);
  }
}

.btn-icon-round:disabled {
  opacity: 0.3;
  cursor: default;
}

@media (hover: hover) {
  .btn-icon-round.btn-danger:hover {
    color: var(--danger);
    border-color: var(--danger);
  }
}

@media (hover: hover) {
  .btn-icon-round.btn-primary:hover {
    color: var(--red);
    border-color: var(--red);
  }
}

.btn-icon-round-lg {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
}

.btn-pill {
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: 0.85rem;
  font-family: var(--font-body);
  color: var(--text);
  cursor: pointer;
  transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease;
}

@media (hover: hover) {
  .btn-pill:hover {
    background: var(--hover-bg);
    border-color: var(--red);
  }
}

.btn-pill.active,
.btn-pill[data-active] {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

/* ── Input base ────────────────────────────────────────────── */

.input-base {
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--rule-faint);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  box-sizing: border-box;
  outline: none;
}

.input-base:focus {
  outline: 2px solid var(--red);
  outline-offset: -1px;
  border-color: var(--red);
}

.input-base::placeholder {
  color: var(--text-light);
}

@media (max-width: 600px) {
  .input-base,
  .input-base.input-sm,
  select.input-base {
    font-size: 16px;
  }
}

.input-lg {
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
}

.input-sm {
  width: 4.5rem;
  text-align: right;
}

.input-inline {
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
}

.input-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.form-helper {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* ── Collapse ──────────────────────────────────────────────── */

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

.collapse-header summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  user-select: none;
}

.collapse-header summary::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0.3rem 0 0.3rem 0.45rem;
  border-color: transparent transparent transparent var(--text-light);
  transition: transform var(--duration-fast) ease;
  flex-shrink: 0;
}

.collapse-header[open] summary::before {
  transform: rotate(90deg);
}

.collapse-header summary::-webkit-details-marker {
  display: none;
}

.collapse-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--duration-normal) ease;
}

.collapse-header[open] + .collapse-body,
.collapse-header[open] ~ .collapse-body {
  grid-template-rows: 1fr;
}

.collapse-inner {
  min-height: 0;
  overflow: hidden;
}
main a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--rule-faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--duration-normal) ease, text-decoration-color var(--duration-normal) ease;
}

@media (hover: hover) {
  main a:hover {
    color: var(--red);
    text-decoration-color: var(--red);
  }
}

main a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

main {
  position: relative;
  /* Under the universal border-box reset, max-width is the outer extent. 41rem
     keeps main's visible card edges where the nav strip is calibrated to them
     (navshell.css .navshell__top); content area is ~35rem after 3rem padding. */
  max-width: 41rem;
  margin: 0 auto var(--gingham-gap);
  padding: 3rem 3rem 5rem;
  background: var(--content-card-bg);
  border: 1px solid var(--rule-faint);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.07),
    0 4px 8px rgba(0, 0, 0, 0.05),
    3px 8px 14px rgba(0, 0, 0, 0.08);
  min-height: calc(100vh - 2 * var(--gingham-gap) - 3rem);
}

main::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("/assets/paper-noise-94045ff2.png");
  background-size: 200px 200px;
  opacity: var(--paper-opacity);
  pointer-events: none;
}

/* Lifts content children above main's ::before paper-noise overlay. <dialog>
   is excluded so the UA-default `:modal { position: fixed }` keeps applying —
   otherwise the modal's layout box stays anchored inside <main> (top-layer
   only relocates the paint), and scroll-into-view-on-focus scrolls the page
   to wherever that layout box sits. */
main > *:not(dialog) {
  position: relative;
}

header {
  text-align: center;
  margin-bottom: 1.5rem;
}

header h1 {
  font-family: var(--font-display);
  font-size: 3.8rem;
  font-weight: 400;
  line-height: 1.05; /* named exception: display heading at 3.8rem needs tight leading */
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem 0;
}

header p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.3rem;
  margin-top: 0;
  color: var(--text-soft);
}

header .recipe-meta {
  font-style: normal;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 1rem;
  color: var(--text-light);
  text-align: center;
}

header .recipe-yield {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-light);
  text-align: center;
  margin-top: 0.25rem;
}

header .recipe-meta a {
  color: inherit;
  text-decoration: none;
}

@media (hover: hover) {
  header .recipe-meta a:hover {
    text-decoration: underline;
  }
}

.recipe-tags {
  margin-top: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
}

.recipe-tag-pill {
  border: none;
  cursor: pointer;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
}

@media (hover: hover) {
  .recipe-tag-pill:hover { opacity: 0.8; }
}

/* Scale bar — centered disclosure toggle + vertical reveal */
.scale-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.6rem;
}

.scale-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-light);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-md);
  user-select: none;
  transition: color var(--duration-normal) ease, background-color var(--duration-slow) ease-out;
}

@media (hover: hover) {
  .scale-toggle:hover {
    color: var(--red);
    background-color: var(--hover-bg);
  }
}

.scale-toggle::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0.3rem 0 0.3rem 0.45rem;
  border-color: transparent transparent transparent currentColor;
  transition: transform var(--duration-fast) ease;
}

.scale-bar.open .scale-toggle::before {
  transform: rotate(90deg);
}

/* Recipe actions row — variable-count button group with middot dividers.
   Flex wraps gracefully for 1 button (just Edit) up to 5 (Share · Edit · Scale on
   the recipe page). Center-justified so it reads as a balanced toolbar regardless
   of count. */
.recipe-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

header > .recipe-actions {
  margin-top: 0.6rem;
}

.recipe-actions-dot {
  color: var(--text-light);
  font-size: 0.85rem;
  line-height: var(--leading-flat);
}


/* Scale controls — animated vertical expand/collapse */
.scale-controls {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows var(--duration-normal) ease;
}

.scale-bar.open .scale-controls {
  grid-template-rows: 1fr;
}

.scale-controls-inner {
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.scale-controls-center {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  min-height: 0;
  padding: 0.5rem 0.25rem;
}

.scale-controls-center > :first-child {
  justify-self: end;
}

.scale-controls-center > :last-child {
  justify-self: start;
}

.scale-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scale-presets {
  display: flex;
  gap: 0.25rem;
}

.scale-preset {
  line-height: var(--leading-flat);
}

@keyframes pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.scale-preset.active {
  background: var(--red);
  border-color: var(--red);
  color: white;
  animation: pulse var(--duration-bloop) var(--ease-bounce);
}

.scale-divider {
  width: 1px;
  height: 1.25rem;
  background: var(--rule);
}

.scale-input {
  text-align: center;
}

.scale-input.invalid,
.scale-input.invalid:focus {
  outline: 2px solid var(--danger);
  outline-offset: -1px;
  border-color: var(--danger);
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--input-bg));
}

.scale-reset[hidden] {
  display: block;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.scalable.scaled {
  background-color: var(--scaled-highlight);
  border-radius: var(--radius-xs);
  padding: 0 1px;
}

.recipe-meta .scalable.scaled,
.recipe-yield .scalable.scaled {
  background-color: transparent;
}

header::after {
  content: "";
  display: block;
  width: 40px;
  height: 1px;
  background: var(--red);
  margin: 1.5rem auto 0;
}

/* Section-heading already carries its own ledger rule (__rule); the
   universal page-header underline would stack a second red bar
   below it. Suppress here so the section reads as one decorator. */
.section-heading::after { display: none; }






section {
  margin-top: 2.5rem;
  break-inside: avoid;
}

section > ul {
  column-count: 2;
  column-gap: 2.5rem;
  list-style: none;
  padding-left: 0;
}

section > ul li {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

section > ul li a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 400;
  transition: color var(--duration-normal);
}

section > ul li a:hover {
  color: var(--red);
}

section h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  line-height: var(--leading-snug);
  text-transform: none;
  letter-spacing: normal;
  margin-top: 3.5rem;
  margin-bottom: 1.25rem;
  border-bottom: none;
  padding-bottom: 0;
}

section:first-of-type h2 {
  margin-top: 0;
}

.homepage section h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  margin: 3rem 0 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* Recipes index: unified navigation (categories + tag filters) */
.index-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.index-nav-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.index-nav-categories {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.index-nav-tags {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* Inline edit affordance — small ghost-text "edit X" zone button (recipe
   index nav, quick-bites). Hover guarded so touch devices don't stick. */
.btn-inline-edit {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 0.7rem;
  font-family: var(--font-body);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.3rem;
  border-radius: var(--radius-sm);
}

@media (hover: hover) {
  .btn-inline-edit:hover {
    color: var(--red);
    background: var(--hover-bg);
  }
}

.index-nav-link a {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0.2rem 0.5rem;
  border-radius: 0.3rem;
  transition: color var(--duration-normal) ease,
              background-color var(--duration-slow) ease-out;
}

.index-nav-link a:hover {
  color: var(--red);
  background-color: var(--hover-bg);
}

.index-nav-link:not(:last-child)::after {
  content: " \00b7";
  color: var(--text-light);
}

.index-nav-divider {
  height: 1px;
  background: var(--rule-faint);
}

.tag-filter-pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-xl);
  font-size: 0.78rem;
  font-family: var(--font-body);
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}

.tag-filter-pill:hover {
  background: var(--hover-bg-strong);
}

.tag-filter-pill.active {
  background: var(--tag-filter-active-bg);
  color: var(--red);
  border-color: var(--red);
}

/* Anchor targets: offset for sticky nav so headers stay visible */

#recipe-listings,
[data-recipe-filter-target="category"] {
  scroll-margin-top: 3.5rem;
}

/* Recipes index: category heading with back-to-top */
.category-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.4rem;
}

.category-heading h2 {
  margin: 0;
}

.category-top-link {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-light);
  text-decoration: none;
  padding-bottom: 0.25rem;
  white-space: nowrap;
}

.category-top-link:hover {
  color: var(--red);
}

.category-permalink-wrap {
  font-size: 0.85em;
  font-weight: normal;
  color: var(--text-light);
}

@media (hover: hover) {
  .category-permalink-wrap {
    opacity: 0;
    transition: opacity 0.15s ease;
  }

  .category-heading:hover .category-permalink-wrap,
  .category-heading:focus-within .category-permalink-wrap {
    opacity: 1;
  }
}

.category-permalink {
  color: var(--text-light);
  text-decoration: none;
}

.category-permalink:hover {
  color: var(--red);
  text-decoration: underline;
}

/* Recipes index: recipe card grid */
.recipe-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

@media (max-width: 599px) {
  .recipe-card-grid {
    grid-template-columns: 1fr;
  }

  .index-nav {
    gap: 0.3rem;
  }
}

/* Recipes index: recipe cards — design-system elevated paper card (#1385) */
.recipe-card {
  --card-pigment: var(--pigment-stone);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 2.75rem;
  background: var(--content-card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-paper);
  color: var(--text);
  text-decoration: none;
  transition: background var(--duration-normal),
              box-shadow var(--duration-normal),
              transform var(--duration-fast) var(--ease-bloop);
}

/* Per-category pigment — see RecipesHelper#category_pigment */
.recipe-card--rose  { --card-pigment: var(--pigment-rose);  }
.recipe-card--clay  { --card-pigment: var(--pigment-clay);  }
.recipe-card--amber { --card-pigment: var(--pigment-amber); }
.recipe-card--leaf  { --card-pigment: var(--pigment-leaf);  }
.recipe-card--mint  { --card-pigment: var(--pigment-mint);  }
.recipe-card--sky   { --card-pigment: var(--pigment-sky);   }
.recipe-card--plum  { --card-pigment: var(--pigment-plum);  }
.recipe-card--stone { --card-pigment: var(--pigment-stone); }

.recipe-card__band {
  height: var(--space-2);
  background: var(--card-pigment);
}

.recipe-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-4);
}

.recipe-card__title {
  font-family: var(--font-display);
  font-style: italic;        /* the italic is the voice */
  font-weight: 400;
  font-size: var(--type-xl);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  text-decoration: none;
}

/* Stretched link: the whole card is the title link's hit area */
.recipe-card__title::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* Single focus indicator: ring the card boundary, and suppress the link's
 * own outline (main a:focus-visible) so we don't draw two concentric rings. */
.recipe-card .recipe-card__title:focus-visible {
  outline: none;
}

.recipe-card:has(.recipe-card__title:focus-visible) {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.recipe-card__desc {
  margin: var(--space-2) 0 0;
  font-family: var(--font-body);
  font-size: var(--type-sm);
  line-height: var(--leading-snug);
  color: var(--text-soft);
}

.recipe-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-2) 0 0;
  font-family: var(--font-body);
  font-size: var(--type-sm);
  color: var(--text-soft);
}

.recipe-card__meta svg {
  flex-shrink: 0;
  color: var(--card-pigment);   /* tiny echo of the band */
}

/* Pressed state — pure CSS; fires via the title link on pointer/touch/keyboard.
 * Navigation activates on release (native anchor); this is press-in feedback. */
.recipe-card:has(.recipe-card__title:active) {
  transform: translateY(1px);
  box-shadow: var(--shadow-press);
}

/* Tag filter (recipe-filter controller): show only matches, hide emptied
 * categories. These two rules were referenced by the controller but never
 * existed in CSS — filtering used to only highlight matches. */
.recipe-card.filtered-out {
  display: none;
}

.filtered-empty {
  display: none;
}

.recipe-tag-list {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.recipe-tag {
  display: inline-block;
  padding: 0.06rem 0.44rem;
  border-radius: 0.625rem;
  font-size: 0.68rem;
  color: var(--text-light);
}

.homepage section:first-of-type h2 {
  margin-top: 0;
}

#export-actions {
  margin-top: 1.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.loading-placeholder {
  color: var(--text-soft);
  font-style: italic;
  padding: 2rem;
  text-align: center;
}

section > div:has(.ingredients):has(.instructions) {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0 2.5rem;
}

.instructions p {
  margin: 0 0 0.85rem 0;
  font-size: 0.95rem;
  line-height: 1.75; /* named exception: long-form recipe instructions, generous leading */
}

.instructions {
  border-left: 1px solid var(--rule-faint);
  padding-left: 2rem;
}

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

.ingredients li {
  break-inside: avoid;
  padding: 0.3rem 0;
  font-size: 0.84rem;
  line-height: var(--leading-body);
}

.quantity {
  color: var(--text-light);
  font-weight: 300;
  white-space: nowrap;
}

/* .ingredients ul li small::before 	{ content: "↳ "; } */

.ingredients ul li small {
  display: block;
  font-style: italic;
  font-size: 0.95em;
  line-height: var(--leading-snug);  /* was 1.3 — fold per fonts audit */
  padding-left: 1rem;
}

footer {
  font-family: var(--font-display);
  font-style: italic;
  text-align: center;
  font-size: 1rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  color: var(--text-light);
  position: relative;
}

footer::after {
  content: "";
  display: block;
  width: 40px;
  height: 1px;
  background: var(--rule);
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.app-version::after {
  display: none;
}

.nutrition-label footer::after {
  display: none;
}

footer small {
  text-align: right;
  display: block;
}

@media (prefers-color-scheme: dark) {
  .smart-icon--crossout::after {
    border-color: rgba(220, 80, 80, 0.85);
    background: linear-gradient(
      to top left,
      transparent calc(50% - 1px),
      rgba(220, 80, 80, 0.85) calc(50% - 1px),
      rgba(220, 80, 80, 0.85) calc(50% + 1px),
      transparent calc(50% + 1px)
    );
  }
}
/******************************************************/
/* Styles for interactivity, applies to screen media */
/*****************************************************/

@media screen {
  /* switch to hand pointer for interactive elements */
  .recipe section h2,
  .recipe .instructions p,
  .recipe .ingredients li {
    cursor: pointer;
  }

  /* Target h2 in a recipe section where every <li> and instructions <p> is "crossed-off".
     Scoped to .recipe so it doesn't affect settings or other pages with <section> + <h2>. */
  .crossed-off,
  .recipe section:not(:has(li:not(.crossed-off), .instructions p:not(.crossed-off))) h2 {
    text-decoration: line-through;
    color: var(--text-light);
    border-color: var(--text-light);
  }

  /* Fade the entire embedded card when the parent step is crossed off */
  section:not(:has(li:not(.crossed-off), .instructions p:not(.crossed-off))) .embedded-recipe {
    opacity: 0.4;
  }
}

/****************************************/
/* Styles for mobiles and small screens */
/****************************************/

/* small mobiles only */
@media screen and (max-width: 720px) and (pointer: coarse) {
  html {
    font-size: 16px;
  }
}

/* anything with a narrow window */
@media screen and (max-width: 720px) {
  :root {
    --gingham-gap: 0.75rem;
  }

  main {
    padding: 1.5rem 1.25rem 3rem;
  }

  section > div:has(.ingredients):has(.instructions) {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  /* On small screens, switch to two ingredient columns */
  .ingredients ul {
    column-count: 2;
    column-gap: 0.5rem;
  }

  /* Switch to two index columns as well */
  section > ul {
    column-count: 2;
  }

  header h1 { font-size: 2.6rem; }


  .instructions {
    border-left: none;
    padding-left: 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--rule-faint);
  }

}

/* Touch viewport: top nav fixed, destinations bar pinned to bottom */
@media (pointer: coarse) and (hover: none) {
  main {
    padding-top: 2rem;
  }

  #recipe-listings,
  [data-recipe-filter-target="category"] {
    scroll-margin-top: 0.5rem;
  }

  body {
    padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0px));
  }
}

html:has(dialog[open]) {
  overflow: hidden;
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes bloop {
  0%   { transform: scale(0.95);  opacity: 0; }
  40%  { transform: scale(1.02);  opacity: 1; }
  70%  { transform: scale(0.992); opacity: 1; }
  100% { transform: scale(1);     opacity: 1; }
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: default;
}
.tag-pill--tag { background: var(--tag-bg); color: var(--tag-text); }
.tag-pill--category { background: var(--cat-bg); color: var(--cat-text); }

/* Smart tag color variants */
.tag-pill--green   { background: var(--smart-green-bg);   color: var(--smart-green-text); }
.tag-pill--amber   { background: var(--smart-amber-bg);   color: var(--smart-amber-text); }
.tag-pill--blue    { background: var(--smart-blue-bg);     color: var(--smart-blue-text); }
.tag-pill--rose    { background: var(--smart-rose-bg);     color: var(--smart-rose-text); }
.tag-pill--purple  { background: var(--smart-purple-bg);   color: var(--smart-purple-text); }
.tag-pill--cuisine { background: var(--smart-cuisine-bg);  color: var(--smart-cuisine-text); }

/* Smart tag icon wrapper */
.smart-icon {
  position: relative;
  margin-right: 0.3em;
  font-size: 0.85em;
  display: inline-flex;
  align-items: center;
}

/* Crossout circle+slash overlay on the icon */
.smart-icon--crossout::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1.5px solid rgba(180, 40, 40, 0.85);
  border-radius: 50%;
  background: linear-gradient(
    to top left,
    transparent calc(50% - 1px),
    rgba(180, 40, 40, 0.85) calc(50% - 1px),
    rgba(180, 40, 40, 0.85) calc(50% + 1px),
    transparent calc(50% + 1px)
  );
  pointer-events: none;
}

.tag-pill__remove {
  font-size: 0.6rem;
  opacity: 0.5;
  cursor: pointer;
  line-height: var(--leading-flat);
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}
.tag-pill__remove:hover { opacity: 1; }
/************************/
/* Notification toast   */
/************************/

.notify-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: var(--ground);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--rule);
  box-shadow: var(--shadow-nav-up);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  transform: translateY(100%);
  opacity: 0;
  transition: transform var(--duration-slow) ease, opacity var(--duration-slow) ease;
}

@keyframes slide-in {
  0%   { transform: translateY(100%); opacity: 0; }
  60%  { transform: translateY(-8%);  opacity: 1; }
  100% { transform: translateY(0);    opacity: 1; }
}

.notify-bar.notify-visible {
  transform: translateY(0);
  opacity: 1;
  animation: slide-in var(--duration-slow) var(--ease-bounce);
}

.notify-dismiss {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--rule);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  line-height: var(--leading-flat);
  flex-shrink: 0;
}

.notify-dismiss:hover {
  color: var(--text-soft);
}
.app-version {
  text-align: center;
  margin: -0.75rem auto 0;
  padding: 0 0 0.25rem;
  max-width: 35rem;
  font-size: 0.7rem;
  font-style: normal;
  color: var(--text);
  opacity: 0.3;
}

/* ── Section heading: italic-serif H2 + ledger rule ─────────────── */
/* For section dividers that want more weight than a plain h2 but less
   than an h1. Pantry's aisle/cadence headings are the seed use; reach
   for it on any page that wants editorial-feeling section breaks. */
.section-heading {
  margin: 1.25rem 0 0.5rem;
}

.section-heading--ledger h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--type-2xl);
  font-weight: 400;
  color: var(--text);
  margin: 0;
}

.section-heading__rule {
  height: 2px;
  width: 32%;
  background: var(--red);
  margin-bottom: 0.5rem;
  border-radius: 1px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .recipe-card:has(.recipe-card__title:active) {
    transform: none; /* keep the --shadow-press feedback, drop the positional shift */
  }
}

