/* Shared shell, extracted from the homepage. Page content styles stay local. */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #fafafa;
    --text: #151923;
    --text-secondary: #4c5867;
    --text-subtle: #748092;
    --accent: #476e67;
    --accent-soft: rgba(71, 110, 103, 0.090);
    --accent-line: rgba(71, 110, 103, 0.24);
    --border: rgba(31, 43, 66, 0.17);
    --border-strong: rgba(31, 43, 66, 0.28);
    --glass: rgba(255, 255, 255, 0.58);
    --glass-strong: rgba(255, 255, 255, 0.78);
    --glass-faint: rgba(255, 255, 255, 0.34);
    --paper: rgba(255, 255, 255, 0.54);
    --tag-bg: rgba(255, 255, 255, 0.18);
    --badge-bg: rgba(255, 244, 203, 0.30);
    --badge-text: #8a4a05;
    --badge-border: rgba(138, 74, 5, 0.22);
    --metric-bg: rgba(0, 176, 150, 0.12);
    --metric-border: rgba(0, 158, 136, 0.34);
    --metric-text: #00826f;
    --link-blue: #006fd8;
    --link-line: rgba(0, 111, 216, 0.26);
    --page-width: 960px;
    --copy-measure: 52rem;
    --copy-size: 16px;
    --copy-leading: 1.64;
    --detail-size: 14px;
    --detail-leading: 1.7;
    --caption-size: 13px;
    --date-column: 108px;
    --radius-lg: 28px;
    --radius-panel: 24px;
    --radius-md: 18px;
    --radius-control: 999px;
    --radius-inline: 8px;
    --glass-link: rgba(255, 255, 255, 0.045);
    --glass-link-hover: rgba(255, 255, 255, 0.12);
    --glass-link-border: rgba(31, 43, 66, 0.18);
    --glass-link-highlight: rgba(255, 255, 255, 0.44);
    --glass-link-sheen: rgba(255, 255, 255, 0.090);
    --glass-link-sheen-hover: rgba(255, 255, 255, 0.13);
    --glass-link-fade: rgba(255, 255, 255, 0.006);
    --glass-bubble-glow: rgba(31, 43, 66, 0.10);
    --glass-lift-border: rgba(31, 43, 66, 0.16);
    --glass-lift-edge: 1px 1px 0 rgba(31, 43, 66, 0.13), 2px 2px 0 rgba(255, 255, 255, 0.42);
    --glass-lift-shadow: 7px 9px 20px rgba(31, 43, 66, 0.13);
    --glass-lift-inset: inset 0 1px 0 rgba(255,255,255,0.62), inset -1px -1px 0 rgba(31,43,66,0.075), inset 0 0 0 0.5px rgba(255,255,255,0.22);
    --shadow-soft: 0 18px 48px rgba(31, 43, 66, 0.060);
    --shadow-card: 0 28px 76px rgba(31, 43, 66, 0.085), 0 8px 28px rgba(31, 43, 66, 0.045);
}

