:root {
    --color-bg: #ffffff;
    --color-surface: #ffffff;
    --color-surface-alt: #f3f4ff;      /* tinted surface for highlighted / "featured" cards */
    --color-text: #1a1a1a;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-primary-tint: #eef0ff;      /* subtle wash of primary — banners, section strips */
    --color-accent: #7c3aed;
    --color-warning: #d97706;           /* amber alerts, "attention" banners */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    --font-serif: 'Georgia', 'Times New Roman', serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }
code { background: #f4f5f9; padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 760px; }
.muted { color: var(--color-muted); }

/* ---------- Header ---------- */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0; z-index: 10;
    backdrop-filter: saturate(180%) blur(8px);
    background: rgba(255, 255, 255, 0.9);
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px;
}
.site-brand {
    display: flex; align-items: center; gap: 10px;
    font-size: 18px; font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}
.site-brand:hover { text-decoration: none; }
.brand-mark {
    width: 28px; height: 28px; border-radius: 7px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
}
/* ---------- Menu system (shared: main + footer + sidebar) ---------- */
.site-nav, .footer-nav { position: relative; }
.menu-list { list-style: none; margin: 0; padding: 0; }

.menu-root {
    display: flex; gap: 4px;
    align-items: center;
}
.menu-item { position: relative; }

/*
 * Base menu item styling. IMPORTANT: the link and label live INSIDE a
 * `.menu-item-row` wrapper (added during the refactor), so selectors must
 * traverse through that wrapper rather than being direct children of the
 * `<li>`. An earlier version of this CSS used `.menu-item > a` which
 * doesn't match the refactored markup — that's why hover states and
 * submenu text color appeared "broken" until now.
 */
.menu-item > .menu-item-row > a,
.menu-item > .menu-item-row > .menu-label {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 6px;
    color: var(--color-muted);
    font-size: 14px; font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.menu-item > .menu-item-row > a:hover,
.menu-item > .menu-item-row > .menu-label:hover,
.menu-item:hover > .menu-item-row > a,
.menu-item:hover > .menu-item-row > .menu-label {
    color: var(--color-primary);
    background: var(--color-primary-tint);
    text-decoration: none;
}
.menu-caret { font-size: 10px; margin-left: 2px; opacity: 0.6; }

/* Menu item row. On the top-level horizontal menu it acts as a compact
   inline flex container. Inside submenus it becomes block-level so the
   inner <a> can expand to full row width (fixes the hover background
   only appearing behind the text). */
.menu-item-row { display: flex; align-items: center; }
.menu-sub .menu-item-row { display: block; }

/* First-level dropdown (depth 0 children) */
.menu-root > .menu-item.has-children > .menu-sub {
    position: absolute;
    top: 100%; left: 0;
    min-width: 220px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.10);
    padding: 6px;
    margin-top: 6px;
    display: none;
    z-index: 100;
}

/*
 * Hover bridge — invisible rectangle that extends the parent item's hover
 * zone DOWN over the visual gap between the parent row and the submenu.
 * Without it, moving the mouse from the parent label into the submenu
 * crosses the 6px margin-top gap where neither element is hovered, the
 * parent's :hover state ends, and the submenu vanishes before the mouse
 * reaches it. The ::after pseudo-element is part of its generating element
 * for :hover purposes, so hovering anywhere on it keeps the parent hovered.
 */
.menu-root > .menu-item.has-children::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;            /* covers the 6px margin + a few pixels of slack */
    display: none;           /* only activate when hover is supported AND the user is hovering */
    background: transparent;
    z-index: 99;
}
@media (hover: hover) and (pointer: fine) {
    .menu-root > .menu-item.has-children:hover::after { display: block; }
}

/* Deeper submenus (depth 1+) — flyout to the right */
.menu-sub .menu-sub {
    position: absolute;
    top: -6px; left: 100%;
    min-width: 220px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.10);
    padding: 6px;
    margin-left: 6px;
    display: none;
    z-index: 101;
}

