/* RecipeBox — bold, high-contrast, flat graphic theme layer on top of
   vendored Bulma (assets/vendor/bulma/bulma.min.css, self-hosted, loaded
   before this file). Bulma 1.x exposes its palette as HSL custom
   properties, so retheming is done by overriding those rather than
   fighting Bulma's own component CSS. This replaces the earlier "warm
   editorial" theme in place (same tokens, new values) — see
   RECIPEBOX_COLOR_AUDIT.md for the before/after and contrast verification. */

/* Self-hosted font (assets/fonts/) — Nunito replaces the previous two-typeface
   pairing (Fraunces headings / Public Sans body) entirely; headings and body
   now differ by WEIGHT only, both in the same family. Variable font, so
   Google serves every weight from the SAME underlying file (confirmed via
   the CSS2 API response declaring "font-weight: 200 1000" for a single src
   URL) — one file per style with a weight RANGE is correct here, not a
   missed per-weight download. */
@font-face {
    font-family: 'Nunito';
    font-style: normal;
    font-weight: 200 1000;
    font-display: swap;
    src: url('../fonts/nunito-variable-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Nunito';
    font-style: italic;
    font-weight: 200 1000;
    font-display: swap;
    src: url('../fonts/nunito-variable-italic.woff2') format('woff2');
}

/* Bulma 1.x auto-switches to its own built-in dark palette under
   `@media (prefers-color-scheme: dark)`, which overrides several of the
   tokens below (title/text-strong color, among others) back to Bulma's
   dark-mode defaults on any device/browser with OS-level dark mode on —
   independently of the light-mode values set here, producing near-invisible
   light-gray headings on this light background. This app has one single
   deliberate palette with no dark-mode variant, so `<html data-theme="light">`
   (set in includes/layout.php and install/lib/layout.php) pins Bulma to its
   light branch regardless of OS preference — the documented, supported way
   to opt out of Bulma's automatic dark mode, not a workaround. */

:root {
    /* Fresh Green (#28a260) replaces the previous ochre/mustard accent as
       Bulma's "primary" and "link" colors. Converted via RGB->HLS:
       h=147.5deg, s=60.4%, l=39.6% round-trips back to #28a260 exactly. */
    --bulma-primary-h: 147.5deg;
    --bulma-primary-s: 60.4%;
    --bulma-primary-l: 39.6%;
    /* Link (and any other plain-text use of the accent) needs to be darker
       than the raw primary to read as text, not just as a UI-component
       fill — raw primary-on-background is only 3.13:1 (fails AA). 30%
       lightness clears 4.5:1 with real margin (5.06:1) — see
       RECIPEBOX_COLOR_AUDIT.md. This also replaces .section-title's old
       separate hardcoded darkened-primary value (a second, disconnected
       "darkened for text" number) — it now reuses this same token. */
    --bulma-link-h: 147.5deg;
    --bulma-link-s: 60.4%;
    --bulma-link-l: 30%;
    /* Bulma actually reads a bare <a>'s plain-text color from this SEPARATE
       variable (--bulma-link-on-scheme-l, default 58%) — not --bulma-link-l
       above, which only feeds components (buttons, tags, focus rings). The
       original fix above missed this one entirely, so any plain content
       link with no other color-affecting class fell through to Bulma's own
       58% default — a light, low-contrast green (first surfaced on the Meal
       Plan recipe links). Same 30% target as --bulma-link-l, for the same
       4.5:1+ contrast reasoning. */
    --bulma-link-on-scheme-l: 30%;

    /* Bright near-white page background, fully neutral (0% saturation) —
       replaces the previous warm cream. main/bis/ter preserve the SAME
       relative lightness deltas as before (main, main+2, main-3) so
       "recessed panel" vs "page" vs "elevated panel" still read distinctly. */
    --bulma-scheme-h: 0deg;
    --bulma-scheme-s: 0%;
    --bulma-scheme-main-l: 98%;
    --bulma-scheme-main-bis-l: 100%;
    --bulma-scheme-main-ter-l: 95%;

    /* True dark neutral text (0% saturation) replaces the previous
       warm-brown-tinted dark. 10% lightness = #1a1a1a, 16.75:1 against the
       new background — stronger contrast than the old pairing (13.89:1). */
    --bulma-text-h: 0deg;
    --bulma-text-s: 0%;
    --bulma-text-l: 10%;

    /* Muted text (footnotes, metadata, section-label sibling text) — same
       35% lightness value as before, now paired with the neutral h/s above
       instead of the old warm h/s. hsl(0,0%,35%) = #595959, 6.68:1 against
       the new background — real margin above 4.5:1, slightly more margin
       than the old pairing had (6.34:1). */
    --rb-muted-l: 35%;

    /* Flat-design borders replace shadows entirely (see .box/.button below):
       a single bold, dark, unmistakably-intentional border color+width
       reused everywhere a component previously relied on box-shadow for
       separation. Reuses the body-text color directly (not a lighter
       neutral) so it reads as "flat design ink", not "leftover default
       border, just darker" — 16.75:1 against the background, far past the
       3:1 UI-component minimum. */
    --rb-border-w: 2px;
    --rb-border-color: hsl(var(--bulma-text-h) var(--bulma-text-s) var(--bulma-text-l));

    /* Single unified hairline-divider value — replaces the two previously
       inconsistent divider treatments (ingredient-list rows at
       hsl(38,40%,90%) vs. the installer checklist at hsl(38,20%,94%)).
       Deliberately much lighter than --rb-border-color: a divider inside a
       bordered container needs to separate without competing with that
       container's own bold edge. */
    --rb-divider-color: hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) 85%);

    --bulma-body-family: "Nunito", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

h1, h2, h3, .title {
    font-family: Nunito, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    font-weight: 800;
}
body {
    font-weight: 400;
}

/* Flat design: shadows removed entirely (see "Remove shadows" in the
   decision log this was implemented from), replaced with one consistent
   bold, dark, solid border everywhere a component previously relied on
   box-shadow (or a barely-there 1px neutral border) for visual separation.
   Applied uniformly across variants — including colored buttons like
   .is-primary — rather than per-variant border colors, since "one
   consistent border weight and color" was the explicit goal; a dark
   outline around a solid-fill colored button is a deliberate, common flat/
   neubrutalist-style choice here, not an oversight. */
.box, .button {
    box-shadow: none;
}
.box {
    border: var(--rb-border-w) solid var(--rb-border-color);
}
.button {
    border-width: var(--rb-border-w);
    border-color: var(--rb-border-color);
    /* Bulma's padding calc (base padding minus border-width) reads its OWN
       --bulma-button-border-width custom property, not the literal
       border-width above — plain buttons default that variable to Bulma's
       generic 1px control-border-width, so even after forcing every
       button's actual border to 2px, plain and solid-fill (.is-primary,
       which sets its own copy of this variable to 0px) buttons still
       computed different padding and rendered at different heights.
       Setting it here keeps every button's padding calc in sync with the
       one real border width this theme actually uses. */
    --bulma-button-border-width: var(--rb-border-w);
}

