:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "SF Mono", "Cascadia Code", "Fira Code", "JetBrains Mono", monospace;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --transition-fast: 0.1s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;

    --accent-blue: #1d9bf0;
    --accent-blue-hover: #1a8cd8;
    --accent-green: #00ba7c;
    --accent-red: #f4212e;
    --accent-orange: #ff7a00;
}

[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #16181c;
    --bg-tertiary: #202327;
    --bg-elevated: #1d1f23;
    --bg-hover: rgba(231, 233, 234, 0.1);

    --text-primary: #e7e9ea;
    --text-secondary: #71767b;
    --text-tertiary: #536471;

    --border-color: #2f3336;
    --border-light: #38444d;

    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --header-bg: rgba(0, 0, 0, 0.72);
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f9f9;
    --bg-tertiary: #eff3f4;
    --bg-elevated: #ffffff;
    --bg-hover: rgba(0, 0, 0, 0.03);

    --text-primary: #0f1419;
    --text-secondary: #536471;
    --text-tertiary: #8b98a5;

    --border-color: #eff3f4;
    --border-light: #cfd9de;

    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --header-bg: rgba(255, 255, 255, 0.85);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

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

a:hover {
    text-decoration: underline;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 53px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 14px;
    border-radius: var(--radius-full);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle,
.menu-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
}

.menu-toggle {
    display: none;
}

.theme-toggle:hover,
.menu-toggle:hover {
    background: var(--bg-hover);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
    display: block;
}

#site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-self: end;
}

#site-nav a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    padding: 9px 14px;
    border-radius: var(--radius-full);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-github {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.nav-github svg {
    width: 15px;
    height: 15px;
    display: block;
    fill: currentColor;
    flex-shrink: 0;
}

#site-nav a:hover,
#site-nav a.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 16px 28px;
}

.section {
    margin-top: 20px;
}

.hero {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.eyebrow {
    color: var(--accent-blue);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hero h1 {
    margin-top: 6px;
    font-size: clamp(2rem, 4.8vw, 3.2rem);
    line-height: 1.15;
}

.lead {
    margin-top: 10px;
    max-width: 72ch;
    color: var(--text-secondary);
}

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 16px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 700;
    border: none;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.btn-primary {
    background: var(--accent-blue);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
    text-decoration: none;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

.section-head h2 {
    font-size: 24px;
    font-weight: 700;
}

.section-head p {
    margin-top: 4px;
    color: var(--text-secondary);
}

.grid {
    display: grid;
    gap: 16px;
    margin-top: 12px;
}

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

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

.card,
.code-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: border-color var(--transition-fast);
}

.card:hover,
.code-card:hover {
    border-color: var(--border-light);
}

.card h3,
.code-card h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.card p,
.card li,
.code-card p {
    color: var(--text-secondary);
}

.card ul {
    padding-left: 18px;
}

.card li + li {
    margin-top: 6px;
}

.architecture-diagram {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.arch-row {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.arch-node {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    width: 320px;
    min-height: 120px;
    box-shadow: var(--shadow-md);
}

.arch-icon {
    font-size: 24px;
    line-height: 1;
}

.arch-node h3 {
    margin: 8px 0 6px;
    font-size: 18px;
    line-height: 1.25;
}

.arch-node p {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.arch-arrow {
    width: 34px;
    min-height: 34px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    flex-shrink: 0;
}

.arch-arrow svg {
    width: 16px;
    height: 16px;
    display: block;
    stroke: var(--accent-blue);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pipeline-flow {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr auto 1fr auto 1fr;
    gap: 10px;
    align-items: stretch;
}

.pipeline-step {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px;
    min-height: 118px;
    position: relative;
}

.pipeline-step-no {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    background: rgba(29, 155, 240, 0.2);
    color: var(--accent-blue);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pipeline-step h3 {
    margin: 2px 0 8px;
    font-size: 15px;
    line-height: 1.25;
}

.pipeline-step p {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.pipeline-step-final {
    border-color: rgba(0, 186, 124, 0.55);
}

.pipeline-connector {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

.pipeline-connector svg {
    width: 16px;
    height: 16px;
    display: block;
    stroke: var(--accent-blue);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.status.implemented {
    border-color: rgba(0, 186, 124, 0.5);
}

.status.partial {
    border-color: rgba(255, 122, 0, 0.5);
}

.status.planned {
    border-color: rgba(244, 33, 46, 0.5);
}

.table-wrap {
    margin-top: 12px;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

td {
    background: var(--bg-secondary);
    font-size: 14px;
}

tr:hover td {
    background: var(--bg-hover);
}

.code-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

pre {
    margin: 0;
    overflow-x: auto;
}

code {
    font-family: var(--font-mono);
    font-size: 13px;
}

.dashboard-link {
    margin-top: 12px;
    color: var(--text-secondary);
}

.dashboard-link code {
    color: var(--text-primary);
}

.site-footer {
    margin-top: 28px;
    padding: 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
}

.reveal {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1024px) {
    .grid.two,
    .grid.three,
    .code-grid {
        grid-template-columns: 1fr;
    }

    .arch-node {
        width: 100%;
        max-width: 680px;
    }

    .arch-arrow {
        transform: rotate(90deg);
    }

    .pipeline-flow {
        grid-template-columns: 1fr;
    }

    .pipeline-step {
        min-height: 0;
    }

    .pipeline-connector {
        transform: rotate(90deg);
        justify-self: center;
    }
}

@media (max-width: 760px) {
    .site-header {
        grid-template-columns: auto 1fr auto;
        padding: 0 10px;
    }

    .menu-toggle {
        display: flex;
    }

    #site-nav {
        justify-self: start;
    }

    #site-nav {
        position: absolute;
        top: 56px;
        right: 10px;
        background: var(--bg-primary);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        padding: 8px;
        box-shadow: var(--shadow-md);
        display: none;
        flex-direction: column;
        min-width: 190px;
        gap: 2px;
    }

    #site-nav.open {
        display: flex;
    }

    #site-nav a {
        width: 100%;
    }
}