/* Same hover bridge on the LEFT edge for deeper flyouts — the 6px
   margin-left gap would otherwise drop the hover state when the mouse
   moves sideways from the parent item into the nested submenu. */
.menu-sub > .menu-item.has-children::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 100%;
    width: 10px;
    display: none;
    background: transparent;
    z-index: 100;
}
@media (hover: hover) and (pointer: fine) {
    .menu-sub > .menu-item.has-children:hover::after { display: block; }
}

/* JS-controlled open state — works on every device, triggered by the
   .menu-submenu-toggle button. This is the universal fallback: even if
   the hover rules below never fire (touchscreen, no mouse) the user can
   always tap the chevron to expand. */
.menu-root > .menu-item.has-children.submenu-open > .menu-sub,
.menu-sub > .menu-item.has-children.submenu-open > .menu-sub {
    display: block;
}
.menu-sub > .menu-item.has-children.submenu-open > .menu-sub .menu-caret {
    transform: rotate(180deg);
}

/* Desktop hover-to-open — ONLY on devices that actually have a hover-capable
   pointer (real mouse / stylus). Touchscreens report `(hover: none)` and
   won't match this query, so mobile users exclusively use the JS toggle
   above. Without this `(hover: hover)` guard, some mobile browsers fire a
   phantom `:hover` on tap that leaves the submenu stuck open. */
@media (hover: hover) and (pointer: fine) {
    .menu-root > .menu-item.has-children:hover > .menu-sub,
    .menu-root > .menu-item.has-children:focus-within > .menu-sub,
    .menu-sub > .menu-item.has-children:hover > .menu-sub,
    .menu-sub > .menu-item.has-children:focus-within > .menu-sub {
        display: block;
    }
}

/* Submenu items render vertically */
.menu-sub { display: none; }
.menu-sub .menu-item { display: block; }

/*
 * Submenu items. These override the base rules above with selectors that
 * correctly traverse through `.menu-item-row` so they actually match the
 * refactored markup. Each link/label is forced to `display: block` +
 * `width: 100%` so the hover background spans the full row of the
 * dropdown — the most-requested visual fix after the refactor.
 */
.menu-sub .menu-item > .menu-item-row > a,
.menu-sub .menu-item > .menu-item-row > .menu-label {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    color: var(--color-text);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.menu-sub .menu-item > .menu-item-row > a:hover,
.menu-sub .menu-item > .menu-item-row > .menu-label:hover {
    background: var(--color-primary-tint);
    color: var(--color-primary);
    text-decoration: none;
}

/* Separator */
.menu-separator {
    height: 1px;
    background: var(--color-border);
    margin: 6px 4px;
}
.menu-root > .menu-separator {
    /* In a horizontal menu the separator becomes a vertical divider */
    height: 20px; width: 1px;
    background: var(--color-border);
    margin: 0 6px;
}

.site-nav a:hover { color: var(--color-text); text-decoration: none; }

/* ---------- Main ---------- */
main { min-height: calc(100vh - 180px); }

/* ---------- Page ---------- */
.page, .blog-post { padding: 48px 0 80px; }
.page-header, .post-header { margin-bottom: 32px; }
.page-header h1, .post-header h1 {
    font-size: 42px; line-height: 1.15; margin: 0 0 16px;
    font-weight: 800; letter-spacing: -0.02em;
}
.page-lead, .post-lead {
    font-size: 19px; color: var(--color-muted);
    margin: 0 0 12px;
}
.post-meta {
    display: flex; justify-content: space-between;
    font-size: 13px; color: var(--color-muted);
    margin-bottom: 24px;
}
.post-byline { color: var(--color-muted); font-size: 14px; margin: 8px 0 0; }

.page-featured, .post-featured {
    margin: 0 0 32px; border-radius: 10px; overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}
.page-featured img, .post-featured img { display: block; width: 100%; }

.page-body, .post-body {
    font-size: 17px; line-height: 1.75;
    color: #374151;
}
.page-body h2, .post-body h2 {
    font-size: 28px; margin: 40px 0 16px;
    font-weight: 700; letter-spacing: -0.01em;
}
.page-body h3, .post-body h3 {
    font-size: 22px; margin: 32px 0 12px; font-weight: 700;
}
.page-body p, .post-body p { margin: 0 0 18px; }
.page-body ul, .post-body ul,
.page-body ol, .post-body ol { margin: 0 0 18px; padding-left: 24px; }
.page-body a, .post-body a { text-decoration: underline; }
.page-body blockquote, .post-body blockquote {
    border-left: 4px solid var(--color-primary);
    margin: 24px 0; padding: 8px 20px;
    color: var(--color-muted); font-style: italic;
}
.page-body pre, .post-body pre {
    background: #0f172a; color: #e2e8f0;
    padding: 16px 20px; border-radius: 8px;
    overflow-x: auto; font-size: 14px;
}
.page-body code, .post-body code {
    background: #f4f5f9; color: #334155;
    padding: 2px 6px; border-radius: 4px; font-size: 0.9em;
}
.page-body pre code, .post-body pre code { background: none; color: inherit; padding: 0; }

.post-tags { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--color-border); }
.tag {
    display: inline-block; margin-right: 8px;
    font-size: 13px; color: var(--color-primary); font-weight: 500;
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 32px 0; margin-top: 80px;
    color: var(--color-muted); font-size: 13px;
    background: #fafafa;
}
.site-footer strong { color: var(--color-text); }
.footer-nav .menu-root { flex-wrap: wrap; gap: 4px; }
.footer-nav .menu-item > a,
.footer-nav .menu-item > .menu-label { font-size: 13px; padding: 4px 10px; }