/* Bulma computes solid-fill button text color from --bulma-button-color-l,
   which defaults to the same dark "text-strong" lightness used for body
   text everywhere else — fine against this theme's light backgrounds, but
   on a solid-color button fill it rendered as near-black text on the
   primary green (#061906ish on #28a260). Numerically that still clears
   AA (5.57:1) since luminance contrast doesn't account for same-hue
   "muddiness," but it read as hard to read in practice — white text at
   3.27:1 clears the 3:1 UI-component/large-bold-text minimum (the same
   standard already applied to icon buttons/borders elsewhere in this
   theme) and is unambiguously easier to read at a glance. */
.button.is-primary {
    color: #fff;
    /* Bulma's own .button.is-primary rule sets its internal
       --bulma-button-border-width custom property to 0px (since Bulma
       normally expects a solid-fill variant to have no border at all).
       Our .button rule above sets the literal border-width property
       to --rb-border-w directly, so the border itself still rendered at
       2px — but Bulma's padding calc subtracts ITS OWN border-width
       variable (still 0px) from the base padding, not our literal
       property, so is-primary buttons got MORE padding than plain ones
       and ended up visibly taller. Re-declared here (same specificity as
       Bulma's own rule, but this file loads after) so the padding calc
       uses the same border width as everything else. */
    --bulma-button-border-width: var(--rb-border-w);
}

/* Recipe cards on the list page */
.recipe-card.archived { opacity: 0.6; }
/* Playful lift + tilt on hover — same spirit as the mobile-nav burger's
   tilt-on-open (a small, low-cost, purely-decorative bit of motion, not a
   structural change to the card). Skipped for archived cards since a
   "lift" reads as an invitation, which is the wrong signal for something
   already put away. */
.recipe-card:not(.archived) {
    transition: transform 0.15s ease;
    /* Promotes the card to its own GPU layer up front, before rotation
       starts — without this, the browser rasterizes the card's text and its
       tag-emoji <img>s independently and re-snaps each to the pixel grid as
       the rotation angle changes, so the emoji visibly drifts sideways by a
       fraction of a pixel relative to the tag text next to it. Rotating one
       pre-composited layer as a whole keeps everything inside it rigid. */
    will-change: transform;
}
.recipe-card:not(.archived):hover {
    transform: translateY(-4px) rotate(-0.75deg) translateZ(0);
}
/* Deterministic per-recipe accent (recipebox_recipe_card_style_attr()) — a
   thin color stripe down the card, distinct from its own tags' colors so it
   never reads as "just another tag". Archived cards skip it too, same
   reasoning as the hover lift above. */
.recipe-card:not(.archived) {
    border-left: 4px solid var(--card-accent, transparent);
}

/* Recipe tag pills, sized up from Bulma's default .tag (0.75rem/2em) — at
   that size the color + emoji were hard to make out at a glance. Scoped to
   .tag-pill (not Bulma's plain .tag) so unrelated status chips elsewhere
   (account invites, archived labels, install-step checks) keep their
   original compact size. .tag-emoji-img is sized in em, so it scales up
   right along with this. */
.tag-pill {
    font-size: 0.95rem;
    height: auto;
    padding: 0.4em 0.85em;
    transition: transform 0.15s ease;
}
.tag-pill:hover {
    animation: tag-pill-wiggle 0.35s ease;
}
@keyframes tag-pill-wiggle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    30% { transform: rotate(-6deg) scale(1.05); }
    60% { transform: rotate(5deg) scale(1.05); }
}

/* Meal Plan recipe links' emoji prefix (recipebox_tag_emoji_html()) stays
   plain on hover — the app-wide plain-link hover rule underlines the whole
   <a>, which read oddly running under an emoji glyph or a small custom
   image rather than just the recipe title text next to it. */
.meal-plan-recipe-emoji {
    text-decoration: none;
}

/* Custom uploaded tag emoji (from the custom_emojis library) — sized to sit
   inline with the pill's text like a real emoji glyph would. */
.tag-emoji-img {
    width: 1em;
    height: 1em;
    object-fit: cover;
    border-radius: 2px;
    vertical-align: -0.15em;
    margin-right: 0.15em;
}

/* Admin Tag Emojis screen: a dense multi-column grid instead of one-per-row,
   so the list of tag/emoji pairs (which take up very little horizontal
   space each) doesn't force endless vertical scrolling as more get added. */
.tag-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
}
.tag-emoji-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--bulma-border);
    border-radius: 6px;
}
.tag-emoji-item-glyph { font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.tag-emoji-item-glyph img { width: 1.2rem; height: 1.2rem; object-fit: cover; border-radius: 2px; }
.tag-emoji-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
}
.tag-emoji-item-edit, .tag-emoji-item-delete {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.55;
    font-size: 0.95rem;
    padding: 0.1rem 0.2rem;
    line-height: 1;
}
.tag-emoji-item-edit:hover, .tag-emoji-item-delete:hover { opacity: 1; }
.tag-emoji-item form { margin: 0; display: inline; }

/* Emoji picker trigger (opens the panel from emoji-picker.js) — shows the
   current selection so the button itself doubles as a live preview. */
.emoji-picker-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 8rem;
}
.emoji-picker-trigger img { width: 1.2em; height: 1.2em; object-fit: cover; border-radius: 2px; }

/* The picker panel itself — a popover anchored right under its trigger
   button (see emoji-picker.js: appended immediately after the trigger in
   the DOM, so position:relative on that wrapping .control is all it needs). */
.emoji-picker {
    position: absolute;
    z-index: 50;
    top: 100%;
    left: 0;
    margin-top: 0.3rem;
    width: 20rem;
    max-height: 22rem;
    display: flex;
    flex-direction: column;
    background: hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) var(--bulma-scheme-main-l));
    border: 1px solid var(--bulma-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
/* The [hidden] attribute selector (0,2,0 specificity) beats the plain class
   rule above (0,1,0) here, but author CSS overriding a UA default isn't
   guaranteed to lose on specificity alone in every case — spelling this out
   explicitly is what actually keeps the panel closed until JS opens it,
   rather than "flex" permanently winning over the browser's own
   [hidden]{display:none} the moment this class rule loads. */
.emoji-picker[hidden] {
    display: none;
}
/* Without an explicit flex-shrink:0, the panel's max-height (set above)
   squeezed ALL THREE flex children by default — search box, tabs, and body
   — proportionally shrinking the tabs bar down to a sliver instead of only
   the body scrolling. flex-shrink:0 here plus flex:1/min-height:0 on the
   body below is what makes the body the one part that scrolls while
   everything above it keeps its natural height. */
.emoji-picker-search-wrap { padding: 0.5rem 0.5rem 0; flex-shrink: 0; }
.emoji-picker-tabs {
    display: flex;
    gap: 0.15rem;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--bulma-border);
    overflow-x: auto;
    flex-shrink: 0;
}
.emoji-picker-tab {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.2rem 0.35rem;
    border-radius: 4px;
    flex-shrink: 0;
}
.emoji-picker-tab:hover { background: hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) 92%); }
.emoji-picker-body { overflow-y: auto; padding: 0.25rem 0.5rem 0.5rem; flex: 1 1 auto; min-height: 0; }
.emoji-picker-section h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: hsl(var(--bulma-text-h) var(--bulma-text-s) var(--rb-muted-l));
    margin: 0.6rem 0 0.3rem;
}
.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(2rem, 1fr));
    gap: 0.15rem;
}
.emoji-picker-item {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    padding: 0.3rem;
    border-radius: 4px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.emoji-picker-item:hover { background: hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) 92%); }
