/**
 * Shared site header & footer — matches index.html chrome.
 * Pages must define base tokens: --bg, --text, --purple, --surface, --border, --text-secondary, --text-tertiary, --light-accent, --green, --radius-sm (optional).
 */
:root {
    --nav-h: 64px;
    --mid-accent: #AFA9EC;
}

/* ── Navbar ── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

@media (prefers-color-scheme: dark) {
    .navbar {
        background: color-mix(in srgb, #111110 82%, transparent);
        box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    }
}

.navbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(83, 74, 183, 0.22) 35%,
        rgba(29, 158, 117, 0.18) 65%,
        transparent 100%
    );
    pointer-events: none;
    opacity: 0.85;
}

.navbar-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: var(--nav-h);
    padding-top: 6px;
    padding-bottom: 6px;
}

@media (min-width: 769px) {
    .navbar-inner {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        column-gap: clamp(12px, 2.5vw, 28px);
    }

    .nav-brand {
        grid-column: 1;
        justify-self: start;
    }

    .nav-links {
        grid-column: 2;
        justify-self: center;
    }

    .nav-actions {
        grid-column: 3;
        justify-self: end;
    }

    .mobile-toggle {
        display: none !important;
    }
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    flex-shrink: 0;
    min-width: min-content;
    transition: opacity 0.2s ease;
}

.nav-brand:hover {
    opacity: 0.92;
}

.nav-brand-icon-wrap {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: linear-gradient(155deg, var(--light-accent) 0%, var(--surface) 100%);
    border: 1px solid color-mix(in srgb, var(--border) 90%, var(--purple));
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 4px 14px rgba(83, 74, 183, 0.1);
}

@media (prefers-color-scheme: dark) {
    .nav-brand-icon-wrap {
        background: linear-gradient(155deg, rgba(83, 74, 183, 0.2) 0%, rgba(28, 28, 26, 1) 100%);
        border-color: rgba(175, 169, 236, 0.2);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    }
}

.nav-brand-icon-wrap img {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: block;
}

.nav-brand-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    min-width: min-content;
    line-height: 1;
}

.nav-brand-name {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.05;
    white-space: nowrap;
}

.nav-brand-tagline {
    display: block;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--purple);
    opacity: 0.9;
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
    line-height: 1;
    max-width: 100%;
}

@media (prefers-color-scheme: dark) {
    .nav-brand-tagline {
        color: var(--mid-accent);
        opacity: 0.95;
    }
}

@media (max-width: 380px) {
    .navbar .nav-brand-tagline {
        display: none;
    }
}

.nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 4px 5px;
    background: color-mix(in srgb, var(--surface) 92%, var(--bg));
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

@media (prefers-color-scheme: dark) {
    .nav-links {
        background: rgba(255, 255, 255, 0.035);
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow: none;
    }
}

.nav-links li {
    white-space: nowrap;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--purple);
    background: var(--bg);
    box-shadow: 0 1px 3px rgba(83, 74, 183, 0.08);
}

@media (prefers-color-scheme: dark) {
    .nav-links a:hover,
    .nav-links a.active {
        background: rgba(255, 255, 255, 0.06);
        box-shadow: none;
    }
}

@media (min-width: 769px) and (max-width: 1040px) {
    .nav-links a {
        padding: 7px 10px;
        font-size: 12.5px;
    }
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Match index.html .btn: single-line label; do not shrink in the navbar grid */
.nav-actions .btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-actions .btn-primary {
    font-weight: 600;
    font-size: 13px;
    padding: 9px 18px;
    /* Match article / legal page .btn corners; avoid 999px pill reading as a “circle” on blog */
    border-radius: var(--radius-sm, 8px);
    box-shadow: 0 2px 12px rgba(83, 74, 183, 0.28);
}

.nav-actions .btn-primary:hover {
    box-shadow: 0 4px 18px rgba(83, 74, 183, 0.35);
}

.mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    flex-shrink: 0;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mobile-toggle:hover {
    border-color: var(--purple);
    color: var(--purple);
}

.mobile-toggle svg {
    width: 22px;
    height: 22px;
}

/* ── Footer (matches home) ── */
.site-chrome-footer {
    padding: 48px 0 24px;
    border-top: 1px solid var(--border);
}

.footer-brand-col {
    min-width: 0;
}

.footer-brand-mark.nav-brand {
    margin-bottom: 14px;
    cursor: default;
    text-decoration: none;
}

.footer-brand-mark.nav-brand:hover {
    opacity: 1;
}

a.footer-brand-mark.nav-brand {
    cursor: pointer;
}

.footer-about {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    max-width: 280px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 40px;
}

@media (max-width: 1100px) {
    .footer-grid {
        grid-template-columns: 1.6fr 1fr 1fr 1fr;
        gap: 28px;
    }
    .footer-grid > div:first-child {
        grid-column: 1 / -1;
    }
}

.footer-heading {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

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

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-tertiary);
}

.footer-bottom a {
    color: var(--text-tertiary);
    transition: color 0.15s;
}

.footer-bottom a:hover {
    color: var(--text);
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .mobile-toggle {
        display: inline-flex;
    }

    .nav-links.open {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        padding: 12px 20px 20px;
        gap: 4px;
        z-index: 99;
        border-radius: 0;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    }

    @media (prefers-color-scheme: dark) {
        .nav-links.open {
            background: color-mix(in srgb, var(--bg) 98%, #000);
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
        }
    }

    .nav-links.open li {
        white-space: normal;
    }

    .nav-links.open a {
        border-radius: var(--radius-sm, 8px);
        padding: 12px 14px;
        font-size: 15px;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

/* Legal / static pages often set global `a:hover { text-decoration: underline }` — keep header/footer chrome clean */
.navbar a,
.navbar a:hover,
.site-chrome-footer .footer-links a,
.site-chrome-footer .footer-links a:hover,
.site-chrome-footer .footer-bottom a,
.site-chrome-footer .footer-bottom a:hover {
    text-decoration: none;
}
