/* ===================================
   CSS Custom Properties (Design System)
   =================================== */
:root {
    /* Colors */
    --color-bg: #F5F1E8;
    --color-text: #1a1a1a;
    --color-border: #d4cfc4;
    --color-accent: #2a2a2a;
    --color-hover: #0a0a0a;
    
    /* Typography */
    --font-mono: 'JetBrains Mono', 'Roboto Mono', 'Courier New', monospace;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-2xl: 32px;
    --font-size-3xl: 48px;
    --font-size-4xl: 64px;
    --font-size-5xl: 72px;
    
    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
    --spacing-2xl: 64px;
    --spacing-3xl: 80px;
    --spacing-4xl: 120px;
    
    /* Layout */
    --container-max-width: 1200px;
    --nav-height: 80px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===================================
   Reset & Base Styles
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: var(--font-size-base);
    overflow-x: hidden;
}

body {
    font-family: var(--font-mono);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Scroll anchoring fights the pinned sticky stages (pipeline, clients
       cascade) and can trap touch scrolling near their boundaries */
    overflow-anchor: none;
}

/* No default browser focus box on links/buttons */
a,
button {
    outline: none;
}

/* ===================================
   Scroll Progress Indicator
   =================================== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background-color: var(--color-text);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* ===================================
   Navigation
   =================================== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background-color: transparent;
    z-index: 1000;
    transition: background-color var(--transition-base), backdrop-filter var(--transition-base);
}

.nav.scrolled {
    background-color: rgba(245, 241, 232, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
}

.nav-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    position: relative;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

/* Blinking text cursor parked at the logo's bottom right — horizontal,
   underscore-style. Phones only; arrives with the logo (same fade),
   then blinks. */
@media (max-width: 767px) {
    .nav-logo::after {
        content: '';
        position: absolute;
        right: -7px;
        bottom: 2px;
        width: 7px;
        height: 2px;
        background: #000;
        opacity: 0;
        animation:
            logoFadeIn 0.6s ease-out 0.2s forwards,
            archCaretBlink 1.1s steps(1) infinite 0.8s;
    }
}

.nav-logo:hover {
    opacity: 0.8;
}

.logo-image {
    height: 40px;
    width: auto;
    display: block;
    opacity: 0;
    animation: logoFadeIn 0.6s ease-out 0.2s forwards;
}

@keyframes logoFadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.nav-link {
    color: var(--color-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    position: relative;
    transition: color var(--transition-fast);
}

.nav-link:hover {
    color: var(--color-hover);
}

.nav-link.active {
    color: var(--color-hover);
    font-weight: 600;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-text);
    transition: width var(--transition-base);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-separator {
    color: var(--color-text);
    opacity: 0.3;
    font-size: 14px;
}

/* ===================================
   Container
   =================================== */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* ===================================
   Hero Section
   =================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--spacing-4xl) var(--spacing-lg);
}

.hero-title {
    font-size: var(--font-size-5xl);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: var(--spacing-xl);
    letter-spacing: -2px;
}

/* Phones get a fixed break so "comes next." always starts the second line;
   everywhere else the headline wraps (or doesn't) on its own. */
.hero-br {
    display: none;
}

@media (max-width: 767px) {
    .hero-br {
        display: inline;
    }
}

.hero-subtitle {
    font-size: var(--font-size-xl);
    font-weight: 400;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
    opacity: 0.9;
}

.hero-eyebrow {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2.5px;
    opacity: 0.55;
    margin-bottom: var(--spacing-md);
}

.hero-subheading {
    font-weight: 600;
    opacity: 1;
}

/* ===================================
   Sections
   =================================== */
.section {
    padding: var(--spacing-4xl) 0;
}

.section-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--spacing-3xl);
    letter-spacing: 1px;
    text-align: center;
}

.section-headline {
    text-align: center;
    font-size: var(--font-size-2xl);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.5px;
    max-width: 720px;
    margin: calc(var(--spacing-3xl) * -0.5) auto var(--spacing-2xl);
}

.section-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-3xl);
    align-items: start;
}

/* Let grid columns shrink below their content width so wide
   visuals (code mockup) scroll internally instead of stretching the page */
.content-text,
.content-visual {
    min-width: 0;
}

