:root {
    --bg-eggshell: #FAF9F6;
    --text-primary: #1A1A1A;
    --text-body: #2D2D2D;
    --text-muted: #6B6B6B;
    --border-subtle: #E5E4E0;
    --font-heading: 'JetBrains Mono', monospace;
    --font-body: 'Inter', sans-serif;
    --font-editorial: 'Playfair Display', serif;
    --accent-blue: #3B82F6;
    --accent-red: #EF4444;
    --accent-green: #10B981;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-body);
    background: var(--bg-eggshell);
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-eggshell);
    border-bottom: 1px solid var(--text-primary);
    z-index: 100;
}

.header-container {
    display: flex;
    align-items: center;
    padding: 0.75rem 2rem;
    gap: 1.5rem;
}

.header-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 0.05em;
}

.header-back:hover { opacity: 0.6; }

.header-title {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

/* Main */
.main {
    max-width: 960px;
    margin: 0 auto;
    padding: 5rem 2rem 3rem;
}

/* Intro */
.intro {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-subtle);
}

.intro-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.intro-subtitle {
    font-family: var(--font-editorial);
    font-style: italic;
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.intro-description {
    font-size: 0.9375rem;
    line-height: 1.75;
    color: var(--text-body);
    max-width: 720px;
}

.intro-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-family: var(--font-heading);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.intro-link:hover { opacity: 0.6; }

.intro-description code {
    font-family: var(--font-heading);
    font-size: 0.8125rem;
    background: #f0efec;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

/* Section headers */
.section-header {
    margin-bottom: 1.5rem;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.section-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Viz Section */
.viz-section {
    margin-bottom: 3rem;
}

/* Graph Tabs */
.graph-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border: 1px solid var(--text-primary);
    overflow: hidden;
    width: fit-content;
}

.graph-tab {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 1.25rem;
    border: none;
    background: var(--bg-eggshell);
    color: var(--text-muted);
    cursor: pointer;
    border-right: 1px solid var(--text-primary);
    transition: all 0.15s;
}

.graph-tab:last-child { border-right: none; }

.graph-tab.active {
    background: var(--text-primary);
    color: var(--bg-eggshell);
}

.graph-tab:hover:not(.active) {
    background: #f0efec;
}

/* Viz Container */
.viz-container {
    border: 1px solid var(--text-primary);
    background: #fff;
    height: 420px;
    position: relative;
}

.viz-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Controls */
.viz-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-label {
    font-family: var(--font-heading);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.control-value {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 1.5rem;
    text-align: center;
}

.control-group input[type="range"] {
    width: 80px;
    accent-color: var(--text-primary);
}

.control-btn-text {
    font-family: var(--font-heading);
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem;
    border: 1px solid var(--text-primary);
    background: var(--bg-eggshell);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
}

.control-btn-text:hover {
    background: var(--text-primary);
    color: var(--bg-eggshell);
}

.control-btn-text.btn-primary {
    background: var(--text-primary);
    color: var(--bg-eggshell);
}

.control-btn-text.btn-primary:hover {
    background: var(--text-body);
}

/* Metrics Bar */
.metrics-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 1rem;
}

.metric {
    border: 1px solid var(--text-primary);
    padding: 0.75rem 1rem;
    text-align: center;
}

.metric-label {
    font-family: var(--font-heading);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.metric-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Formulation Section */
.formulation-section {
    margin-bottom: 3rem;
}

.formula-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.formula-card {
    border: 1px solid var(--text-primary);
}

.formula-header {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--text-primary);
}

.formula-body {
    padding: 1rem;
}

.formula-math {
    font-family: var(--font-heading);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.formula-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Pipeline Section */
.arch-section {
    margin-bottom: 3rem;
}

.pipeline-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.pipeline-card {
    border: 1px solid var(--text-primary);
    padding: 1.25rem;
}

.pipeline-card-highlight {
    background: var(--text-primary);
    color: var(--bg-eggshell);
}

.pipeline-step {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.75rem;
    opacity: 0.3;
}

.pipeline-card-highlight .pipeline-step { opacity: 0.5; }

.pipeline-title {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.pipeline-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.pipeline-card-highlight .pipeline-desc { color: #aaa; }

/* Insight Section */
.insight-section {
    margin-bottom: 3rem;
}

.insight-card {
    border: 2px solid var(--text-primary);
    padding: 1.5rem 2rem;
}

.insight-title {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.insight-text {
    font-size: 0.9375rem;
    line-height: 1.75;
    color: var(--text-body);
}

/* Footer */
.footer {
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
}

.footer p {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .main { padding: 4.5rem 1rem 2rem; }
    .intro-title { font-size: 1.5rem; }
    .viz-container { height: 320px; }
    .metrics-bar { grid-template-columns: repeat(2, 1fr); }
    .formula-grid { grid-template-columns: 1fr; }
    .pipeline-grid { grid-template-columns: repeat(2, 1fr); }
    .graph-tabs { flex-wrap: wrap; }
    .viz-controls { gap: 0.75rem; }
}
