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

:root {
    --lab-darkness: #0A1628;
    --twilight-navy: #1A2840;
    --focused-light: #E8EFF5;
    --dim-filament: #8A9BB5;
    --ethereal-ray: #7EB8DA;
    --prism-violet: #9B7EDA;
    --brass-instrument: #B8976A;
    --lens-flare: #D6E8F5;
    --spectral-amber: #E8C56A;
    --gradient-lens: radial-gradient(ellipse at center, rgba(126, 184, 218, 0.15) 0%, transparent 70%);
    --gradient-lab: linear-gradient(180deg, #0A1628 0%, #1A2840 50%, #0A1628 100%);
    --gradient-flare: radial-gradient(circle at center, rgba(214, 232, 245, 0.6) 0%, rgba(126, 184, 218, 0.2) 30%, transparent 60%);
}

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 1.75;
    color: var(--focused-light);
    background: var(--lab-darkness);
    overflow-x: hidden;
}

/* === TYPOGRAPHY === */
.section-heading {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 4.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--focused-light);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.section-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--focused-light);
    position: absolute;
    bottom: 20%;
    left: 8%;
    z-index: 10;
}

.section-subtitle {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 300;
    font-size: 2rem;
    letter-spacing: 0.08em;
    color: var(--dim-filament);
    position: absolute;
    bottom: 14%;
    left: 8%;
    z-index: 10;
}

.brass-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--brass-instrument);
}

/* === SNAP SECTIONS === */
.snap-section {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
    scroll-snap-align: start;
    background: var(--gradient-lab);
}

/* === PARALLAX BACKGROUND === */
.parallax-bg {
    position: absolute;
    inset: 0;
    background: var(--gradient-lens);
    z-index: 0;
}

/* === BRASS DETAILS === */
.brass-screw {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid var(--brass-instrument);
    z-index: 20;
}

.brass-screw::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 1px;
    right: 1px;
    height: 1px;
    background: var(--brass-instrument);
    transform: translateY(-50%);
}

.screw-tl { top: 20px; left: 20px; }
.screw-tr { top: 20px; right: 20px; }
.screw-bl { bottom: 20px; left: 20px; }
.screw-br { bottom: 20px; right: 20px; }

.label-top-left { position: absolute; top: 24px; left: 40px; z-index: 20; }
.label-top-right { position: absolute; top: 24px; right: 40px; z-index: 20; }
.label-bottom-left { position: absolute; bottom: 24px; left: 40px; z-index: 20; }
.label-bottom-right { position: absolute; bottom: 24px; right: 40px; z-index: 20; }

/* === RIGHT NAV === */
#right-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.nav-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--brass-instrument);
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.4s ease;
}

.nav-dot.active {
    background: var(--ethereal-ray);
    border-color: var(--ethereal-ray);
    box-shadow: 0 0 12px rgba(126, 184, 218, 0.6);
}

.nav-label {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--brass-instrument);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.nav-dot:hover .nav-label {
    opacity: 1;
}

/* === LENS FLARE SYSTEM === */
.lens-flare {
    position: absolute;
    z-index: 5;
    pointer-events: none;
}

.flare-bloom {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: var(--gradient-flare);
    position: absolute;
}

.flare-hex {
    position: absolute;
    background: rgba(126, 184, 218, 0.12);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.hex-1 { width: 60px; height: 60px; }
.hex-2 { width: 40px; height: 40px; }
.hex-3 { width: 25px; height: 25px; }

.flare-streak {
    width: 250px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(214, 232, 245, 0.4), transparent);
    position: absolute;
}

/* Flare positions per section */
.flare-prism { top: 15%; right: 20%; }
.flare-prism .flare-bloom { top: 0; left: 0; }
.flare-prism .hex-1 { top: 60px; left: 180px; }
.flare-prism .hex-2 { top: 120px; left: 240px; }
.flare-prism .hex-3 { top: 30px; left: 280px; }
.flare-prism .flare-streak { top: 75px; left: -50px; }

.flare-lens { top: 10%; left: 15%; }
.flare-lens .flare-bloom { top: 0; left: 0; }
.flare-lens .hex-1 { top: 80px; left: 160px; }
.flare-lens .hex-2 { top: 40px; left: 220px; }
.flare-lens .flare-streak { top: 70px; left: -30px; }

.flare-aperture { bottom: 20%; right: 25%; }
.flare-aperture .flare-bloom { top: 0; left: 0; }
.flare-aperture .hex-1 { top: 50px; left: 170px; }
.flare-aperture .flare-streak { top: 65px; left: -40px; }

.flare-mirror { top: 20%; left: 50%; }
.flare-mirror .flare-bloom { top: 0; left: 0; }
.flare-mirror .hex-1 { top: 70px; left: 140px; }
.flare-mirror .flare-streak { top: 60px; left: -20px; }

.flare-grating { top: 15%; right: 15%; }
.flare-grating .flare-bloom { top: 0; left: 0; }
.flare-grating .hex-1 { top: 55px; left: 155px; }
.flare-grating .flare-streak { top: 70px; left: -45px; }

