/* Zero Delta shared site shell.
   Owned by the zero-delta-dev repository and published at
   https://zerodelta.dev/assets/site-shell.css. Every zerodelta.dev page,
   including the Codex Advisor pages under /advisor/, links this file FIRST and
   its own page styles after it, so this file holds the one design system:
   tokens, base, the outer frame, header, footer, headings, section labels,
   status pill, cards, buttons, links, focus rings, the single compact
   breakpoint and reduced-motion handling. Page files keep only layouts and
   components no other page uses.

   Page skeleton (identical on every page):
     <a class="skip-link" href="#content">Skip to content</a>
     <header class="global-header"><div class="wrap">...</div></header>
     <div class="site-frame">
       <div class="hero"><div class="wrap">...</div></div>
       <main id="content"><div class="wrap">...</div></main>
       <footer class="site-footer">...</footer>
     </div>

   Type: body copy is sans; the header, footer, headings, labels, pills,
   buttons and code stay mono. The frame, header, footer, type split and
   breakpoint match daveschmidt.dev's shell so the two sites read as one family.

   Breakpoint: one compact layout at max-width 680px. Custom properties cannot
   be used inside media queries, so pages that need their own narrow rules use
   the same literal 680px. */

/* ── Tokens ── */
:root {
    --bg: #0d1117;
    --panel: #0f141c;
    --panel-soft: rgba(255, 255, 255, 0.03);
    --panel-hover: rgba(255, 255, 255, 0.05);
    --code-bg: #080b10;
    --text: #f5f7fb;
    --muted: #9aa6b2;
    --soft: #6c7a89;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --accent: #00e5ff;
    --accent-dim: rgba(0, 229, 255, 0.12);
    --accent-line: rgba(0, 229, 255, 0.3);
    --success: #2dd4bf;
    --warn: #f5b342;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", "Menlo", "Consolas", monospace;
    --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --frame-width: 1080px;
    --gutter-y: 40px;
    --gutter-x: 18px;
    --inset: 34px;
    --header-clearance: 88px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (max-width: 680px) {
    :root {
        --gutter-y: 18px;
        --gutter-x: 12px;
        --inset: 18px;
        --header-clearance: 112px;
    }
}

/* ── Base ── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: var(--sans);
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    display: grid;
    grid-template-columns: minmax(0, var(--frame-width));
    align-content: start;
    justify-content: center;
    padding: var(--gutter-y) var(--gutter-x);
    -webkit-font-smoothing: antialiased;
}

/* Subtle grid background */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
    opacity: 0.28;
    z-index: -1;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* In-page anchors land below the pinned header. */
[id] {
    scroll-margin-top: var(--header-clearance);
}

/* Terminal-style chrome stays mono over the sans body copy. */
.skip-link,
.global-header,
.site-footer,
h1,
h2,
h3,
.section-label,
.status-pill,
.btn,
pre,
code {
    font-family: var(--mono);
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 8px;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--accent);
    z-index: 100;
}

.skip-link:focus-visible {
    left: 8px;
}

/* One horizontal inset for header, content and footer at every width. */
.wrap {
    width: 100%;
    padding: 0 var(--inset);
}