/* ---------- Not found ---------- */
.not-found {
    min-height: 70vh;
    display: flex; align-items: center; justify-content: center;
    text-align: center; padding: 60px 20px;
}
.not-found h1 {
    font-size: 96px; margin: 0 0 8px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 800;
}
.not-found p { font-size: 17px; color: var(--color-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .page-header h1, .post-header h1 { font-size: 30px; }
    .page, .blog-post { padding: 32px 0 60px; }
}

/* ============================================================
   Page blocks — framework only.
   Per-block CSS now lives in BlockDefinition.TemplateStyles and is
   emitted by Views/Shared/_Blocks.cshtml. See SeedAdminData.BuiltinTemplates.
   ============================================================ */
.page-blocks > .block + .block { margin-top: 4px; }
.block { padding: 56px 0; }
.block > .container { max-width: 1120px; }
.prose { line-height: 1.7; }
.prose p { margin: 0 0 16px; }
.prose h2 { font-size: 28px; margin-top: 32px; }
.prose h3 { font-size: 22px; margin-top: 24px; }
.prose ul, .prose ol { padding-left: 24px; }

/* Unknown block safety net (shown in dev when a block type can't be resolved) */
.block-unknown .unknown-block {
    padding: 14px 18px;
    border: 1px dashed #dc2626;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 8px;
    font-size: 13px;
}
.block-unknown .small-muted { color: #b91c1c; opacity: 0.85; }

@media (max-width: 768px) {
    .block { padding: 40px 0; }
}

/* ---------- Header layouts + mobile menu ----------
   The layout is driven entirely by classes on <body>: header-{variant}
   and mobile-{mode}. Keeps the Razor layout file simple and puts every
   responsive decision in one place. Breakpoint is fixed at 768px
   (tablet portrait), matching Bootstrap's md breakpoint. */

.header-brand {
    display: flex; align-items: center; gap: 10px;
    font-size: 18px; font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}
.header-brand:hover { text-decoration: none; }
.site-logo { max-height: 40px; width: auto; display: block; }
.brand-name { font-weight: 700; }

.header-nav { display: flex; align-items: center; }

.header-cta.btn-cta {
    display: inline-block;
    padding: 10px 20px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s;
}
.header-cta.btn-cta:hover { background: var(--color-primary-hover, #4338ca); text-decoration: none; }

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--color-border, #e4e7ed);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    color: var(--color-text, #1f2937);
    line-height: 1;
}
.mobile-menu-toggle:hover { background: #f4f5f9; }
/* Unicode ☰ glyph — sized so it's recognisable without FontAwesome. */
.hamburger-glyph {
    font-size: 24px;
    line-height: 1;
    display: inline-block;
    color: inherit;
}

/* ---------- Layout 1: logo-left-menu-right (default) ---------- */
.header-logo-left-menu-right .header-inner {
    display: flex; align-items: center; justify-content: space-between;
}
.header-logo-left-menu-right .header-nav { margin-left: auto; }

/* ---------- Layout 2: logo-center-menu-below ---------- */
.header-logo-center-menu-below .header-inner {
    display: flex; flex-direction: column; gap: 10px; align-items: center;
    padding-top: 16px; padding-bottom: 8px;
}
.header-logo-center-menu-below .header-brand { justify-content: center; }
.header-logo-center-menu-below .header-nav { justify-content: center; }

/* ---------- Layout 3: logo-left-menu-center-cta-right ---------- */
.header-logo-left-menu-center-cta-right .header-inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
}
.header-logo-left-menu-center-cta-right .header-nav { justify-content: center; }

/* ---------- Layout 4: compact-inline ---------- */
.header-compact-inline .header-inner { padding: 10px 24px; }
.header-compact-inline .site-logo { max-height: 28px; }
.header-compact-inline .header-brand { font-size: 15px; gap: 6px; }
.header-compact-inline .header-nav { margin-left: 16px; }

/* ---------- Mobile menu backdrop (real div, z-index controlled) ----------

   STACKING CONTEXT NOTE: .site-header is `position: sticky; z-index: 10`
   which creates a new stacking context. Every positioned descendant of
   the header — including .header-nav when it's the open drawer — is
   trapped inside that 10-level context, so no matter how high we set
   the drawer's own z-index, it can never paint above anything with a
   global z-index > 10.

   Fix: when the mobile menu is open, we temporarily lift the whole
   header's stacking context above the backdrop (z-index 1001 > 998).
   The drawer inside still gets its own z-index 1000 which is now
   effectively "above 1001" within the correct context. */
.mobile-menu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 998;
}
.mobile-menu-open .mobile-menu-backdrop { display: block; }
.mobile-menu-open .site-header { z-index: 1001; }
.mobile-dropdown.mobile-menu-open .mobile-menu-backdrop { display: none; } /* dropdown has no overlay */

/* ---------- Mobile breakpoint ---------- */
@media (max-width: 767.98px) {
    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        /* Sit above the backdrop + drawer so the user can always close
           the menu by tapping the hamburger again, from any mode. */
        position: relative;
        z-index: 1002;
    }

    /* On mobile every header layout collapses to "brand left, hamburger right".
       The mode-specific rules below position the menu itself. */
    .site-header .header-inner {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px;
        padding: 14px 18px;
    }
    .site-header .header-brand { margin: 0; }
    .header-cta { display: none; }
    .header-nav { display: none; }

    /* --- Base "menu open" state — applies regardless of mode ---
       Uses drawer positioning as the fallback so that even if the body
       doesn't have any mobile-{mode} class (e.g. Settings failed to
       resolve), clicking the hamburger still shows the menu. Mode-
       specific rules below override as needed.

       height: 100vh + top:0 + bottom:0 force a full-viewport panel even
       when the inner menu is empty — previously an empty Main menu made
       the drawer only ~88px tall (just padding) and it looked broken. */
    .mobile-menu-open .header-nav {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: var(--color-surface, #fff);
        box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        padding: 64px 20px 24px;
        overflow-y: auto;
    }
    .mobile-menu-open .header-nav .site-nav { width: 100%; min-height: 60vh; }

    /* --- Mode: fullscreen — menu covers the whole viewport --- */
    .mobile-fullscreen.mobile-menu-open .header-nav {
        display: flex;
        inset: 0;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: none;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 64px 20px 24px;
        box-shadow: none;
    }

    /* --- Mode: dropdown — menu stacks directly under the header, no overlay --- */
    .mobile-dropdown .site-header { position: relative; }
    .mobile-dropdown.mobile-menu-open .header-nav {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        bottom: auto;
        width: auto;
        max-width: none;
        background: var(--color-surface, #fff);
        border-top: 1px solid var(--color-border, #e4e7ed);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
        padding: 12px 16px;
        z-index: 500;
    }

    /* In mobile, stack menu items vertically regardless of mode. The inner
       .site-nav wraps the .menu-root list; we flex the list itself. */
    .mobile-menu-open .header-nav .site-nav { width: 100%; }
    .mobile-menu-open .menu-root {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        width: 100%;
    }
    .mobile-menu-open .menu-item { width: 100%; }
    .mobile-menu-open .menu-item > a,
    .mobile-menu-open .menu-item > .menu-label {
        padding: 12px 14px;
        border-radius: 6px;
        width: 100%;
        justify-content: flex-start;
    }

    /* Empty-menu fallback: when there are no menu items, the Menu component
       renders nothing at all, so the drawer would be empty. Show a hint. */
    .mobile-menu-open .header-nav:empty::before {
        content: "No menu items yet. Add some under Menus → Main.";
        display: block;
        color: var(--color-muted, #6b7280);
        font-size: 14px;
        line-height: 1.4;
    }

    /* Prevent horizontal scrollbars when the drawer slides in. */
    body.mobile-menu-open { overflow: hidden; }

    /* ----- Mobile submenu: inline accordion inside the drawer -----
       Override the desktop absolute-positioned flyout rules so a tapped
       parent expands its submenu IN PLACE underneath, indented with a
       thin left border as a visual separator. No background color
       change — the indent + border is the only cue that you're inside
       a nested group, which keeps the drawer visually calm. */
    .mobile-menu-open .menu-root > .menu-item.has-children > .menu-sub,
    .mobile-menu-open .menu-sub .menu-sub {
        position: static !important;
        top: auto !important;
        left: auto !important;
        min-width: 0 !important;
        margin: 4px 0 4px 10px !important;   /* small top/bottom breath + indent offset */
        padding: 2px 0 2px 14px !important;  /* left padding = indent for child labels */
        border: none !important;
        border-left: 2px solid var(--color-border, #e4e7ed) !important; /* the separator */
        box-shadow: none !important;
        background: transparent !important;
    }

    /* Explicitly kill the old "change bg on open" hack — no matter what
       state the row is in, the background stays the drawer's color. */
    .mobile-menu-open .menu-item.has-children.submenu-open { background: transparent; }

    /* Give parent rows comfortable tap targets without affecting the
       overall cramped desktop density. */
    .mobile-menu-open .menu-item-row > a,
    .mobile-menu-open .menu-item-row > .menu-label {
        flex: 1;
        padding: 12px 14px;
        font-size: 15px;
    }

    /* Horizontal hairline BETWEEN top-level menu items — gives the drawer
       a clean "list of sections" feel without shouting. */
    .mobile-menu-open .menu-root > .menu-item + .menu-item {
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }
}

/* ---------- Empty-state hint for menus ----------
   Rendered by Views/Shared/Components/Menu/Default.cshtml when the Main
   (or Footer) menu has zero items. Invisible by default so an empty
   header doesn't scream at desktop visitors — only shows inside the
   mobile drawer where the author needs to know the drawer is empty
   by design, not by bug. */
.menu-empty-hint { display: none; }
.menu-empty-hint strong {
    display: block;
    font-size: 16px;
    color: var(--color-text, #1f2937);
    margin-bottom: 6px;
}
.menu-empty-hint p {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--color-muted, #6b7280);
}
.menu-empty-hint em {
    background: #f4f5f9;
    padding: 1px 6px;
    border-radius: 4px;
    font-style: normal;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (max-width: 767.98px) {
    /* Show the empty-state hint only inside the opened mobile drawer. */
    .mobile-menu-open .header-nav .menu-empty-hint { display: block; }
}

/* ============================================================
   MENU THEMES — visual skins selectable from Settings → Header & menu
   Applied via `body.menu-theme-{name}` class from _Layout.cshtml.
   Each theme overrides typography, spacing, padding, and hover
   treatment on the main nav menu items. All themes share the
   same HTML structure so switching is purely cosmetic.
   ============================================================ */

/* Shared baseline the themes build on top of. Desktop-only; mobile
   drawer has its own padding/size scale inside the media query. */
.menu-root .menu-item > a,
.menu-root .menu-item > .menu-item-row > a,
.menu-root .menu-item > .menu-label,
.menu-root .menu-item > .menu-item-row > .menu-label {
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}

/* ---------- Theme: default (the current look) ---------- */
.menu-theme-default .menu-root .menu-item > .menu-item-row > a,
.menu-theme-default .menu-root .menu-item > .menu-item-row > .menu-label {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-muted);
}
.menu-theme-default .menu-root .menu-item > .menu-item-row > a:hover,
.menu-theme-default .menu-root .menu-item > .menu-item-row > .menu-label:hover {
    background: var(--color-primary-tint);
    color: var(--color-primary);
}

/* ---------- Theme: minimal ----------
   No background, no bold, thin underline on hover. Tight spacing. */
.menu-theme-minimal .menu-root { gap: 20px; }
.menu-theme-minimal .menu-root .menu-item > .menu-item-row > a,
.menu-theme-minimal .menu-root .menu-item > .menu-item-row > .menu-label {
    padding: 6px 0;
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text);
    border-radius: 0;
    border-bottom: 1px solid transparent;
}
.menu-theme-minimal .menu-root .menu-item > .menu-item-row > a:hover,
.menu-theme-minimal .menu-root .menu-item > .menu-item-row > .menu-label:hover {
    background: transparent;
    border-bottom-color: var(--color-text);
}

/* ---------- Theme: pills ----------
   Rounded background pill on hover + active state. Chunkier. */
.menu-theme-pills .menu-root { gap: 6px; }
.menu-theme-pills .menu-root .menu-item > .menu-item-row > a,
.menu-theme-pills .menu-root .menu-item > .menu-item-row > .menu-label {
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-muted);
    background: transparent;
}
.menu-theme-pills .menu-root .menu-item > .menu-item-row > a:hover,
.menu-theme-pills .menu-root .menu-item > .menu-item-row > .menu-label:hover {
    background: var(--color-primary);
    color: #fff;
}

/* ---------- Theme: bold ----------
   Uppercase, bold, letter-spaced, larger font. Editorial feel. */
.menu-theme-bold .menu-root { gap: 4px; }
.menu-theme-bold .menu-root .menu-item > .menu-item-row > a,
.menu-theme-bold .menu-root .menu-item > .menu-item-row > .menu-label {
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text);
}
.menu-theme-bold .menu-root .menu-item > .menu-item-row > a:hover,
.menu-theme-bold .menu-root .menu-item > .menu-item-row > .menu-label:hover {
    background: var(--color-primary-tint);
    color: var(--color-primary);
}

/* ---------- Theme: underlined ----------
   Clean label with an animated underline that slides in from left. */
.menu-theme-underlined .menu-root { gap: 22px; }
.menu-theme-underlined .menu-root .menu-item > .menu-item-row > a,
.menu-theme-underlined .menu-root .menu-item > .menu-item-row > .menu-label {
    padding: 6px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    background: transparent;
    border-radius: 0;
    position: relative;
}
.menu-theme-underlined .menu-root .menu-item > .menu-item-row > a::after,
.menu-theme-underlined .menu-root .menu-item > .menu-item-row > .menu-label::after {
    content: "";
    position: absolute;
    left: 0;
    right: 100%;
    bottom: 0;
    height: 2px;
    background: var(--color-primary);
    transition: right 0.25s ease;
}
.menu-theme-underlined .menu-root .menu-item > .menu-item-row > a:hover,
.menu-theme-underlined .menu-root .menu-item > .menu-item-row > .menu-label:hover {
    background: transparent;
    color: var(--color-primary);
}
.menu-theme-underlined .menu-root .menu-item > .menu-item-row > a:hover::after,
.menu-theme-underlined .menu-root .menu-item > .menu-item-row > .menu-label:hover::after {
    right: 0;
}

/* Mobile theme overrides — at mobile width, each menu theme gets a
   simplified rendering so the drawer stays readable. Most themes
   collapse to the default vertical list; "pills" keeps its pill shape
   at a smaller scale. */
@media (max-width: 767.98px) {
    .mobile-menu-open .menu-item > .menu-item-row > a,
    .mobile-menu-open .menu-item > .menu-item-row > .menu-label {
        /* Reset any absolute-positioning tricks that would break the drawer. */
        position: static;
    }
    .menu-theme-underlined.mobile-menu-open .menu-root .menu-item > .menu-item-row > a::after,
    .menu-theme-underlined.mobile-menu-open .menu-root .menu-item > .menu-item-row > .menu-label::after {
        display: none;
    }
    .menu-theme-bold.mobile-menu-open .menu-root .menu-item > .menu-item-row > a,
    .menu-theme-bold.mobile-menu-open .menu-root .menu-item > .menu-item-row > .menu-label {
        text-transform: none; /* stacked uppercase labels are hard to scan */
        letter-spacing: 0;
    }
}

/* ============================================================
   COLOR PALETTES — site-wide CSS variable overrides
   ============================================================
   Each palette is a class on <body>. Because every component in this
   stylesheet references --color-* custom properties, overriding them
   on a parent element retints the whole page with one class change.
   No per-component rule rewrites needed.

   Palettes override these variables:
     --color-bg          page background
     --color-surface     cards, header, footer
     --color-border      dividers
     --color-text        primary text
     --color-muted       secondary text
     --color-primary     brand accent
     --color-primary-hover  darker accent for hover
     --color-accent      second accent (used by brand-mark gradient)
   Everything else (success/warning/danger) stays semantic.

   Light palettes use a near-white bg with a colored primary. The
   "midnight" palette flips bg/text for a dark-mode effect. */

/* ---------- Indigo (default) ----------
   Declared explicitly so selecting "Indigo" in admin overrides any
   cascaded values from a previously-applied palette without requiring
   a full page reload. */
body.palette-indigo {
    --color-bg: #f5f6fa;
    --color-surface: #ffffff;
    --color-surface-alt: #f3f4ff;
    --color-border: #e4e7ed;
    --color-text: #1f2937;
    --color-muted: #6b7280;
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-primary-tint: #eef0ff;
    --color-accent: #8b5cf6;
    --color-warning: #d97706;
}

/* ---------- Ocean (cyan/teal) ---------- */
body.palette-ocean {
    --color-bg: #f0f9ff;
    --color-surface: #ffffff;
    --color-surface-alt: #e0f2fe;
    --color-border: #bae6fd;
    --color-text: #0c4a6e;
    --color-muted: #0369a1;
    --color-primary: #0891b2;
    --color-primary-hover: #0e7490;
    --color-primary-tint: #cffafe;
    --color-accent: #06b6d4;
    --color-warning: #d97706;
}

/* ---------- Forest (emerald) ---------- */
body.palette-forest {
    --color-bg: #f0fdf4;
    --color-surface: #ffffff;
    --color-surface-alt: #dcfce7;
    --color-border: #bbf7d0;
    --color-text: #14532d;
    --color-muted: #166534;
    --color-primary: #059669;
    --color-primary-hover: #047857;
    --color-primary-tint: #d1fae5;
    --color-accent: #10b981;
    --color-warning: #d97706;
}

/* ---------- Sunset (warm orange/red) ---------- */
body.palette-sunset {
    --color-bg: #fff7ed;
    --color-surface: #ffffff;
    --color-surface-alt: #ffedd5;
    --color-border: #fed7aa;
    --color-text: #7c2d12;
    --color-muted: #9a3412;
    --color-primary: #ea580c;
    --color-primary-hover: #c2410c;
    --color-primary-tint: #ffedd5;
    --color-accent: #f59e0b;
    --color-warning: #b45309;
}

/* ---------- Rose ---------- */
body.palette-rose {
    --color-bg: #fff1f2;
    --color-surface: #ffffff;
    --color-surface-alt: #ffe4e6;
    --color-border: #fecdd3;
    --color-text: #881337;
    --color-muted: #9f1239;
    --color-primary: #e11d48;
    --color-primary-hover: #be123c;
    --color-primary-tint: #ffe4e6;
    --color-accent: #f43f5e;
    --color-warning: #d97706;
}

/* ---------- Slate (neutral corporate) ---------- */
body.palette-slate {
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-surface-alt: #f1f5f9;
    --color-border: #e2e8f0;
    --color-text: #0f172a;
    --color-muted: #475569;
    --color-primary: #334155;
    --color-primary-hover: #1e293b;
    --color-primary-tint: #e2e8f0;
    --color-accent: #64748b;
    --color-warning: #d97706;
}

/* ---------- Midnight (dark mode) ----------
   Inverted bg + text. Surface stays slightly lighter than bg so cards
   still stand out. Borders are more transparent so they don't dominate.
   Primary stays bright (indigo) for accent contrast against the dark bg. */
body.palette-midnight {
    --color-bg: #0b0f1a;
    --color-surface: #111827;
    --color-surface-alt: #1e293b;
    --color-border: #1f2937;
    --color-text: #f3f4f6;
    --color-muted: #9ca3af;
    --color-primary: #818cf8;
    --color-primary-hover: #6366f1;
    --color-primary-tint: #312e81;
    --color-accent: #c4b5fd;
    --color-warning: #fbbf24;
    color: var(--color-text);
}
body.palette-midnight .site-header {
    background: rgba(17, 24, 39, 0.85);
    border-bottom-color: var(--color-border);
}
body.palette-midnight .site-footer {
    background: var(--color-surface);
    color: var(--color-muted);
    border-top: 1px solid var(--color-border);
}
body.palette-midnight img { filter: brightness(0.92); }

/* ============================================================
   ADMIN BAR — fixed top bar for logged-in CMS admins
   ============================================================
   Only rendered when User.Identity.IsAuthenticated is true.
   The `has-admin-bar` class on <body> pushes the sticky header
   down so the admin bar doesn't overlap the navigation. */

.admin-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 36px;
    background: #1e1e2e;
    color: #a0a0b8;
    z-index: 9999;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.admin-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 16px;
    max-width: none;
}
.admin-bar-left,
.admin-bar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}
.admin-bar-logo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    margin-right: 12px;
    padding: 4px 10px;
    border-radius: 4px;
}
.admin-bar-logo:hover {
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
    color: #fff;
}
.admin-bar-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #a0a0b8;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 4px;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}
.admin-bar-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
}
.admin-bar-link i { font-size: 13px; }
.admin-bar-user {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #a0a0b8;
    padding: 4px 10px;
    font-weight: 500;
}

/* Push the site header down when the admin bar is present so they
   don't overlap. The header is position:sticky, so we offset its
   top by the bar height. The body gets top padding too, pushing
   the entire page below the bar. */
body.has-admin-bar {
    padding-top: 36px;
}
body.has-admin-bar .site-header {
    top: 36px;
}

/* On mobile, collapse the admin bar to just the logo + edit link.
   Secondary links hide into a dropdown for a future iteration. */
@media (max-width: 767.98px) {
    .admin-bar { font-size: 11px; }
    .admin-bar-link { padding: 4px 6px; }
    /* Hide non-essential links on mobile */
    .admin-bar-left .admin-bar-link:not(:first-child) { display: none; }
    .admin-bar-right .admin-bar-link { display: none; }
}
