/* ============================================
   genpatsu.io — Design Tokens
   ============================================ */

:root {
    --forest-black: #0A1F15;
    --reactor-green: #1B5E3B;
    --aurora-phosphor: #39FF7B;
    --cherenkov-blue: #00A3E0;
    --instrument-cream: #E8E0D0;
    --muted-sage: #4A6B5A;
    --warning-amber: #C4850C;
    --panel-gray: #162B20;
    --bezel-green: #0B3D2E;
    --font-display: 'Chakra Petch', sans-serif;
    --font-body: 'IBM Plex Mono', monospace;
    --font-annotation: 'Share Tech Mono', monospace;
    --inset-x: 8vw;
    --inset-y: 10vh;
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--forest-black);
    color: var(--instrument-cream);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.75;
    letter-spacing: 0.02em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Scanline Overlay (CRT effect)
   ============================================ */

#scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(10, 31, 21, 0.15) 2px,
        rgba(10, 31, 21, 0.15) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* ============================================
   Geiger Counter Particles
   ============================================ */

#geiger-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
}

.geiger-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background-color: var(--aurora-phosphor);
    border-radius: 50%;
    opacity: 0;
    animation: particle-fade 1.5s ease-out forwards;
}

@keyframes particle-fade {
    0% {
        opacity: 0.8;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* ============================================
   Instrument Strip (Left Nav)
   ============================================ */

#instrument-strip {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    z-index: 100;
    padding: 16px 0;
    background: linear-gradient(180deg, transparent, rgba(22, 43, 32, 0.6) 20%, rgba(22, 43, 32, 0.6) 80%, transparent);
}

.strip-pip {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.pip-dot {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--reactor-green);
    background: transparent;
    transition: background-color 0.5s ease, box-shadow 0.3s ease, border-color 0.5s ease;
}

.strip-pip.active .pip-dot {
    background-color: var(--aurora-phosphor);
    border-color: var(--aurora-phosphor);
    box-shadow: 0 0 8px var(--aurora-phosphor);
}

.strip-pip .pip-dot:hover {
    box-shadow: 0 0 24px var(--aurora-phosphor);
}

/* ============================================
   Panel (Section) Base
   ============================================ */

.panel {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
}

.panel-viewport {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: var(--inset-y) var(--inset-x);
    padding-left: calc(var(--inset-x) + 48px);
    border: 2px solid var(--bezel-green);
    border-left: none;
    border-right: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ============================================
   Grid Underlay
   ============================================ */

.grid-underlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   Z-Pattern Content Layout
   ============================================ */

.z-content {
    position: relative;
    z-index: 2;
}

.z-content--left {
    max-width: 50%;
    margin-right: auto;
}

.z-content--right {
    max-width: 45%;
    margin-left: auto;
    margin-top: 3rem;
}

.z-content--wide-right {
    max-width: 65%;
    margin-left: auto;
}

/* ============================================
   Z-Path Waypoints
   ============================================ */

.z-waypoint {
    position: absolute;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.z-waypoint--bottom-right {
    bottom: 5%;
    right: 15%;
}

.z-waypoint--center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.waypoint-dot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--aurora-phosphor);
    box-shadow: 0 0 8px var(--aurora-phosphor);
    animation: pulse-indicator 4s ease-in-out infinite;
}

.waypoint-dot--amber {
    background-color: var(--warning-amber);
    box-shadow: 0 0 8px var(--warning-amber);
    animation: pulse-indicator-amber 4s ease-in-out infinite;
}

@keyframes pulse-indicator {
    0%, 100% {
        box-shadow: 0 0 8px var(--aurora-phosphor);
        opacity: 0.7;
    }
    50% {
        box-shadow: 0 0 20px var(--aurora-phosphor);
        opacity: 1;
    }
}

@keyframes pulse-indicator-amber {
    0%, 100% {
        box-shadow: 0 0 8px var(--warning-amber);
        opacity: 0.7;
    }
    50% {
        box-shadow: 0 0 20px var(--warning-amber);
        opacity: 1;
    }
}

/* ============================================
   Z-Path Connector Lines
   ============================================ */

.z-connector {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* ============================================
   Section Headings
   ============================================ */

.section-heading-group {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 2rem;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--instrument-cream);
    line-height: 1.1;
}

.section-heading--amber {
    color: var(--warning-amber);
}

.section-heading--decommission {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2rem, 4.5vw, 3.8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cherenkov-blue);
    text-align: center;
    margin-bottom: 3rem;
}