/* ── Frame: everything below the header sits in one panel ── */
.site-frame {
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.hero {
    padding: 30px 0 28px;
    border-bottom: 1px solid var(--border);
}

/* ── Header ── */
.global-header {
    margin: 0;
    padding: 0;
    line-height: 1.7;
    letter-spacing: normal;
    border: 1px solid var(--border);
    border-bottom: 1px solid transparent;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    /* Solid, not frosted: WebKit draws unblurred page text through a
       translucent backdrop-filter header, so the pinned bar stays opaque. */
    background: var(--panel);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.global-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    flex-wrap: wrap;
}

.global-brand {
    display: inline-flex;
    align-items: center;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
    text-decoration: none;
}

.global-brand:hover,
.global-brand:focus-visible {
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    display: block;
    height: 40px;
    width: auto;
    margin-right: 12px;
}

.global-brand::before {
    content: ">";
    color: var(--accent);
    font-weight: 400;
    margin-right: 0.6em;
}

.global-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 18px;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Header and footer links share one quiet treatment: muted text that turns
   accent and grows a 1px underline on hover. */
.global-nav a,
.footer-links a {
    color: var(--muted);
    text-decoration: none;
    background: linear-gradient(var(--accent), var(--accent)) left bottom / 0 1px no-repeat;
    transition: color 0.2s ease, background-size 0.25s ease;
}

.global-nav a:hover,
.global-nav a:focus-visible,
.footer-links a:hover,
.footer-links a:focus-visible {
    color: var(--accent);
    text-decoration: none;
}

.global-nav a:hover,
.footer-links a:hover {
    background-size: 100% 1px;
}

.global-nav a[aria-current="page"] {
    color: var(--text);
}

/* Header squares off and gains depth once it is pinned (no JS). */
@supports (animation-timeline: scroll()) {
    @keyframes header-pinned {
        to {
            border-radius: 0;
            border-bottom-color: rgba(0, 229, 255, 0.18);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        }
    }

    .global-header {
        animation: header-pinned linear both;
        animation-timeline: scroll(root);
        animation-range: 0 40px;
    }
}

/* ── Footer ── */
.site-footer {
    padding: 22px 0 26px;
    border-top: 1px solid var(--border);
    color: var(--soft);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px 24px;
}

.footer-legal {
    margin: 0;
    max-width: none;
    color: inherit;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
}

/* ── Headings ── */
h1 {
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.12;
    color: var(--text);
}

h1::before {
    content: "> ";
    color: var(--accent);
    font-weight: 400;
}

h2 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.4;
    margin-bottom: 6px;
    display: flex;
    align-items: baseline;
    gap: 9px;
}

h2::before {
    content: ">";
    color: var(--accent);
    font-weight: 400;
}

h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

/* Small uppercase label with the accent prompt: section names on the home
   page and the eyebrow above document titles. */
.section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--soft);
}

.section-label::before {
    content: ">";
    color: var(--accent);
}

.lede {
    margin-top: 16px;
    max-width: 62ch;
    color: var(--muted);
    font-size: 0.95rem;
}

/* ── Status pill ── */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
    background: rgba(45, 212, 191, 0.1);
    border: 1px solid rgba(45, 212, 191, 0.25);
}

.status-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 12px rgba(45, 212, 191, 0.7);
}

/* ── Cards: one surface for every tile, list item and panel ── */
.card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel-soft);
    color: var(--muted);
}

a.card {
    display: block;
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

a.card:hover,
a.card:focus-visible {
    transform: translateY(-1px);
    border-color: var(--accent-line);
    background: var(--panel-hover);
    text-decoration: none;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    font-size: 0.85rem;
    color: var(--text);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.btn:hover,
.btn:focus-visible {
    text-decoration: none;
    border-color: rgba(0, 229, 255, 0.4);
    background: var(--panel-soft);
    transform: translateY(-1px);
}

.btn-primary {
    border-color: rgba(0, 229, 255, 0.35);
    background: var(--accent-dim);
    color: var(--accent);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: rgba(0, 229, 255, 0.2);
}

/* ── Compact layout (the single breakpoint) ── */
@media (max-width: 680px) {
    .global-header .wrap {
        min-height: 58px;
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 10px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .brand-mark {
        height: 34px;
    }

    .global-nav {
        gap: 6px 14px;
        font-size: 0.68rem;
    }

    .hero {
        padding: 22px 0 24px;
    }

    .site-footer .wrap {
        flex-direction: column;
        gap: 8px;
    }
}

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

    .global-header {
        animation: none !important;
    }

    .global-nav a,
    .footer-links a,
    a.card,
    .btn {
        transition: none;
    }

    a.card:hover,
    a.card:focus-visible,
    .btn:hover,
    .btn:focus-visible {
        transform: none;
    }
}

/* ── Print ── */
@media print {
    * {
        animation: none !important;
        transition: none !important;
    }

    body {
        padding: 0;
        background: #ffffff;
        color: #111111;
    }

    body::before,
    .skip-link,
    .global-nav,
    .site-footer {
        display: none;
    }

    .global-header,
    .site-frame {
        position: static;
        max-width: 100%;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: #ffffff;
    }

    .global-brand,
    h1,
    h2,
    h3 {
        color: #111111;
    }

    .hero {
        border-color: #d1d5db;
    }
}
