/* ============================================================
   NOMS — Design System Foundations
   ============================================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--bg-base);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
}

a {
    color: var(--accent-ink);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-ink);
}

a:not(.btn):not(.navbar-link):hover {
    text-decoration: underline;
}

/* ============================================================
   CSS Custom Properties — Light Mode (default)
   ============================================================ */
:root {
    /* Shared desktop composition width; inner text measures remain independent. */
    --content-max-width: 1760px;
    /* Backgrounds */
    --bg-base: #FAF7F2;
    --surface: #F5F0E8;

    /* Neumorphic shadows */
    --shadow-light: #FAF7F1;
    --shadow-dark: #C8C1B4;
    --border-color: rgba(122, 117, 109, 0.28);

    /* Contrast roles keep the original coral fills and warm surfaces intact. */
    --on-accent: #12100D;
    --on-danger: #FFFFFF;
    --accent-ink: #95432F;
    --error-ink: #A73732;
    --success-ink: #2E6B40;
    --warning-ink: #805018;
    --field-placeholder: #696159;
    --focus-ring: #95432F;
    --field-border: #847C70;

    /* Button edge color (inherits parent context) */
    --btn-edge: var(--surface);

    /* Glassmorphism */
    --glass-fill: rgba(255, 255, 255, 0.20);
    --glass-border: rgba(255, 255, 255, 0.30);
    --glass-blur: blur(16px) saturate(180%);

    /* M4 dialog material is independent of navigation's existing glass. */
    --overlay-opaque: var(--bg-base);
    --overlay-fill: rgba(250, 247, 242, 0.94);
    --overlay-border: rgba(255, 255, 255, 0.80);
    --overlay-shadow: 0 20px 64px rgba(45, 42, 38, 0.24), 0 4px 16px rgba(45, 42, 38, 0.12);
    --overlay-blur: blur(20px) saturate(120%);
    --overlay-muted: #635D55;

    /* Accent palette */
    --accent: #D9735A;
    --accent-hover: #C4613F;
    --success: #5A9E6F;
    --success-bg: rgba(90, 158, 111, 0.10);
    --warning: #D4923B;
    --error: #C4504A;
    --error-bg: rgba(196, 80, 74, 0.10);

    /* Text */
    --text-primary: #2D2A26;
    /* Small copy must stay readable even over the warmest gradient stop. */
    --text-secondary: #625B53;
    --text-tertiary: #696159;

    /* Typography */
    --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Fredoka', 'Georgia', serif;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Background gradient */
    --bg-gradient-1: #FAF7F2;
    --bg-gradient-2: #F5E6D0;
    --bg-gradient-3: #E8EDE2;
    --bg-gradient-4: #F0DCC8;
}

/* ============================================================
   CSS Custom Properties — Dark Mode
   ============================================================ */
.dark {
    --bg-base: #1E1C18;
    --surface: #242220;
    --shadow-light: #33302A;
    --shadow-dark: #0F0E0B;
    --border-color: rgba(237, 232, 223, 0.20);
    --on-accent: #12100D;
    --on-danger: #1E1C18;
    --accent-ink: #E8896E;
    --error-ink: #F2938B;
    --success-ink: #93CCA3;
    --warning-ink: #E5A54E;
    --field-placeholder: #9E978C;
    --focus-ring: #E8896E;
    --field-border: #9E978C;
    --glass-fill: rgba(30, 28, 24, 0.50);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-blur: blur(16px) saturate(150%);
    --overlay-opaque: var(--bg-base);
    --overlay-fill: rgba(30, 28, 24, 0.94);
    --overlay-border: rgba(237, 232, 223, 0.24);
    --overlay-shadow: 0 20px 64px rgba(0, 0, 0, 0.48), 0 4px 16px rgba(0, 0, 0, 0.24);
    --overlay-blur: blur(20px) saturate(120%);
    --overlay-muted: #B8B1A7;
    --accent: #E8896E;
    --accent-hover: #F0A08C;
    --success: #72B886;
    --success-bg: rgba(114, 184, 134, 0.15);
    --warning: #E5A54E;
    --error: #D96B63;
    --error-bg: rgba(217, 107, 99, 0.15);
    --text-primary: #EDE8DF;
    --text-secondary: #9E978C;
    --text-tertiary: #968D80;

    --bg-gradient-1: #1A1814;
    --bg-gradient-2: #221E18;
    --bg-gradient-3: #181E20;
    --bg-gradient-4: #1E1820;
}

/* Resolve the shared material and relief against each theme's own palette. */
:root, .dark {
    --neumo-surface: color-mix(in srgb, var(--surface) 42%, transparent);
    --elevation-raised:
        0 12px 26px color-mix(in srgb, var(--shadow-dark) 46%, transparent),
        4px 6px 10px color-mix(in srgb, var(--shadow-dark) 38%, transparent),
        -5px -5px 13px color-mix(in srgb, var(--shadow-light) 75%, transparent),
        inset 2px 2px 1px color-mix(in srgb, var(--shadow-light) 85%, transparent);
    --elevation-raised-hover:
        0 16px 30px color-mix(in srgb, var(--shadow-dark) 52%, transparent),
        5px 7px 12px color-mix(in srgb, var(--shadow-dark) 42%, transparent),
        -5px -5px 13px color-mix(in srgb, var(--shadow-light) 75%, transparent),
        inset 2px 2px 1px color-mix(in srgb, var(--shadow-light) 85%, transparent);
    --elevation-raised-compact:
        0 5px 12px color-mix(in srgb, var(--shadow-dark) 35%, transparent),
        2px 3px 6px color-mix(in srgb, var(--shadow-dark) 26%, transparent),
        -3px -3px 8px color-mix(in srgb, var(--shadow-light) 70%, transparent);
    --elevation-inset:
        inset 4px 4px 7px color-mix(in srgb, var(--shadow-dark) 64%, transparent),
        inset -3px -3px 7px color-mix(in srgb, var(--shadow-light) 82%, transparent),
        1px 2px 5px color-mix(in srgb, var(--shadow-dark) 18%, transparent);
    --elevation-inset-compact:
        inset 2px 2px 4px color-mix(in srgb, var(--shadow-dark) 60%, transparent),
        inset -2px -2px 5px color-mix(in srgb, var(--shadow-light) 75%, transparent),
        1px 1px 3px color-mix(in srgb, var(--shadow-dark) 12%, transparent);
}

/* ============================================================
   Animated Background Gradient (Layer 0)
   ============================================================ */
.bg-gradient-animated {
    background: linear-gradient(
        135deg,
        var(--bg-gradient-1),
        var(--bg-gradient-2),
        var(--bg-gradient-3),
        var(--bg-gradient-4)
    );
    background-size: 400% 400%;
    animation: gradient-shift 30s ease infinite;
}

@keyframes gradient-shift {
    0%   { background-position: 0% 50%; }
    25%  { background-position: 100% 50%; }
    50%  { background-position: 100% 100%; }
    75%  { background-position: 0% 100%; }
    100% { background-position: 0% 50%; }
}

/* ============================================================
   Neumorphic Utility Classes
   ============================================================ */
.neumo-raised {
    background: var(--neumo-surface);
    box-shadow: var(--elevation-raised);
    border-radius: var(--radius-md);
}

.neumo-inset {
    background: var(--neumo-surface);
    box-shadow: var(--elevation-inset);
    border-radius: var(--radius-md);
}

.neumo-card {
    --btn-edge: var(--neumo-surface);
    background: var(--neumo-surface);
    box-shadow: var(--elevation-raised);
    border-radius: var(--radius-lg);
}

/* Collection picker uses the shared opaque-first warm-glass overlay material. */
.collection-picker { position: fixed; inset: auto; margin: 0; width: min(400px, calc(100vw - 16px)); padding: 18px; border-radius: 22px; overflow-y: auto; overscroll-behavior: contain; z-index: 1100; }
.collection-picker__header h2 { font-size: 20px; margin: 0 0 6px; }
.collection-picker__header p { margin: 6px 0 12px; }
.collection-picker__help { color: var(--overlay-muted); }
.collection-picker__search { display: grid; gap: 6px; margin-bottom: 12px; }
.collection-picker__list { min-width: 0; padding: 0; margin: 0; border: 0; }
.collection-picker__list legend { font-weight: 700; margin-bottom: 8px; }
.collection-picker__row { display: flex; align-items: center; min-width: 0; margin-bottom: 4px; }
.collection-picker__expand { flex: 0 0 32px; min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--text-primary); cursor: pointer; }
.collection-picker__spacer { flex: 0 0 32px; }
.collection-picker__choice { display: flex; align-items: center; gap: 10px; padding: 10px; min-height: 44px; flex: 1; min-width: 0; border-radius: 14px; cursor: pointer; }
.collection-picker__choice--checked { background: var(--surface); }
.collection-picker__choice input { accent-color: var(--accent); flex-shrink: 0; width: 18px; height: 18px; }
.collection-picker__choice small { display: block; color: var(--overlay-muted); }
.collection-picker__choice .collection-picker__error { color: var(--error-ink); }
.collection-picker__footer { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--overlay-border); padding-top: 14px; margin-top: 12px; }
.collection-picker__footer span { margin-right: auto; }
.collection-picker button:focus-visible, .collection-picker input:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ============================================================
   Glassmorphism Utility
   ============================================================ */
.glass {
    background: var(--glass-fill);
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

/* ============================================================
   Loading Spinner
   ============================================================ */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--surface);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   Responsive Content Container
   ============================================================ */
.container {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

@media (min-width: 1024px) {
    .container {
        padding: 0 var(--space-xl);
    }
}

/* ============================================================
    Touch Target Minimum (WCAG / Apple HIG)
    ============================================================ */
.touch-target {
    min-width: 44px;
    min-height: 44px;
}

/* ============================================================
    Button Components
    ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary,
.navbar .navbar-contained-action {
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: var(--elevation-raised),
                inset 0 0 0 5px var(--btn-edge);
}

.btn-primary:hover:not(:disabled),
.navbar .navbar-contained-action:hover:not(:disabled) {
    color: var(--on-accent);
    background: var(--accent-hover);
    box-shadow: var(--elevation-raised),
                inset 0 0 0 5px var(--btn-edge);
}

.btn-primary:active:not(:disabled),
.navbar .navbar-contained-action:active:not(:disabled) {
    box-shadow: var(--elevation-inset);
}

.btn-secondary {
    --outline-radius: var(--radius-md);
    position: relative;
    isolation: isolate;
    background: var(--neumo-surface);
    color: var(--accent-ink);
    border: 1px solid transparent;
    box-shadow: var(--elevation-raised-compact);
}

/* Keep a material rim outside the accent line so the raised edge stays visible. */
.btn-secondary::after {
    content: "";
    position: absolute;
    inset: 5px;
    border: 1px solid var(--accent);
    border-radius: calc(var(--outline-radius) - 5px);
    pointer-events: none;
}

.btn-secondary:hover:not(:disabled) {
    color: var(--on-accent);
    box-shadow: var(--elevation-raised);
}

/* The hover fill begins inside the 5px inset stroke, leaving the raised rim exposed. */
.btn-secondary:hover:not(:disabled)::before {
    content: "";
    position: absolute;
    inset: 6px;
    z-index: -1;
    background: var(--accent);
    border-radius: calc(var(--outline-radius) - 6px);
    pointer-events: none;
}

.btn-secondary:hover:not(:disabled)::after {
    border-color: var(--on-accent);
}

.btn-secondary:active:not(:disabled) {
    box-shadow: var(--elevation-inset-compact);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: var(--space-xs) var(--space-sm);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--accent-ink);
    background: var(--glass-fill);
}

.btn-danger {
    background: var(--error);
    color: var(--on-danger);
    box-shadow: var(--elevation-raised),
                inset 0 0 0 5px var(--btn-edge);
}

.btn-danger:hover:not(:disabled) {
    color: var(--on-danger);
    box-shadow: var(--elevation-raised),
                inset 0 0 0 5px var(--btn-edge);
}

.btn-danger:active:not(:disabled) {
    box-shadow: var(--elevation-inset);
}

/* ============================================================
    Input Component
    ============================================================ */
.input {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
select.input { border: 1px solid var(--field-border); }

/* Text entry shares one borderless, inset material; selects and other controls
   retain their own presentation. Page-specific rules may still own sizing. */
.input:is(input, textarea),
.landing-search input,
.search-page input:not([type="date"]) {
    border: 0;
    background: var(--neumo-surface);
    box-shadow: var(--elevation-inset);
}

/* Preserve page-owned field sizing; only the shared component is full width. */
.input--shared {
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--neumo-surface);
    width: 100%;
}

/* Low-specificity baseline leaves specialized graph focus treatments intact. */
:where(button, a[href], input, select, textarea, summary, [tabindex]):focus-visible,
.btn:focus-visible,
select.input:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 3px;
}

.input:is(input, textarea):focus-visible,
.landing-search input:focus-visible,
.search-page input:not([type="date"]):focus-visible {
    outline: none;
    background: color-mix(in srgb, var(--neumo-surface) 88%, var(--accent) 12%);
    box-shadow: var(--elevation-inset);
}

.input::placeholder {
    color: var(--field-placeholder);
    opacity: 1;
}

/* ============================================================
    App Shell
    ============================================================ */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding-top: 112px; /* Space for the inset fixed navigation shell. */
    padding-bottom: var(--space-xl);
}

/* ============================================================
    Navbar
    ============================================================ */