/* ============================================
   Reactor Rod Indicator Bars
   ============================================ */

.reactor-rod-bar {
    width: 8px;
    height: 80px;
    border-radius: 2px;
    flex-shrink: 0;
}

.rod-bar--green {
    background: linear-gradient(to top, var(--reactor-green), var(--aurora-phosphor));
    animation: rod-rise 6s ease-in-out infinite alternate;
}

.rod-bar--amber {
    background: linear-gradient(to top, #6B4A08, var(--warning-amber));
    animation: rod-rise 6s ease-in-out infinite alternate;
}

@keyframes rod-rise {
    0% {
        height: 40px;
    }
    100% {
        height: 120px;
    }
}

/* ============================================
   Typography
   ============================================ */

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.75;
    letter-spacing: 0.02em;
    color: var(--instrument-cream);
    margin-bottom: 1.5rem;
}

.body-text--incident {
    line-height: 1.5;
    letter-spacing: 0.01em;
}

.body-text--centered {
    text-align: center;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1.5rem;
}

.annotation-text {
    font-family: var(--font-annotation);
    font-weight: 400;
    font-size: clamp(0.7rem, 0.8vw, 0.85rem);
    color: var(--muted-sage);
    opacity: 0.7;
    margin-top: 1rem;
}

.annotation-text--amber {
    color: var(--warning-amber);
    opacity: 0.7;
}

.annotation-text--centered {
    text-align: center;
    display: block;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   SECTION 1: IGNITION
   ============================================ */

#ignition .panel-viewport {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    position: relative;
}

.aurora-curtain {
    position: absolute;
    width: 100%;
    pointer-events: none;
    z-index: 1;
}

.aurora-curtain--top {
    top: 0;
    left: 0;
    height: 60%;
}

.aurora-curtain--bottom {
    bottom: 0;
    left: 0;
    height: 50%;
}

.aurora-curtain svg {
    width: 100%;
    height: 100%;
}

/* Aurora path animations */
.aurora-path-1 { animation: aurora-drift-1 15s ease-in-out infinite alternate; }
.aurora-path-2 { animation: aurora-drift-2 19s ease-in-out infinite alternate; }
.aurora-path-3 { animation: aurora-drift-3 22s ease-in-out infinite alternate; }
.aurora-path-4 { animation: aurora-drift-4 17s ease-in-out infinite alternate; }
.aurora-path-5 { animation: aurora-drift-5 25s ease-in-out infinite alternate; }

.aurora-path-b1 { animation: aurora-drift-1 18s ease-in-out infinite alternate; }
.aurora-path-b2 { animation: aurora-drift-2 14s ease-in-out infinite alternate; }
.aurora-path-b3 { animation: aurora-drift-3 20s ease-in-out infinite alternate; }
.aurora-path-b4 { animation: aurora-drift-4 23s ease-in-out infinite alternate; }
.aurora-path-b5 { animation: aurora-drift-5 16s ease-in-out infinite alternate; }

@keyframes aurora-drift-1 {
    0% { transform: translateX(0) scaleY(1); }
    100% { transform: translateX(-30px) scaleY(1.1); }
}

@keyframes aurora-drift-2 {
    0% { transform: translateX(0) scaleY(1); }
    100% { transform: translateX(25px) scaleY(0.9); }
}

@keyframes aurora-drift-3 {
    0% { transform: translateX(0) scaleY(1); }
    100% { transform: translateX(-20px) scaleY(1.15); }
}

@keyframes aurora-drift-4 {
    0% { transform: translateX(0) scaleY(1); }
    100% { transform: translateX(35px) scaleY(0.95); }
}

@keyframes aurora-drift-5 {
    0% { transform: translateX(0) scaleY(1); }
    100% { transform: translateX(-15px) scaleY(1.05); }
}

.ignition-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.site-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3rem, 6vw, 5.5rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--instrument-cream);
    line-height: 1.1;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 40px rgba(57, 255, 123, 0.15);
}

.site-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.85rem, 1vw, 1rem);
    color: var(--muted-sage);
    letter-spacing: 0.08em;
}

