:root {
    --navy: #0F1A2E;
    --amber: #D4A04A;
    --parchment: #E8DFD0;
    --slate: #1E2D45;
    --tarnished: #A67C3B;
    --copper: #8B6B3D;
    --amber-wash: rgba(212, 160, 74, 0.1);
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Source Sans 3', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --split-position: 45%;
    --morph-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--navy);
    color: var(--parchment);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ================================
   HERO OVERLAY - Full-bleed opening
   ================================ */
#hero-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background-color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s var(--morph-ease);
    pointer-events: all;
}

#hero-overlay.split-complete {
    opacity: 0;
    pointer-events: none;
}

#hero-duotone-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(212, 160, 74, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(212, 160, 74, 0.04) 0%, transparent 50%),
        linear-gradient(180deg, var(--navy) 0%, var(--slate) 100%);
}

#hero-circuit-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.6;
}

#hero-circuit-pattern svg {
    width: 100%;
    height: 100%;
}

#hero-title {
    position: relative;
    z-index: 2;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(3rem, 10vw, 7rem);
    color: var(--amber);
    letter-spacing: 0.3em;
    display: flex;
    align-items: baseline;
    transition: letter-spacing 1.2s var(--morph-ease);
}

#hero-title.morph-tight {
    letter-spacing: 0.02em;
}

.hero-letter {
    display: inline-block;
    transform: translateY(var(--offset));
    transition: transform 1.2s var(--morph-ease);
}

#hero-title.morph-tight .hero-letter {
    transform: translateY(0);
}

/* ================================
   SPLIT LAYOUT
   ================================ */
#split-layout {
    display: flex;
    min-height: 100vh;
    opacity: 0;
    transition: opacity 0.8s ease-out 0.3s;
}

#split-layout.visible {
    opacity: 1;
}

/* Left panel: circuit trace atmosphere */
#circuit-panel {
    width: var(--split-position);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    background-color: var(--navy);
    overflow: hidden;
    z-index: 1;
}

#circuit-traces-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 400%;
    will-change: transform;
}

.circuit-layer {
    width: 100%;
    height: 100%;
}

/* Trace brightening on viewport intersection */
.trace-line {
    transition: opacity 0.8s ease-out;
}

.trace-line.bright {
    opacity: 0.5;
}

.via-hole {
    transition: opacity 0.6s ease-out, r 0.6s ease-out;
}

/* ================================
   SPLIT DIVIDER - Oscillating sine wave
   ================================ */
#split-divider {
    position: fixed;
    left: var(--split-position);
    top: 0;
    bottom: 0;
    width: 18px;
    margin-left: -9px;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

#split-divider.visible {
    opacity: 1;
}

#divider-svg {
    width: 100%;
    height: 100%;
}

#divider-path {
    vector-effect: non-scaling-stroke;
}

/* ================================
   CONTENT PANEL - Right side
   ================================ */
#content-panel {
    width: calc(100% - var(--split-position));
    margin-left: var(--split-position);
    position: relative;
    z-index: 2;
    padding-top: 100vh;
}

/* ================================
   CONTENT SECTIONS
   ================================ */
.content-section {
    padding: 120px 3rem 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.content-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Section counter: ordinal + amber rule */
.section-counter {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2rem;
}

.counter-num {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--amber);
    letter-spacing: 0.04em;
    min-width: 1.8em;
}

.counter-rule {
    flex: 1;
    max-width: 140px;
    height: 1px;
    background-color: var(--amber);
    opacity: 0.3;
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.8s var(--morph-ease);
}

.content-section.visible .counter-rule {
    transform: scaleX(1);
}

/* Section heading with oscilloscope wave underline */
.section-heading {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: var(--parchment);
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
    line-height: 1.3;
    position: relative;
    display: inline-block;
}

.section-heading::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 8px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 8'%3E%3Cpath d='M0,4 Q25,0 50,4 Q75,8 100,4 Q125,0 150,4 Q175,8 200,4' stroke='%23D4A04A' stroke-width='1' fill='none' opacity='0.25'/%3E%3C/svg%3E") repeat-x;
    background-size: 200px 8px;
    opacity: 0;
    transition: opacity 0.6s ease-out 0.4s;
}

.content-section.visible .section-heading::after {
    opacity: 1;
}