/* N1/N4 shared navigation */
.navbar {
    position: fixed;
    top: 16px;
    left: 24px;
    right: 24px;
    max-width: var(--content-max-width);
    margin-inline: auto;
    z-index: 100;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    box-shadow: var(--elevation-raised);
}
.navbar-inner { display: flex; align-items: center; min-height: 72px; gap: 12px; padding: 10px 16px; }
.navbar-logo { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; font: 600 26px var(--font-display); color: var(--accent-ink); text-decoration: none; }
.navbar-links { display: flex; align-items: center; gap: 4px; }
.navbar-link { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 14px; border: 1px solid transparent; border-radius: 18px; font: 600 14px var(--font-body); color: var(--text-primary); text-decoration: none; background: transparent; cursor: pointer; }
.navbar-link:hover { background: var(--bg-base); color: var(--accent-ink); }
.navbar-link--current,
.navbar-link--current:hover { background: var(--surface); border-color: transparent; box-shadow: var(--elevation-inset); }
.navbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.navbar-create { white-space: nowrap; font-size: 14px; min-height: 44px; padding: 8px 14px; border-radius: 18px; }
.navbar-user-menu { position: relative; }
.navbar-user-dropdown { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 8px; border: 1px solid var(--border-color); border-radius: 18px; color: var(--text-primary); background: var(--surface); cursor: pointer; }
.navbar-user-dropdown:hover { background: var(--bg-base); }
.navbar-username { max-width: 100px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 600 14px var(--font-body); }
.navbar-logout-form { width: 100%; margin: 0; }
.navbar-theme-toggle, .navbar-menu-toggle, .navigation-close { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 8px; border: 1px solid var(--border-color); border-radius: 16px; background: var(--surface); color: var(--text-primary); font: 600 14px var(--font-body); cursor: pointer; flex-shrink: 0; }
.navbar-menu-toggle:hover, .navbar-theme-toggle:hover, .navigation-close:hover { background: var(--bg-base); }
.navigation-search { display: flex; align-items: center; min-width: 0; border: 0; border-radius: 18px; background: var(--neumo-surface); box-shadow: var(--elevation-inset); }
.navigation-search--header { flex: 1 1 180px; margin-left: auto; border: 0; }
.navigation-search input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 0 10px 14px; border: 0; border-radius: 18px; background: transparent; box-shadow: none; color: var(--text-primary); font: 400 14px var(--font-body); }
.navigation-search input::placeholder { color: var(--field-placeholder); opacity: 1; }
.navigation-search button { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border: 0; border-radius: 16px; background: transparent; color: var(--text-primary); cursor: pointer; }
.navbar :is(a, button, input):focus-visible, .navigation-drawer :is(a, button, input):focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.navigation-search:focus-within { background: color-mix(in srgb, var(--neumo-surface) 88%, var(--accent) 12%); }
.navigation-search input:focus-visible { outline: none; background: transparent; box-shadow: none; }
.navbar .navigation-search--header:focus-within { background: color-mix(in srgb, var(--neumo-surface) 88%, var(--accent) 12%); }
.navbar .navigation-search--header input:focus-visible { outline: none; }
.navbar .navigation-search--header:focus-within button { color: var(--accent-ink); }
.navigation-drawer { position: fixed; top: 16px; right: 16px; bottom: 16px; width: min(360px, calc(100% - 32px)); padding: 20px; border-radius: 24px; overflow-y: auto; overscroll-behavior: contain; }
.navigation-drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.navigation-drawer-header h2 { margin: 0; font-size: 22px; }
.navigation-identity { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.navigation-identity strong { min-width: 0; overflow-wrap: anywhere; }
.navigation-drawer-links { display: grid; gap: 4px; margin-top: 16px; }
.navigation-drawer-account { display: grid; gap: 4px; border-top: 1px solid var(--field-border); margin-top: 16px; padding-top: 12px; }
.navigation-drawer-account .navbar-link { width: 100%; }
/* Navbar utilities keep their own dimensions while sharing the primary button material. */
.navbar .navbar-contained-action {
    min-height: 48px;
    padding: 10px 18px;
    border: 0;
    border-radius: 18px;
}
.navbar .navbar-theme-toggle.navbar-contained-action {
    min-width: 48px;
    padding: 10px;
    border-radius: 16px;
}
.navbar .navbar-menu-toggle.navbar-contained-action { border-radius: 16px; }
@media (max-width: 1399px) { .navbar-username { display: none; } }
@media (max-width: 1099px) {
    .navbar-links, .navigation-search--header { display: none; }
    .navbar-actions { margin-left: auto; }
    .navbar-menu-toggle { margin-left: auto; }
    .navbar-actions + .navbar-menu-toggle { margin-left: 0; }
}
@media (max-width: 599px) {
    .navbar { top: 8px; left: 8px; right: 8px; border-radius: 24px; }
    .navbar-inner { min-height: 64px; padding: 8px 12px; }
    .navbar-actions { display: none; }
    .navbar-actions + .navbar-menu-toggle { margin-left: auto; }
    .main-content { padding-top: 96px; }
}
@media (forced-colors: active) {
    .navbar, .navigation-search, .navbar-link--current { border: 1px solid CanvasText; box-shadow: none; }
    .navbar .navbar-contained-action { border: 1px solid CanvasText; box-shadow: none; }
    .navbar-link--current { text-decoration: underline; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
/* End shared navigation */

/* ============================================================
    Footer
    ============================================================ */
.footer {
    --btn-edge: var(--surface);
    background: var(--surface);
    border-top: 1px solid var(--glass-border);
    padding: var(--space-2xl) 0 var(--space-lg);
    color: var(--text-tertiary);
    font-size: 13px;
}

.footer-inner {
    display: grid;
    gap: var(--space-xl);
}

.footer-brand {
    max-width: 360px;
}

.footer-logo {
    display: inline-block;
    margin-bottom: var(--space-sm);
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: 15px;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-xl);
}

.footer-links > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
}

.footer-links strong {
    color: var(--text-primary);
    font-size: 14px;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-links a:hover {
    color: var(--accent-ink);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

@media (min-width: 720px) {
    .footer-inner {
        grid-template-columns: minmax(260px, 1fr) minmax(360px, 0.8fr);
        align-items: start;
    }
}

/* ============================================================
    Error Fallback
    ============================================================ */
.error-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-secondary);
}

.error-fallback h1 {
    color: var(--error-ink);
    margin-bottom: var(--space-md);
}

.error-fallback p {
    margin-bottom: var(--space-lg);
}

/* ============================================================
    NotFound (404) Page
    ============================================================ */
.not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
}

.not-found h1 {
    font-size: 48px;
    color: var(--accent-ink);
    margin-bottom: var(--space-sm);
}

.not-found h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.not-found p {
    color: var(--text-secondary);
}

.not-found code {
    background: var(--surface);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 14px;
    color: var(--text-tertiary);
}

/* ============================================================
    Danger Zone
    ============================================================ */
.danger-zone .neumo-card {
    border: 2px solid var(--error);
    background: var(--error-bg);
}

/* ============================================================
    Modal Overlay
    ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    animation: fade-in 0.2s ease;
    padding: var(--space-md);
}

/* Native top-layer shell; preserve the existing M4 inner card and dim exactly once. */
dialog.shared-modal {
    margin: 0;
    border: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    color: inherit;
}
dialog.shared-modal:not([open]) { display: none; }
dialog.shared-modal::backdrop { background: transparent; }

.modal-card {
    background: var(--bg-base);
    border-radius: var(--radius-lg);
    box-shadow: 5px 5px 4px var(--shadow-dark), -5px -5px 4px var(--shadow-light);
    padding: var(--space-xl);
    max-width: 440px;
    width: 100%;
    animation: modal-slide-in 0.2s ease;
}

/* Keep the editor's independent flex/overflow contract out of this migration.
   Muted copy needs stronger ink over glass; fields retain opaque surface roles. */
.modal-card:not(.modal-card--editor) {
    --text-secondary: var(--overlay-muted);
    --text-tertiary: var(--overlay-muted);
    background: var(--overlay-opaque);
    border: 1px solid var(--overlay-border);
    box-shadow: var(--overlay-shadow);
    max-height: calc(100vh - 2 * var(--space-md));
    max-height: calc(100dvh - 2 * var(--space-md));
    overflow-y: auto;
}

/* Unsupported browsers keep the opaque, legible default above. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .modal-card:not(.modal-card--editor) {
        background: var(--overlay-fill);
        backdrop-filter: var(--overlay-blur);
        -webkit-backdrop-filter: var(--overlay-blur);
    }
}

@keyframes modal-slide-in {
    from { opacity: 0; transform: scale(0.95) translateY(-8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-card h2 {
    font-size: 18px;
    color: var(--text-primary);
}

.modal-card p {
    margin: 0;
}

.modal-card code {
    background: var(--surface);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 13px;
    color: var(--text-primary);
}

/* Image editor modal variant */
.modal-card--editor {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(1180px, 95vw);
    max-width: 95vw;
    max-height: 92vh;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    background: var(--bg-base);
}

.image-editor__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
    background: var(--glass-fill);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.image-editor__header h2 {
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 1.1;
    color: var(--text-primary);
}

.image-editor__subtitle {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
}

.image-editor__header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.image-editor__history-actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding-right: var(--space-sm);
    margin-right: var(--space-xs);
    border-right: 1px solid var(--glass-border);
}

.image-editor__soft-button,
.image-editor__icon-button {
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: var(--surface);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: 3px 3px 4px var(--shadow-dark), -3px -3px 4px var(--shadow-light);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.image-editor__soft-button {
    min-height: 36px;
    padding: var(--space-xs) var(--space-md);
    font-size: 13px;
    font-weight: 700;
}

.image-editor__icon-button {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
}

.image-editor__soft-button:hover,
.image-editor__icon-button:hover {
    color: var(--accent-ink);
    background: var(--glass-fill);
}

.image-editor__soft-button:active,
.image-editor__icon-button:active {
    box-shadow: inset 3px 3px 4px var(--shadow-dark), inset -3px -3px 4px var(--shadow-light);
}

.image-editor__soft-button:disabled,
.image-editor__icon-button:disabled {
    color: var(--text-tertiary);
    cursor: not-allowed;
    opacity: 0.55;
    box-shadow: inset 2px 2px 3px var(--shadow-dark), inset -2px -2px 3px var(--shadow-light);
}

.image-editor__soft-button:disabled:hover,
.image-editor__icon-button:disabled:hover {
    color: var(--text-tertiary);
    background: var(--surface);
}

.image-editor__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    min-height: 0;
    padding: var(--space-lg);
    overflow-y: auto;
}

.image-editor__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--glass-border);
    background: var(--glass-fill);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.image-editor__preview-panel {
    min-width: 0;
    min-height: 0;
    container-type: size;
    display: flex;
    align-items: center;
    justify-content: center;
    height: min(48vh, 560px);
    flex: 0 0 auto;
    padding: 0;
    overflow: visible;
}

.image-editor__controls {
    min-width: 0;
    max-height: 34vh;
    padding: 2px var(--space-xs) 2px 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--text-tertiary) transparent;
}

.image-editor__controls > .image-editor__section + .image-editor__section {
    margin-top: var(--space-md);
}

.image-editor__section {
    padding: var(--space-sm) 0 var(--space-md);
    border-bottom: 1px solid var(--glass-border);
}

.image-editor__section:first-child {
    padding-top: 0;
}

.image-editor__section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.image-editor__section-title {
    margin-bottom: var(--space-sm);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    color: var(--accent-ink);
}

.image-editor__image-wrapper {
    --image-aspect: 1;
    --image-natural-width: 100%;
    --image-frame-padding: 6px;
    box-sizing: border-box;
    position: relative;
    display: block;
    width: min(var(--image-natural-width), 100cqw, calc(100cqh * var(--image-aspect)));
    height: min(calc(var(--image-natural-width) / var(--image-aspect)), 100cqh, calc(100cqw / var(--image-aspect)));
    aspect-ratio: var(--image-aspect);
    padding: var(--image-frame-padding);
    overflow: visible;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: var(--surface);
    box-shadow: 5px 5px 4px var(--shadow-dark), -5px -5px 4px var(--shadow-light);
}

.image-editor__transform-stage {
    position: absolute;
    inset: var(--image-frame-padding);
    width: auto;
    height: auto;
    transform-origin: center center;
    will-change: transform;
}

.image-editor__crop-stage {
    position: absolute;
    inset: var(--image-frame-padding);
    z-index: 2;
}

.image-editor__crop-stage--ellipse {
    overflow: hidden;
    border-radius: var(--radius-sm);
}

.image-editor__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    user-select: none;
    -webkit-user-drag: none;
    cursor: grab;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 24px rgba(45, 42, 38, 0.16);
}

.image-editor__image-wrapper:has(.image-editor__image:active) {
    cursor: grabbing;
}

.image-editor__scale-slider {
    width: 100%;
    min-width: 0;
    height: 28px;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    outline: none;
}

.image-editor__scale-slider::-webkit-slider-runnable-track {
    height: 12px;
    padding: 2px;
    border-radius: var(--radius-full);
    background:
        linear-gradient(
            to right,
            var(--accent) 0%,
            var(--accent) var(--slider-fill, 0%),
            transparent var(--slider-fill, 0%),
            transparent 100%
        ) content-box,
        var(--surface);
    box-shadow: 4px 4px 5px var(--shadow-dark), -4px -4px 5px var(--shadow-light);
}

.image-editor__scale-slider::-moz-range-track {
    height: 12px;
    border-radius: var(--radius-full);
    background: var(--surface);
    box-shadow: 4px 4px 5px var(--shadow-dark), -4px -4px 5px var(--shadow-light);
}

.image-editor__scale-slider::-moz-range-progress {
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--accent);
}

.image-editor__scale-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    margin-top: -6px;
    border: none;
    border-radius: 50%;
    background: var(--bg-base);
    box-shadow: 3px 3px 4px var(--shadow-dark), -3px -3px 4px var(--shadow-light);
}

.image-editor__scale-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: var(--bg-base);
    box-shadow: 3px 3px 4px var(--shadow-dark), -3px -3px 4px var(--shadow-light);
}

.image-editor__scale-slider:hover::-webkit-slider-thumb,
.image-editor__scale-slider:hover::-moz-range-thumb {
    background: var(--surface);
}

.image-editor__scale-slider:focus-visible::-webkit-slider-thumb,
.image-editor__scale-slider:focus-visible::-moz-range-thumb {
    box-shadow: 0 0 0 2px var(--accent), 3px 3px 4px var(--shadow-dark), -3px -3px 4px var(--shadow-light);
}

.image-editor__scale-slider:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.image-editor__scale-slider::-ms-track {
    height: 12px;
    border-color: transparent;
    color: transparent;
    background: transparent;
}

.image-editor__scale-slider::-ms-fill-lower,
.image-editor__scale-slider::-ms-fill-upper {
    border-radius: var(--radius-full);
    box-shadow: 4px 4px 5px var(--shadow-dark), -4px -4px 5px var(--shadow-light);
    border: 2px solid var(--surface);
}

.image-editor__scale-slider::-ms-fill-lower {
    background: var(--accent);
}

.image-editor__scale-slider::-ms-fill-upper {
    background: var(--surface);
}

.image-editor__scale-slider::-ms-thumb {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: var(--bg-base);
    cursor: pointer;
}

.image-editor__scale-slider:focus-visible,
.image-editor__number-input:focus-visible,
.image-editor__flip-toggle:focus-visible,
.image-editor__soft-button:focus-visible,
.image-editor__icon-button:focus-visible,
.image-editor__primary-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.image-editor__slider-row {
    display: grid;
    grid-template-columns: 76px minmax(84px, 1fr) 86px;
    align-items: center;
    gap: var(--space-sm);
    min-height: 34px;
    margin-bottom: var(--space-xs);
}