.content-text {
    display: flex;
    flex-direction: column;
    gap: 68px;
}

.content-group {
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.content-heading {
    font-size: var(--font-size-xl);
    font-weight: 500;
    margin-bottom: 0;
    letter-spacing: 0.5px;
}

.content-paragraph {
    font-size: var(--font-size-lg);
    line-height: 1.7;
    opacity: 0.9;
}

/* ===================================
   Code Mockup
   =================================== */
.content-visual {
    position: sticky;
    /*top: calc(var(--nav-height) + var(--spacing-lg));*/
}

.code-mockup {
    background-color: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.code-header {
    background-color: #fafafa;
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    gap: 8px;
}

.code-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--color-border);
}

.code-dot:nth-child(1) { background-color: #e6a09a; }
.code-dot:nth-child(2) { background-color: #e6cf9a; }
.code-dot:nth-child(3) { background-color: #a9c79a; }

.code-content {
    padding: var(--spacing-lg);
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    min-height: calc(14 * 1.6 * 13px);
    box-sizing: content-box;
}

.code-content code {
    font-family: var(--font-mono);
    color: var(--color-text);
}

/* ===================================
   Metrics Mockup
   =================================== */
.metrics-mockup {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.metric-card {
    background-color: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: var(--spacing-lg);
    text-align: center;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.metric-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -1px;
}

.metric-label {
    font-size: 14px;
    opacity: 0.7;
    letter-spacing: 0.5px;
}

.metric-word {
    font-size: var(--font-size-xl);
}

/* ===================================
   Section Divider
   =================================== */
.section-divider {
    max-width: var(--container-max-width);
    margin: 0 auto;
    height: 1px;
    background-color: var(--color-border);
}

/* ===================================
   Contact Section
   =================================== */
.section-contact {
    text-align: center;
    padding: var(--spacing-4xl) 0;
}

.contact-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    letter-spacing: -1px;
}

.contact-subtitle {
    font-size: var(--font-size-xl);
    opacity: 0.9;
    margin-bottom: var(--spacing-3xl);
}

.contact-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.contact-link {
    color: var(--color-text);
    text-decoration: none;
    font-size: var(--font-size-lg);
    font-weight: 600;
    letter-spacing: 0.5px;
    position: relative;
    transition: color var(--transition-fast);
}

.contact-link:hover {
    color: var(--color-hover);
}

.contact-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-text);
    transition: width var(--transition-base);
}

.contact-link:hover::after {
    width: 100%;
}

.contact-separator {
    opacity: 0.3;
    font-size: var(--font-size-lg);
}

/* ===================================
   Footer
   =================================== */
.footer {
    padding: var(--spacing-3xl) 0;
    text-align: center;
    border-top: 1px solid var(--color-border);
}

.footer-text {
    font-size: 14px;
    opacity: 0.6;
    letter-spacing: 0.5px;
}

/* ===================================
   Animations
   =================================== */
.fade-in {
    animation: fadeIn var(--transition-slow) ease-out;
}

.fade-in-delay {
    animation: fadeIn var(--transition-slow) ease-out 0.3s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===================================
   Responsive Design - Tablet
   =================================== */
@media (max-width: 1024px) {
    :root {
        --font-size-3xl: 40px;
        --font-size-4xl: 56px;
        --font-size-5xl: 64px;
        --spacing-3xl: 64px;
        --spacing-4xl: 80px;
    }
    
    .logo-image {
        height: 32px;
    }
    
    .nav-links {
        gap: var(--spacing-sm);
        font-size: 12px;
    }
    
    .section-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-2xl);
    }
    
    .content-visual {
        position: static;
    }
}

/* ===================================
   Responsive Design - Mobile
   =================================== */