/* Body text */
.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    color: var(--parchment);
    max-width: 38em;
    margin-bottom: 1.5rem;
    opacity: 0.85;
}

/* Block quote */
.block-quote {
    margin: 2rem 0;
    padding-left: 1.5rem;
    border-left: 2px solid var(--amber);
}

.block-quote p {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    line-height: 1.5;
    color: var(--amber);
    margin-bottom: 0.75rem;
}

.block-quote cite {
    display: block;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.75rem;
    font-style: normal;
    color: var(--tarnished);
    letter-spacing: 0.06em;
}

/* ================================
   MORPH IMAGES - Duotone frames
   ================================ */
.section-image {
    margin-top: 2rem;
    overflow: hidden;
}

.morph-image {
    width: 60%;
    border-radius: 12px;
    transition: width 0.8s var(--morph-ease), border-radius 0.8s var(--morph-ease);
}

.morph-image.morphed {
    width: 100%;
    border-radius: 2px;
}

.duotone-frame {
    position: relative;
    overflow: hidden;
    background-color: var(--navy);
}

.duotone-frame svg {
    display: block;
    width: 100%;
    height: auto;
}

/* Duotone overlay effect on frame */
.duotone-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 26, 46, 0.3) 0%, rgba(212, 160, 74, 0.08) 100%);
    mix-blend-mode: multiply;
    pointer-events: none;
}

/* ================================
   MERGE MOMENTS - Full-width breather
   ================================ */
.merge-moment {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: calc(var(--split-position) * -1);
    width: calc(100% + var(--split-position));
    padding: 4rem;
    z-index: 20;
    opacity: 0;
    transition: opacity 1s ease-out;
}

.merge-moment.visible {
    opacity: 1;
}

.merge-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.merge-bg svg {
    width: 100%;
    height: 100%;
}

.merge-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--navy) 0%, transparent 15%, transparent 85%, var(--navy) 100%);
    z-index: 1;
}

.merge-quote {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 700px;
    border: none;
    padding: 0;
}

.merge-quote p {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    line-height: 1.4;
    color: var(--amber);
    margin-bottom: 1.5rem;
}

.merge-quote cite {
    display: block;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.8rem;
    font-style: normal;
    color: var(--tarnished);
    letter-spacing: 0.08em;
}

/* ================================
   FOOTER
   ================================ */
.content-footer {
    padding: 8rem 3rem 4rem;
    text-align: left;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.content-footer.visible {
    opacity: 1;
    transform: translateY(0);
}

.footer-wave {
    margin-bottom: 2rem;
    max-width: 300px;
}

.footer-wave svg {
    width: 100%;
    height: auto;
}

.footer-domain {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--amber);
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
}

.footer-colophon {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--tarnished);
    line-height: 1.7;
    max-width: 38em;
    opacity: 0.7;
}

/* ================================
   RESPONSIVE - Mobile (<768px)
   ================================ */
@media (max-width: 768px) {
    #hero-title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    #circuit-panel {
        display: none;
    }

    #split-divider {
        display: none;
    }

    #content-panel {
        width: 100%;
        margin-left: 0;
        padding-top: 100vh;
    }

    .content-section {
        padding: 3rem 1.5rem;
    }

    /* Mobile circuit strip dividers */
    .content-section::before {
        content: '';
        display: block;
        height: 80px;
        margin-bottom: 2rem;
        background:
            linear-gradient(0deg, transparent 39px, rgba(212, 160, 74, 0.08) 39px, rgba(212, 160, 74, 0.08) 40px, transparent 40px),
            linear-gradient(90deg, transparent 79px, rgba(212, 160, 74, 0.06) 79px, rgba(212, 160, 74, 0.06) 80px, transparent 80px);
        background-size: 40px 40px, 80px 80px;
        border-top: 1px solid rgba(212, 160, 74, 0.2);
    }

    .merge-moment {
        margin-left: 0;
        width: 100%;
        min-height: 50vh;
        padding: 3rem 1.5rem;
    }

    .morph-image {
        width: 100%;
        border-radius: 4px;
    }

    .content-footer {
        padding: 4rem 1.5rem 3rem;
    }
}

@media (max-width: 480px) {
    .body-text {
        font-size: 0.95rem;
    }

    .section-heading {
        font-size: 1.3rem;
    }
}
