/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background: #2C2420;
    color: #EDE4D8;
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
}

body {
    background: #2C2420;
    overflow-x: hidden;
    position: relative;
    /* palette: #3D3530 #8B4A2B #F2EBE0 */
}

/* ===== HERO ===== */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#hero-field-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 0 2rem;
}

#hero-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #8A9185;
    background: linear-gradient(transparent, transparent); /* #F2EBE0 alt cream */
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeInUp 1s ease 0.5s forwards;
}

#hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 700;
    color: #EDE4D8;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeInUp 1s ease 0.8s forwards;
}

#hero-title .dot {
    color: #D4845A;
}

#hero-equation {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1rem, 2vw, 1.4rem);
    font-weight: 400;
    color: #D4845A;
    letter-spacing: 0.15em;
    margin-bottom: 0.75rem;
    opacity: 0;
    animation: fadeInUp 1s ease 1.1s forwards;
}

#hero-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    color: #A0836C;
    letter-spacing: 0.05em;
    opacity: 0;
    animation: fadeInUp 1s ease 1.4s forwards;
}

#scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 38.2%;
    transform: translateX(-50%);
    z-index: 1;
    opacity: 0;
    animation: fadeIn 1s ease 2s forwards;
}

#scroll-line {
    width: 2px;
    height: 40px;
    background: #D4845A;
    animation: scrollPulse 2s ease-in-out infinite;
}

/* ===== TIMELINE SPINE ===== */
#timeline-spine {
    position: fixed;
    top: 0;
    left: 38.2%;
    width: 2px;
    height: 100vh;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        #C2714F 15%,
        #C2714F 85%,
        transparent 100%
    );
    z-index: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

#timeline-spine.visible {
    opacity: 1;
}

/* ===== TIMELINE ===== */
#timeline {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 2rem 8rem;
    z-index: 1;
}

/* ===== TIMELINE NODES ===== */
.timeline-node {
    position: relative;
    margin-bottom: 6rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.timeline-node.visible {
    opacity: 1;
    transform: translateY(0);
}

.node-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #D4845A;
    border: 1px solid #8B4A2B;
    border-radius: 50%;
    top: 0.5rem;
    z-index: 2;
}

.node-year {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: #C2714F;
    position: absolute;
    top: 0.25rem;
}

.node-content {
    max-width: 480px;
}

/* Right-aligned nodes (content to the right of spine) */
.node-right {
    padding-left: calc(38.2% + 40px);
}

.node-right .node-dot {
    left: calc(38.2% - 5px);
}

.node-right .node-year {
    left: calc(38.2% + 20px);
}

.node-right .node-content {
    margin-top: 2rem;
}

/* Left-aligned nodes (content to the left of spine) */
.node-left {
    padding-right: calc(61.8% + 40px);
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.node-left .node-dot {
    left: calc(38.2% - 5px);
}

.node-left .node-year {
    right: calc(61.8% + 20px);
    left: auto;
}

.node-left .node-content {
    margin-top: 2rem;
    margin-right: calc(61.8% + 40px - 100% + 480px);
}

.node-left .node-content {
    margin-top: 2rem;
}

/* ===== NODE CONTENT STYLES ===== */
.node-content h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    font-weight: 600;
    color: #F2EBE0;
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.node-content p {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    color: #A0836C;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.wheat-paste-note {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: #D4845A;
    border-left: 2px solid #C2714F;
    padding-left: 1rem;
    margin-top: 1rem;
    font-style: italic;
    letter-spacing: 0.02em;
}

.node-left .wheat-paste-note {
    border-left: none;
    border-right: 2px solid #C2714F;
    padding-left: 0;
    padding-right: 1rem;
}

/* ===== FIELD DIAGRAMS ===== */
.field-diagram {
    margin-top: 1.5rem;
    opacity: 0.8;
}

.field-diagram svg {
    width: 100%;
    max-width: 200px;
    height: auto;
}

.node-left .field-diagram {
    display: flex;
    justify-content: flex-end;
}

/* ===== FOOTER / CODA ===== */
#coda {
    position: relative;
    padding: 8rem 2rem 4rem;
    text-align: center;
    overflow: hidden;
}

#coda-field-lines {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 200px;
    opacity: 0.3;
}

#coda-field-lines svg {
    width: 100%;
    height: 100%;
}

#coda-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    color: #EDE4D8;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
    margin-bottom: 1rem;
}

#coda-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    color: #3D3530;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scrollPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scaleY(0.6);
        transform-origin: top;
    }
    50% {
        opacity: 1;
        transform: scaleY(1);
        transform-origin: top;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .node-right {
        padding-left: 3rem;
    }
    
    .node-left {
        padding-right: 0;
        padding-left: 3rem;
        text-align: left;
        align-items: flex-start;
    }
    
    .node-left .wheat-paste-note {
        border-right: none;
        border-left: 2px solid #C2714F;
        padding-right: 0;
        padding-left: 1rem;
    }
    
    .node-left .field-diagram {
        justify-content: flex-start;
    }
    
    .node-dot {
        left: 0 !important;
    }
    
    .node-year {
        left: 20px !important;
        right: auto !important;
    }
    
    #timeline-spine {
        left: 5px;
    }
    
    #scroll-indicator {
        left: 50%;
    }
    
    .node-left .node-content,
    .node-right .node-content {
        max-width: 100%;
    }
}

/* ===== GRAIN OVERLAY ===== */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}