.image-editor__slider-label {
    min-width: 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-editor__number-shell {
    display: flex;
    align-items: center;
    min-width: 0;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: inset 3px 3px 4px var(--shadow-dark), inset -3px -3px 4px var(--shadow-light);
    overflow: hidden;
}

.image-editor__number-input {
    width: 100%;
    min-width: 0;
    height: 32px;
    padding: 0 4px 0 var(--space-sm);
    border: none;
    outline: none;
    color: var(--text-primary);
    background: transparent;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
}

.image-editor__number-input::-webkit-outer-spin-button,
.image-editor__number-input::-webkit-inner-spin-button {
    margin: 0;
}

.image-editor__number-suffix {
    padding-right: var(--space-sm);
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 700;
}

.image-editor__toggle-row {
    display: grid;
    grid-template-columns: 76px 1fr;
    align-items: center;
    gap: var(--space-sm);
    min-height: 34px;
    margin-top: var(--space-xs);
}

/* Flip toggle group */
.image-editor__toggle-group {
    display: flex;
    gap: var(--space-xs);
}

.image-editor__flip-toggle {
    width: 40px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: var(--text-secondary);
    background: var(--surface);
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: 3px 3px 4px var(--shadow-dark), -3px -3px 4px var(--shadow-light);
    cursor: pointer;
    transition: all 0.15s ease;
}

.image-editor__flip-toggle:hover {
    color: var(--accent-ink);
}

.image-editor__flip-toggle--active {
    color: white;
    background: var(--accent);
    box-shadow: inset 3px 3px 4px rgba(92, 55, 43, 0.28), inset -3px -3px 4px rgba(255, 236, 226, 0.18);
}

.image-editor__flip-toggle--active:hover {
    background: var(--accent-hover);
}

/* Dark overlay panels outside the crop area */
.image-editor__crop-overlay {
    position: absolute;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: 0;
}

.image-editor__crop-overlay--top {
    top: 0;
    left: 0;
    width: 100%;
}

.image-editor__crop-overlay--bottom {
    bottom: 0;
    left: 0;
    width: 100%;
}

.image-editor__crop-overlay--left {
    left: 0;
}

.image-editor__crop-overlay--right {
    right: 0;
}

/* Crop outline */
.image-editor__crop-rect {
    position: absolute;
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    pointer-events: none;
    box-sizing: border-box;
    z-index: 1;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.50), 0 0 18px rgba(217, 115, 90, 0.28);
}

.image-editor__crop-rect--ellipse {
    border-radius: 50%;
}

/* Circular mask: the large outer shadow darkens everything outside the
   ellipse, including the corners inside its square bounding box. */
.image-editor__crop-ellipse-mask {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
}

/* Full-edge resize bars (invisible, clickable anywhere on the edge) */
.image-editor__resize-edge {
    position: absolute;
    pointer-events: auto;
    z-index: 1;
}

.image-editor__resize-edge--top {
    top: -6px;
    left: 0;
    width: 100%;
    height: 12px;
    cursor: ns-resize;
}

.image-editor__resize-edge--bottom {
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 12px;
    cursor: ns-resize;
}

.image-editor__resize-edge--left {
    top: 0;
    left: -6px;
    width: 12px;
    height: 100%;
    cursor: ew-resize;
}

.image-editor__resize-edge--right {
    top: 0;
    right: -6px;
    width: 12px;
    height: 100%;
    cursor: ew-resize;
}

@media (max-width: 900px) {
    .modal-card--editor {
        width: min(720px, 96vw);
    }

    .image-editor__body {
        overflow: hidden;
    }

    .image-editor__controls {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        padding-right: 0;
        overflow-y: auto;
    }

    .image-editor__preview-panel {
        height: min(42vh, 420px);
    }

    .image-editor__image {
        width: 100%;
        height: 100%;
    }
}

@media (min-width: 901px) {
    .image-editor__controls {
        display: flex;
        gap: var(--space-lg);
        max-height: none;
        overflow: visible;
    }

    .image-editor__controls > .image-editor__section {
        flex: 1 1 0;
        min-width: 0;
        margin-top: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

    .image-editor__controls > .image-editor__section + .image-editor__section {
        margin-top: 0;
        padding-left: var(--space-lg);
        border-left: 1px solid var(--glass-border);
    }
}

@media (min-width: 901px) and (max-height: 720px) {
    .image-editor__body {
        overflow: hidden;
    }

    .image-editor__controls {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
    }
}

@media (max-width: 560px) {
    .modal-overlay {
        padding: var(--space-sm);
    }

    .image-editor__header {
        align-items: flex-start;
        padding: var(--space-sm) var(--space-md);
    }

    .image-editor__header-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .image-editor__history-actions {
        padding-right: 0;
        margin-right: 0;
        border-right: none;
    }

    .image-editor__body {
        padding: var(--space-md);
    }

    .image-editor__footer {
        padding: var(--space-sm) var(--space-md);
    }

    .image-editor__slider-row {
        grid-template-columns: 64px minmax(74px, 1fr) 78px;
        gap: var(--space-xs);
    }

    .image-editor__preview-panel {
        padding: 0;
    }
}

/* ============================================================
   Settings Tabs
   ============================================================ */
.settings-tabs {
    --btn-edge: var(--surface);
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: var(--space-xs);
    box-shadow: inset 5px 5px 4px var(--shadow-dark), inset -5px -5px 4px var(--shadow-light);
    width: fit-content;
    max-width: 100%;
}

.settings-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.settings-tab:hover {
    color: var(--accent-ink);
    background: var(--glass-fill);
}

.settings-tab-active {
    color: var(--accent-ink);
    background: var(--bg-base);
    box-shadow: 5px 5px 4px var(--shadow-dark), -5px -5px 4px var(--shadow-light);
}

.settings-tab-active:hover {
    color: var(--accent-ink);
}

/* ============================================================
    Recipe Grid (Dashboard)
    ============================================================ */
.recipe-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

@media (min-width: 640px) {
    .recipe-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .recipe-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================================
    Recipe Card
    ============================================================ */
.recipe-card {
    --btn-edge: var(--neumo-surface);
    background: var(--neumo-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--elevation-raised);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.recipe-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--elevation-raised-hover);
}

.recipe-card__author {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
}

.recipe-card__author-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.recipe-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.recipe-card__image {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.recipe-card__image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-tertiary);
    background: linear-gradient(
        135deg,
        var(--bg-gradient-2) 0%,
        var(--bg-gradient-3) 50%,
        var(--bg-gradient-4) 100%
    );
}

.recipe-card__image-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.edited-recipe-image {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--bg-base);
}

.edited-recipe-image--ellipse {
    border-radius: 50%;
}

.edited-recipe-image__stage {
    position: absolute;
}

.edited-recipe-image__img,
.edited-recipe-image__plain {
    display: block;
    width: 100%;
    height: 100%;
}

.edited-recipe-image__img {
    transform-origin: center center;
}

.edited-recipe-image__plain {
    object-position: center;
}

.recipe-card__content {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.recipe-card__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.recipe-card__description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
    /* Truncate to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recipe-card__meta {
    display: flex;
    gap: var(--space-sm);
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: auto;
}

.recipe-card__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.recipe-card__actions {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--shadow-light);
}

.recipe-card__action-btn {
    background: none;
    border: none;
    padding: var(--space-xs);
    cursor: default;
    color: var(--text-tertiary);
    font-size: 16px;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.recipe-card__action-btn:hover {
    opacity: 0.8;
}

/* Load more button container */
.load-more {
    display: flex;
    justify-content: center;
    margin-top: var(--space-xl);
}

/* Recipe count */
.recipe-count {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
    margin-top: var(--space-md);
}

/* ============================================================
   Explore Page (CP9)
   ============================================================ */

.explore-page {
    padding-top: var(--space-sm);
}

/* X7C: opt-in framed cards; other recipe grids keep their existing layout. */
.explore-heading {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-md);
    margin: 0 0 18px;
}
.explore-heading__copy {
    flex: 0 1 auto;
    min-width: 0;
}
.explore-heading h1 {
    font-size: clamp(36px, 3.4vw, 52px);
    line-height: 1.1;
}
.explore-intro {
    color: var(--overlay-muted);
    font-size: 16px;
    margin-top: 4px;
}
.explore-tools {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    gap: var(--space-md);
    min-width: 0;
    width: 100%;
    padding-bottom: 3px;
}
.explore-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.explore-search {
    position: relative;
    flex: 0 1 280px;
    min-width: 220px;
    margin: 0;
}
.explore-search__icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--overlay-muted);
    pointer-events: none;
}
.explore-search .input {
    width: 100%;
    min-height: 44px;
    padding-left: 44px;
    border-radius: var(--radius-full);
    background: var(--neumo-surface);
    border: 0;
    box-shadow: var(--elevation-inset);
}
.explore-tags {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}
.explore-tags:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.explore-tag, .explore-results {
    color: var(--overlay-muted);
    font-size: 14px;
}
.explore-tag {
    flex-shrink: 0;
    padding: 8px 14px;
    background: var(--success-bg);
    border: 1px solid transparent;
    border-radius: 999px;
    overflow-wrap: anywhere;
}
.explore-results { margin: 0 0 8px; }
.explore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 24px;
    margin: 0 0 32px;
}
.recipe-card--framed {
    padding: 12px;
    min-width: 0;
    background: var(--neumo-surface);
    border: 1px solid color-mix(in srgb, var(--shadow-light) 78%, var(--shadow-dark));
    box-shadow: var(--elevation-raised);
}
.recipe-card--framed:hover {
    box-shadow: var(--elevation-raised-hover);
}
.recipe-card--framed .recipe-card__link {
    display: flex;
    flex-direction: column;
    flex: 1;
    border-radius: var(--radius-md);
}
.recipe-card--framed .recipe-card__image {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    border: 3px solid color-mix(in srgb, var(--shadow-light) 68%, var(--bg-base));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--shadow-dark) 38%, transparent);
}
.recipe-card--framed .recipe-card__image::after {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow:
        inset 3px 3px 6px color-mix(in srgb, var(--shadow-dark) 54%, transparent),
        inset -2px -2px 5px color-mix(in srgb, var(--shadow-light) 65%, transparent);
    content: "";
    pointer-events: none;
}
.recipe-card--framed .recipe-card__image-placeholder {
    display: grid;
    place-items: center;
    background: var(--bg-base);
    color: var(--overlay-muted);
    font-size: 14px;
}
.recipe-card--framed .recipe-card__content { flex: 1; padding: 10px 4px 4px; gap: 4px; }
.recipe-card--framed .recipe-card__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}
.recipe-card--framed .recipe-card__description,
.recipe-card--framed .recipe-card__meta,
.recipe-card--framed .recipe-card__author-name {
    color: var(--overlay-muted);
    overflow-wrap: anywhere;
}
.recipe-card--framed .recipe-card__meta {
    flex-wrap: wrap;
    gap: 4px;
    padding-top: 4px;
}
.recipe-card--framed .recipe-card__meta span + span::before {
    content: "·";
    margin-right: 4px;
}
.recipe-card--framed .recipe-card__author {
    margin-top: auto;
    padding: 8px 4px 4px;
    border: 0;
    text-decoration: none;
    border-radius: 4px;
    min-width: 0;
}
.recipe-card--framed .recipe-card__author-name {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
}
.recipe-card--framed .recipe-card__avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
}
.recipe-card--framed a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.explore-status {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    color: var(--overlay-muted);
}
@media (forced-colors: active) {
    .recipe-card--framed,
    .recipe-card--framed:hover { border-color: CanvasText; box-shadow: none; }
    .recipe-card--framed .recipe-card__image { border-color: CanvasText; box-shadow: none; }
    .recipe-card--framed .recipe-card__image::after { box-shadow: none; }
    .explore-tag { border-color: CanvasText; }
}

@media (max-width: 1023px) {
    .explore-search { flex-basis: 320px; }
}

@media (max-width: 599px) {
    .explore-tools { align-items: stretch; flex-direction: column; }
    .explore-search { flex-basis: auto; min-width: 0; width: 100%; }
}

@media (min-width: 1024px) {
    .explore-page { padding-inline: clamp(32px, 5.5vw, 88px); }
}

.tag-chip {
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background-color: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-body);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 3px var(--shadow-dark), -2px -2px 3px var(--shadow-light);
}

.tag-chip:hover {
    color: var(--accent-ink);
    box-shadow: 3px 3px 4px var(--shadow-dark), -3px -3px 4px var(--shadow-light);
}

.tag-chip--active {
    background-color: var(--accent);
    color: white;
    box-shadow: inset 2px 2px 3px rgba(0, 0, 0, 0.15),
                inset -2px -2px 3px rgba(255, 255, 255, 0.1);
}

/* ============================================================
    Profile Page (CP10)
    ============================================================ */

.profile-page {
    padding-top: var(--space-lg);
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-xl) var(--space-md);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: var(--space-md);
    margin-bottom: 0;
}

.profile-username {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-bottom: var(--space-sm);
}

.profile-bio {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin-bottom: var(--space-sm);
    line-height: 1.5;
}

.profile-stats {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.profile-recipes {
    padding: 0 var(--space-md) var(--space-xl);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

/* ============================================================
   Recipe Scaler Widget (CP12)
   ============================================================ */

.recipe-scaler {
    background: var(--neumo-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--elevation-raised);
    overflow: hidden;
}

.recipe-scaler__toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-md);
    background: none;
    border: none;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s ease;
}

.recipe-scaler__toggle:hover {
    background: var(--glass-fill);
}

.recipe-scaler__badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
}

.recipe-scaler__body {
    padding: 0 var(--space-md) var(--space-md);
}

.recipe-scaler__input {
    width: 80px;
    padding: var(--space-xs) var(--space-sm);
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--neumo-surface);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    text-align: center;
    box-shadow: var(--elevation-inset-compact);
}

.recipe-scaler__input:focus {
    outline: none;
    background: color-mix(in srgb, var(--neumo-surface) 88%, var(--accent) 12%);
    box-shadow: var(--elevation-inset-compact);
}

.recipe-scaler__presets {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.recipe-scaler__preset {
    padding: var(--space-xs) var(--space-sm);
    background: var(--neumo-surface);
    border: 1px solid var(--surface);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--elevation-raised-compact);
}

.recipe-scaler__preset:hover {
    color: var(--accent-ink);
}

.recipe-scaler__preset--active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: inset 2px 2px 3px rgba(0, 0, 0, 0.15),
                inset -2px -2px 3px rgba(255, 255, 255, 0.1);
}

.recipe-scaler__select {
    width: 100%;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--surface);
    border-radius: var(--radius-sm);
    background: var(--neumo-surface);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    box-shadow: var(--elevation-inset-compact);
}

.recipe-scaler__select:focus {
    outline: none;
    box-shadow: var(--elevation-inset-compact), 0 0 0 2px var(--accent);
}

.recipe-scaler__reset {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: var(--font-body);
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    margin-top: var(--space-sm);
}

.recipe-scaler__reset:hover {
    background: var(--glass-fill);
    color: var(--accent-ink);
}

/* ============================================================
    Step Nodes — Nested Instruction Tree (CP6)
    ============================================================ */
.step-node {
    position: relative;
    padding: var(--space-sm) 0;
}

.step-node[data-depth="1"] {
    margin-left: var(--space-lg);
    padding-left: var(--space-md);
    border-left: 2px solid var(--glass-border);
}

.step-node[data-depth="2"] {
    margin-left: var(--space-lg);
    padding-left: var(--space-md);
    border-left: 2px dashed var(--text-tertiary);
}

.step-node__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 var(--space-xs);
    margin-right: var(--space-sm);
    border-radius: var(--radius-full);
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-body);
    flex-shrink: 0;
}

.step-node__content {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
}

.step-node__text {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
}