.emoji-picker-item img { width: 1.3rem; height: 1.3rem; object-fit: cover; border-radius: 2px; }
.emoji-picker-custom-item { position: relative; display: inline-block; }
/* Same "authored display beats the hidden attribute" trap as .emoji-picker
   itself above — the search filter (emoji-picker.js) sets `hidden` on
   non-matching buttons, which these two unconditional display rules
   silently ignored, so typing in the search box visually did nothing. */
.emoji-picker-item[hidden], .emoji-picker-custom-item[hidden] {
    display: none;
}
.emoji-picker-custom-remove {
    position: absolute;
    top: -0.3rem;
    right: -0.3rem;
    background: hsl(var(--bulma-danger-h) var(--bulma-danger-s) 45%);
    color: #fff;
    border: none;
    border-radius: 999px;
    width: 1.1rem;
    height: 1.1rem;
    line-height: 1;
    font-size: 0.75rem;
    cursor: pointer;
    display: none;
}
.emoji-picker-custom-item:hover .emoji-picker-custom-remove { display: block; }
.emoji-picker-custom-add {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--bulma-border);
}
.emoji-picker-custom-name { width: 100%; }
/* A raw <input type=file> under Bulma's .input class rendered its native
   "Browse…" button at full input-field height/padding, oversized next to
   its own "No file selected" text — this drops the Bulma class in favor of
   a lighter custom style (smaller font shrinks the native button with it)
   sized to match the rest of this mini-form instead. */
.emoji-picker-custom-file {
    width: 100%;
    font-size: 0.8rem;
    padding: 0.3rem 0.4rem;
    border: var(--rb-border-w) solid var(--rb-border-color);
    border-radius: 4px;
    background: hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) var(--bulma-scheme-main-l));
}
.emoji-picker-custom-submit { width: 100%; }
.emoji-picker-custom-error { width: 100%; margin: 0; }

/* Filter panel (recipes/index.php). Flat design has no shadow to lean on
   for "this is one distinct control group, separate from the content below
   it" — every other element (search box, dropdowns, Filter button, cards)
   used the identical 2px black border with nothing to tell them apart, so
   spacing/tint/weight do that job instead: a tinted background one step
   darker than the page, its own thin border, and generous padding wrap the
   whole filter row as a contained unit. */
.recipe-filters-panel {
    background: hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) var(--bulma-scheme-main-ter-l));
    border: 1px solid var(--bulma-border);
    border-radius: 10px;
    padding: 1.25rem 1.25rem 1rem;
    margin-bottom: 2.5rem;
}
/* Filter inputs read visibly lighter than the bold card borders below —
   cards are the actual content and should feel more prominent than the
   controls used to narrow them down, not compete equally for attention. */
.recipe-filters-panel .input,
.recipe-filters-panel .select select {
    border-width: 1px;
    border-color: var(--bulma-border);
    background-color: hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) var(--bulma-scheme-main-bis-l));
}

/* Bulma's .grid uses minmax(<min>, 1fr) columns — the 1fr stretches
   whatever cards exist to fill the row, so with only 1-2 recipes each card
   balloons to the full container width instead of staying card-sized. Cap
   the cell itself so it never grows past a normal card width, regardless of
   how few siblings exist to share the row with. .is-col-min-14's own
   min-track (--bulma-grid-column-min) is 21rem — the original 22rem cap
   here left almost no room to grow past that minimum, so at typical
   desktop widths cards sat pinned near their narrowest possible size with
   the extra row width going to dead space instead of wider cards. 28rem
   gives real breathing room to stretch into on wide viewports while still
   capping the single-card-full-width case this exists to prevent. */
.grid.is-col-min-14 > .cell { max-width: 28rem; }
/* A bit more air between cards than Bulma's own default gap (0.75rem) —
   both directions, since --bulma-grid-gap drives row and column gap
   together. Modest bump, not a redesign: enough to keep cards from feeling
   like they're touching without loosening the grid dramatically. */
.grid.is-col-min-14 { --bulma-grid-gap: 1.25rem; }

/* Recipe titles legitimately wrap to 1 or 2 lines depending on length and
   should never truncate — instead the title area itself reserves space for
   2 lines (1.35 line-height at the is-5 title's 1.25rem font-size) so a
   short 1-line title still leaves the same whitespace before the metadata
   line as a long 2-line one, and the tag row (rendered unconditionally
   below, even with zero tags) reserves space for TWO pill rows the same
   way — measured live against a real 3-tag card, which already wraps to 2
   rows at this card width, so 1 row's worth wasn't actually enough headroom
   for the data that exists today. Together these keep every card ending at
   the same height regardless of how much its actual content varies.
   Desktop-only: mobile stacks one card per row (see the 768px block above),
   where matching row-heights across cards doesn't apply and this would
   just add unwanted blank space under short titles/tag-less cards. */
@media screen and (min-width: 769px) {
    .recipe-card-title {
        min-height: calc(2 * 1.25rem * 1.35);
        margin-bottom: 0.5rem !important;
    }
    .recipe-card-tags {
        min-height: 4.9rem;
    }
}

/* Below the point where only one grid column fits, CSS Grid's
   minmax(14rem,1fr)-with-auto-fill sizing has a real rounding quirk:
   measured live at 375px, the single remaining column rendered 336px wide
   inside a 327px container — a 9px overflow past the container's own
   right edge, not just a visual nitpick. Forcing a plain block layout
   below the tablet breakpoint (Bulma's own breakpoint, used elsewhere in
   this app for the same mobile/desktop split) sidesteps the grid math
   entirely — a single stacked column is just 100% width, which can't
   overflow its own container the way the grid track calculation did. The
   22rem cap above is desktop-only "few cards" behavior and doesn't apply
   here (this always stacks one per row regardless of card count). */
@media screen and (max-width: 768px) {
    .grid.is-col-min-14 { display: block; }
    .grid.is-col-min-14 > .cell { max-width: none; margin-bottom: 0.75rem; }
    /* Tighter padding and internal spacing on mobile — a card with only a
       title and one metadata line took up nearly as much vertical space as
       one with tags too, since the box's padding/margins didn't scale down
       with how little content some cards actually have. Desktop is
       untouched; this whole block is scoped to the same breakpoint above. */
    .recipe-card { padding: 0.85rem 1rem; }
    .recipe-card .title.is-5 { margin-bottom: 0.35rem !important; font-size: 1.15rem; }
    .recipe-card .tags { margin-top: 0.35rem !important; }
}