/* ============================================
   Scanline Dividers
   ============================================ */

.scanline-divider {
    width: 100%;
    height: 120px;
    background: repeating-linear-gradient(
        var(--forest-black),
        var(--forest-black) 3px,
        var(--reactor-green) 3px,
        var(--reactor-green) 4px
    );
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.scanline-divider--amber {
    background: repeating-linear-gradient(
        var(--forest-black),
        var(--forest-black) 3px,
        rgba(196, 133, 12, 0.4) 3px,
        rgba(196, 133, 12, 0.4) 4px
    );
}

.divider-readout {
    font-family: var(--font-annotation);
    font-weight: 400;
    font-size: clamp(0.7rem, 0.8vw, 0.85rem);
    color: var(--muted-sage);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    background: var(--forest-black);
    padding: 6px 24px;
    position: relative;
    z-index: 1;
}

.divider-readout--amber {
    color: var(--warning-amber);
}

/* ============================================
   Duotone Image Containers
   ============================================ */

.duotone-image-container {
    position: relative;
    width: 100%;
    margin-bottom: 2rem;
    filter: grayscale(100%);
    transition: filter 1.2s ease-out;
}

.duotone-image-container.revealed {
    filter: grayscale(0%);
}

.duotone-image--green {
    background: var(--forest-black);
}

.duotone-image--amber {
    background: var(--forest-black);
}

.image-inset-border {
    border: 2px solid var(--reactor-green);
    padding: 4px;
}

.image-inset-border--amber {
    border-color: var(--warning-amber);
}

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

.operation-image {
    max-width: 100%;
}

.operation-text {
    margin-top: 2rem;
}

/* ============================================
   SECTION 4: INCIDENT overrides
   ============================================ */

.panel--incident .panel-viewport {
    border-color: rgba(196, 133, 12, 0.4);
}

/* ============================================
   SECTION 5: DECOMMISSION
   ============================================ */

.decommission-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.decommission-body {
    margin-top: 1rem;
}

#decommission .panel-viewport {
    border-color: rgba(0, 163, 224, 0.3);
}

/* ============================================
   Terminal Void
   ============================================ */

.terminal-void {
    height: 40vh;
    background-color: var(--forest-black);
    position: relative;
}

/* ============================================
   Fade-in Animation (triggered by JS)
   ============================================ */

.fade-in-element {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

/* ============================================
   Hover Underline Draw Effect
   ============================================ */

a, .interactive-text {
    color: var(--cherenkov-blue);
    text-decoration: none;
    position: relative;
    display: inline-block;
}

a::after, .interactive-text::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0%;
    height: 1px;
    background-color: var(--aurora-phosphor);
    transition: width 0.4s ease-out;
}

a:hover::after, .interactive-text:hover::after {
    width: 100%;
}

/* ============================================
   Scroll-linked Rod Animation (controlled by JS)
   ============================================ */

.reactor-rod-bar[data-scroll-height] {
    transition: height 0.1s linear;
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 1024px) {
    :root {
        --inset-x: 5vw;
        --inset-y: 6vh;
    }

    #instrument-strip {
        display: none;
    }

    .panel-viewport {
        padding-left: var(--inset-x);
    }

    .z-content--left {
        max-width: 100%;
    }

    .z-content--right {
        max-width: 100%;
        margin-left: 0;
        margin-top: 2rem;
    }

    .z-content--wide-right {
        max-width: 100%;
        margin-left: 0;
    }

    .z-waypoint {
        display: none;
    }

    .z-connector {
        display: none;
    }
}

@media (max-width: 768px) {
    .site-title {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }

    .section-heading {
        font-size: clamp(1.8rem, 6vw, 3rem);
    }

    .section-heading--decommission {
        font-size: clamp(1.6rem, 5vw, 2.5rem);
    }

    .body-text--centered {
        max-width: 100%;
    }

    .scanline-divider {
        height: 80px;
    }

    .decommission-content {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    :root {
        --inset-x: 4vw;
        --inset-y: 4vh;
    }

    .section-heading-group {
        gap: 10px;
    }

    .reactor-rod-bar {
        width: 6px;
        height: 50px;
    }

    @keyframes rod-rise {
        0% { height: 30px; }
        100% { height: 70px; }
    }
}
