/* monopole.quest - Avant-garde particle physics aesthetic */
/* Dark neon palette with Playfair-elegant typography */

/* ===== CSS Custom Properties ===== */
:root {
    --void-black: #0a0a12;
    --deep-indigo: #141425;
    --neon-magenta: #ff006e;
    --electric-cyan: #00f0ff;
    --aged-parchment: #f0e6d3;
    --warm-stone: #c8c0b4;
    --dormant-violet: #4a4555;
    --faded-amber: #b8860b;
    --grid-line: #1e1e2e;
    --muted-stone: #8a8278;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void-black);
    color: var(--warm-stone);
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.015em;
    overflow-x: hidden;
    min-height: 520vh;
}

/* ===== Background Layers ===== */
#field-lines-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

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

.field-line {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    animation: drawFieldLine 6s ease-out forwards;
}

.field-line:nth-child(2) { animation-delay: 0.3s; }
.field-line:nth-child(3) { animation-delay: 0.6s; }
.field-line:nth-child(4) { animation-delay: 0.9s; }
.field-line:nth-child(5) { animation-delay: 1.2s; }
.field-line:nth-child(6) { animation-delay: 1.5s; }
.field-line:nth-child(7) { animation-delay: 1.8s; }
.field-line:nth-child(8) { animation-delay: 2.1s; }
.field-line:nth-child(9) { animation-delay: 2.4s; }
.field-line:nth-child(10) { animation-delay: 2.7s; }
.field-line:nth-child(11) { animation-delay: 3.0s; }
.field-line:nth-child(12) { animation-delay: 3.3s; }
.field-line:nth-child(13) { animation-delay: 3.6s; }
.field-line:nth-child(14) { animation-delay: 3.9s; }
.field-line:nth-child(15) { animation-delay: 4.2s; }
.field-line:nth-child(16) { animation-delay: 4.5s; }

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

/* ===== Field Rings ===== */
#field-rings {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vmax;
    height: 100vmax;
    z-index: 1;
    pointer-events: none;
}

#field-rings::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow:
        0 0 0 40px rgba(255, 0, 110, 0.08),
        0 0 0 90px rgba(0, 240, 255, 0.06),
        0 0 0 150px rgba(255, 0, 110, 0.05),
        0 0 0 220px rgba(0, 240, 255, 0.04),
        0 0 0 300px rgba(255, 0, 110, 0.035),
        0 0 0 390px rgba(0, 240, 255, 0.03),
        0 0 0 490px rgba(255, 0, 110, 0.025),
        0 0 0 600px rgba(0, 240, 255, 0.02),
        0 0 0 720px rgba(255, 0, 110, 0.015),
        0 0 0 850px rgba(0, 240, 255, 0.012),
        0 0 0 1000px rgba(255, 0, 110, 0.01),
        0 0 0 1160px rgba(0, 240, 255, 0.008);
    animation: pulseRings 12s ease-in-out infinite;
}

@keyframes pulseRings {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.03); }
}

/* ===== Grid Overlay ===== */
#grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    background-image:
        linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
    background-size: calc(100% / 12) calc(100% / 12);
    opacity: 0.15;
    animation: gridPulse 8s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.2; }
}

/* ===== Phases ===== */
.phase {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0;
    padding: 2rem;
}

/* ===== Phase 1: The Field ===== */
#phase-1 {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phase-content {
    text-align: center;
    position: relative;
    z-index: 3;
}

#monopole-glyph-container {
    width: clamp(180px, 30vw, 320px);
    height: clamp(180px, 30vw, 320px);
    margin: 0 auto 2rem;
    perspective: 800px;
}

#monopole-glyph {
    width: 100%;
    height: 100%;
    animation: rotateGlyph 30s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    filter: drop-shadow(0 0 20px rgba(255, 0, 110, 0.3)) drop-shadow(0 0 40px rgba(0, 240, 255, 0.15));
}

@keyframes rotateGlyph {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

#site-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.title-monopole {
    color: var(--electric-cyan);
}

.title-dot {
    color: var(--aged-parchment);
    font-weight: 700;
}

.title-quest {
    color: var(--neon-magenta);
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 700;
}

#site-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--warm-stone);
    letter-spacing: 0.05em;
}

/* ===== Blur-Focus Animation System ===== */
.blur-hidden {
    filter: blur(12px);
    opacity: 0;
    transition: filter 2s ease-out, opacity 2s ease-out;
}

.blur-visible {
    filter: blur(0px);
    opacity: 1;
}

/* Subtitle delay */
#site-subtitle.blur-visible {
    transition-delay: 0.8s;
}

/* ===== Phase 2 & 3: Content Layout ===== */
#phase-2,
#phase-3 {
    min-height: 150vh;
    padding: 8vh 2rem;
    display: grid;
    grid-template-columns: 2fr 8fr 2fr;
    gap: 2rem;
    align-content: start;
}

/* ===== Marginalia ===== */
.marginalia {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    padding-top: 10vh;
    position: sticky;
    top: 10vh;
    height: fit-content;
}

