/* monopole.ai -- Abstract glitch particle physics detector */
/* Palette: #08090D (Void Black), #1C1F2A (Detector Gray), #00E5FF (Signal Cyan), #D946EF (Anomaly Magenta), #E8ECF1 (Equation White), #F59E0B (Field Amber), #312E81 (Noise Indigo) */

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

:root {
    --void: #08090D;
    --detector: #1C1F2A;
    --cyan: #00E5FF;
    --magenta: #D946EF;
    --white: #E8ECF1;
    --amber: #F59E0B;
    --indigo: #312E81;
}

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

body {
    background-color: var(--void);
    color: var(--white);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.7;
    overflow-x: hidden;
}

/* Grain overlay */
.grain-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='128' height='128' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 128px 128px;
}

/* Zone nav */
.zone-nav {
    position: fixed;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    z-index: 500;
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--detector);
    border: 1px solid rgba(0, 229, 255, 0.3);
    transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
    cursor: pointer;
}

.nav-dot.active {
    background: var(--amber);
    border-color: var(--amber);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

/* Zone base */
.zone {
    min-height: 100svh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.zone-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
}

/* Zone headings */
.zone-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.8rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--white);
    margin-bottom: 1.5rem;
}

.zone-body {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.7;
    color: var(--white);
    max-width: 38ch;
}

/* ─── Zone 1: Detection Signal ─── */
.zone-detection {
    background: var(--void);
}

.field-lines-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.field-lines-svg {
    width: 100%;
    height: 100%;
    max-width: 800px;
    max-height: 800px;
}

.field-line {
    stroke: var(--cyan);
    stroke-width: 1;
    opacity: 0.4;
    stroke-dasharray: var(--line-len);
    stroke-dashoffset: var(--line-len);
    transition: stroke-dashoffset 1.5s ease;
}

.field-line.drawn {
    stroke-dashoffset: 0;
}

.field-line.blur-line {
    filter: blur(1px);
}

.domain-glitch {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 10vw, 12rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--white);
    line-height: 1;
    margin-bottom: 1rem;
}

.dirac-equation {
    opacity: 0;
    transition: opacity 800ms ease;
}

.dirac-equation.visible {
    opacity: 1;
}

.eq-text {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    color: var(--amber);
    letter-spacing: 0.05em;
}

/* ─── Zone 2: Hypothesis ─── */
.zone-hypothesis {
    background: var(--void);
}

.hypothesis-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 2rem;
    width: 100%;
    max-width: 1100px;
    padding: 2rem 4rem;
    position: relative;
    z-index: 2;
}

.hypothesis-left,
.hypothesis-right {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.monopole-field,
.dipole-field {
    width: 100%;
    max-width: 350px;
    height: auto;
}

.monopole-line {
    stroke: var(--cyan);
    stroke-width: 1;
    opacity: 0.5;
    stroke-dasharray: var(--line-len);
    stroke-dashoffset: var(--line-len);
    transition: stroke-dashoffset 3s ease;
}

.hypothesis-left.revealed .monopole-line {
    stroke-dashoffset: 0;
}

.field-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    color: var(--cyan);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 1rem;
    opacity: 0.6;
}

.hypothesis-text {
    margin-top: 2rem;
    text-align: left;
}

/* ─── Zone 3: The Search ─── */
.zone-search {
    background: var(--void);
}

.diagonal-band {
    position: relative;
    width: 120%;
    margin-left: -10%;
    transform: rotate(-15deg) scale(1.1);
    background: rgba(49, 46, 129, 0.6);
    padding: 3rem 0;
    z-index: 2;
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 4rem;
}

.milestone {
    transform: rotate(15deg);
    display: flex;
    gap: 1.5rem;
    align-items: baseline;
    padding: 1rem 1.5rem;
    border: 1px solid var(--cyan);
    background: rgba(8, 9, 13, 0.8);
    animation: glitchBorder 6s ease infinite;
}

@keyframes glitchBorder {
    0%, 90%, 100% { border-style: solid; }
    92% { border-style: dashed; }
    95% { border-style: dotted; }
    97% { border-style: solid; }
}

.milestone-date {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    color: var(--amber);
    white-space: nowrap;
    min-width: 4rem;
}