/* ============================================================
   Recipe Detail Page — Card Layout
   ============================================================ */

.recipe-detail {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    padding-top: var(--space-lg);
    padding-bottom: var(--space-xl);
}

/* ── Delete Error ──────────────────────────────────────────── */
.recipe-detail__delete-error {
    padding: var(--space-sm) var(--space-md);
    background-color: var(--error-bg);
    border-radius: var(--radius-md);
    color: var(--error-ink);
    font-size: 14px;
    margin-bottom: var(--space-md);
}

/* ── Overview Section ──────────────────────────────────────── */
.recipe-detail__overview {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* ── Tags ──────────────────────────────────────────────────── */
.recipe-detail__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.recipe-detail__tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background-color: rgba(217, 115, 90, 0.10);
    color: var(--accent-ink);
    font-size: 13px;
    font-weight: 500;
}

.dark .recipe-detail__tag {
    background-color: rgba(232, 137, 110, 0.15);
}

/* ── Meta Row ──────────────────────────────────────────────── */
.recipe-detail__meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--shadow-light);
}

.recipe-detail__meta-item {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ── Description ───────────────────────────────────────────── */
.recipe-detail__description {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* ── Commentary ────────────────────────────────────────────── */
.recipe-detail__commentary {
    font-size: 15px;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.6;
    margin: 0;
}

/* ── Author Line ───────────────────────────────────────────── */
.recipe-detail__author-line {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: auto;
}

.recipe-detail__author-link {
    color: var(--accent-ink);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.recipe-detail__author-link:hover {
    color: var(--accent-ink);
}

/* ── Section Title (Equipment, Ingredients, Steps) ─────────── */
.recipe-detail__section-title {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 2px solid var(--shadow-light);
}

/* ── Generic List (Equipment, Ingredients) ─────────────────── */
.recipe-detail__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.recipe-detail__list-item {
    padding: var(--space-xs) var(--space-sm);
    font-size: 14px;
    color: var(--text-primary);
}

/* ── Steps List ────────────────────────────────────────────── */
.recipe-detail__steps-list {
    padding-left: var(--space-lg);
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    list-style: none;
}

/* ── Step Photo ────────────────────────────────────────────── */
.recipe-step-photo {
    display: block;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin-top: var(--space-sm);
    border-radius: var(--radius-md);
}

.step-photo-preview {
    width: 120px;
    height: auto;
    aspect-ratio: 16 / 9;
}

/* ── Fork Lineage ─────────────────────────────────────────── */
.recipe-lineage {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.recipe-lineage__header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
}

.recipe-lineage__flow {
    display: grid;
    grid-template-columns: minmax(190px, 0.85fr) minmax(260px, 1.15fr);
    align-items: start;
    gap: var(--space-xl);
}

.recipe-lineage__group {
    min-width: 0;
}

.recipe-lineage__group h3 {
    margin: 0 0 var(--space-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.recipe-lineage__ancestor-list,
.recipe-lineage__descendant-list,
.recipe-lineage__children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.recipe-lineage__ancestor-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.recipe-lineage__ancestor-list > li {
    position: relative;
}

.recipe-lineage__ancestor-list > li:not(:last-child)::after,
.recipe-lineage__ancestor-list > li:not(:last-child)::before {
    content: "";
    position: absolute;
    z-index: 2;
}

.recipe-lineage__ancestor-list > li:not(:last-child)::after {
    left: 17px;
    top: calc(100% + 1px);
    width: 2px;
    height: 9px;
    background: color-mix(in srgb, var(--accent) 55%, transparent);
}

.recipe-lineage__ancestor-list > li:not(:last-child)::before {
    left: 13px;
    top: calc(100% + 8px);
    width: 0;
    height: 0;
    border-right: 5px solid transparent;
    border-left: 5px solid transparent;
    border-top: 6px solid color-mix(in srgb, var(--accent) 65%, transparent);
}

.recipe-lineage__node {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 8px 11px;
    border: 1px solid var(--shadow-light);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: 1px 2px 4px var(--shadow-dark), -1px -1px 3px var(--shadow-light);
}

.recipe-lineage__thumbnail {
    width: 72px;
    height: auto;
    aspect-ratio: 16 / 9;
    flex: 0 0 72px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--background);
}

.recipe-lineage__thumbnail-placeholder {
    display: grid;
    place-items: center;
    color: var(--text-tertiary);
    font-size: 18px;
}

.recipe-lineage__node-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.recipe-version-history__summary {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 0;
}

.recipe-version-history__thumbnail {
    width: 92px;
    height: auto;
    aspect-ratio: 16 / 9;
    flex: 0 0 92px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--background);
}

.recipe-version-history__thumbnail-placeholder {
    display: grid;
    place-items: center;
    color: var(--text-tertiary);
    font-size: 20px;
}

.recipe-version-history__details {
    min-width: 0;
}

/* ── Recipe Version Graph ─────────────────────────────────── */
.recipe-version-graph {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.recipe-version-graph__description {
    margin: 0;
    color: var(--text-secondary);
}

.recipe-version-graph__mouse-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem var(--space-sm);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.76rem;
}

.recipe-version-graph__mouse-control {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
}

.recipe-version-graph__mouse-control kbd {
    padding: 0.08rem 0.3rem;
    border: 1px solid var(--border-color);
    border-bottom-width: 2px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--surface) 92%, var(--background));
    color: var(--text-primary);
    font: inherit;
    font-weight: 600;
    white-space: nowrap;
}

.recipe-version-graph__lineage-counts {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin: calc(-1 * var(--space-xs)) 0 0;
    padding: 0;
    list-style: none;
}

.recipe-version-graph__lineage-count {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--surface) 92%, var(--background));
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.recipe-version-graph__lineage-count strong {
    color: var(--text-primary);
    font-size: 1rem;
}

.recipe-version-graph__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm) var(--space-md);
    flex-wrap: wrap;
}

.recipe-version-graph__controls-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.recipe-version-graph__controls,
.recipe-version-graph__legend {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.recipe-version-graph__control {
    display: inline-grid;
    min-width: 38px;
    min-height: 38px;
    padding: 6px 10px;
    place-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: 1px 2px 4px var(--shadow-dark), -1px -1px 3px var(--shadow-light);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.recipe-version-graph__control--text {
    min-width: auto;
}

.recipe-version-graph__control:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border-color));
    color: var(--accent-ink);
}

.recipe-version-graph__control:focus-visible,
.recipe-version-graph__static-card:focus-visible,
.recipe-version-graph__canvas-viewport:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent);
    outline-offset: 2px;
}

.recipe-version-graph__control:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.recipe-version-graph__legend {
    gap: var(--space-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.recipe-version-graph__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.recipe-version-graph__legend-swatch {
    display: inline-block;
    width: 18px;
    height: 14px;
    border: 2px solid;
    border-radius: 4px;
}

.recipe-version-graph__legend-swatch--main-recipe {
    border-color: var(--success);
    background: color-mix(in srgb, var(--success) 24%, var(--surface));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 72%, transparent);
}

.recipe-version-graph__legend-swatch--ancestor {
    border-color: #5573a8;
    background: color-mix(in srgb, #5573a8 16%, var(--surface));
    outline: 2px solid color-mix(in srgb, #5573a8 72%, transparent);
    outline-offset: 1px;
}

.recipe-version-graph__legend-swatch--descendant {
    border-color: var(--warning);
    background: color-mix(in srgb, var(--warning) 18%, var(--surface));
    outline: 2px dashed color-mix(in srgb, var(--warning) 82%, transparent);
    outline-offset: 1px;
}

.dark .recipe-version-graph__legend-swatch--ancestor {
    border-color: #8ba8db;
    background: color-mix(in srgb, #8ba8db 20%, var(--surface));
    outline-color: color-mix(in srgb, #8ba8db 86%, transparent);
}

.recipe-version-graph__legend-line {
    display: inline-block;
    width: 30px;
    border-top: 3px solid color-mix(in srgb, var(--accent) 70%, var(--border-color));
}

.recipe-version-graph__legend-line--fork {
    border-top-style: dashed;
    border-top-color: var(--accent);
}

.recipe-version-graph__canvas-viewport {
    position: relative;
    width: 100%;
    height: clamp(420px, 65vh, 680px);
    min-height: 420px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background-color: color-mix(in srgb, var(--surface) 92%, var(--background));
    background-image:
        linear-gradient(color-mix(in srgb, var(--border-color) 35%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--border-color) 35%, transparent) 1px, transparent 1px);
    background-size: 24px 24px;
    cursor: grab;
    isolation: isolate;
}

.recipe-version-graph__canvas-viewport--panning {
    cursor: grabbing;
    user-select: none;
}

.recipe-version-graph__canvas-viewport--panning * {
    cursor: grabbing;
}

.recipe-version-graph__context-menu {
    position: absolute;
    z-index: 4;
    display: grid;
    width: min(256px, calc(100% - 16px));
    max-height: calc(100% - var(--context-menu-top, 8px) - 8px);
    padding: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 22px;
    cursor: default;
}

.recipe-version-graph__context-menu-heading {
    display: grid;
    gap: 2px;
    padding: 8px 10px 9px;
    color: var(--text-primary);
}

.recipe-version-graph__context-menu-heading strong {
    overflow: hidden;
    font-size: 0.92rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recipe-version-graph__context-menu-heading span {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
}

.recipe-version-graph__context-menu-unavailable {
    margin: 0 10px 6px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.35;
}

.recipe-version-graph__context-menu-item {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
}

.recipe-version-graph__context-menu-item:hover:not(:disabled),
.recipe-version-graph__context-menu-item:focus-visible {
    background: var(--surface);
    color: var(--text-primary);
    outline: none;
}

.recipe-version-graph__context-menu-item:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: -2px;
}

.recipe-version-graph__context-menu-item:disabled {
    cursor: not-allowed;
    color: var(--overlay-muted);
}

.recipe-version-graph__context-menu-separator {
    height: 1px;
    margin: 5px 8px;
    background: var(--border-color);
}

.recipe-version-graph__canvas-stage {
    position: absolute;
    inset: 0 auto auto 0;
    transform-origin: 0 0;
    will-change: transform;
}

.recipe-version-graph__frontier-layer {
    position: absolute;
    z-index: 4;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.recipe-version-graph__frontier-control {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    max-width: 264px;
    transform: translate(-50%, -50%) scale(var(--recipe-version-graph-frontier-scale, 1));
    pointer-events: auto;
}

.recipe-version-graph__frontier-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.recipe-version-graph__frontier-button,
.recipe-version-graph__outline-frontier-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 10px;
    border: 2px solid color-mix(in srgb, var(--accent) 62%, var(--border-color));
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--surface) 94%, var(--accent));
    box-shadow: 1px 2px 5px var(--shadow-dark), -1px -1px 3px var(--shadow-light);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
}

.recipe-version-graph__frontier-button:hover:not(:disabled),
.recipe-version-graph__outline-frontier-button:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent-ink);
}

.recipe-version-graph__frontier-button--continue,
.recipe-version-graph__outline-frontier-button--continue {
    border-style: dashed;
    color: var(--accent-ink);
}

.recipe-version-graph__frontier-button:focus-visible,
.recipe-version-graph__outline-frontier-button:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 65%, transparent);
    outline-offset: 3px;
}

.recipe-version-graph__frontier-button:disabled,
.recipe-version-graph__outline-frontier-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.recipe-version-graph__frontier-spinner {
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
    border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.recipe-version-graph__frontier-error-marker {
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 50%;
    background: var(--error);
    color: white;
    font-weight: 800;
}

.recipe-version-graph__expansion-live {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.recipe-version-graph__expansion-error {
    margin: calc(-1 * var(--space-sm)) 0 0;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid color-mix(in srgb, var(--error) 55%, transparent);
    border-radius: var(--radius-md);
    background: var(--error-bg);
    color: var(--error-ink);
}

.recipe-version-graph__edge-layer {
    position: absolute;
    z-index: 0;
    inset: 0 auto auto 0;
    overflow: visible;
    pointer-events: none;
}

.recipe-version-graph__edge {
    fill: none;
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
}

.recipe-version-graph__edge--version {
    stroke: color-mix(in srgb, var(--accent) 65%, var(--border-color));
    stroke-dasharray: none;
}

.recipe-version-graph__edge--fork {
    stroke: var(--accent);
    stroke-dasharray: 10 7;
}

#recipe-version-graph-arrow-version path {
    fill: color-mix(in srgb, var(--accent) 65%, var(--border-color));
}

#recipe-version-graph-arrow-fork path {
    fill: var(--accent);
}

.recipe-version-graph__card-layer {
    position: relative;
    z-index: 1;
}

.recipe-version-graph__canvas-node {
    position: absolute;
    width: 240px;
    height: 300px;
}

.recipe-version-graph__node--fork-source {
    box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--accent) 65%, transparent),
        3px 4px 8px var(--shadow-dark), -2px -2px 6px var(--shadow-light);
}

.recipe-version-graph__node--fork-target {
    outline: 2px dashed color-mix(in srgb, var(--accent) 75%, transparent);
    outline-offset: 3px;
}

.recipe-version-graph__node-link,
.recipe-version-graph__static-card {
    display: block;
    width: 100%;
    height: 100%;
    color: inherit;
    text-decoration: none;
    border-radius: var(--radius-lg);
}

.recipe-version-graph__node-link:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 65%, transparent);
    outline-offset: 4px;
}

.recipe-version-graph__node {
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: 3px 4px 8px var(--shadow-dark), -2px -2px 6px var(--shadow-light);
    height: 100%;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.recipe-version-graph__node-link:hover .recipe-version-graph__node {
    transform: translateY(-2px);
    box-shadow: 4px 6px 12px var(--shadow-dark), -2px -2px 7px var(--shadow-light);
}

.recipe-version-graph__node--current {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent),
        3px 4px 8px var(--shadow-dark), -2px -2px 6px var(--shadow-light);
}