/* Recipe list filters: search + tag go full-width on mobile (the two
   filters worth keeping always visible), Filter/More-Filters buttons stay
   inline beside them, and everything else (diet/prep/cook/total-time,
   show-archived) collapses behind the "More Filters" toggle — the
   remaining five controls were taking up several screens' worth of
   vertical space before a user ever saw a single recipe. Desktop is
   untouched: the toggle button is is-hidden-tablet (hidden above the
   breakpoint), and the panel it controls has no display override outside
   this media query, so it's simply always visible there regardless of the
   .is-active class this toggle manages. */
@media screen and (max-width: 768px) {
    .recipe-filters-primary .control:nth-child(1),
    .recipe-filters-primary .control:nth-child(2) { width: 100%; }
    .recipe-filters-primary .control:nth-child(2) .select,
    .recipe-filters-primary .control:nth-child(2) .select select { width: 100%; }
    /* Plain .recipe-filters-more (specificity 0,1,0) loses to Bulma's own
       .field.is-grouped {display:flex} (0,2,0, two chained classes) —
       verified live that the panel stayed visibly flex-displayed despite
       this rule matching, purely on a specificity tie-loss, not a caching
       or cascade-order issue. Matching that specificity by chaining the
       element's own existing .field class fixes it outright. */
    .field.recipe-filters-more { display: none; }
    .field.recipe-filters-more.is-active { display: flex; }
}

/* Dietary flags are fully manual/voluntary (see RECIPEBOX_CLAUDE.md decision
   log) — a flag only ever renders at all when explicitly declared. On the
   edit form they're still tap-to-toggle pills (name text needed there, since
   it's a control being switched on/off, not just a status display). On the
   recipe detail page they're bare icons only, sized up for readability since
   there's no text label to help identify them — the flag name still reaches
   assistive tech via the badge's title/sr-only text. */
.dflag-icon { width: 1rem; height: 1rem; flex: 0 0 auto; }
.nav-gear-icon { width: 0.9rem; height: 0.9rem; margin-left: 0.35rem; vertical-align: -0.15em; }

.dietary-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.5rem; }
.dflag-badge { display: inline-flex; }
.dflag-badge .dflag-icon { width: 1.75rem; height: 1.75rem; }

/* Bulma's default .tag background is --bulma-background-l (96%) — the same
   lightness family as the page background, so plain tags are nearly
   invisible against this cream theme (the same root cause fixed earlier for
   buttons/inputs). Recipe tags get a per-tag color burst instead of one flat
   neutral (see recipebox_tag_color() in helpers.php) via --tag-bg/--tag-fg
   custom properties set inline per tag; the fallback values here (used by
   any .tag that doesn't set those, e.g. dietary-flag toggle chips) are the
   same hsl(38,40%,90%)/muted-text pair from the original fix, 5.64:1
   contrast. Hover uses a brightness filter rather than a hardcoded
   background-color override so it works uniformly across every tag color,
   not just the single default. */
.tag {
    background-color: var(--tag-bg, hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) 90%));
    color: var(--tag-fg, hsl(var(--bulma-text-h) var(--bulma-text-s) var(--rb-muted-l)));
}
a.tag:hover { filter: brightness(0.94); }

/* Tag-entry chip editor (recipe create/edit form) — replaces the old plain
   comma-separated text input. Wrapped in the same border treatment as
   .input/.textarea/.select so it reads as one more themed form control, not
   a bespoke widget; chips use the same colored-tag look as everywhere else
   (color set via --tag-bg/--tag-fg custom properties, computed in JS with
   the same hash+palette as recipebox_tag_color() in helpers.php). */
.tags-editor {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.5em;
    padding: 0.3rem 0.5rem;
    border: var(--rb-border-w) solid var(--rb-border-color);
    border-radius: 4px;
    background: #fff;
}
.tags-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: #fff;
    border: var(--rb-border-w) solid var(--rb-border-color);
    border-radius: 4px;
    z-index: 20;
    overflow: hidden;
}
.tags-suggestion-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    cursor: pointer;
    font: inherit;
    color: hsl(var(--bulma-text-h) var(--bulma-text-s) var(--bulma-text-l));
}
.tags-suggestion-item:hover {
    background: hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) 94%);
}
.tags-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags-editor-chip { display: inline-flex; align-items: center; gap: 0.35rem; }
.tags-editor-chip-remove {
    border: none; background: none; padding: 0; cursor: pointer;
    color: inherit; font-size: 1rem; line-height: 1; opacity: 0.7;
}
.tags-editor-chip-remove:hover { opacity: 1; }
.tags-editor-input {
    flex: 1 1 8rem;
    min-width: 8rem;
    border: none;
    outline: none;
    font: inherit;
    background: transparent;
    padding: 0.3rem 0;
}

/* Free-text ingredient lines are asterisk-marked (scaling/dietary caveat) */
.ingredient-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.ingredient-list li { padding: 0.4rem 0; border-bottom: 1px solid var(--rb-divider-color); }
.ingredient-list li:last-child { border-bottom: none; }
.ingredient-list .free-text::after { content: " *"; color: hsl(var(--bulma-primary-h) var(--bulma-primary-s) var(--bulma-primary-l)); font-weight: bold; }

/* Numbered recipe steps */
/* The steps column is wide (is-8, ~65% of the container) for visual balance
   against the narrower ingredients column, but that column width alone
   would put ~97 characters on a line (measured live at 1280px viewport) —
   almost double the 50-75ch comfortable-reading convention. Capped
   independently of the column's actual width so the two concerns (visual
   proportion vs. line length) don't have to be the same number. A CSS `ch`
   unit was tried first but Public Sans's "0" glyph (what `ch` is defined
   against) measures wider than this text's actual average character width,
   so 65ch rendered at ~80 real chars/line — this fixed px value was reached
   by measuring actual rendered chars/line directly and adjusting, landing
   at 65 real chars/line (see conversation this was tuned in). */
.steps-list { padding: 0; margin: 0; counter-reset: step; max-width: 34rem; }
.steps-list li { list-style: none; counter-increment: step; margin-bottom: 1.75rem; padding-left: 2.4rem; position: relative; }
.steps-list li::before {
    content: counter(step);
    position: absolute; left: 0; top: 0;
    width: 1.8rem; height: 1.8rem;
    background: hsl(var(--bulma-primary-h) var(--bulma-primary-s) var(--bulma-primary-l)); color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 600;
}
.steps-list .step-ingredients { color: hsl(var(--bulma-text-h) var(--bulma-text-s) var(--rb-muted-l)); font-size: 0.8rem; margin-top: 0.3rem; }

