:root {
    --cream: #FFF5E6;
    --terra: #E8C4A0;
    --honey: #D4892C;
    --coral: #E07A5F;
    --text: #3D2C1E;
    --muted: #7A6252;
    --glow: #F0C674;
    --blush: #FFE0CC;
    --burgundy: #8B3A3A;
    --font-display: 'Baloo 2', cursive;
    --font-body: 'Nunito', sans-serif;
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    font-size: 16px;
    overflow-x: hidden;
}

body {
    background: var(--cream);
    color: var(--text);
    font-family: var(--font-body);
    overflow-x: hidden;
    overflow-y: auto;
}

/* ===== Progress Bar ===== */
.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(212, 137, 44, 0.15);
    z-index: 200;
}

.progress-fill {
    height: 100%;
    background: var(--honey);
    width: 0%;
    will-change: width;
    transition: width 0.08s linear;
}

/* ===== Scroll Container ===== */
.scroll-container {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

.horizontal-track {
    display: flex;
    flex-wrap: nowrap;
    width: 600vw;
    will-change: transform;
    transform: translateZ(0);
}

/* ===== Panels ===== */
.panel {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 4rem;
    position: relative;
    flex-shrink: 0;
    background: var(--cream);
    overflow: hidden;
    will-change: opacity;
}

.panel-warm {
    background: var(--terra);
}

.panel-content {
    max-width: 520px;
    text-align: center;
    position: relative;
    z-index: 10;
}

/* ===== Hero ===== */
.hero-content {
    z-index: 10;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(3.5rem, 10vw, 8rem);
    color: var(--text);
    line-height: 1;
    margin-bottom: 1rem;
    position: relative;
}

.letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(40px);
    animation: letterIn 0.6s var(--spring) forwards;
}

.letter:nth-child(1)  { animation-delay: 0.1s; }
.letter:nth-child(2)  { animation-delay: 0.16s; }
.letter:nth-child(3)  { animation-delay: 0.22s; }
.letter:nth-child(4)  { animation-delay: 0.28s; }
.letter:nth-child(5)  { animation-delay: 0.34s; }
.letter:nth-child(6)  { animation-delay: 0.40s; }
.letter:nth-child(7)  { animation-delay: 0.46s; }
.letter:nth-child(8)  { animation-delay: 0.52s; }
.letter:nth-child(9)  { animation-delay: 0.58s; }
.letter:nth-child(10) { animation-delay: 0.64s; }
.letter:nth-child(11) { animation-delay: 0.70s; }
.letter:nth-child(12) { animation-delay: 0.76s; }

@keyframes letterIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title.assembled .letter {
    animation: none;
    opacity: 1;
    transform: translateY(0);
}

.hero-title.breathing {
    animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.015); }
}

.hero-sub {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    color: var(--muted);
    font-weight: 400;
    line-height: 1.7;
}

.hero-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vmin;
    height: 80vmin;
    z-index: 1;
    opacity: 0.4;
    pointer-events: none;
}

/* ===== Circuit Background SVGs ===== */
.circuit-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.trace-path {
    stroke-linecap: round;
    will-change: stroke-dashoffset;
}

.trace-path.drawn {
    transition: stroke-dashoffset 2.5s ease-out;
    stroke-dashoffset: 0 !important;
}

/* ===== Node Dots ===== */
.node-dot {
    animation: nodePulse 3s ease-in-out infinite;
}

@keyframes nodePulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.node-dot:nth-child(even) {
    animation-delay: 1s;
}

.node-dot:nth-child(3n) {
    animation-delay: 1.8s;
}

/* ===== Strata Layers (Panel 2) ===== */
.strata-layer {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 2;
    pointer-events: none;
}