.recipe-version-graph__node--ancestor {
    border-color: #5573a8;
    background: color-mix(in srgb, #5573a8 16%, var(--surface));
    outline: 3px solid color-mix(in srgb, #5573a8 72%, transparent);
    outline-offset: 3px;
    animation: recipe-version-graph-ancestor-breathe 2s ease-in-out infinite;
}

.recipe-version-graph__node--immediate-descendant {
    border-color: var(--warning);
    background: color-mix(in srgb, var(--warning) 18%, var(--surface));
    outline: 3px dashed color-mix(in srgb, var(--warning) 82%, transparent);
    outline-offset: 3px;
    animation: recipe-version-graph-immediate-descendant-breathe 2s ease-in-out infinite;
}

@keyframes recipe-version-graph-ancestor-breathe {
    0%,
    100% {
        background: color-mix(in srgb, #5573a8 8%, var(--surface));
    }

    50% {
        background: color-mix(in srgb, #5573a8 32%, var(--surface));
    }
}

@keyframes recipe-version-graph-immediate-descendant-breathe {
    0%,
    100% {
        background: color-mix(in srgb, var(--warning) 10%, var(--surface));
    }

    50% {
        background: color-mix(in srgb, var(--warning) 34%, var(--surface));
    }
}

.recipe-version-graph__node--main-recipe {
    position: relative;
    border-color: var(--success);
    background: color-mix(in srgb, var(--success) 24%, var(--surface));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 20%, transparent),
        3px 4px 8px var(--shadow-dark), -2px -2px 6px var(--shadow-light);
    animation: recipe-version-graph-main-recipe-breathe 2s ease-in-out infinite;
}

.recipe-version-graph__node--main-recipe::after {
    position: absolute;
    z-index: 2;
    inset: 10px;
    border-radius: calc(var(--radius-lg) - 10px);
    outline: 9px solid color-mix(in srgb, var(--success) 88%, white);
    pointer-events: none;
    content: "";
}

@keyframes recipe-version-graph-main-recipe-breathe {
    0%,
    100% {
        background: color-mix(in srgb, var(--success) 12%, var(--surface));
    }

    50% {
        background: color-mix(in srgb, var(--success) 42%, var(--surface));
    }
}

@media (prefers-reduced-motion: reduce) {
    .recipe-version-graph__node--main-recipe {
        background: color-mix(in srgb, var(--success) 24%, var(--surface));
        animation: none;
    }
}

.recipe-version-graph__node--main-recipe.recipe-version-graph__node--fork-source {
    box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--accent) 65%, transparent),
        0 0 0 2px color-mix(in srgb, var(--success) 20%, transparent),
        3px 4px 8px var(--shadow-dark), -2px -2px 6px var(--shadow-light);
}

.recipe-version-graph__node-link:hover .recipe-version-graph__node--main-recipe {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 20%, transparent),
        4px 6px 12px var(--shadow-dark), -2px -2px 7px var(--shadow-light);
}

.recipe-version-graph__node-link:hover
    .recipe-version-graph__node--main-recipe.recipe-version-graph__node--fork-source {
    box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--accent) 65%, transparent),
        0 0 0 2px color-mix(in srgb, var(--success) 20%, transparent),
        4px 6px 12px var(--shadow-dark), -2px -2px 7px var(--shadow-light);
}

.recipe-version-graph__node--redacted {
    border-style: dashed;
}

.recipe-version-graph__node--deleted {
    border-style: dashed;
    opacity: 0.82;
}

.recipe-version-graph__thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--background);
}

.recipe-version-graph__thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recipe-version-graph__edited-image {
    width: 100%;
    height: 100%;
}

.recipe-version-graph__thumbnail-placeholder {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    color: var(--text-tertiary);
    font-size: 28px;
}

.recipe-version-graph__node-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    padding: var(--space-md);
}

.recipe-version-graph__node--main-recipe .recipe-version-graph__node-body {
    gap: 2px;
}

.recipe-version-graph__node-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.recipe-version-graph__badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-xs);
}

.recipe-version-graph__version,
.recipe-version-graph__current-badge,
.recipe-version-graph__main-recipe-badge,
.recipe-version-graph__relationship-badge,
.recipe-version-graph__deleted-badge {
    color: var(--accent-ink);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.recipe-version-graph__relationship-badge {
    padding: 2px 8px;
    border: 1px solid currentColor;
    border-radius: var(--radius-full);
    background: var(--surface);
}

.recipe-version-graph__relationship-badge--ancestor {
    color: #3f5f96;
    background: color-mix(in srgb, #5573a8 15%, var(--surface));
}

.recipe-version-graph__relationship-badge--descendant {
    color: var(--warning-ink);
    background: color-mix(in srgb, var(--warning) 16%, var(--surface));
}

.dark .recipe-version-graph__node--ancestor {
    border-color: #8ba8db;
    background: color-mix(in srgb, #8ba8db 20%, var(--surface));
    outline-color: color-mix(in srgb, #8ba8db 86%, transparent);
    animation-name: recipe-version-graph-dark-ancestor-breathe;
}

@keyframes recipe-version-graph-dark-ancestor-breathe {
    0%,
    100% {
        background: color-mix(in srgb, #8ba8db 10%, var(--surface));
    }

    50% {
        background: color-mix(in srgb, #8ba8db 34%, var(--surface));
    }
}

.dark .recipe-version-graph__relationship-badge--ancestor {
    color: #b7cef5;
    background: color-mix(in srgb, #8ba8db 18%, var(--surface));
}

@media (prefers-reduced-motion: reduce) {
    .recipe-version-graph__node--ancestor,
    .recipe-version-graph__node--immediate-descendant {
        animation: none;
    }

    .recipe-version-graph__node--ancestor {
        background: color-mix(in srgb, #5573a8 16%, var(--surface));
    }

    .recipe-version-graph__node--immediate-descendant {
        background: color-mix(in srgb, var(--warning) 18%, var(--surface));
    }

    .dark .recipe-version-graph__node--ancestor {
        background: color-mix(in srgb, #8ba8db 20%, var(--surface));
    }
}

.recipe-version-graph__current-badge {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.recipe-version-graph__main-recipe-badge {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    color: var(--success-ink);
    background: var(--success-bg);
}

.recipe-version-graph__deleted-badge {
    color: var(--text-secondary);
}

.recipe-version-graph__node h2,
.recipe-version-graph__node p {
    margin: 0;
}

.recipe-version-graph__node h2 {
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recipe-version-graph__owner,
.recipe-version-graph__node time,
.recipe-version-graph__summary {
    color: var(--text-secondary);
    font-size: 13px;
}

.recipe-version-graph__node--main-recipe .recipe-version-graph__owner,
.recipe-version-graph__node--main-recipe time,
.recipe-version-graph__node--main-recipe .recipe-version-graph__summary {
    color: var(--text-primary);
}

.recipe-version-graph__summary {
    margin-top: var(--space-xs) !important;
}

.recipe-version-graph__node--main-recipe .recipe-version-graph__summary {
    margin-top: 0 !important;
}

.recipe-version-graph__comparison {
    display: grid;
    gap: var(--space-md);
    padding: var(--space-lg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface) 94%, var(--background));
}

.recipe-version-graph__comparison-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
}

.recipe-version-graph__comparison-heading h2,
.recipe-version-graph__comparison-heading p,
.recipe-version-graph__comparison-result h3 {
    margin: 0;
}

.recipe-version-graph__comparison-heading p {
    margin-top: var(--space-xs);
    color: var(--text-secondary);
}

.recipe-version-graph__comparison-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.recipe-version-graph__comparison-selection {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-md);
}

.recipe-version-graph__comparison-selection > div {
    display: grid;
    gap: 2px;
    min-height: 70px;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.recipe-version-graph__comparison-selection span {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 700;
}

.recipe-version-graph__comparison-arrow {
    color: var(--accent-ink) !important;
    font-size: 1.4rem !important;
}

.recipe-version-graph__comparison-submit {
    justify-self: start;
}

.recipe-version-graph__comparison-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-secondary);
}

.recipe-version-graph__comparison-error {
    margin: 0;
    color: var(--error-ink);
}

.recipe-version-graph__comparison-result {
    display: grid;
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.recipe-version-graph__comparison-empty {
    margin: 0;
    color: var(--text-secondary);
}

.recipe-version-graph__comparison-changes {
    display: grid;
    gap: var(--space-md);
}

.recipe-version-graph__comparison-change {
    padding: var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.recipe-version-graph__comparison-change header {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.recipe-version-graph__comparison-change header span {
    color: var(--accent-ink);
    font-size: var(--font-size-sm);
    font-weight: 700;
}

.recipe-version-graph__comparison-values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-md);
}

.recipe-version-graph__comparison-value {
    padding: var(--space-sm);
    border-left: 4px solid;
    border-radius: var(--radius-sm);
}

.recipe-version-graph__comparison-value--before {
    border-color: var(--error);
    background: var(--error-bg);
}

.recipe-version-graph__comparison-value--after {
    border-color: var(--success);
    background: var(--success-bg);
}

.recipe-version-graph__comparison-value pre {
    margin: var(--space-xs) 0 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    font: inherit;
}

.recipe-version-graph__outline {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--surface) 92%, var(--background));
}

.recipe-version-graph__outline summary {
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 700;
}

.recipe-version-graph__outline summary:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent);
    outline-offset: 2px;
}

.recipe-version-graph__outline ol,
.recipe-version-graph__outline ul {
    margin: 0;
    padding: 0 var(--space-xl) var(--space-md) calc(var(--space-xl) + var(--space-sm));
}

.recipe-version-graph__outline li + li {
    margin-top: var(--space-xs);
}

.recipe-version-graph__outline-frontier-button {
    margin-inline-start: var(--space-sm);
    box-shadow: none;
    font-size: 0.82rem;
}

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

.recipe-version-graph__outline h3 {
    margin: var(--space-sm) var(--space-md);
    font-size: 0.95rem;
}

@media (max-width: 760px) {
    .recipe-version-graph__lineage-counts {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    }

    .recipe-version-graph__lineage-count {
        justify-content: center;
        padding-inline: var(--space-xs);
    }

    .recipe-version-graph__toolbar {
        align-items: flex-start;
    }

    .recipe-version-graph__controls {
        width: 100%;
    }

    .recipe-version-graph__controls-group {
        width: 100%;
    }

    .recipe-version-graph__control {
        flex: 1 1 38px;
    }

    .recipe-version-graph__control--text {
        flex-basis: auto;
    }

    .recipe-version-graph__canvas-viewport {
        height: min(70vh, 520px);
        min-height: 360px;
    }

    .recipe-version-graph__frontier-button {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .recipe-version-graph__comparison-heading {
        display: grid;
    }

    .recipe-version-graph__comparison-selection,
    .recipe-version-graph__comparison-values {
        grid-template-columns: 1fr;
    }

    .recipe-version-graph__comparison-arrow {
        justify-self: center;
        transform: rotate(90deg);
    }

    .recipe-version-graph__outline ol,
    .recipe-version-graph__outline ul {
        padding-inline: var(--space-xl) var(--space-md);
    }
}

.recipe-lineage__current {
    border: 1px solid var(--accent);
    box-shadow: 0 0 0 2px rgba(217, 115, 90, 0.1),
        1px 2px 4px var(--shadow-dark), -1px -1px 3px var(--shadow-light);
}

.recipe-lineage__node--linked {
    color: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.recipe-lineage__node--linked:hover {
    border-color: color-mix(in srgb, var(--accent) 70%, var(--shadow-light));
    box-shadow: 2px 3px 7px var(--shadow-dark), -2px -2px 5px var(--shadow-light);
    transform: translateY(-1px);
}

.recipe-lineage__node--linked:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
    outline-offset: 3px;
}

.recipe-lineage__node--deleted {
    border-style: dashed;
}

.recipe-lineage__node--redacted {
    border-style: dashed;
    box-shadow: none;
    opacity: 0.78;
}

.recipe-lineage__node-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-xs);
    min-width: 0;
}

.recipe-lineage__node-title {
    overflow-wrap: anywhere;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.recipe-lineage__node--linked:hover .recipe-lineage__node-title {
    color: var(--accent-ink);
}

.recipe-lineage__status {
    flex-shrink: 0;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    background: rgba(217, 115, 90, 0.12);
    color: var(--accent-ink);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.recipe-lineage__owner,
.recipe-lineage__fork-point,
.recipe-lineage__truncated,
.recipe-lineage__empty {
    color: var(--text-tertiary);
    font-size: 12px;
}

.recipe-lineage__message {
    margin: 2px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    font-style: italic;
    line-height: 1.4;
}

.recipe-lineage__descendant-list,
.recipe-lineage__children {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.recipe-lineage__descendant-list,
.recipe-lineage__children {
    position: relative;
    padding-left: 18px;
}

.recipe-lineage__children {
    margin: 6px 0 0 10px;
}

.recipe-lineage__descendant-list::before,
.recipe-lineage__children::before {
    content: "";
    position: absolute;
    left: 0;
    top: 17px;
    bottom: 17px;
    width: 2px;
    background: color-mix(in srgb, var(--accent) 45%, transparent);
}

.recipe-lineage__children::before {
    top: -6px;
}

.recipe-lineage__branch {
    position: relative;
}

.recipe-lineage__descendant-list > .recipe-lineage__branch::before,
.recipe-lineage__children > .recipe-lineage__branch::before {
    content: "";
    position: absolute;
    z-index: 1;
    top: 17px;
    right: 100%;
    width: 18px;
    height: 2px;
    background: color-mix(in srgb, var(--accent) 45%, transparent);
}

.recipe-lineage__descendant-list > .recipe-lineage__branch:last-child::after,
.recipe-lineage__children > .recipe-lineage__branch:last-child::after {
    content: "";
    position: absolute;
    z-index: 1;
    top: 19px;
    right: calc(100% + 16px);
    bottom: 0;
    width: 2px;
    background: var(--surface);
}

.recipe-lineage__truncated {
    display: block;
    margin: 5px 0 0 11px;
    padding-left: 9px;
    border-left: 2px dotted color-mix(in srgb, var(--accent) 55%, transparent);
    font-style: italic;
    line-height: 1.35;
}

.recipe-lineage__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px solid color-mix(in srgb, var(--text-tertiary) 22%, transparent);
}

.recipe-lineage__branch-controls {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 5px 0 0 11px;
    padding-left: 9px;
    border-left: 2px dotted color-mix(in srgb, var(--accent) 55%, transparent);
}

.recipe-lineage__count {
    color: var(--text-tertiary);
    font-size: 12px;
}

.recipe-lineage__control-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.recipe-lineage__control-button {
    padding: 6px 10px;
    border: 1px solid color-mix(in srgb, var(--accent) 65%, var(--shadow-light));
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    color: var(--accent-ink);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    transition: background 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.recipe-lineage__control-button:hover {
    background: color-mix(in srgb, var(--accent) 17%, var(--surface));
    box-shadow: 1px 2px 4px var(--shadow-dark);
    transform: translateY(-1px);
}

.recipe-lineage__control-button:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent);
    outline-offset: 2px;
}

.recipe-lineage__control-button--secondary {
    border-color: var(--shadow-light);
    background: var(--surface);
    color: var(--text-secondary);
}

.recipe-lineage__control-button--branch {
    padding: 4px 8px;
    font-size: 11px;
}

.recipe-lineage__limit-notice {
    margin: 0;
    padding: var(--space-sm) var(--space-md);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    background: rgba(217, 115, 90, 0.08);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

@media (max-width: 760px) {
    .recipe-lineage__flow {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-md);
    }
}

/* ============================================================
   Recipe Image Slider
   ============================================================ */
.recipe-image-slider {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    box-shadow: 5px 5px 4px var(--shadow-dark), -5px -5px 4px var(--shadow-light);
}

.recipe-image-slider__viewport {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 711.11px; /* 400px * 16/9 — keeps ratio at height cap */
    margin: 0 auto;
    padding: var(--space-sm);
    aspect-ratio: 16 / 9;
    max-height: 400px;
    overflow: hidden;
}

.recipe-image-slider__image {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-md);
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.recipe-image-slider__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-fill);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    color: white;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
    box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}

.recipe-image-slider__arrow:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.recipe-image-slider__arrow--left {
    left: var(--space-sm);
}

.recipe-image-slider__arrow--right {
    right: var(--space-sm);
}

.recipe-image-slider__dots {
    position: absolute;
    bottom: var(--space-sm);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--space-xs);
    z-index: 2;
}

.recipe-image-slider__dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.recipe-image-slider__dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

.recipe-image-slider__dot--active {
    background: white;
    transform: scale(1.2);
}

/* ============================================================
   Image Upload Component (CP4)
   ============================================================ */

/* Container */
.image-upload {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* Dropzone */
.image-upload__dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    min-height: 120px;
    padding: var(--space-lg);
    border: 2px dashed var(--text-tertiary);
    border-radius: var(--radius-lg);
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-body);
    color: var(--text-secondary);
    font-size: 14px;
}