[data-theme="dark"] {
    --bg: #000;
    --text: #edf2fa;
    --text-secondary: #b6c0cc;
    --text-subtle: #8793a4;
    --accent: #a5cac3;
    --accent-soft: rgba(165, 202, 195, 0.095);
    --accent-line: rgba(165, 202, 195, 0.24);
    --border: rgba(255, 255, 255, 0.16);
    --border-strong: rgba(255, 255, 255, 0.24);
    --glass: rgba(23, 29, 40, 0.052);
    --glass-strong: rgba(22, 28, 38, 0.11);
    --glass-faint: rgba(255, 255, 255, 0.004);
    --paper: rgba(255, 255, 255, 0.010);
    --tag-bg: rgba(255, 255, 255, 0.040);
    --badge-bg: rgba(251, 191, 36, 0.10);
    --badge-text: #fbbf24;
    --badge-border: rgba(251, 191, 36, 0.26);
    --metric-bg: rgba(64, 224, 198, 0.14);
    --metric-border: rgba(64, 224, 198, 0.34);
    --metric-text: #71f0d7;
    --link-blue: #74b7ff;
    --link-line: rgba(116, 183, 255, 0.36);
    --glass-link: rgba(255, 255, 255, 0.010);
    --glass-link-hover: rgba(255, 255, 255, 0.045);
    --glass-link-border: rgba(255, 255, 255, 0.18);
    --glass-link-highlight: rgba(255, 255, 255, 0.20);
    --glass-link-sheen: rgba(255, 255, 255, 0.050);
    --glass-link-sheen-hover: rgba(255, 255, 255, 0.075);
    --glass-link-fade: rgba(255, 255, 255, 0.004);
    --glass-bubble-glow: rgba(0, 0, 0, 0.24);
    --glass-lift-border: rgba(255, 255, 255, 0.20);
    --glass-lift-edge: 1px 1px 0 rgba(255, 255, 255, 0.12), 2px 2px 0 rgba(0, 0, 0, 0.26);
    --glass-lift-shadow: 7px 10px 24px rgba(0, 0, 0, 0.34);
    --glass-lift-inset: inset 0 1px 0 rgba(255,255,255,0.24), inset -1px -1px 0 rgba(0,0,0,0.28), inset 0 0 0 0.5px rgba(255,255,255,0.16);
    --shadow-soft: 0 18px 48px rgba(0, 0, 0, 0.28);
    --shadow-card: 0 34px 86px rgba(0, 0, 0, 0.38), 0 10px 30px rgba(0, 0, 0, 0.26);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #000;
        --text: #edf2fa;
        --text-secondary: #b6c0cc;
        --text-subtle: #8793a4;
        --accent: #a5cac3;
        --accent-soft: rgba(165, 202, 195, 0.095);
        --accent-line: rgba(165, 202, 195, 0.24);
        --border: rgba(255, 255, 255, 0.16);
        --border-strong: rgba(255, 255, 255, 0.24);
        --glass: rgba(23, 29, 40, 0.052);
        --glass-strong: rgba(22, 28, 38, 0.11);
        --glass-faint: rgba(255, 255, 255, 0.004);
        --paper: rgba(255, 255, 255, 0.010);
        --tag-bg: rgba(255, 255, 255, 0.040);
        --badge-bg: rgba(251, 191, 36, 0.10);
        --badge-text: #fbbf24;
        --badge-border: rgba(251, 191, 36, 0.26);
        --metric-bg: rgba(64, 224, 198, 0.14);
        --metric-border: rgba(64, 224, 198, 0.34);
        --metric-text: #71f0d7;
        --link-blue: #74b7ff;
        --link-line: rgba(116, 183, 255, 0.36);
        --glass-link: rgba(255, 255, 255, 0.010);
        --glass-link-hover: rgba(255, 255, 255, 0.045);
        --glass-link-border: rgba(255, 255, 255, 0.18);
        --glass-link-highlight: rgba(255, 255, 255, 0.20);
        --glass-link-sheen: rgba(255, 255, 255, 0.050);
        --glass-link-sheen-hover: rgba(255, 255, 255, 0.075);
        --glass-link-fade: rgba(255, 255, 255, 0.004);
        --glass-bubble-glow: rgba(0, 0, 0, 0.24);
        --glass-lift-border: rgba(255, 255, 255, 0.20);
        --glass-lift-edge: 1px 1px 0 rgba(255, 255, 255, 0.12), 2px 2px 0 rgba(0, 0, 0, 0.26);
        --glass-lift-shadow: 7px 10px 24px rgba(0, 0, 0, 0.34);
        --glass-lift-inset: inset 0 1px 0 rgba(255,255,255,0.24), inset -1px -1px 0 rgba(0,0,0,0.28), inset 0 0 0 0.5px rgba(255,255,255,0.16);
        --shadow-soft: 0 18px 48px rgba(0, 0, 0, 0.28);
        --shadow-card: 0 34px 86px rgba(0, 0, 0, 0.38), 0 10px 30px rgba(0, 0, 0, 0.26);
    }
}

html {
    background: var(--bg);
}

body {
    position: relative;
    min-height: 100vh;
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
}

.led-background-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Dark mode: the nav sits on the LED panel at the top and only frosts once content scrolls under it. */
[data-theme="dark"] nav.top-nav {
    border-bottom-color: transparent;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

[data-theme="dark"] nav.top-nav.is-scrolled {
    border-bottom-color: rgba(255, 255, 255, 0.10);
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(18px) saturate(1.1);
    -webkit-backdrop-filter: blur(18px) saturate(1.1);
}

/* Dark mode: the intro card uses the same clear glass as the section panel. */
[data-theme="dark"] header {
    background: var(--paper);
    box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.10);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}