@media (max-width: 768px) {
    :root {
        --font-size-xl: 20px;
        --font-size-2xl: 28px;
        --font-size-3xl: 32px;
        --font-size-4xl: 40px;
        --font-size-5xl: 48px;
        --spacing-lg: 24px;
        --spacing-xl: 32px;
        --spacing-2xl: 48px;
        --spacing-3xl: 56px;
        --spacing-4xl: 64px;
    }

    /* Mobile nav: logo only, centered */
    .nav-links {
        display: none;
    }

    .nav-container {
        justify-content: center;
    }

    .section,
    .hero {
        scroll-margin-top: var(--nav-height);
    }

    .logo-image {
        height: 28px;
    }

    .dash-card.dash-card-success {
        display: none;
    }

    .hero {
        padding: var(--spacing-3xl) var(--spacing-md);
        padding-top: calc(var(--nav-height) + var(--spacing-2xl));
        min-height: 80vh;
    }

    .hero-title {
        font-size: var(--font-size-4xl);
        letter-spacing: -1px;
    }
    
    .hero-subtitle {
        font-size: var(--font-size-lg);
    }
    
    .section {
        padding: var(--spacing-3xl) 0;
    }
    
    .section-title {
        font-size: var(--font-size-2xl);
        margin-bottom: var(--spacing-2xl);
    }
    
    .content-heading {
        font-size: var(--font-size-lg);
    }
    
    .content-paragraph {
        font-size: var(--font-size-base);
    }
    
    .metrics-mockup {
        grid-template-columns: 1fr;
    }

    .contact-title {
        font-size: var(--font-size-2xl);
    }
    
    .contact-subtitle {
        font-size: var(--font-size-lg);
    }
    
    .contact-links {
        flex-direction: column;
        gap: 40px;
        margin-top: 40px;
    }

    .contact-link {
        font-size: 22px;
    }

    .contact-separator {
        display: none;
    }
    
    .code-content {
        min-height: calc(14 * 1.6 * 12px);
        font-size: 12px;
        padding: var(--spacing-md);
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-5xl: 36px;
        --spacing-lg: 16px;
    }
    
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .nav-container {
        padding: 0 var(--spacing-md);
    }
    
    .logo-image {
        height: 30px;
    }

    .hero-title {
        margin-top: 30px;
        font-size:28px;
    }

    .hero-eyebrow {
        letter-spacing: 1.5px;
        font-size: 11px;
    }

    .section-headline {
        font-size: var(--font-size-xl);
    }
}


/* ===================================
   03 // PIPELINE — Scrollytelling
   =================================== */
.section-pipeline {
    padding-top: var(--spacing-4xl);
    padding-bottom: 0;
}

.pipeline-intro {
    text-align: center;
    font-size: var(--font-size-lg);
    opacity: 0.75;
    margin-top: calc(var(--spacing-3xl) * -0.5);
    margin-bottom: var(--spacing-2xl);
    letter-spacing: 0.3px;
}

.pipeline-subtext {
    text-align: center;
    font-size: var(--font-size-2xl);
    opacity: 0.55;
    margin-top: calc(var(--spacing-3xl) * -0.5);
    margin-bottom: var(--spacing-2xl);
    letter-spacing: 0.3px;
}

.pipeline-subtext + .pipeline-intro {
    margin-top: 0;
}