/* Recipe detail header: title/source-link/tags, the Start Cooking button,
   and the dietary-flag row are three independent grid areas so their
   ORDER can differ by breakpoint without duplicating markup. Desktop
   keeps the original look — main content left, button top-right, dietary
   row spanning below both (visually identical to before: it's left-
   aligned content, so spanning the full width under a right-aligned
   button reads the same as being confined to the left column only).
   Mobile stacks all three in a single column, reordered so Start Cooking
   sits between the source link/tags and the dietary icons, not off to the
   side — CSS `order`-on-siblings can't do this because the button used to
   be a sibling of a wrapping div that ALSO contained the dietary row, so
   grid-template-areas (which needs actual sibling elements, not nested
   ones) required pulling the dietary row out to be a sibling too — see
   recipes/show.php. */
.detail-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "main cook" "diet diet";
    column-gap: 1rem;
    margin-bottom: 1.5rem;
}
.detail-header-main { grid-area: main; }
/* Grid items stretch to fill their track's height by default — the "cook"
   area shares a row with "main" (title/source-link/tags, often multiple
   lines tall), so without align-self the button ballooned vertically to
   match, instead of sizing to its own content like a normal button. */
.detail-header-cook { grid-area: cook; justify-self: start; align-self: start; }
.detail-header-diet { grid-area: diet; }
@media screen and (max-width: 768px) {
    .detail-header {
        grid-template-columns: 1fr;
        grid-template-areas: "main" "cook" "diet";
        row-gap: 0.75rem;
    }
    .detail-header-cook { justify-self: stretch; text-align: center; }
    /* Big title on mobile, per explicit request — the title's own
       font-size otherwise comes from Bulma's .title default, which reads
       smaller relative to the page on a narrow screen than it does on
       desktop. */
    .detail-header-main .title { font-size: 2rem; }
}

/* Mobile nav (real Bulma navbar-burger, toggled via JS in layout.php) drops
   the menu down below the navbar in normal document flow (Bulma's own
   default .navbar-menu.is-active behavior — display:block, no transform,
   no overlay) rather than sliding in from a side drawer. Bulma's default
   box-shadow on the dropped-down menu is replaced with the same bold
   border as every other separated surface in this flat theme. */
.navbar-menu {
    box-shadow: none;
}

/* "RecipeBox" reads as the app's name, not just another nav link — bigger,
   bolder, and in the primary accent color, distinct from the plain-text
   Recipes/Meal Plan/Shopping Lists items beside it. Sized in em relative to
   its own navbar-item (not a fixed rem value) so it scales with the
   desktop-only navbar height bump right below. */
.navbar-brand-name, a.navbar-brand-name:hover {
    font-weight: 800;
    font-size: 1.3em;
    color: hsl(var(--bulma-primary-h) var(--bulma-primary-s) var(--bulma-link-l));
}

/* Desktop-only: a taller navbar gives the brand name (now visually heavier)
   room to breathe, and the nav links a bit more presence too — mobile stays
   untouched at Bulma's default height, where every pixel of vertical space
   is already at a premium. */
@media screen and (min-width: 769px) {
    .navbar {
        --bulma-navbar-height: 4.25rem;
    }
    /* :not() here isn't just style preference — .navbar-brand-name IS a
       .navbar-item too, and an unscoped rule of equal specificity here would
       win by appearing later in the stylesheet, silently overwriting that
       rule's own 1.3em back down to this flat 1.05rem. */
    .navbar-item:not(.navbar-brand-name), .navbar-link {
        font-size: 1.05rem;
    }
}
/* Scoped to .is-active (only ever added by the mobile burger toggle) rather
   than bare .navbar-menu — the desktop layout shows this same element
   inline at all times without that class, so an unscoped border rendered
   as a stray line under the whole navbar on desktop too. */
.navbar-menu.is-active {
    border-bottom: var(--rb-border-w) solid var(--rb-border-color);
}

/* Mobile action bar (Import from URL / + New Recipe) — its own full-width
   row below the navbar, not squeezed into it alongside the brand name and
   burger. That in-navbar layout genuinely didn't fit on a real phone
   (confirmed on an actual device, not just the narrow end of an emulated
   range) even after shrinking fonts once already to try to close the gap —
   a structural fix (give it its own row) instead of a second, smaller
   shrink. Buttons stretch evenly to fill the width via .has-addons'
   existing flex layout, no extra sizing needed here. */
.mobile-nav-actions-bar {
    padding: 0.5rem 0.75rem;
}
.mobile-nav-actions-bar .buttons.has-addons { margin-bottom: 0; }
.mobile-nav-actions-bar .button { flex: 1 1 0; }

/* A plain hamburger emoji standing in for Bulma's default three-bar icon —
   its span still gets Bulma's bar CSS (absolute position, fixed
   width/height, background-color as a colored rectangle) since that's
   selector-based, not opt-in, so it has to be reset back to plain inline
   text explicitly. The is-active rotate-on-open transform (built for the
   three bars turning into an X) still applies to this single span too —
   left in on purpose, the emoji tilting 45° when the menu opens is a fun
   side effect, not a bug. */
.burger-emoji span {
    position: static;
    background: none;
    width: auto;
    height: auto;
    display: inline;
    font-size: 1.3rem;
    line-height: 1;
}

/* Checkboxes/radios pick up the ochre theme instead of the browser's default
   blue — Bulma's own .checkbox class is just spacing/cursor, it doesn't set
   accent-color at all. */
input[type=checkbox], input[type=radio] {
    accent-color: hsl(var(--bulma-primary-h) var(--bulma-primary-s) var(--bulma-primary-l));
}

/* Bulma's ".checkbox" class really is just cursor:pointer + inline-block —
   no border, no sizing, no background — so a bare native checkbox next to
   the bordered search input/select/Filter button in the same toolbar row
   reads as unstyled rather than as one more themed control. Wrapped in a
   bordered pill matching the input border color so it sits at the same
   visual weight as its neighbors. */
label.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 2.5em;
    padding: 0 0.9rem;
    border: var(--rb-border-w) solid var(--rb-border-color);
    border-radius: 4px;
    background: hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) 98%);
}
label.checkbox input[type=checkbox] {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
}

/* Text inputs have the same "invisible until hover" problem as the icon
   buttons above — Bulma's default input border is the generic --bulma-border
   (86% lightness, 1.22:1 against the page) and its background exactly
   matches the page. Same fix, same target value, applied globally since
   every input in the app shares this one root cause. */
.input, .textarea, .select select {
    border-width: var(--rb-border-w);
    border-color: var(--rb-border-color);
}

/* Bulma rounds the corners of a .field.has-addons group using
   .control:first-child/:last-child — but nearly every POST form in this app
   opens with csrf_field()'s hidden <input>, rendered as a sibling BEFORE the
   first .control div, not inside it. That hidden input becomes the form's
   actual :first-child, so the first .control no longer matches
   :first-child at all — it silently falls into Bulma's "middle control"
   rule instead (radius:0 on every corner), losing its left-side rounding
   while the has-addons button on the end (still legitimately :last-child,
   unaffected by what precedes it) keeps its own correct corners. Only forms
   with no CSRF field (the plain GET search/filter form) or with the field
   as their literal first element ever had the correct rounding by accident.
   :first-of-type/:last-of-type match by tag+position among same-tag
   siblings, so a preceding same-tag-different-class or different-tag (like
   this hidden input) sibling can't break them the same way — reproducing
   Bulma's own left/right split, just on a selector CSRF fields can't derail. */