.flare-fiber { bottom: 25%; left: 10%; }
.flare-fiber .flare-bloom { top: 0; left: 0; }
.flare-fiber .hex-1 { top: 65px; left: 160px; }
.flare-fiber .flare-streak { top: 55px; left: -25px; }

/* === SECTION 1: PRISM === */
.prism-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 400px;
    z-index: 5;
}

.prism-shape {
    position: absolute;
    top: 50%;
    left: 40%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 140px;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    background: linear-gradient(135deg, rgba(126, 184, 218, 0.25), rgba(155, 126, 218, 0.15));
    border: none;
}

.prism-inner {
    position: absolute;
    inset: 3px;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    background: linear-gradient(135deg, rgba(232, 197, 106, 0.1), rgba(126, 184, 218, 0.15), rgba(155, 126, 218, 0.1));
}

.beam-input {
    position: absolute;
    top: 50%;
    left: 0;
    width: 38%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--focused-light));
    transform: translateY(-50%);
}

.spectral-rays {
    position: absolute;
    top: 25%;
    left: 55%;
    width: 45%;
    height: 60%;
}

.ray {
    position: absolute;
    left: 0;
    height: 1px;
    width: 100%;
    transform-origin: left center;
    opacity: 0.7;
}

.ray-word {
    position: absolute;
    right: 0;
    top: -12px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ray-1 { top: 0%; background: var(--spectral-amber); transform: rotate(-15deg); }
.ray-1 .ray-word { color: var(--spectral-amber); }
.ray-2 { top: 14%; background: var(--brass-instrument); transform: rotate(-10deg); }
.ray-2 .ray-word { color: var(--brass-instrument); }
.ray-3 { top: 28%; background: var(--ethereal-ray); transform: rotate(-5deg); }
.ray-3 .ray-word { color: var(--ethereal-ray); }
.ray-4 { top: 42%; background: var(--focused-light); transform: rotate(0deg); }
.ray-4 .ray-word { color: var(--focused-light); }
.ray-5 { top: 56%; background: var(--prism-violet); transform: rotate(5deg); }
.ray-5 .ray-word { color: var(--prism-violet); }
.ray-6 { top: 70%; background: var(--dim-filament); transform: rotate(10deg); }
.ray-6 .ray-word { color: var(--dim-filament); }
.ray-7 { top: 84%; background: var(--lens-flare); transform: rotate(15deg); }
.ray-7 .ray-word { color: var(--lens-flare); }

.prism-title {
    text-shadow: 0 0 60px rgba(126, 184, 218, 0.3);
}

/* === SECTION 2: CONVEX LENS === */
.convex-lens-shape {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(126, 184, 218, 0.08) 0%, transparent 70%);
    border: 1px solid rgba(126, 184, 218, 0.15);
    z-index: 2;
}

.focus-plane {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10% 15%;
    z-index: 5;
}

.focus-block {
    max-width: 600px;
    padding: 2rem;
    margin: 1rem 0;
    transition: filter 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease;
}

.focus-block.depth-far {
    filter: blur(6px);
    opacity: 0.3;
}

.focus-block.depth-mid {
    filter: blur(3px);
    opacity: 0.5;
}

.focus-block.depth-near {
    filter: blur(0px);
    opacity: 1;
}

.focus-block.active {
    filter: blur(0px) !important;
    opacity: 1 !important;
}

/* === SECTION 3: APERTURE === */
.aperture-iris {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 350px;
    height: 350px;
    z-index: 3;
}

.blade {
    position: absolute;
    width: 160px;
    height: 28px;
    border-radius: 14px;
    background: linear-gradient(180deg, #1e3050, var(--twilight-navy));
    border: 1px solid var(--brass-instrument);
    top: 50%;
    left: 50%;
    transform-origin: 0% 50%;
    transform: rotate(calc(var(--blade-index) * 45deg)) translateX(30px);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.aperture-iris.open .blade {
    transform: rotate(calc(var(--blade-index) * 45deg)) translateX(90px);
}

.aperture-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10% 15%;
    z-index: 5;
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease 0.3s;
}

.aperture-iris.open ~ .aperture-content {
    opacity: 1;
}

.concept-grid {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
}

.concept-item {
    flex: 1;
    padding: 1.5rem;
    border: 1px solid rgba(184, 151, 106, 0.3);
    border-radius: 4px;
}

.concept-item .brass-label {
    display: block;
    margin-bottom: 0.5rem;
}

.concept-item p {
    font-size: 0.95rem;
    color: var(--dim-filament);
}

/* === SECTION 4: MIRROR === */
.mirror-array {
    position: absolute;
    inset: 0;
    display: flex;
    z-index: 5;
}

.mirror-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8%;
}

.panel-left {
    transform: perspective(800px) rotateY(8deg);
    transform-origin: right center;
}