.milestone-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    color: var(--white);
    line-height: 1.5;
}

.particle-tracks {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.track-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: drawTrack 8s ease forwards;
    animation-delay: 2s;
}

.track-2 {
    animation-delay: 4s;
}

.track-3 {
    animation-delay: 3s;
    animation-duration: 6s;
}

.track-4 {
    animation-delay: 5s;
    animation-duration: 7s;
}

@keyframes drawTrack {
    to {
        stroke-dashoffset: 0;
    }
}

/* ─── Zone 4: The Signal ─── */
.zone-signal {
    background: var(--void);
}

.noise-field {
    position: absolute;
    inset: 0;
    background:
        conic-gradient(from 0deg at 25% 35%, var(--indigo) 0%, var(--void) 25%, var(--indigo) 50%, var(--void) 75%, var(--indigo) 100%),
        conic-gradient(from 120deg at 75% 65%, var(--void) 0%, var(--indigo) 30%, var(--void) 60%, var(--indigo) 90%),
        conic-gradient(from 240deg at 50% 50%, var(--indigo) 0%, var(--void) 20%, var(--indigo) 40%, var(--void) 60%);
    background-blend-mode: overlay;
    opacity: 0.3;
    animation: noiseRotate 45s linear infinite;
    z-index: 0;
}

@keyframes noiseRotate {
    from { filter: hue-rotate(0deg); }
    to { filter: hue-rotate(360deg); }
}

.gaussian-container {
    margin-bottom: 2rem;
}

.gaussian-svg {
    width: 100%;
    max-width: 600px;
    height: auto;
}

.gaussian-peak {
    stroke-dasharray: 1200;
    stroke-dashoffset: 0;
    transform-origin: center 160px;
    transform: scaleY(0.1);
    transition: transform 2s ease-out;
}

.gaussian-container.revealed .gaussian-peak {
    transform: scaleY(1);
}

.peak-glow {
    transition: opacity 2s ease-out 0.5s;
}

.gaussian-container.revealed .peak-glow {
    opacity: 0.6;
}

.signal-question {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.25rem, 3vw, 2.5rem);
    letter-spacing: 0.08em;
    color: var(--cyan);
    opacity: 0;
    transition: opacity 600ms ease;
}

.signal-question.visible {
    opacity: 1;
}

/* ─── Zone 5: The Implication ─── */
.zone-implication {
    background: var(--void);
}

.field-lines-expanded {
    transform: scale(1.5);
}

.manifesto-block {
    max-width: 52ch;
    margin: 0 auto;
    text-align: left;
}

.manifesto {
    font-size: clamp(1.1rem, 1.6vw, 1.35rem);
    max-width: 52ch;
}

.final-domain {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.08em;
    color: var(--cyan);
    margin-top: 3rem;
    text-align: center;
}

/* Reveal animations */
[data-reveal] {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 600ms ease, transform 600ms ease;
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Glitch character style */
.glitch-char {
    display: inline-block;
    color: var(--magenta);
    transition: color 80ms;
}

.glitch-char.resolved {
    color: var(--white);
}

/* Responsive */
@media (max-width: 768px) {
    .hypothesis-grid {
        grid-template-columns: 1fr;
        padding: 2rem;
    }

    .zone-nav {
        display: none;
    }

    .diagonal-band {
        transform: rotate(-8deg) scale(1.1);
    }

    .milestone {
        transform: rotate(8deg);
        flex-direction: column;
        gap: 0.5rem;
    }

    .timeline-content {
        padding: 0 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    [data-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .field-line {
        stroke-dashoffset: 0;
        transition: none;
    }

    .monopole-line {
        stroke-dashoffset: 0;
        transition: none;
    }

    .gaussian-peak {
        transform: scaleY(1);
        transition: none;
    }

    .peak-glow {
        opacity: 0.6;
        transition: none;
    }

    .noise-field {
        animation: none;
    }

    .track-path {
        stroke-dashoffset: 0;
        animation: none;
    }

    .dirac-equation {
        opacity: 1;
        transition: none;
    }

    .signal-question {
        opacity: 1;
        transition: none;
    }
}