.field.has-addons .control:first-of-type:not(:only-of-type) .input,
.field.has-addons .control:first-of-type:not(:only-of-type) .button,
.field.has-addons .control:first-of-type:not(:only-of-type) .select select {
    border-start-start-radius: var(--bulma-control-radius);
    border-end-start-radius: var(--bulma-control-radius);
    border-start-end-radius: 0;
    border-end-end-radius: 0;
}
.field.has-addons .control:last-of-type:not(:only-of-type) .input,
.field.has-addons .control:last-of-type:not(:only-of-type) .button,
.field.has-addons .control:last-of-type:not(:only-of-type) .select select {
    border-start-start-radius: 0;
    border-end-start-radius: 0;
    border-start-end-radius: var(--bulma-control-radius);
    border-end-end-radius: var(--bulma-control-radius);
}
.field.has-addons .control:not(:first-of-type):not(:last-of-type) .input,
.field.has-addons .control:not(:first-of-type):not(:last-of-type) .button,
.field.has-addons .control:not(:first-of-type):not(:last-of-type) .select select {
    border-radius: 0;
}

/* Bulma's own placeholder color formula is the text color at 30% opacity —
   against this theme's near-black text token that renders very light/washed
   out (e.g. "Amount", "Ingredient name"), while the tag-entry input (a
   plain custom input, not a Bulma .input) was never touched by that rule
   and fell back to the browser's own default placeholder color instead —
   visibly different shades side by side. Unified to the same muted-text
   token used for every other secondary-text purpose in the app, at full
   opacity, on every placeholder-bearing field regardless of which markup
   pattern it uses. */
.input::placeholder,
.textarea::placeholder,
.tags-editor-input::placeholder {
    color: hsl(var(--bulma-text-h) var(--bulma-text-s) var(--rb-muted-l));
    opacity: 1;
}

/* Plain in-content links (recipe titles in Meal Plan, "Imported from" source
   links, etc.) had no hover state at all — Bulma only defines :hover for
   specific components (breadcrumb/panel/tabs), not bare <a> tags. */
.container a:not(.button):not(.navbar-item):not(.dropdown-item):not(.tag) {
    text-decoration: none;
}
.container a:not(.button):not(.navbar-item):not(.dropdown-item):not(.tag):not(.recipe-card):hover {
    text-decoration: underline;
}

/* Icon-only controls (kebab menu, pencil-rename) — Bulma's default .button
   border is only 1.22:1 against the page background (same lightness family,
   10 percentage points apart), and its background exactly MATCHES the page,
   so there's no visible clickable boundary until hover. Border darkened to
   hsl(38,40%,44%) = #9d7c43, 3.61:1 at rest — clears the 3:1 UI-component
   minimum without waiting for :hover. */
.icon-affordance {
    border-width: var(--rb-border-w);
    border-color: var(--rb-border-color);
    background-color: hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) var(--bulma-scheme-main-l));
}
.icon-affordance:hover {
    background-color: hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) var(--bulma-scheme-main-ter-l));
}
.action-icon { width: 1.1rem; height: 1.1rem; display: block; }
/* A text button's height comes from its line-height (~24px at 1rem text);
   action-icon is a block-level SVG (no line box of its own), so at its
   default 1.1rem/17.6px it made icon-only buttons render ~6px shorter than
   their text siblings in the same row (measured: 35.6px vs 42px). Sized up
   to match that same ~24px content height instead of fighting flexbox/
   line-height to force it. */
.icon-affordance .action-icon { width: 1.5rem; height: 1.5rem; }

/* Bulma's h1.title carries its own 24px margin-bottom, which dominated the
   gap above this badge regardless of the badge's own margin-top — tightened
   specifically when a source-badge follows so the badge reads as attached
   to the title, with clear separation below instead, before the tags. */
h1.title:has(+ .source-badge) { margin-bottom: 0.35rem; }
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 1rem;
    font-size: 0.85rem;
    color: hsl(var(--bulma-text-h) var(--bulma-text-s) var(--rb-muted-l));
}
.source-badge .action-icon { width: 0.9rem; height: 0.9rem; }
.source-badge:hover { color: hsl(var(--bulma-primary-h) var(--bulma-primary-s) var(--bulma-link-l)); }

/* Structured-ingredient / step editor rows in the recipe form */
/* Imported ingredient line the parser couldn't confidently split — gated
   behind an explicit "Structure" / "Keep as free text" choice before the
   normal editing UI (and the free-text toggle) becomes visible. */
.ingredient-row.needs-review .row-top,
.ingredient-row.needs-review .free-text-toggle,
.ingredient-row.needs-review .free-text-field { display: none; }

/* Demoted from the theme's bold black border to the same light divider
   color used for ingredient-list dividers — with a whole stack of these
   repeated per recipe, giving every single one the same heavy black
   outline as the form's actual section containers made the page read as
   a wall of black boxes with no hierarchy. The outer section .box
   containers below keep the bold border (that's still the right weight
   for "this is a distinct section of the form") plus a colored left
   accent stripe, so sections are identifiable at a glance without relying
   on border weight alone. */
.ingredient-row, .step-row {
    border: 1px solid var(--rb-divider-color);
    border-radius: 8px;
    padding: 0.8rem;
    margin-bottom: 0.7rem;
    background: hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) var(--bulma-scheme-main-bis-l));
}

/* Recipe form section accents — every top-level section box (Basic Info,
   Ingredients, Steps, Nutrition, Dietary Flags — all five now, Ingredients/
   Steps previously had no box at all, which is why they looked
   inconsistent next to the other three's bold borders) gets a colored left
   stripe + a light background tint, pulled from the same 8-hue palette
   recipebox_tag_color() (tags) and the dietary-flag icons already use, so
   this stays one shared color system instead of introducing a 4th. Picked
   hues distinct from the theme's own primary green (already used for the
   section-title text baseline and the submit button) to avoid confusion
   with those. Widened from the first pass's 4px to 8px, and added the
   background tint and matching header-text color, after feedback that a
   thin border-only stripe read as too subtle to actually scan by. */