@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) nav.top-nav {
        border-bottom-color: transparent;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    :root:not([data-theme="light"]) nav.top-nav.is-scrolled {
        border-bottom-color: rgba(255, 255, 255, 0.10);
        background: rgba(0, 0, 0, 0.62);
        backdrop-filter: blur(18px) saturate(1.1);
        -webkit-backdrop-filter: blur(18px) saturate(1.1);
    }

    :root:not([data-theme="light"]) header {
        background: var(--paper);
        box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.10);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

}

.container {
    position: relative;
    z-index: 1;
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0 24px 64px;
}

nav.top-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    min-height: 58px;
    margin: 0 0 24px calc(50% - 50vw);
    padding: 0 max(24px, calc((100vw - var(--page-width)) / 2 + 24px));
    border: 0;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    /* Transparent over the LED panel at the top; frosted once content scrolls under it. */
    background: transparent;
    box-shadow: none;
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

nav.top-nav.is-scrolled {
    border-bottom-color: rgba(31, 43, 66, 0.10);
    background: rgba(250, 250, 250, 0.72);
    backdrop-filter: blur(18px) saturate(1.1);
    -webkit-backdrop-filter: blur(18px) saturate(1.1);
}

.site-mark {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0;
    border-radius: 0;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0;
    white-space: nowrap;
}

.site-mark span {
    color: var(--text-subtle);
    font-weight: 600;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.nav-actions a,
.nav-link-button,
.theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    cursor: pointer;
    overflow: hidden;
    transform-origin: center;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: color 0.22s ease, background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.nav-link-button,
.theme-toggle {
    appearance: none;
    font: inherit;
}

.theme-toggle {
    min-width: 34px;
    padding: 0 10px;
    line-height: 1;
}

.nav-actions a:hover,
.nav-actions a:focus-visible,
.nav-link-button:hover,
.nav-link-button:focus-visible,
.theme-toggle:hover,
.theme-toggle:focus-visible {
    color: var(--text);
    border-color: var(--glass-lift-border);
    background:
        radial-gradient(70% 140% at 30% 0%, rgba(255,255,255,0.18), transparent 58%),
        linear-gradient(180deg, var(--glass-link-sheen-hover), var(--glass-link-fade)),
        var(--glass-link-hover);
    box-shadow: var(--glass-lift-inset), var(--glass-lift-edge), var(--glass-lift-shadow);
    backdrop-filter: blur(22px) saturate(1.32);
    -webkit-backdrop-filter: blur(22px) saturate(1.32);
    transform: translate(-1px, -2px) scale(1.045);
    z-index: 2;
    outline: none;
}

.nav-actions a {
    color: var(--text);
}

.nav-actions a:hover,
.nav-actions a:focus-visible {
    color: var(--text);
    border-color: var(--glass-lift-border);
}

header {
    position: relative;
    padding: 44px 32px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: 18px;
    /* Same clear glass as the section panel, so the LED panel shows through. */
    background: var(--paper);
    box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.10);
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.58), transparent 42%) top left / 68% 1px no-repeat,
        linear-gradient(180deg, rgba(255,255,255,0.52), transparent 44%) top left / 1px 68% no-repeat,
        radial-gradient(180px 110px at 94% 12%, rgba(71, 110, 103, 0.075), transparent 72%);
    opacity: 0.78;
}

header > * {
    position: relative;
    z-index: 1;
}

main {
    border: 1px solid var(--border);
    border-radius: var(--radius-panel);
    background: var(--paper);
    box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.10);
    overflow: hidden;
}

@media (max-width: 560px) {
    .container {
        padding: 0 16px 44px;
    }

    nav.top-nav {
        position: sticky;
        top: 0;
        align-items: center;
        flex-direction: column;
        gap: 5px;
        width: 100vw;
        min-height: auto;
        margin: 0 0 18px calc(50% - 50vw);
        padding: 9px 16px 10px;
        border-radius: 0;
    }

    .site-mark {
        justify-content: center;
        min-height: 24px;
        font-size: 13px;
    }

    .nav-actions {
        justify-content: center;
        flex-wrap: wrap;
        gap: 2px;
    }

    .nav-actions a,
    .nav-link-button,
    .theme-toggle {
        min-height: 30px;
        padding: 0 9px;
        font-size: 12px;
    }

}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