.scrolly {
    position: relative;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.scrolly-stage {
    position: sticky;
    top: var(--nav-height);
    height: calc(100vh - var(--nav-height));
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 40px;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 1;
}

.scrolly-stage-inner {
    position: relative;
    width: 100%;
    max-width: 1140px;
    aspect-ratio: 16 / 9;
    max-height: 78vh;
    pointer-events: auto;
}

/* Stage meta (step label + progress bar) */
.scrolly-meta {
    position: absolute;
    top: -36px;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-size: 11px;
    letter-spacing: 1.2px;
    font-weight: 600;
    opacity: 0.85;
}
.scrolly-step-label {
    white-space: nowrap;
}
.scrolly-progress-track {
    flex: 1;
    height: 2px;
    background-color: var(--color-border);
    position: relative;
    overflow: hidden;
}
.scrolly-progress-fill {
    position: absolute;
    inset: 0;
    background-color: var(--color-text);
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.15s linear;
}

/* Shared panel chrome */
.stage-panel {
    position: absolute;
    inset: 0;
    background-color: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 18px 60px -20px rgba(20, 16, 8, 0.18), 0 4px 16px rgba(20, 16, 8, 0.05);
    display: flex;
    flex-direction: column;
    transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
    will-change: opacity, transform;
}

/* Editor — slides in from left, occupies left half once terminal arrives */
.stage-editor {
    right: 50%;
    margin-right: 8px;
    opacity: 0;
    transform: translateX(-30px);
}
.stage-editor.is-visible {
    opacity: 1;
    transform: translateX(0);
}
.stage-editor.is-solo {
    right: 0;
    margin-right: 0;
}

/* Terminal — slides in from right */
.stage-terminal {
    left: 50%;
    margin-left: 8px;
    opacity: 0;
    transform: translateX(30px);
}
.stage-terminal.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Dashboard — fades over the top */
.stage-dashboard {
    inset: 0;
    opacity: 0;
    transform: translateY(20px) scale(0.985);
    pointer-events: none;
}
.stage-dashboard.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ----- Editor (light theme) ----- */
.editor-chrome {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 10px 14px;
    background-color: #fafaf7;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.editor-traffic {
    display: flex;
    gap: 6px;
}
.traffic-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background-color: #d4cfc4;
}
.traffic-red { background-color: #e6a09a; }
.traffic-yellow { background-color: #e6cf9a; }
.traffic-green { background-color: #a9c79a; }

.editor-tabs {
    display: flex;
    gap: 2px;
    flex: 1;
    margin-left: var(--spacing-sm);
}
.editor-tab {
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 4px;
    color: rgba(26, 26, 26, 0.5);
    letter-spacing: 0.3px;
}
.editor-tab-active {
    background-color: #fff;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.editor-status {
    font-size: 10px;
    letter-spacing: 0.6px;
    opacity: 0.5;
}

.editor-body {
    display: flex;
    flex: 1;
    min-height: 0;
    background-color: #fdfcf8;
    overflow: hidden;
    position: relative;
}
.editor-gutter {
    flex-shrink: 0;
    width: 44px;
    padding: 14px 0;
    text-align: right;
    font-size: 12px;
    line-height: 1.65;
    color: rgba(26, 26, 26, 0.3);
    border-right: 1px solid #ece8de;
    user-select: none;
}
.editor-gutter span {
    display: block;
    padding-right: 10px;
}
.editor-code {
    flex: 1;
    margin: 0;
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--color-text);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-y: auto;
    position: relative;
}
.editor-code code {
    font-family: inherit;
}
.editor-caret {
    display: inline-block;
    width: 1.5px;
    height: 1.05em;
    background-color: var(--color-text);
    vertical-align: text-bottom;
    margin-left: 1px;
    animation: editorCaretBlink 1s steps(2, end) infinite;
}
@keyframes editorCaretBlink {
    50% { opacity: 0; }
}

/* GraphQL token colors (warm muted palette) */
.tok-key { color: #6b3a8a; }       /* keywords: query, mutation */
.tok-name { color: #1a4d7a; }      /* names */
.tok-arg { color: #8a4a1a; }       /* arg keys */
.tok-str { color: #4a6b1a; }       /* strings */
.tok-num { color: #8a3a3a; }       /* numbers */
.tok-punc { color: rgba(26, 26, 26, 0.55); }
.tok-com { color: rgba(26, 26, 26, 0.4); font-style: italic; }

/* ----- Terminal (light theme to match brand) ----- */
.terminal-chrome {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 10px 14px;
    background-color: #1a1a1a;
    border-bottom: 1px solid #1a1a1a;
    color: #f5f1e8;
    flex-shrink: 0;
}
.terminal-chrome .traffic-dot {
    background-color: #3a3a3a;
}
.terminal-chrome .traffic-red { background-color: #c97064; }
.terminal-chrome .traffic-yellow { background-color: #c9a164; }
.terminal-chrome .traffic-green { background-color: #7ea064; }
.terminal-title {
    flex: 1;
    text-align: center;
    font-size: 11px;
    letter-spacing: 0.4px;
    opacity: 0.7;
}
.terminal-chrome .editor-status {
    color: #f5f1e8;
    opacity: 0.5;
}

.terminal-body {
    flex: 1;
    background-color: #16140f;
    color: #e8e3d4;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.65;
    padding: 14px 18px;
    overflow-y: auto;
    min-height: 0;
}
.term-line {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
}
.term-prompt-user { color: #a9c79a; }
.term-prompt-path { color: #8aa9c7; }
.term-prompt-arrow { color: #d4b066; margin-right: 6px; }
.term-cmd { color: #f5f1e8; }
.term-info { color: rgba(232, 227, 212, 0.65); }
.term-ok { color: #a9c79a; }
.term-warn { color: #d4b066; }
.term-port { color: #d4b066; font-weight: 600; }
.term-dim { color: rgba(232, 227, 212, 0.45); }
.term-caret {
    display: inline-block;
    width: 7px;
    height: 1.05em;
    background-color: #e8e3d4;
    vertical-align: text-bottom;
    animation: editorCaretBlink 1s steps(2, end) infinite;
    margin-left: 2px;
}

/* ----- Dashboard ----- */
.dashboard-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    background-color: #fafaf7;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.dashboard-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    letter-spacing: 1.4px;
    font-weight: 600;
}
.dashboard-bullet {
    width: 8px;
    height: 8px;
    background-color: var(--color-text);
}
.dashboard-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-size: 11px;
    letter-spacing: 0.8px;
}
.dashboard-live {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}
.dashboard-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #6b9a4a;
    box-shadow: 0 0 0 0 rgba(107, 154, 74, 0.6);
    animation: livePulse 2s ease-out infinite;
}
@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(107, 154, 74, 0.55); }
    100% { box-shadow: 0 0 0 8px rgba(107, 154, 74, 0); }
}
.dashboard-time {
    opacity: 0.55;
    font-variant-numeric: tabular-nums;
}

.dashboard-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 1fr;
    gap: 12px;
    padding: 18px;
    background-color: #fdfcf8;
    min-height: 0;
}
.dash-card {
    background-color: #fff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    min-height: 0;
}
.dash-card-wide { /* stays 1 col in 2-col grid; visual variation only via spark */ }

.dash-label {
    font-size: 10.5px;
    letter-spacing: 1.4px;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.55;
}
.dash-value {
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -1.2px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.dash-value-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}
.dash-value-row .dash-value {
    font-size: 32px;
}
.dash-unit {
    display: inline-block;
    margin-left: 6px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0.55;
    letter-spacing: 0.4px;
    vertical-align: baseline;
}
.dash-bar {
    height: 4px;
    background-color: var(--color-bg);
    border-radius: 2px;
    overflow: hidden;
}
.dash-bar-fill {
    height: 100%;
    width: var(--fill, 0%);
    background-color: var(--color-text);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.is-visible .dash-bar-fill {
    transform: scaleX(1);
}
.dash-foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    opacity: 0.6;
    letter-spacing: 0.3px;
}
.dash-foot-single { justify-content: flex-start; }

.sparkline {
    width: 60%;
    height: 40px;
    overflow: visible;
}
.spark-line {
    fill: none;
    stroke: var(--color-text);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s;
}
.spark-fill {
    fill: var(--color-text);
    opacity: 0;
    transition: opacity 1.2s ease 0.6s;
}
.is-visible .spark-line { stroke-dashoffset: 0; }
.is-visible .spark-fill { opacity: 0.06; }

/* ----- Scroll steps (the spacer/captions) ----- */
.scrolly-steps {
    position: relative;
    z-index: 2;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 0;
    /* Negative top margin so first step overlaps the sticky stage */
    margin-top: -100vh;
    padding-top: 100vh;
}
.scrolly-step {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 0 0 var(--spacing-md);
}
.scrolly-step-card {
    pointer-events: auto;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 22px 24px;
    max-width: 320px;
    box-shadow: 0 6px 24px -8px rgba(20, 16, 8, 0.15);
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0.5;
    transform: translateX(-8px);
}
.scrolly-step.is-active .scrolly-step-card {
    opacity: 1;
    transform: translateX(0);
}
.scrolly-kicker {
    font-size: 10px;
    letter-spacing: 1.6px;
    font-weight: 700;
    margin-bottom: 10px;
    opacity: 0.55;
}
.scrolly-step-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.4px;
    margin-bottom: 10px;
}
.scrolly-step-body {
    font-size: 14px;
    line-height: 1.6;
    opacity: 0.78;
}

/* ----- Responsive ----- */
@media (max-width: 1024px) {
    .scrolly-stage-inner {
        max-height: 70vh;
    }
    .dash-value { font-size: 30px; }
    .dash-value-row .dash-value { font-size: 26px; }
}

@media (max-width: 768px) {
    .scrolly-stage {
        top: var(--nav-height);
        height: calc(100vh - var(--nav-height));
    }
    .scrolly-stage-inner {
        aspect-ratio: auto;
        max-height: 72vh;
        height: 72vh;
    }
    /* Stack editor + terminal vertically on mobile */
    .stage-editor,
    .stage-terminal {
        right: auto;
        left: auto;
        margin-right: 0;
        margin-left: 0;
    }
    .stage-editor {
        inset: 0 0 50% 0;
        transform: translateY(-12px);
    }
    .stage-editor.is-visible { transform: translateY(0); }
    .stage-editor.is-solo { inset: 0; }
    .stage-terminal {
        inset: 50% 0 0 0;
        margin-top: 6px;
        transform: translateY(12px);
    }
    .stage-terminal.is-visible { transform: translateY(0); }
    .scrolly-step {
        justify-content: center;
        padding: 0 var(--spacing-md);
    }
    .scrolly-step-card {
        max-width: 100%;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px;
    }
    .dash-card { padding: 12px 14px; gap: 6px; }
    .dash-value { font-size: 26px; }
    .dash-value-row .dash-value { font-size: 22px; }
    .editor-code, .terminal-body {
        font-size: 11px;
    }
    .editor-gutter { width: 32px; font-size: 10px; }
    .pipeline-intro {
        font-size: var(--font-size-base);
        padding: 0 var(--spacing-md);
    }
}

@media (prefers-reduced-motion: reduce) {
    .stage-panel,
    .scrolly-step-card,
    .dash-bar-fill,
    .spark-line,
    .spark-fill {
        transition: none !important;
    }
    .editor-caret, .term-caret, .dashboard-live-dot {
        animation: none !important;
    }
}


/* ===================================
   Nav menu swap (01/02/03 <-> 04/05)
   =================================== */
.nav-menu-swap { display: grid; }
.nav-menu-swap > .nav-menu {
    grid-area: 1 / 1;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    justify-self: end;
    transition: opacity 0.16s ease;
}
.nav-menu.is-hidden { opacity: 0; pointer-events: none; }

/* Clickable menu-swap affordance (⋯) */
.nav-dots {
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: 0;
    padding: 0 0.15em;
    margin: 0;
    font: inherit;
    letter-spacing: inherit;
    line-height: 1;
    color: var(--color-text);
    opacity: 0.4;
    cursor: pointer;
    transition: color 0.16s ease, opacity 0.16s ease;
}
.nav-dots:hover,
.nav-dots:focus-visible { color: #33dd66; opacity: 1; outline: none; }
.scramble-cursor::after {
    content: '\2588';
    margin-left: 1px;
    color: var(--color-hover, currentColor);
    animation: navCaretBlink 0.6s steps(1) infinite;
}
@keyframes navCaretBlink { 50% { opacity: 0; } }

/* Replay the active underline when a swapped-in menu appears */
.nav-link.line-reset::after { width: 0 !important; transition: none !important; }

/* Engineering code mockup — scroll-typed cursor */
.arch-caret {
    display: inline-block;
    width: 7px;
    height: 0.95em;
    background: currentColor;
    opacity: 0.7;
    vertical-align: text-bottom;
    animation: archCaretBlink 1s steps(1) infinite;
}
@keyframes archCaretBlink { 50% { opacity: 0; } }

/* ===================================
   Article Links (tech-coder themed)
   =================================== */
.article-link {
    display: inline-flex;
    flex-direction: column;
    gap: 5px;
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
    max-width: 100%;
}
.article-link-kicker {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.5px;
    opacity: 0.45;
    text-transform: lowercase;
}
.article-link-kicker .blink {
    animation: archCaretBlink 1.1s steps(1) infinite;
}
.article-link-row {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 15px;
    line-height: 1.45;
}
.article-link-prompt {
    color: var(--color-text);
    opacity: 0.55;
    flex-shrink: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.article-link-title {
    position: relative;
    background-image: linear-gradient(var(--color-text), var(--color-text));
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 0% 1.5px;
    transition: background-size 0.35s ease;
    padding-bottom: 5px;
}
.article-link-arrow {
    flex-shrink: 0;
    opacity: 0.55;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.article-link:hover .article-link-title {
    background-size: 100% 1.5px;
}
.article-link:hover .article-link-arrow {
    transform: translate(3px, -3px);
    opacity: 1;
}
.article-link:hover .article-link-prompt {
    transform: translateX(2px);
    opacity: 1;
}
@media (max-width: 768px) {
    .article-link-row { font-size: 13px; }
}

/* WWF logo slot — let transparent PNG show through (kill the default frame fill) */
#wwf-logo::part(frame) { background: transparent; }

/* ===================================
   How I Work — boot / screen-wake (light paper palette)
   =================================== */
.stage-boot {
    background-color: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    z-index: 4;
    overflow: visible;
    transition: none;
}
.boot-screen {
    position: absolute;
    inset: 0;
    padding: 30px 34px;
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.9;
    color: var(--color-text);
    overflow: hidden;
}
.boot-log { margin: 0; white-space: pre-wrap; word-break: break-word; }
.boot-row { display: block; }
.boot-log .b-dim { color: #9a917c; }
.boot-log .b-ok { color: #5f8a4f; }
.boot-log .b-accent { color: #b07d3a; }
.boot-cursor {
    display: inline-block;
    width: 8px;
    height: 1.05em;
    background: var(--color-text);
    vertical-align: text-bottom;
    margin-left: 2px;
    animation: bootBlink 1s steps(1) infinite;
}
@keyframes bootBlink { 50% { opacity: 0; } }


/* ===================================
   Mobile hero terminal sequence
   Phones only (767px, not 768px — an iPad in portrait is exactly 768px
   wide and must stay unaffected).
   =================================== */
@media (max-width: 767px) {
    /* The h1 becomes the positioning context for the animated overlay. */
    .hero-title.is-hero-seq {
        position: relative;
    }

    /* The real headline, kept in flow so the box is always the final size.
       visibility:hidden survives the JetBrains Mono webfont swap; a measured
       min-height taken before the swap would reserve the wrong height. */
    .hero-title.is-hero-seq .hero-title-ghost {
        visibility: hidden;
    }

    /* Animated text, overlaid on the ghost and centered in its box —
       the 16px command line sits inside a box sized for the headline. */
    .hero-title.is-hero-seq .hero-title-anim {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Flex items do not shrink below min-content by default. */
    .hero-title.is-hero-seq .hero-title-line {
        max-width: 100%;
    }

    /* Command phase: reads as a shell command, not a headline. Dropped once
       the file opens, so the headline inherits .hero-title's real type. */
    .hero-title.is-hero-seq .hero-title-anim.is-terminal {
        font-size: 16px;
        font-weight: 400;
        letter-spacing: 0;
    }

    /* vi's "file opened" status line — smaller and dimmer than the command,
       the way a real status line sits under the buffer. */
    .hero-title.is-hero-seq .hero-title-anim.is-status {
        font-size: 13px;
        font-weight: 400;
        letter-spacing: 0;
        opacity: 0.55;
    }

    /* Cursor held solid for the simulated Enter keypress. */
    .scramble-cursor.is-cursor-solid::after {
        animation: none;
        opacity: 1;
    }

    /* The headline's words, landing left to right as the file renders.
       inline-block is required for transform; words stay atomic and still
       wrap normally on the spaces between them. */
    .hero-title.is-hero-seq .hero-word {
        display: inline-block;
        opacity: 0;
        filter: blur(6px);
        transform: translateY(4px);
        transition:
            opacity 280ms ease-out,
            filter 280ms ease-out,
            transform 280ms cubic-bezier(0.2, 0.7, 0.3, 1);
    }

    .hero-title.is-hero-seq .hero-word.is-in {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }

    /* Subtitles wait for the sequence to resolve. */
    .hero.is-seq-hold .fade-in-delay {
        animation: none;
        opacity: 0;
    }

    /* Released with no delay — the stock rule's 0.3s would add dead time
       after an already two-second sequence. */
    .hero.is-seq-release .fade-in-delay {
        animation: fadeIn var(--transition-slow) ease-out both;
    }
}