.form-section-basic { border-left: 8px solid #1d3972; background-color: #eff3fa; }
.form-section-ingredients { border-left: 8px solid #72471d; background-color: #faf5ef; }
.form-section-steps { border-left: 8px solid #721d56; background-color: #faeff7; }
.form-section-nutrition { border-left: 8px solid #401d72; background-color: #f4effa; }
.form-section-dietary { border-left: 8px solid #721d1d; background-color: #faefef; }

/* Section headers colored to match their section's own accent below them,
   instead of the uniform green every other section-title in the app uses
   — reinforces which header belongs to which colored box, scoped to just
   this form so the app-wide section-title convention elsewhere is
   untouched. */
.section-title.form-section-title-ingredients { color: #72471d; }
.section-title.form-section-title-steps { color: #721d56; }
.section-title.form-section-title-nutrition { color: #401d72; }
.section-title.form-section-title-dietary { color: #721d1d; }
.ingredient-row .row-top, .step-row .row-top { display: flex; gap: 0.5rem; align-items: flex-start; }
.ingredient-row .row-top > * { flex: 1; }
/* step-row never got this same rule — its textarea had no flex-basis
   constraint, so it rendered at its own natural (too-wide) width and
   pushed the remove button out past the row's border instead of sharing
   the row with it. flex:1 alone wasn't enough on its own, either: flex
   items default to min-width:auto (their min-content size), and a
   textarea's min-content width is large enough that it still refused to
   shrink to fit — min-width:0 is the standard fix for this flexbox
   textarea/input overflow gotcha. */
.step-row .row-top > *:not(.remove-btn) { flex: 1; min-width: 0; }
/* Step number badge — shows the step's current position so it's easy to
   find "step 4" when going back to edit one, and stays live as steps are
   added/removed/reordered (renumberSteps() in the script below), since
   there's no persisted step number in the form itself until save. Excluded
   from the flex:1 rule above so it stays a small fixed circle instead of
   stretching to share the row's width like the textarea does. */
.step-row .row-top .step-number-badge {
    flex: 0 0 auto;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: hsl(var(--bulma-primary-h) var(--bulma-primary-s) var(--bulma-primary-l));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}
.ingredient-row .row-top .amount { flex: 0 0 6.5rem; }
/* Bulma's .has-text-grey defaults to a cold blue-gray (#69748c, 4.35:1 — also
   an actual AA failure) that doesn't match this warm palette at all. Used
   site-wide for metadata like "Prep 15 min · Cook 20 min" — override globally
   to the same fixed warm muted color as everywhere else, not just for the
   one label.label case this rule originally targeted. */
.has-text-grey { color: hsl(var(--bulma-text-h) var(--bulma-text-s) var(--rb-muted-l)) !important; }
.ingredient-row .row-top .unit { flex: 0 0 10rem; }
.ingredient-row .row-top .remove-btn, .step-row .remove-btn { flex: 0 0 auto; }
/* name-remove-group wraps the name field and remove button together (see
   the mobile media query below for why) — needs its own flex row at every
   width, not just mobile, since it now sits between unit and notes as a
   single .row-top child instead of two. */
.ingredient-row .row-top .name-remove-group { display: flex; flex: 1; gap: 0.5rem; min-width: 0; }
.ingredient-row .row-top .name-remove-group .ingredient-name-wrap { flex: 1; min-width: 0; }
/* .row-top's fixed-width amount (6.5rem) + unit (10rem) + two icon toggles
   + remove button add up to ~360px, wider than a 375px phone screen has
   room for once page padding is subtracted (measured ~249px available) —
   real horizontal overflow, not a rare edge case, since every recipe's
   ingredient rows use this same layout. Wrapping to two lines and letting
   amount/unit share a row proportionally (fixed rem widths would still
   overflow on their own) keeps every control on-screen without shrinking
   any of them illegibly. */
@media screen and (max-width: 480px) {
    .ingredient-row .row-top {
        flex-wrap: wrap;
        row-gap: 0.6rem;
    }
    /* Split unevenly rather than 50/50 — amount values are short numbers
       ("1", "1/2") but unit names ("tablespoon", "kilogram") need more
       room than an even split gives, or the select just clips the text. */
    .ingredient-row .row-top .amount {
        flex: 1 1 32%;
    }
    .ingredient-row .row-top .unit {
        flex: 1 1 60%;
    }
    /* Name + notes + remove all inherited the base rule's plain flex:1 with
       no explicit width (only amount/unit were given one above), so all
       three squeezed into equal thirds of the row -- the ingredient name,
       the one field that actually needs room to be readable, ended up as
       cramped as the two-character remove button next to it. name and
       remove are grouped in the markup (own full-width row) so they
       always share a line without relying on flex-wrap/order guesswork;
       notes gets its own full-width row below. */
    .ingredient-row .row-top .name-remove-group {
        flex: 1 1 100%;
        display: flex;
        gap: 0.5rem;
    }
    .ingredient-row .row-top .name-remove-group .ingredient-name-wrap {
        flex: 1 1 auto;
        min-width: 0;
    }
    .ingredient-row .row-top .name-remove-group .remove-btn {
        flex: 0 0 2.75rem;
    }
    .ingredient-row .row-top .name-remove-group .remove-btn .button {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
    .ingredient-row .row-top .notes-wrap {
        flex: 1 1 100%;
    }
    /* Bulma's is-grouped-multiline sizes each .control to its own content,
       so on a narrow screen the singular/plural inputs, the type select,
       and Add/Cancel all end up as separate cramped islands instead of
       overflowing (which would at least force a wrap) — full-width
       controls read as a normal stacked form instead. */
    .add-unit-panel.field.is-grouped {
        flex-wrap: wrap;
        row-gap: 0.5rem;
    }
    .add-unit-panel .control {
        flex: 1 1 100%;
    }
    .add-unit-panel .control .input,
    .add-unit-panel .control .select,
    .add-unit-panel .control .select select {
        width: 100%;
    }
}
.ingredient-row .free-text-toggle { font-size: 0.8rem; color: hsl(var(--bulma-text-h) var(--bulma-text-s) var(--rb-muted-l)); margin-top: 0.5rem; display: flex; align-items: center; gap: 0.4rem; }
/* Indented to line up with the textarea above, not the row's own left edge
   — the textarea starts 2.3rem in (1.8rem number badge + 0.5rem row-top
   gap), but .step-ingredient-tags and the reset button are separate
   siblings below .row-top, not inside it, so they started flush against
   the step number instead of the text field they actually relate to. */
.step-ingredient-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 0 2.3rem; }
/* Bulma's .tag defaults to white-space:nowrap, fine for short words like
   "chicken" but not for a full ingredient line ("kosher salt (plus 1/2
   teaspoon, divided)") — nowrap forced the whole label onto one line
   regardless of container width, which on mobile blew the pill (and the
   whole page) out to ~590px wide instead of wrapping the text within it. */
.step-ingredient-tags label.tag {
    font-weight: normal;
    cursor: pointer;
    white-space: normal;
    max-width: 100%;
    height: auto;
}
.step-ingredient-tags input { margin-right: 0.3rem; }
.reset-step-match { margin-left: 2.3rem; }

/* Dietary flag toggles: icon-only (no pill, no text label — name is still
   available via the label's title attribute and an sr-only span), greyed
   out until clicked. Greyscale + reduced opacity reads as "inactive" without
   needing a separate unchecked-state icon set; clicking restores full
   color, which doubles as the "this is now active" signal. */
.dietary-toggle-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.dflag-toggle {
    display: inline-flex;
    cursor: pointer;
    user-select: none;
    border-radius: 50%;
    padding: 0.35rem;
    transition: background-color 0.15s ease;
}
.dflag-toggle input { display: none; }
.dflag-toggle .dflag-icon {
    width: 2.5rem;
    height: 2.5rem;
    filter: grayscale(1);
    opacity: 0.4;
    transition: filter 0.15s ease, opacity 0.15s ease;
}
.dflag-toggle:hover .dflag-icon { opacity: 0.7; }
.dflag-toggle:hover { background-color: hsl(var(--bulma-scheme-h) var(--bulma-scheme-s) 92%); }
.dflag-toggle.on .dflag-icon { filter: none; opacity: 1; }

/* Section labels use the green accent, darkened for text-safe contrast —
   reuses --bulma-link-l rather than its own separate hardcoded darkened
   value (the two used to be independently-tuned numbers: link at 42%,
   section-title at 34%; unified to one "darkened-for-text primary" token
   now that both need the same thing). Sized at 1.15rem so it's
   unmistakably larger than the 1rem metadata line beneath it (e.g.
   "Prep 15 min · Cook 20 min", plain body-size text via .has-text-grey) —
   previously 0.85rem, actually SMALLER than that metadata despite being
   the label meant to introduce it. */
.section-title { font-size: 1.15rem; text-transform: uppercase; letter-spacing: 0.06em; color: hsl(var(--bulma-primary-h) var(--bulma-primary-s) var(--bulma-link-l)); margin: 2rem 0 0.75rem; }

.footnote { color: hsl(var(--bulma-text-h) var(--bulma-text-s) var(--rb-muted-l)); font-size: 0.82rem; margin-top: 0.5rem; }

/* .servings-scaler is the SAME element as .field.has-addons (it's all one
   <form>), so a blanket flexbox `gap` here doesn't just space the label
   from the input group — it also inserts a gap BETWEEN the input and the
   Update button, defeating has-addons' whole point of joining them into
   one visual unit with no seam. The label needs its own spacing instead,
   scoped to just that one gap, leaving has-addons' controls truly adjacent. */
.servings-scaler { display: flex; align-items: center; }
.servings-scaler input[type=number] { width: 5rem; }

/* "+ Meal Plan" and "+ Add to Shopping List" are both a single .field
   has-addons row with FOUR controls (a label/select, a date/text input, the
   submit button, and Cancel) — has-addons forces one unbreakable flex row
   with no wrapping, which fits a desktop width fine but genuinely overflows
   a real phone screen (confirmed on an actual device, not just an emulated
   one). Wrapping to stacked full-width controls on mobile fixes the
   overflow; the border-radius reset undoes has-addons' "joined into one
   visual unit" corner rounding (own CSS earlier in this file), since that
   treatment only makes sense when the controls actually sit side by side —
   stacked, it left odd half-rounded corners at each wrap point instead. */
@media screen and (max-width: 480px) {
    #add-to-meal-plan .field.has-addons,
    #add-to-shopping-list .field.has-addons {
        flex-wrap: wrap;
        gap: 0.6rem;
    }
    #add-to-meal-plan .field.has-addons .control,
    #add-to-shopping-list .field.has-addons .control {
        width: 100%;
        margin: 0 !important;
    }
    #add-to-meal-plan .field.has-addons .select,
    #add-to-meal-plan .field.has-addons .select select,
    #add-to-shopping-list .field.has-addons .select,
    #add-to-shopping-list .field.has-addons .select select {
        width: 100%;
    }
    #add-to-meal-plan .field.has-addons .input,
    #add-to-meal-plan .field.has-addons .button,
    #add-to-shopping-list .field.has-addons .input,
    #add-to-shopping-list .field.has-addons .button {
        border-radius: 4px !important;
    }
}
/* Copy for Instacart / Mark as Shopped: side by side with auto-sized
   (content-width) buttons, this pair is fine at the base system font size
   but has no flex-wrap — a larger Dynamic Type / accessibility text size
   setting (which an emulator at default zoom won't reproduce) can push
   their combined width past the screen, overflowing the right edge instead
   of wrapping. Letting them wrap to their own full-width rows removes that
   dependency on how wide the button text happens to render. */
@media screen and (max-width: 480px) {
    .shopping-list-actions {
        flex-wrap: wrap;
        row-gap: 0.6rem;
    }
    .shopping-list-actions .control {
        flex: 1 1 100%;
        margin-right: 0 !important;
    }
    .shopping-list-actions .control .button {
        width: 100%;
    }
}
/* "Servings" previously used .button.is-static, which made a plain label
   look like a disabled button. Bulma's .label class gives normal
   bold-text styling with no button chrome. */
.servings-plain-label { margin: 0 0.6rem 0 0; font-weight: 600; }

/* "Mark as Shopped" celebration — purely decorative overlay (see
   shopping-lists/show.php), plays for ~0.7s before the real submit
   proceeds. pointer-events:none so it can never intercept a click even if
   something delays it. */
.shopped-celebration {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    z-index: 50;
}
.shopped-celebration.show { opacity: 1; }
.shopped-checkmark {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    background: hsl(var(--bulma-primary-h) var(--bulma-primary-s) var(--bulma-primary-l));
    color: #fff;
    font-size: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
}
.shopped-celebration.show .shopped-checkmark {
    animation: shopped-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes shopped-pop {
    0% { transform: scale(0); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.shopped-confetti {
    position: absolute;
    font-size: 1.5rem;
    opacity: 0;
}
.shopped-celebration.show .shopped-confetti {
    animation: shopped-confetti-burst 0.7s ease-out forwards;
}
.shopped-confetti-1 { animation-delay: 0.05s; }
.shopped-confetti-2 { animation-delay: 0.1s; }
.shopped-confetti-3 { animation-delay: 0.02s; }
.shopped-confetti-4 { animation-delay: 0.12s; }
@keyframes shopped-confetti-burst {
    0% { opacity: 1; transform: translate(0, 0) scale(0.6); }
    100% { opacity: 0; transform: translate(var(--dx, -60px), var(--dy, -70px)) scale(1.1); }
}
.shopped-confetti-1 { --dx: -70px; --dy: -80px; }
.shopped-confetti-2 { --dx: 70px; --dy: -80px; }
.shopped-confetti-3 { --dx: -50px; --dy: 60px; }
.shopped-confetti-4 { --dx: 50px; --dy: 60px; }

/* A raw URL rendered as its own link text (import source, magic-link/
   email-change debug links) has no natural break points — no spaces, and
   default CSS only wraps at those — so on a narrow screen it just extends
   straight past its container's edge and off the visible screen instead of
   wrapping. overflow-wrap:anywhere lets it break mid-word/mid-URL when
   there's truly nowhere else to break, which a full URL usually needs. */
.source-url-link {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Data tables (Invite Management, Meal Plan) don't reflow their columns on
   a narrow screen — a real email address or a long recipe title just holds
   its column open at full width, pushing the whole table (and the page
   along with it) wider than the viewport. Scoping overflow-x to a wrapper
   around just the <table> keeps the table itself fully intact (no lost
   columns, no squeezed text) while confining the horizontal scroll to the
   table alone — the page body itself never scrolls sideways. */
.table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