.margin-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.isometric-icon {
    width: 64px;
    height: 64px;
    transition: opacity 0.6s ease;
}

.margin-icon:hover .isometric-icon g {
    opacity: 0.8;
}

.icon-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.65rem, 1vw, 0.8rem);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--dormant-violet);
    text-align: center;
}

.margin-icon:hover .icon-label {
    color: rgba(255, 0, 110, 0.6);
}

/* Connector lines */
.connector-line {
    width: 100%;
    height: 2px;
    overflow: visible;
}

/* ===== Content Panels ===== */
.content-area {
    display: flex;
    flex-direction: column;
    gap: 6rem;
    padding-top: 10vh;
}

.content-panel {
    background: rgba(20, 20, 37, 0.85);
    border: 1px solid var(--neon-magenta);
    padding: clamp(1.5rem, 3vw, 3rem);
    position: relative;
    max-width: 800px;
}

.content-panel.layer-2 {
    border-color: rgba(255, 0, 110, 0.4);
}

.content-panel.layer-2-mid {
    border-color: rgba(255, 0, 110, 0.3);
    opacity: 0.92;
}

.content-panel.layer-2-mid.blur-visible {
    opacity: 0.92;
}

.content-panel.layer-2-deep {
    border-color: rgba(255, 0, 110, 0.2);
}

.content-panel.layer-2-deep.blur-visible {
    opacity: 0.85;
}

/* ===== Section Headings ===== */
.section-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    color: var(--aged-parchment);
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

/* Misregistered CMYK print effect */
.misregistered {
    text-shadow:
        -1px 0 0 rgba(255, 0, 110, 0.5),
        1px 0.5px 0 rgba(0, 240, 255, 0.4);
}

/* ===== Body Text ===== */
.body-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    color: var(--warm-stone);
    margin-bottom: 1.2rem;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.015em;
}

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

.body-text em {
    font-style: italic;
    color: var(--electric-cyan);
    font-weight: 400;
}

.body-text.poetic {
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    color: var(--muted-stone);
    line-height: 1.85;
    font-style: italic;
}

/* ===== Field Strength Column ===== */
.field-strength-column {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 10vh;
    position: sticky;
    top: 10vh;
    height: fit-content;
}

.field-bar {
    width: 6px;
    background: linear-gradient(to top, var(--neon-magenta), var(--electric-cyan));
    border-radius: 3px;
    position: relative;
    min-height: 40px;
    opacity: 0.5;
    transition: opacity 0.6s ease, height 1s ease;
}

.field-bar.intensified {
    opacity: 0.75;
    animation: fieldBarPulse 3s ease-in-out infinite;
}

@keyframes fieldBarPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.9; }
}

.field-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.55rem, 0.8vw, 0.7rem);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 0, 110, 0.6);
    white-space: nowrap;
    position: absolute;
    bottom: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    bottom: auto;
    top: 50%;
    left: calc(100% + 0.5rem);
    transform: translateY(-50%);
}

/* ===== Phase 4: The Quest Continues ===== */
#phase-4 {
    min-height: 120vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10vh 2rem;
}

.phase-4-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4rem;
    max-width: 700px;
    text-align: center;
}

#monopole-glyph-final {
    width: clamp(240px, 40vw, 450px);
    height: clamp(240px, 40vw, 450px);
    perspective: 800px;
    margin: 2rem 0;
}

#monopole-glyph-large {
    width: 100%;
    height: 100%;
    animation: rotateGlyphFast 18s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    filter: drop-shadow(0 0 30px rgba(255, 0, 110, 0.4)) drop-shadow(0 0 60px rgba(0, 240, 255, 0.2));
}

@keyframes rotateGlyphFast {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

#quest-continues {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--neon-magenta);
    letter-spacing: -0.02em;
    animation: pulseAttention 4s ease-in-out infinite;
}

#quest-continues.blur-visible {
    animation: pulseAttention 4s ease-in-out infinite;
}

@keyframes pulseAttention {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    #phase-2,
    #phase-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .marginalia {
        flex-direction: row;
        justify-content: center;
        gap: 2rem;
        position: static;
        padding-top: 2rem;
    }

    .field-strength-column {
        flex-direction: row;
        position: static;
        padding-bottom: 2rem;
        justify-content: center;
    }

    .field-bar {
        width: 40px;
        height: 6px !important;
        min-height: 0;
        min-width: 40px;
    }

    .field-label {
        writing-mode: horizontal-tb;
        position: static;
        transform: none;
        display: block;
        margin-top: 0.3rem;
    }

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

    #monopole-glyph-container {
        width: 180px;
        height: 180px;
    }

    #monopole-glyph-final {
        width: 220px;
        height: 220px;
    }
}

@media (max-width: 480px) {
    .phase {
        padding: 1rem;
    }

    #site-title {
        font-size: 2.5rem;
    }

    .section-heading {
        font-size: 1.6rem;
    }

    #quest-continues {
        font-size: 1.8rem;
    }
}