.strata-1 {
    bottom: 0;
    height: 25%;
    background: linear-gradient(to top, #8B3A3A, transparent);
    opacity: 0.15;
    border-top: 2px dashed rgba(240, 198, 116, 0.2);
}

.strata-2 {
    bottom: 15%;
    height: 20%;
    background: linear-gradient(to top, #D4892C, transparent);
    opacity: 0.12;
    border-top: 2px dashed rgba(240, 198, 116, 0.15);
}

.strata-3 {
    bottom: 28%;
    height: 15%;
    background: linear-gradient(to top, #E8C4A0, transparent);
    opacity: 0.1;
    border-top: 2px dashed rgba(240, 198, 116, 0.1);
}

/* ===== Panel Labels / Headings / Body ===== */
.panel-label {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--honey);
    display: block;
    margin-bottom: 1rem;
}

.panel-warm .panel-label {
    color: var(--text);
}

.panel-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 4.8rem);
    color: var(--text);
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.panel-heading-final {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

.panel-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.7;
    color: var(--text);
    max-width: 42ch;
    margin: 0 auto 1.5rem;
}

.panel-body:last-child {
    margin-bottom: 0;
}

/* ===== Panel Dividers ===== */
.panel-divider {
    position: absolute;
    right: -2px;
    top: 0;
    bottom: 0;
    width: 80px;
    z-index: 5;
    pointer-events: none;
}

.panel-divider svg {
    width: 100%;
    height: 100%;
}

/* ===== Chain Links (Panel 3) ===== */
.chain-links {
    position: absolute;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0;
    z-index: 5;
}

.chain-link {
    width: 100px;
    height: 60px;
    background: var(--blush);
    border: 2px solid var(--honey);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

.link-inner {
    text-align: center;
}

.link-label {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text);
}

.chain-connector {
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chain-connector svg {
    display: block;
}

/* ===== Data Packets ===== */
.data-packet {
    position: absolute;
    width: 16px;
    height: 12px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    animation: packetMove 10s linear infinite;
}

.data-packet::before {
    content: '';
    display: block;
    width: 16px;
    height: 12px;
    background: var(--coral);
    border: 1.5px solid var(--text);
    border-radius: 4px;
}

.data-packet::after {
    content: '>';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8px;
    color: var(--cream);
    line-height: 1;
    font-weight: 700;
}

@keyframes packetMove {
    0% { left: -8px; opacity: 0; }
    5% { opacity: 1; }
    90% { opacity: 1; }
    100% { left: 52px; opacity: 0; }
}

/* ===== Cross Section (Panel 4) ===== */
.cross-section {
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    max-width: 500px;
    z-index: 5;
}

.layer-band {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    position: relative;
}

.layer-l1 {
    background: linear-gradient(135deg, rgba(139, 58, 58, 0.2), rgba(212, 137, 44, 0.15));
    border: 1px dashed rgba(240, 198, 116, 0.3);
    margin-bottom: 0.5rem;
}

.layer-l2 {
    background: linear-gradient(135deg, rgba(224, 122, 95, 0.15), rgba(240, 198, 116, 0.2));
    border: 1px dashed rgba(240, 198, 116, 0.4);
}

.layer-band-label {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-right: auto;
}

.rollup-bundle {
    cursor: default;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

/* ===== Hover-Lift ===== */
.hover-lift {
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(61, 44, 30, 0.15);
}

/* ===== Constellation (Panel 5) ===== */
.constellation {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 700px;
    z-index: 3;
    pointer-events: none;
}

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

.constellation-node {
    pointer-events: auto;
    cursor: default;
    transition: transform 0.3s ease-out;
}

/* ===== Closing Panel ===== */
.closing-domain {
    margin-top: 2.5rem;
}

.closing-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--honey);
    letter-spacing: 0.02em;
    opacity: 0.7;
}

/* ===== Dot Navigation ===== */
.dot-nav {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.75rem;
    z-index: 200;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: none;
    background: var(--muted);
    opacity: 0.4;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease-out;
}

.dot.active {
    width: 10px;
    height: 10px;
    background: var(--honey);
    opacity: 1;
    box-shadow: 0 0 0 2px var(--coral);
    transform: translateY(-2px);
}

/* ===== Fade Reveal ===== */
.fade-reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease-out, transform 0.6s var(--spring);
}

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

/* ===== Panel Opacity Transitions ===== */
.panel.panel-dimmed {
    opacity: 0.85;
}

.panel.panel-active {
    opacity: 1;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
    .scroll-container {
        position: static;
        height: auto;
        overflow: visible;
    }

    .horizontal-track {
        flex-direction: column;
        width: 100%;
        transform: none !important;
    }

    .panel {
        width: 100%;
        min-height: 100vh;
        height: auto;
        padding: 3rem 1.5rem;
    }

    .dot-nav {
        display: none;
    }

    .progress-bar {
        left: auto;
        right: 0;
        bottom: auto;
        top: 0;
        width: 4px;
        height: 100%;
    }

    .progress-fill {
        width: 100%;
        height: 0%;
        transition: height 0.1s linear;
    }

    .chain-links {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        flex-wrap: wrap;
        justify-content: center;
        margin-bottom: 2rem;
        gap: 0.5rem;
    }

    .chain-link {
        width: 80px;
        height: 48px;
    }

    .chain-connector {
        width: 40px;
    }

    .cross-section {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        width: 90%;
        margin: 0 auto 2rem;
    }

    .constellation {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 95%;
        margin: 0 auto 2rem;
    }

    .hero-rings {
        width: 100vmin;
        opacity: 0.2;
    }

    .strata-layer {
        opacity: 0.08;
    }
}

@media (max-width: 480px) {
    .panel-heading {
        font-size: 2rem;
    }

    .panel-body {
        font-size: 1rem;
    }

    .hero-title {
        font-size: 3rem;
    }

    .chain-links {
        gap: 0.25rem;
    }

    .chain-link {
        width: 64px;
        height: 40px;
    }

    .link-label {
        font-size: 0.55rem;
    }

    .chain-connector {
        width: 30px;
    }
}