.image-upload__dropzone:hover {
    border-color: var(--accent);
}

.image-upload__dropzone:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

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

.image-upload__dropzone--active {
    border-color: var(--accent);
    background: rgba(217, 115, 90, 0.06);
}

/* Hint text */
.image-upload__hint {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Pending item row */
.image-upload__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
}

.image-upload__item[draggable="true"] {
    cursor: grab;
}

.image-upload__item--dragging,
.step-photo-item--dragging {
    opacity: 0.55;
}

.image-upload__order-controls {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.image-upload__order-controls .btn {
    min-width: 32px;
    min-height: 32px;
    padding: 2px 8px;
}

/* Thumbnail */
.image-upload__thumb {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
}

.image-upload__item > .image-upload__thumb:not(.image-upload__thumb--placeholder) {
    width: 120px;
    height: auto;
    aspect-ratio: 16 / 9;
}

.image-upload__thumb.step-photo-preview {
    width: 88px;
    height: auto;
    aspect-ratio: 16 / 9;
}

.step-photo-item {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    cursor: grab;
}

.step-photo-item__preview {
    position: relative;
    padding: var(--space-xs);
    background: var(--surface);
    width: 104px;
}

.step-photo-item__preview .step-photo-preview {
    border-radius: calc(var(--radius-md) - 2px);
    margin-inline: auto;
}

.step-photo-item__meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-top: 4px;
    line-height: 1.2;
}

.step-photo-item__name {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.step-photo-item__size {
    color: var(--text-tertiary);
    font-size: 10px;
}

.step-photo-item__controls {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-top: 3px;
}

.step-photo-item__controls .btn {
    min-width: 26px;
    min-height: 26px;
    padding: 1px 6px;
}

.step-photo-item__remove {
    color: var(--error-ink);
}

.image-upload__preview-button {
    display: block;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    cursor: pointer;
}

.image-upload__preview-button:focus-visible {
    outline: 2px solid var(--accent-ink);
    outline-offset: 4px;
}

.recipe-image-preview {
    width: 120px;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.image-upload__thumb--placeholder {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: linear-gradient(135deg, var(--bg-gradient-2), var(--bg-gradient-3));
}

/* Meta: name + size + toggle */
.image-upload__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.image-upload__meta > span:first-child {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Size readout */
.image-upload__size {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* High-Quality toggle */
.image-upload__toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    margin-top: 2px;
}

.image-upload__toggle input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Status */
.image-upload__status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    font-size: 12px;
    /* Failure copy must fit the panel rather than enlarge the flex row. */
    min-width: 0;
    max-width: 100%;
    flex: 0 1 90px;
}

.image-upload__status > span {
    white-space: normal;
}

.image-upload__status:has(.image-upload__error) {
    flex-basis: 100%;
    align-items: flex-start;
}

/* Progress bar (indeterminate animation) */
.image-upload__progress {
    width: 100%;
    height: 3px;
    border-radius: var(--radius-full);
    background: var(--text-tertiary);
    overflow: hidden;
    position: relative;
}

.image-upload__progress::after {
    content: "";
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-full);
    animation: image-upload-progress-indeterminate 1.2s ease-in-out infinite;
}

@keyframes image-upload-progress-indeterminate {
    0% {
        left: -40%;
    }
    50% {
        left: 30%;
    }
    100% {
        left: 100%;
    }
}

/* Error text (inline) */
.image-upload__error {
    color: var(--error-ink);
    font-size: 12px;
    overflow-wrap: anywhere;
}

/* Error banner */
.image-upload__error--banner {
    background: var(--error-bg);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
}
.recipe-detail__visibility-control {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin: var(--space-md) 0;
    padding: var(--space-sm) var(--space-md);
}

.recipe-detail__visibility-control label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
}

.recipe-detail__visibility-control select {
    min-width: 9rem;
}

.recipe-detail__visibility-success {
    color: var(--success-ink);
}

.recipe-detail__visibility-error {
    color: var(--error-ink);
}

.collection-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--surface);
}

.collection-cover--hero {
    aspect-ratio: 16 / 9;
    margin-bottom: var(--space-md);
}

.collection-cover .edited-recipe-image,
.collection-cover .edited-recipe-image__stage,
.collection-cover .edited-recipe-image__plain {
    width: 100%;
    height: 100%;
}

.collection-cover__mosaic {
  display: grid;
  width: 100%;
  height: 100%;
  gap: 2px;
  background: var(--surface);
}

.collection-cover__mosaic--one {
  grid-template-columns: 1fr;
}

.collection-cover__mosaic--two,
.collection-cover__mosaic--three,
.collection-cover__mosaic--four {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.collection-cover__mosaic--three,
.collection-cover__mosaic--four {
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.collection-cover__mosaic--three .collection-cover__mosaic-tile:first-child {
  grid-row: 1 / span 2;
}

.collection-cover__mosaic-tile {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.collection-cover__mosaic-tile .edited-recipe-image,
.collection-cover__mosaic-tile .edited-recipe-image__stage,
.collection-cover__mosaic-tile .edited-recipe-image__plain,
.collection-cover__tile-fallback {
  width: 100%;
  height: 100%;
}

.collection-cover__tile-fallback {
  display: grid;
  place-items: center;
  font-size: clamp(1rem, 3vw, 2rem);
}

.collection-cover__fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    font-size: clamp(2rem, 7vw, 4rem);
}
/* ============================================================
   Marketing pages
   ============================================================ */
.marketing-page {
    --marketing-ink: var(--text-primary);
    --marketing-muted: var(--text-secondary);
    overflow: clip;
}

.marketing-page section[id] {
    scroll-margin-top: 96px;
}

.marketing-eyebrow {
    margin-bottom: var(--space-sm);
    color: var(--accent-ink);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.marketing-lede {
    max-width: 720px;
    color: var(--marketing-muted);
    font-size: clamp(18px, 2.2vw, 22px);
    line-height: 1.65;
}

.marketing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: center;
}

.marketing-note {
    color: var(--text-tertiary);
    font-size: 14px;
}

.marketing-hero {
    display: grid;
    min-height: min(760px, calc(100vh - 80px));
    align-items: center;
    gap: clamp(40px, 7vw, 100px);
    padding-top: clamp(56px, 10vw, 112px);
    padding-bottom: clamp(72px, 10vw, 120px);
}

.marketing-hero__copy {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-lg);
}

.marketing-hero h1,
.about-hero h1,
.how-to-hero h1 {
    max-width: 840px;
    font-size: clamp(42px, 7vw, 86px);
    line-height: 1.02;
    letter-spacing: -0.035em;
}

.home-recipe-visual {
    position: relative;
    min-height: 480px;
    isolation: isolate;
}

.home-recipe-visual__sun {
    position: absolute;
    top: 4%;
    right: 5%;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--warning) 22%, transparent);
    filter: blur(1px);
}

.home-recipe-visual__card {
    position: absolute;
    width: min(390px, 82%);
    min-height: 410px;
    border: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
    border-radius: 28px;
    box-shadow: 18px 22px 45px color-mix(in srgb, var(--shadow-dark) 65%, transparent);
}

.home-recipe-visual__card--back {
    top: 15%;
    left: 16%;
    transform: rotate(-7deg);
    background: color-mix(in srgb, var(--success) 42%, var(--surface));
}

.home-recipe-visual__card--front {
    top: 8%;
    left: 10%;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: clamp(28px, 5vw, 48px);
    transform: rotate(2deg);
    background: color-mix(in srgb, var(--surface) 96%, white);
}

.home-recipe-visual__label {
    color: var(--accent-ink);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.home-recipe-visual__card h2 {
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
}

.home-recipe-visual__card p,
.home-recipe-visual__card li {
    color: var(--text-secondary);
}

.home-recipe-visual__card ul {
    display: grid;
    gap: var(--space-sm);
    padding-left: var(--space-lg);
}

.home-recipe-visual__rule {
    width: 70px;
    height: 4px;
    border-radius: var(--radius-full);
    background: var(--accent);
}

.home-recipe-visual__meta {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.home-recipe-visual__bowl {
    position: absolute;
    right: 2%;
    bottom: 2%;
    z-index: 3;
    width: 170px;
    height: 88px;
    border-radius: 10px 10px 90px 90px;
    background: color-mix(in srgb, var(--accent) 80%, var(--surface));
    box-shadow: 8px 14px 25px color-mix(in srgb, var(--shadow-dark) 55%, transparent);
}

.marketing-values {
    display: grid;
    gap: var(--space-md);
    padding-bottom: clamp(80px, 12vw, 150px);
}

.marketing-value-card {
    min-height: 230px;
    padding: var(--space-xl);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: color-mix(in srgb, var(--surface) 78%, transparent);
}

.marketing-value-card__marker {
    display: block;
    margin-bottom: var(--space-xl);
    color: var(--accent-ink);
    font-family: var(--font-display);
    font-size: 14px;
}

.marketing-value-card h2 {
    margin-bottom: var(--space-md);
    font-size: 23px;
}

.marketing-value-card p {
    color: var(--text-secondary);
}

.marketing-feature-list {
    display: grid;
    gap: clamp(80px, 12vw, 150px);
    padding-bottom: clamp(100px, 14vw, 170px);
}

.marketing-feature {
    display: grid;
    align-items: center;
    gap: clamp(36px, 8vw, 110px);
}

.marketing-feature__copy h2,
.marketing-community h2,
.marketing-cta-panel h2,
.about-story__copy h2,
.how-to-troubleshooting h2 {
    margin-bottom: var(--space-lg);
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.08;
    letter-spacing: -0.025em;
}

.marketing-feature__copy > p:not(.marketing-eyebrow),
.marketing-community__copy > p:not(.marketing-eyebrow),
.about-story__copy > p:not(.marketing-eyebrow) {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1.7;
}

.marketing-text-link {
    display: inline-flex;
    margin-top: var(--space-md);
    font-weight: 700;
}

.marketing-feature__visual {
    position: relative;
    min-height: 390px;
    border: 1px solid var(--border-color);
    border-radius: 32px;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    box-shadow: 14px 18px 40px color-mix(in srgb, var(--shadow-dark) 42%, transparent);
    overflow: hidden;
}

.marketing-draft-visual {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-lg);
    padding: clamp(28px, 7vw, 70px);
}

.marketing-draft-visual__status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--success-ink);
    font-size: 14px;
    font-weight: 700;
}

.marketing-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
}

.marketing-draft-visual__line {
    width: 84%;
    height: 12px;
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--text-tertiary) 28%, transparent);
}

.marketing-draft-visual__line--title {
    width: 64%;
    height: 24px;
    background: color-mix(in srgb, var(--accent) 56%, transparent);
}

.marketing-draft-visual__line--short {
    width: 45%;
}

.marketing-draft-visual__ingredients {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.marketing-draft-visual__ingredients span {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--success) 14%, var(--surface));
    color: var(--text-secondary);
    font-size: 13px;
}

.marketing-collection-visual {
    min-height: 430px;
}

.marketing-folder {
    position: absolute;
    display: flex;
    align-items: flex-end;
    width: 62%;
    height: 180px;
    padding: var(--space-lg);
    border-radius: 18px 18px 28px 28px;
    box-shadow: 8px 12px 25px color-mix(in srgb, var(--shadow-dark) 45%, transparent);
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
}

.marketing-folder::before {
    content: "";
    position: absolute;
    top: -25px;
    left: 0;
    width: 42%;
    height: 42px;
    border-radius: 18px 18px 0 0;
    background: inherit;
}

.marketing-folder--main {
    right: 8%;
    bottom: 10%;
    z-index: 3;
    background: color-mix(in srgb, var(--warning) 55%, var(--surface));
}

.marketing-folder--second {
    top: 26%;
    left: 10%;
    z-index: 2;
    background: color-mix(in srgb, var(--success) 48%, var(--surface));
}

.marketing-folder--third {
    top: 8%;
    right: 8%;
    background: color-mix(in srgb, var(--accent) 42%, var(--surface));
}

.marketing-version-visual {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-lg);
    padding: clamp(32px, 7vw, 72px);
}

.marketing-version-line {
    position: absolute;
    top: 18%;
    bottom: 18%;
    left: 76px;
    width: 2px;
    background: color-mix(in srgb, var(--accent) 40%, var(--border-color));
}

.marketing-version-node {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 54px 1fr;
    align-items: center;
    gap: var(--space-lg);
}

.marketing-version-node strong {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: var(--surface);
    color: var(--accent-ink);
}

.marketing-version-node--current span {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--text-primary);
    font-weight: 700;
}

.marketing-version-node:not(.marketing-version-node--current) span {
    color: var(--text-secondary);
}

.marketing-community {
    display: grid;
    gap: clamp(40px, 8vw, 100px);
    align-items: center;
    padding-bottom: clamp(100px, 14vw, 170px);
}

.marketing-community__copy .marketing-actions {
    margin-top: var(--space-xl);
}

.marketing-community__scale-card {
    padding: clamp(32px, 6vw, 56px);
    border: 1px solid var(--border-color);
    border-radius: 32px;
    background: color-mix(in srgb, var(--success) 12%, var(--surface));
    transform: rotate(2deg);
}