.panel-right.reflection {
    transform: perspective(800px) rotateY(-8deg) scaleX(-1);
    transform-origin: left center;
    opacity: 0.2;
    filter: blur(1px);
    color: var(--dim-filament);
}

.mirror-divider {
    position: absolute;
    top: 10%;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
}

/* === SECTION 5: DIFFRACTION GRATING === */
.grating-overlay {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 3px,
        rgba(26, 40, 64, 0.5) 3px,
        rgba(26, 40, 64, 0.5) 4px
    );
    z-index: 3;
    pointer-events: none;
}

.grating-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10% 18%;
    z-index: 5;
    text-align: center;
}

.spectrum-bar {
    display: flex;
    width: 100%;
    max-width: 500px;
    height: 4px;
    margin: 2rem 0;
    border-radius: 2px;
    overflow: hidden;
}

.spectrum-segment {
    flex: 1;
}

.analysis-items {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
}

.analysis-item {
    flex: 1;
    text-align: center;
}

.analysis-item .brass-label {
    display: block;
    margin-bottom: 0.5rem;
}

.analysis-item p {
    font-size: 0.95rem;
    color: var(--dim-filament);
}

/* === SECTION 6: FIBER OPTIC === */
.fiber-paths {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
}

.fiber-line {
    fill: none;
    stroke: var(--ethereal-ray);
    stroke-width: 1.5;
    opacity: 0.4;
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 2s ease-out;
}

.fiber-line.animated {
    stroke-dashoffset: 0;
}

.fiber-node {
    fill: var(--ethereal-ray);
    opacity: 0;
    transition: opacity 0.8s ease;
}

.fiber-node.visible {
    opacity: 0.8;
}

.fiber-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 550px;
    text-align: center;
    z-index: 5;
    padding: 3rem;
    background: rgba(10, 22, 40, 0.8);
    border: 1px solid rgba(184, 151, 106, 0.2);
    border-radius: 4px;
}

/* === SECTION 7: FOCAL POINT === */
#section-focal {
    transition: background-color 2s ease-in-out;
}

#section-focal.illuminated {
    background: linear-gradient(180deg, var(--twilight-navy) 0%, var(--lens-flare) 100%);
}

#section-focal.illuminated .focal-heading,
#section-focal.illuminated .focal-text {
    color: var(--lab-darkness);
}

#section-focal.illuminated .brass-label {
    color: var(--brass-instrument);
}

.focal-bloom {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--gradient-flare);
    z-index: 2;
    transition: width 2s ease-in-out, height 2s ease-in-out;
}

#section-focal.illuminated .focal-bloom {
    width: 120vmax;
    height: 120vmax;
}

.convergence-lines {
    position: absolute;
    inset: 0;
    z-index: 3;
}

.convergence-svg {
    width: 100%;
    height: 100%;
}

.conv-line {
    stroke: rgba(126, 184, 218, 0.2);
    stroke-width: 1;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.5s ease-out;
}

.conv-line.animated {
    stroke-dashoffset: 0;
}

.focal-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10% 20%;
    text-align: center;
    z-index: 5;
}

.focal-heading {
    transition: filter 1.5s ease, color 2s ease;
    filter: blur(6px);
}

.focal-text {
    transition: filter 1.5s ease 0.3s, color 2s ease;
    filter: blur(4px);
    max-width: 600px;
}

#section-focal.illuminated .focal-heading {
    filter: blur(0px);
}

#section-focal.illuminated .focal-text {
    filter: blur(0px);
}

.focal-symbol {
    font-size: 3rem;
    color: var(--ethereal-ray);
    margin-top: 2rem;
    opacity: 0;
    transition: opacity 1.5s ease 0.8s;
}

#section-focal.illuminated .focal-symbol {
    opacity: 1;
}

/* === LIGHT PARTICLES (section 1 bg) === */
.light-particles {
    position: absolute;
    inset: 0;
}

.light-particles::before,
.light-particles::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(126, 184, 218, 0.3);
    animation: float-particle 8s infinite ease-in-out;
}

.light-particles::before {
    top: 30%;
    left: 60%;
    animation-delay: 0s;
}

.light-particles::after {
    top: 60%;
    left: 30%;
    animation-delay: 4s;
}

@keyframes float-particle {
    0%, 100% { transform: translate(0, 0); opacity: 0.3; }
    50% { transform: translate(20px, -30px); opacity: 0.7; }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .section-heading {
        font-size: 2.67rem;
    }

    .section-title {
        font-size: 4rem;
    }

    .section-subtitle {
        font-size: 1.2rem;
    }

    .concept-grid,
    .analysis-items {
        flex-direction: column;
        gap: 1rem;
    }

    .mirror-array {
        flex-direction: column;
    }

    .panel-left,
    .panel-right.reflection {
        transform: none;
    }

    .prism-container {
        width: 90%;
    }

    .focus-plane {
        padding: 10% 8%;
    }

    .grating-content {
        padding: 10% 8%;
    }

    #right-nav {
        right: 12px;
    }

    .nav-dot {
        width: 12px;
        height: 12px;
    }
}