.marketing-community__scale-label {
    display: block;
    margin-bottom: var(--space-sm);
    color: var(--success-ink);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.marketing-community__scale-card strong {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(26px, 4vw, 38px);
}

.marketing-community__scale-line {
    display: flex;
    justify-content: space-between;
    margin: var(--space-xl) 0;
    padding: var(--space-md) 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.marketing-cta-panel {
    padding-bottom: clamp(80px, 12vw, 140px);
}

.marketing-cta-panel__inner {
    display: grid;
    align-items: center;
    gap: var(--space-xl);
    padding: clamp(36px, 7vw, 72px);
    border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border-color));
    border-radius: 36px;
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.marketing-cta-panel h2 {
    margin-bottom: var(--space-md);
}

.marketing-cta-panel p {
    max-width: 680px;
    color: var(--text-secondary);
    font-size: 18px;
}

/* About */
.about-purpose {
    display: grid;
    gap: 28px;
    padding-top: 20px;
    padding-bottom: 48px;
}

.about-purpose section {
    padding: clamp(24px, 3vw, 40px);
    border-radius: 26px;
    background: var(--neumo-surface);
    box-shadow: var(--elevation-raised);
}

.about-purpose .about-purpose__mission {
    display: grid;
    gap: 24px;
    background: color-mix(in srgb, var(--success) 12%, var(--neumo-surface));
}

.about-purpose h2 {
    max-width: 540px;
    margin: 0 0 20px;
    font-size: clamp(26px, 2.7vw, 36px);
    line-height: 1.18;
    letter-spacing: -0.015em;
}

.about-purpose p:not(.marketing-eyebrow) {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.75;
    margin: 0 0 16px;
}

.about-purpose section > :last-child,
.about-purpose__mission h2 {
    margin-bottom: 0;
}

.about-purpose__audience ul {
    list-style: none;
    margin: 24px 0 0;
    padding: 0;
    display: grid;
    gap: 18px;
}

.about-purpose__audience li {
    display: grid;
    grid-template-columns: 8px 1fr;
    column-gap: 14px;
    row-gap: 3px;
}

.about-purpose__audience li::before {
    content: "";
    grid-row: span 2;
    width: 8px;
    height: 8px;
    margin-top: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.about-purpose__audience strong { font-size: 16px; }
.about-purpose__audience span { color: var(--text-secondary); font-size: 14px; line-height: 1.6; }

@media (min-width: 900px) {
    .about-purpose { grid-template-columns: 1fr 1fr; }
    .about-purpose .about-purpose__mission {
        grid-column: 1 / -1;
        grid-template-columns: 1fr 1fr;
        align-items: center;
        gap: 56px;
    }
}

.about-hero,
.how-to-hero {
    padding-top: clamp(70px, 11vw, 130px);
    padding-bottom: clamp(70px, 10vw, 120px);
}

.about-hero {
    display: grid;
    align-items: center;
    gap: clamp(32px, 5vw, 80px);
    padding-top: clamp(32px, 4vw, 56px);
    padding-bottom: clamp(32px, 4vw, 56px);
}

.about-page > .container { max-width: var(--content-max-width); }
.about-hero__copy > * { margin: 0; }
.about-hero__copy .marketing-lede { max-width: 520px; font-size: 19px; line-height: 1.65; }

.about-hero__copy {
    display: grid;
    justify-items: start;
    gap: var(--space-lg);
}

.about-hero h1 {
    max-width: 650px;
    color: var(--text-primary);
    font-size: clamp(42px, 4.8vw, 66px);
    line-height: 1.08;
}

.about-hero__illustration {
    position: relative;
    min-height: 370px;
    isolation: isolate;
    border-radius: 42% 58% 45% 55%;
    background: radial-gradient(ellipse at 53% 57%, color-mix(in srgb, var(--surface) 90%, var(--success) 10%) 0 55%, transparent 72%);
}

.about-hero__cloth {
    position: absolute;
    inset: 49% 12% 6% 8%;
    border-radius: 24px 40px 30px 20px;
    background: repeating-linear-gradient(0deg, transparent 0 22px, color-mix(in srgb, var(--success) 10%, transparent) 22px 32px), repeating-linear-gradient(90deg, var(--surface) 0 22px, color-mix(in srgb, var(--success) 18%, var(--surface)) 22px 32px);
    transform: rotate(-8deg);
}

.about-hero__book {
    position: absolute;
    z-index: 2;
    top: 10%;
    left: 23%;
    width: 41%;
    height: 69%;
    border: 1px solid color-mix(in srgb, var(--text-primary) 50%, var(--success));
    border-radius: 15px 22px 20px 16px;
    background: linear-gradient(120deg, color-mix(in srgb, var(--success) 80%, var(--surface)), color-mix(in srgb, var(--success) 60%, var(--text-primary)));
    box-shadow: 9px 17px 22px color-mix(in srgb, var(--text-primary) 22%, transparent), inset 3px 2px 2px #ffffff55, inset -5px -3px 4px #00000018;
    transform: rotate(-12deg);
}

.about-hero__book-spine {
    position: absolute;
    inset: 0 auto 0 0;
    width: 11%;
    border-right: 1px solid color-mix(in srgb, var(--text-primary) 30%, transparent);
    border-radius: 12px 3px 3px 12px;
    background: color-mix(in srgb, var(--success) 70%, var(--text-primary));
}

.about-hero__book-label {
    position: absolute;
    top: 27%;
    left: 21%;
    right: 22%;
    padding: 20px 8px;
    border-radius: 7px;
    background: var(--bg-base);
    color: var(--text-primary);
    box-shadow: 1px 3px 4px #00000026, inset 0 0 0 5px var(--bg-base), inset 0 0 0 6px color-mix(in srgb, var(--accent) 24%, transparent);
    font-family: var(--font-display);
    font-size: clamp(16px, 2vw, 25px);
    text-align: center;
}

.about-hero__book-band {
    position: absolute;
    z-index: 3;
    inset: -3px 9% -3px auto;
    width: 10%;
    border-radius: 4px;
    background: var(--accent);
    box-shadow: 2px 0 3px color-mix(in srgb, var(--text-primary) 30%, transparent);
}

.about-hero__book-pages {
    position: absolute;
    inset: auto 3% -7% 6%;
    height: 7%;
    border: 1px solid color-mix(in srgb, var(--text-secondary) 50%, transparent);
    border-radius: 0 0 9px 9px;
    background: repeating-linear-gradient(0deg, var(--bg-base) 0 3px, color-mix(in srgb, var(--text-secondary) 20%, var(--bg-base)) 3px 4px);
}

.about-hero__bookmark { position: absolute; bottom: -14%; left: 18%; width: 20px; height: 44px; background: var(--accent); clip-path: polygon(0 0,100% 0,100% 100%,50% 80%,0 100%); }
.about-hero__note { position: absolute; z-index: 4; bottom: 1%; left: 9%; display: grid; gap: 8px; padding: 18px 24px; border-radius: 4px 4px 12px 4px; background: var(--surface); box-shadow: 3px 6px 12px #00000018; transform: rotate(5deg); font-size: 12px; color: var(--text-secondary); }
.about-hero__note span:first-child { font-family: var(--font-display); font-size: 18px; color: var(--text-primary); }

.about-hero__mug {
    position: absolute;
    z-index: 3;
    right: 8%;
    bottom: 16%;
    width: 20%;
    height: 26%;
    border: 1px solid color-mix(in srgb, var(--success) 35%, var(--surface));
    border-radius: 15% 15% 35% 35%;
    background: linear-gradient(100deg, var(--surface), color-mix(in srgb, var(--surface) 85%, var(--success)));
    box-shadow: 5px 9px 12px #00000020, inset 4px 0 5px #ffffff66;
}

.about-hero__mug::before { content: ""; position: absolute; inset: -6px 3px auto; height: 22px; border: 5px solid var(--surface); border-radius: 50%; background: #79614a; box-shadow: 0 -2px 0 color-mix(in srgb, var(--success) 65%, var(--surface)), inset 0 3px 4px #00000030; }

.about-hero__mug::after {
    content: "";
    position: absolute;
    top: 16%;
    left: 100%;
    width: 33%;
    height: 50%;
    border: 8px solid color-mix(in srgb, var(--surface) 90%, var(--success));
    border-left: 0;
    border-radius: 0 50% 50% 0;
}

.about-hero__sprig {
    position: absolute;
    right: 8%;
    top: 12%;
    width: 2px;
    height: 32%;
    background: var(--success);
    transform: rotate(18deg);
}

.about-hero__sprig span {
    position: absolute;
    width: 32px;
    height: 16px;
    border-radius: 100% 0 100% 0;
    background: var(--success);
}

.about-hero__sprig span:nth-child(1) { top: 10%; left: -29px; transform: rotate(22deg); }
.about-hero__sprig span:nth-child(2) { top: 31%; left: 0; transform: rotate(65deg); }
.about-hero__sprig span:nth-child(3) { top: 49%; left: -29px; transform: rotate(20deg); }
.about-hero__sprig span:nth-child(4) { top: 68%; left: 0; transform: rotate(65deg); }

.about-page .marketing-cta-panel__inner {
    border-color: transparent;
    background: color-mix(in srgb, var(--success) 21%, var(--surface));
    box-shadow: var(--elevation-raised);
}

.about-contents {
    display: flex;
    gap: var(--space-sm);
    padding-top: 12px;
    padding-bottom: 32px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.about-contents a {
    flex: 0 0 auto;
    padding: var(--space-sm) var(--space-md);
    border: 0;
    border-radius: var(--radius-full);
    background: var(--neumo-surface);
    box-shadow: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}

.about-contents a:hover { color: var(--accent-ink); box-shadow: var(--elevation-inset-compact); }

.about-story {
    display: grid;
    gap: 28px;
    padding-top: var(--space-sm);
    padding-bottom: clamp(70px, 9vw, 110px);
}

.about-story__section {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 26px;
    padding: clamp(24px, 2.5vw, 36px);
    border-radius: 25px;
    background: var(--neumo-surface);
    box-shadow: var(--elevation-raised);
}

.about-story__copy h2 {
    font-size: clamp(24px, 2.2vw, 30px);
    line-height: 1.2;
    letter-spacing: -0.015em;
}

.about-story__copy > p:not(.marketing-eyebrow) {
    font-size: 15px;
    line-height: 1.7;
}

.about-story__copy > p:last-child { margin-bottom: 0; }
.about-story__copy .marketing-eyebrow { font-size: 11px; letter-spacing: .12em; }

.about-story__visual {
    position: relative;
    height: 180px;
    flex: 0 0 180px;
    border-radius: 18px;
    background: radial-gradient(ellipse, color-mix(in srgb, var(--success) 13%, transparent), transparent 75%);
}

.about-story__card {
    position: absolute;
    top: 12%;
    left: 8%;
    z-index: 2;
    display: flex;
    width: 80%;
    min-height: 125px;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--space-md);
    border-radius: 5px 5px 12px 5px;
    background: color-mix(in srgb, var(--surface) 94%, white);
    box-shadow: 3px 5px 10px #00000018;
    transform: rotate(-5deg);
}

.about-story__card span {
    color: var(--accent-ink);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.about-story__card strong {
    font-family: var(--font-display);
    font-size: 19px;
}

.about-story__card p { margin: 7px 0; font-size: 10px; color: var(--text-secondary); }
.about-story__card i, .about-story__versions i { display: block; height: 1px; margin-top: 9px; background: color-mix(in srgb, var(--text-secondary) 20%, transparent); }

.about-story__accent {
    position: absolute;
    top: 30%;
    right: 9%;
    width: 10px;
    height: 130px;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(90deg, var(--accent) 65%, color-mix(in srgb, var(--accent) 70%, white) 65%);
    transform: rotate(35deg);
}

.about-story__accent::after { content: ""; position: absolute; top: 100%; border: 5px solid transparent; border-top: 14px solid #bda37c; }

.about-story__versions {
    position: absolute;
    inset: 15% 0 10%;
    display: flex;
    align-items: end;
    gap: 8px;
}

.about-story__versions span {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    height: 72%;
    padding: 14px 9px;
    border-radius: 5px 5px 10px 5px;
    background: var(--surface);
    box-shadow: 3px 5px 9px #00000018;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 14px;
    transform: rotate(-5deg);
}

.about-story__versions small { font-family: var(--font-body); font-size: 8px; color: var(--accent-ink); margin-bottom: 8px; }
.about-story__versions strong { font-weight: 400; }

.about-story__versions span:nth-child(2) { height: 86%; transform: rotate(2deg); }
.about-story__versions span:nth-child(3) { height: 100%; transform: rotate(7deg); }

.about-story__visibility {
    position: absolute;
    inset: 2% 8%;
    display: grid;
    gap: 5px;
    padding: 12px;
    border-radius: 15px;
    background: var(--surface);
    box-shadow: var(--elevation-raised-compact);
}

.about-story__visibility span {
    display: grid;
    grid-template-columns: 10px 1fr;
    align-items: center;
    column-gap: 10px;
    row-gap: 0;
    padding: 0 10px;
    border-radius: 9px;
    background: var(--neumo-surface);
    box-shadow: var(--elevation-inset-compact);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
}

.about-story__visibility small { grid-column: 2; font-size: 10px; font-weight: 400; color: var(--text-secondary); }
.about-story__visibility strong { align-self: end; }

.about-story__visibility span::before {
    content: "";
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: 50%;
    background: var(--success);
    grid-row: span 2;
}

.about-story__folders { position: absolute; inset: 10px 8% 0; display: flex; flex-direction: column; padding-top: 15px; }
.about-story__folders span { position: relative; margin-top: -5px; padding: 18px 22px; border-radius: 3px 12px 12px 12px; background: color-mix(in srgb, var(--success) 18%, var(--surface)); box-shadow: 2px 4px 7px #00000018, inset 0 1px #ffffff66; font-family: var(--font-display); font-size: 15px; transform: rotate(-3deg); }
.about-story__folders span::before { content: ""; position: absolute; top: -8px; left: 0; width: 40%; height: 10px; border-radius: 5px 8px 0 0; background: inherit; }
.about-story__folders span:nth-child(2) { background: color-mix(in srgb, var(--accent) 13%, var(--surface)); transform: rotate(2deg); }
.about-story__folders span:nth-child(3) { background: var(--surface); transform: rotate(-2deg); }
.about-story__scaling { position: absolute; inset: 14px 5%; display: grid; grid-template-columns: 1fr 28px 1fr; align-items: center; gap: 12px; text-align: center; }
.about-story__scaling div { display: grid; gap: 5px; padding: 14px; border-radius: 50%; aspect-ratio: 1; align-content: center; background: var(--neumo-surface); box-shadow: var(--elevation-raised-compact), inset 0 0 0 7px color-mix(in srgb, var(--success) 9%, var(--surface)); }
.about-story__scaling small, .about-story__lineage small { color: var(--text-secondary); font-size: 9px; letter-spacing: .08em; }
.about-story__scaling strong { font-family: var(--font-display); font-size: 34px; font-weight: 400; }
.about-story__scaling > span { color: var(--accent-ink); font-size: 24px; }
.about-story__scaling p { grid-column: 1 / -1; margin: 0; font-size: 10px; color: var(--text-secondary); }
.about-story__lineage { position: absolute; inset: 8px 5%; display: grid; grid-template-columns: 24px 1fr; gap: 10px; }
.about-story__lineage div { display: grid; gap: 6px; padding: 15px 20px; border-radius: 6px 12px 12px 6px; background: var(--surface); box-shadow: 3px 5px 9px #00000018; }
.about-story__lineage div:first-child { grid-column: 1 / -1; margin-right: 24px; transform: rotate(-3deg); }
.about-story__lineage div:last-child { background: color-mix(in srgb, var(--success) 10%, var(--surface)); transform: rotate(2deg); }
.about-story__lineage strong { font-family: var(--font-display); font-size: 16px; font-weight: 400; }
.about-story__lineage > span { color: var(--accent-ink); font-size: 32px; }
.about-page .marketing-cta-panel__inner { padding: clamp(28px, 4vw, 48px); border-radius: 26px; }
.about-page .marketing-cta-panel h2 { font-size: clamp(28px, 3vw, 40px); }
.about-page .marketing-cta-panel p { font-size: 16px; }

/* How-to */
.how-to-hero {
    max-width: 1080px;
}

.how-to-hero h1 {
    margin-bottom: var(--space-lg);
}

.how-to-layout {
    display: grid;
    gap: clamp(40px, 7vw, 90px);
    padding-bottom: clamp(100px, 15vw, 180px);
}

.how-to-contents nav {
    padding: var(--space-lg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.how-to-contents__title {
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    font-weight: 800;
}

.how-to-contents ol {
    display: grid;
    gap: var(--space-xs);
    padding-left: var(--space-lg);
}

.how-to-contents a {
    color: var(--text-secondary);
    font-size: 14px;
}

.how-to-guide {
    display: grid;
    gap: clamp(72px, 10vw, 110px);
    min-width: 0;
}

.how-to-section h2 {
    margin-bottom: var(--space-lg);
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1.12;
}

.how-to-section > p,
.how-to-section > ol,
.how-to-section > ul {
    margin-bottom: var(--space-lg);
    color: var(--text-secondary);
    font-size: 17px;
}

.how-to-section ol,
.how-to-section ul {
    display: grid;
    gap: var(--space-md);
    padding-left: 1.35em;
}

.visibility-grid {
    display: grid;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.visibility-card {
    padding: var(--space-lg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 78%, transparent);
}

.visibility-card strong {
    color: var(--accent-ink);
    font-family: var(--font-display);
    font-size: 19px;
}

.visibility-card p {
    margin-top: var(--space-xs);
    color: var(--text-secondary);
}

.guide-callout {
    margin-top: var(--space-xl);
    padding: var(--space-lg);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.guide-callout--success {
    border-left-color: var(--success);
    background: var(--success-bg);
}

.guide-callout--warning {
    border-left-color: var(--warning);
    background: color-mix(in srgb, var(--warning) 10%, transparent);
}

.guide-callout p {
    margin-top: var(--space-xs);
    color: var(--text-secondary);
}

.how-to-troubleshooting {
    padding: clamp(28px, 5vw, 48px);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.how-to-troubleshooting details {
    padding: var(--space-md) 0;
    border-top: 1px solid var(--border-color);
}

.how-to-troubleshooting summary {
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 700;
}

.how-to-troubleshooting details p {
    padding-top: var(--space-sm);
    color: var(--text-secondary);
}

@media (min-width: 720px) {
    .about-story { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .marketing-values {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .visibility-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .marketing-cta-panel__inner {
        grid-template-columns: minmax(0, 1.4fr) auto;
    }
}

@media (min-width: 900px) {
    .marketing-hero,
    .about-hero,
    .marketing-feature,
    .marketing-community {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .marketing-feature--reverse .marketing-feature__copy {
        order: 2;
    }

    .marketing-feature--reverse .marketing-feature__visual {
        order: 1;
    }

    .marketing-values {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .how-to-layout {
        grid-template-columns: 250px minmax(0, 820px);
        justify-content: center;
    }

    .how-to-contents nav {
        position: sticky;
        top: 96px;
    }
}

@media (min-width: 1100px) {
    .about-story { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 719px) {
    .about-hero__illustration { min-height: 300px; width: 100%; }
    .about-hero__copy .marketing-actions { width: min(100%, 380px); }

    .marketing-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .marketing-actions .btn {
        justify-content: center;
        width: 100%;
    }

    .marketing-hero h1,
    .about-hero h1,
    .how-to-hero h1 {
        overflow-wrap: anywhere;
    }

    .home-recipe-visual {
        min-height: 420px;
    }

    .home-recipe-visual__card {
        width: 86%;
        min-height: 360px;
    }

    .home-recipe-visual__card--front {
        left: 4%;
        padding: 28px;
    }

    .home-recipe-visual__bowl {
        right: -25px;
        width: 135px;
        height: 72px;
    }

    .footer-bottom {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .home-recipe-visual__card,
    .marketing-community__scale-card,
    .about-hero__book,
    .about-story__card {
        transform: none;
    }
}

@media (forced-colors: active) {
    .marketing-value-card,
    .marketing-feature__visual,
    .marketing-community__scale-card,
    .marketing-cta-panel__inner,
    .about-story__visual,
    .how-to-contents nav,
    .visibility-card,
    .how-to-troubleshooting {
        border: 1px solid CanvasText;
    }
}

/* ============================================================
   Search
   ============================================================ */
.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;
}

.landing-search {
    display: flex;
    width: min(100%, 620px);
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
}

.landing-search input,
.search-page input,
.search-page select {
    min-width: 0;
    border-radius: var(--radius-md);
    padding: 11px 13px;
    color: var(--text-primary);
    font: inherit;
}

.landing-search input {
    flex: 1;
    font-size: 16px;
}

.search-page select,
.search-page input[type="date"] {
    border: 1px solid color-mix(in srgb, var(--text-tertiary) 45%, transparent);
    background: color-mix(in srgb, var(--surface) 82%, white);
}

.search-page {
    max-width: var(--content-max-width);
    padding-block: var(--space-xl) var(--space-2xl);
}

.search-hero {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.search-hero h1 { font-size: clamp(32px, 5vw, 52px); }
.search-eyebrow { color: var(--accent-ink); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 12px; }
.search-subtitle { color: var(--text-secondary); max-width: 620px; }

.search-workspace { display: grid; gap: var(--space-lg); }
.search-box { position: relative; z-index: 4; }
.search-input-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 8px;
    border-radius: var(--radius-lg);
    background: var(--neumo-surface);
    box-shadow: var(--elevation-inset);
}
.search-input-row:focus-within { background: color-mix(in srgb, var(--neumo-surface) 88%, var(--accent) 12%); }
.search-icon { padding-left: 10px; color: var(--accent-ink); font-size: 28px; line-height: 1; }
.search-query-input { flex: 1; border: 0; background: transparent !important; box-shadow: none !important; font-size: 18px !important; }
.search-query-input:focus-visible { background: transparent !important; }
.search-submit { min-width: 104px; }

.search-suggestions {
    position: absolute;
    inset: calc(100% + 8px) 0 auto;
    list-style: none;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: 0 18px 45px rgba(45, 42, 38, .22);
}
.search-suggestion { display: flex; gap: 12px; align-items: center; padding: 12px 16px; cursor: pointer; }
.search-suggestion + .search-suggestion { border-top: 1px solid color-mix(in srgb, var(--text-tertiary) 22%, transparent); }
.search-suggestion:hover, .search-suggestion.is-active { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.suggestion-kind { font-size: 20px; }
.suggestion-copy { display: grid; }
.suggestion-copy small { color: var(--text-secondary); }

.search-scope-tabs { display: flex; gap: var(--space-xs); overflow-x: auto; border-bottom: 1px solid color-mix(in srgb, var(--text-tertiary) 30%, transparent); }
.search-scope-tab { border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-weight: 800; padding: 10px 18px; cursor: pointer; border-bottom: 3px solid transparent; }
.search-scope-tab.is-active { color: var(--accent-ink); border-bottom-color: var(--accent); }

.search-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
}
.search-control { display: grid; gap: 5px; min-width: 150px; color: var(--text-secondary); font-size: 13px; font-weight: 700; }
.search-control-wide { flex: 1; min-width: 210px; }
.search-sort-control { margin-left: auto; }
.active-filter-row { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-chip, .facet-list span { padding: 5px 10px; border-radius: var(--radius-full); background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent-ink); font-size: 13px; font-weight: 700; }
.clear-filters { border: 0; background: transparent; color: var(--accent-ink); text-decoration: underline; cursor: pointer; }

.advanced-search { border: 1px solid color-mix(in srgb, var(--text-tertiary) 28%, transparent); border-radius: var(--radius-lg); background: var(--surface); }
.advanced-search summary { padding: 14px 18px; cursor: pointer; color: var(--accent-ink); font-weight: 800; }
.advanced-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); padding: 0 var(--space-lg) var(--space-lg); }
.advanced-help, .advanced-actions { grid-column: 1 / -1; }
.advanced-field { display: grid; grid-template-columns: 1.4fr .8fr 1fr; gap: 8px; border: 0; }
.advanced-field legend, .advanced-simple-field span { color: var(--text-secondary); font-size: 13px; font-weight: 800; margin-bottom: 5px; }
.advanced-simple-field { display: grid; }
.advanced-date-field { grid-template-columns: 1fr 1fr; }
.advanced-date-field label { display: grid; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.advanced-actions { display: flex; gap: var(--space-sm); }

.search-results { min-height: 180px; }
.search-loading { display: flex; justify-content: center; align-items: center; gap: 12px; padding: var(--space-2xl); color: var(--text-secondary); }
.results-heading { display: flex; justify-content: space-between; align-items: baseline; margin: var(--space-md) 0; }
.results-heading span { color: var(--text-secondary); }
.grouped-section + .grouped-section { margin-top: var(--space-xl); }
.search-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-md); }
.entity-result-card { display: flex; gap: 14px; min-height: 130px; padding: var(--space-lg); border-radius: var(--radius-lg); background: var(--neumo-surface); color: var(--text-primary); box-shadow: var(--elevation-raised); }
.entity-result-card:hover { color: var(--text-primary); transform: translateY(-2px); box-shadow: var(--elevation-raised-hover); }
.entity-result-card h3 { color: var(--accent-ink); }
.entity-result-card p { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.entity-icon { font-size: 26px; }
.entity-path, .entity-result-card small { color: var(--text-secondary); font-size: 13px; }
.facet-summary { display: grid; gap: 10px; margin-bottom: var(--space-lg); padding: var(--space-md); border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.facet-summary h2 { font-size: 18px; }
.facet-summary h3 { font-size: 13px; color: var(--text-secondary); }
.facet-list { display: flex; flex-wrap: wrap; gap: 6px; }
.search-pagination { display: flex; justify-content: center; align-items: center; gap: var(--space-md); margin-top: var(--space-xl); }
.search-state-card { padding: var(--space-xl); border-radius: var(--radius-lg); background: var(--surface); text-align: center; }
.search-state-error { border: 1px solid color-mix(in srgb, var(--error) 45%, transparent); }

@media (max-width: 700px) {
    .landing-search, .search-input-row { align-items: stretch; }
    .landing-search { flex-direction: column; }
    .search-submit { min-width: auto; }
    .advanced-form { grid-template-columns: 1fr; }
    .advanced-field { grid-template-columns: 1fr; }
    .search-control, .search-control-wide, .search-sort-control { flex: 1 1 100%; margin-left: 0; }
    .search-hero { align-items: start; }
}

/* T2 nonmodal feedback: local warm glass, never a page-wide backdrop. */
.feedback-surface {
    background: var(--overlay-opaque);
    color: var(--text-primary);
    border: 1px solid var(--overlay-border);
    box-shadow: var(--overlay-shadow);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.feedback-trigger { display: inline-flex; }
.feedback-tooltip {
    position: fixed;
    inset: auto;
    margin: 0;
    z-index: 1100;
    max-width: min(20rem, calc(100vw - 16px));
    padding: 8px 14px;
    border-radius: 18px;
}
.feedback-tooltip[hidden] { display: none; }
.feedback-host {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    max-width: min(28rem, calc(100vw - 32px));
    z-index: 1000;
    pointer-events: none;
}
.feedback-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 24px;
    padding: 12px 14px;
    pointer-events: auto;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
}
.feedback-toast--empty { pointer-events: none; }
.feedback-toast__message { min-width: 0; flex: 1; }
.feedback-toast__icon {
    flex: 0 0 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--bg-base);
    color: var(--text-primary);
    border: 1px solid var(--success);
    font-weight: 800;
}
.feedback-toast__icon--error { border-color: var(--error); }
.feedback-toast__close { min-width: 44px; min-height: 44px; padding: 4px; flex-shrink: 0; }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .feedback-surface {
        background: var(--overlay-fill);
        backdrop-filter: var(--overlay-blur);
        -webkit-backdrop-filter: var(--overlay-blur);
    }
}

/* Shared accessibility fallbacks follow component rules in the cascade. */
.account-menu-panel {
    position: fixed;
    inset: auto;
    margin: 0;
    width: min(280px, calc(100vw - 16px));
    padding: 10px;
    border-radius: 22px;
    z-index: 1100;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.account-menu-panel[hidden] { display: none; }
.action-menu-panel { width: min(256px, calc(100vw - 16px)); }
.account-menu-item:disabled { color: var(--overlay-muted); cursor: not-allowed; }
.account-menu-identity { display: flex; align-items: center; gap: 12px; padding: 12px 10px; }
.account-menu-identity-text { min-width: 0; display: grid; gap: 2px; }
.account-menu-identity-text strong { font-size: 16px; }
.account-menu-identity-text span { color: var(--overlay-muted); }
.account-menu-divider { height: 1px; background: var(--overlay-border); margin: 6px 10px; }
.account-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 16px;
    background: transparent;
    color: var(--text-primary);
    text-decoration: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.account-menu-item svg { flex-shrink: 0; }
.account-menu-item:hover, .account-menu-item:focus-visible { background: var(--surface); color: var(--text-primary); }
.account-menu-item:focus-visible, .navbar-user-dropdown:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.action-menu-item--danger, .action-menu-item--danger:hover, .action-menu-item--danger:focus-visible { color: var(--error-ink); }

@media (prefers-reduced-transparency: reduce) {
    .modal-card:not(.modal-card--editor), .feedback-surface {
        background: var(--overlay-opaque);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .bg-gradient-animated,
    .spinner,
    .modal-overlay,
    .modal-card:not(.modal-card--editor) {
        animation: none;
    }

    .btn,
    .navbar-user-dropdown,
    .input,
    a {
        transition: none;
    }
}

@media (forced-colors: active) {
    .btn-secondary::before, .btn-secondary::after { display: none; }

    .modal-card:not(.modal-card--editor), .feedback-surface {
        --text-primary: CanvasText;
        --text-secondary: CanvasText;
        --text-tertiary: CanvasText;
        background: Canvas;
        color: CanvasText;
        border: 1px solid CanvasText;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .btn,
    .input,
    .landing-search input,
    .search-page input,
    .neumo-raised,
    .neumo-inset,
    .neumo-card,
    .recipe-scaler,
    .recipe-scaler__input,
    .recipe-scaler__select,
    .recipe-scaler__preset,
    .search-input-row,
    .entity-result-card {
        border: 1px solid CanvasText;
        box-shadow: none;
    }

    .btn:focus-visible,
    .input:focus-visible,
    .landing-search input:focus-visible,
    .search-page input:focus-visible,
    .navigation-search input:focus-visible {
        outline: 2px solid Highlight !important;
    }

    .input::placeholder {
        color: GrayText;
    }
}
/* Hidden retained editors must also hide descendants promoted to the top layer. */
#session-retained-page[hidden] dialog,
#session-retained-page[hidden] [popover] {
    display: none !important;
}
