/* ============================================================
   doublestandard.xyz — Dark Neon Scholarly Experience
   ============================================================ */

/* --- Custom Properties --- */
:root {
    --void-bg: #0b0e1a;
    --deep-surface: #141929;
    --subtle-surface: #1e2340;
    --neon-cyan: #00ffcc;
    --neon-magenta: #ff2d78;
    --neon-amber: #ffb830;
    --text-primary: #d8dce8;
    --text-muted: #7a82a0;
    --font-headline: 'Libre Baskerville', Georgia, serif;
    --font-body: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    --font-mono: 'DM Mono', 'Courier New', monospace;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--void-bg);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    overflow-x: hidden;
}

/* --- Particle Field Canvas --- */
#particle-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- Double Standard Vertical Rules --- */
.standard-rule {
    position: fixed;
    top: 0;
    width: 1px;
    height: 100%;
    background: rgba(0, 255, 204, 0.12);
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    animation: fadeInRule 2s ease-out forwards;
}

.standard-rule--main {
    left: 8%;
}

.standard-rule--annotation {
    left: 65%;
}

@keyframes fadeInRule {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Zones (common) --- */
.zone {
    position: relative;
    z-index: 2;
    min-height: 100vh;
}

/* --- Dissolve Transitions --- */
.zone__dissolve {
    position: absolute;
    left: 0;
    width: 100%;
    height: 15vh;
    pointer-events: none;
    z-index: 3;
}

.zone__dissolve--top {
    top: 0;
}

.zone--first .zone__dissolve--top {
    background: linear-gradient(to bottom, var(--void-bg), transparent);
}

.zone--contradiction .zone__dissolve--top {
    background: linear-gradient(to bottom, var(--void-bg), transparent);
}

.zone--synthesis .zone__dissolve--top {
    background: linear-gradient(to bottom, var(--deep-surface), transparent);
}

.zone--colophon .zone__dissolve--top {
    background: linear-gradient(to bottom, var(--void-bg), transparent);
}

/* === ZONE 0 — The Threshold === */
.zone--threshold {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    min-height: 100vh;
    background: var(--void-bg);
}

.zone-0__content {
    text-align: center;
    opacity: 0;
    animation: fadeInContent 2.5s ease-out 1.5s forwards;
}

@keyframes fadeInContent {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.zone-0__title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 6rem);
    line-height: 1.08;
    letter-spacing: -0.025em;
}

.zone-0__title-double {
    display: block;
    color: var(--text-primary);
}

.zone-0__title-standard {
    display: block;
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 255, 204, 0.4), 0 0 24px rgba(0, 255, 204, 0.15);
}

.zone-0__fragment {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.9rem, 1.1vw, 1.1rem);
    color: var(--text-muted);
    margin-top: 2rem;
    max-width: 32rem;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.zone-0__chevron {
    margin-top: 4rem;
    opacity: 0.3;
    animation: pulseChevron 3s ease-in-out infinite;
}

@keyframes pulseChevron {
    0%, 100% { transform: translateY(0); opacity: 0.3; }
    50% { transform: translateY(6px); opacity: 0.6; }
}

/* === ZONE 1 — The First Standard === */
.zone--first {
    background: var(--void-bg);
    padding-top: 8vh;
    padding-bottom: clamp(4rem, 8vh, 10rem);
}

.zone-1__layout {
    position: relative;
    display: flex;
    gap: 4%;
    padding-left: 8%;
    padding-right: 4%;
}

/* --- Main Channel --- */
.main-channel {
    width: 55%;
    position: relative;
    z-index: 2;
}

.main-channel--right {
    width: 55%;
    margin-left: auto;
}

/* --- Annotation Channel --- */
.annotation-channel {
    width: 30%;
    position: relative;
}

.annotation-channel--left {
    width: 30%;
    order: -1;
}

.annotation-sticky {
    position: sticky;
    z-index: 1;
}

/* --- Section Heading --- */
.section-heading {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
    line-height: 1.08;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    margin-bottom: clamp(2rem, 4vh, 4rem);
}

/* --- Body Text --- */
.body-text {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    max-width: 38rem;
}

/* --- Margin Number --- */
.margin-number {
    position: absolute;
    left: -2%;
    top: 0;
    font-family: var(--font-mono);
    font-size: clamp(6rem, 12vw, 14rem);
    font-weight: 500;
    color: var(--neon-cyan);
    opacity: 0.04;
    line-height: 1;
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

.margin-number--right {
    left: auto;
    right: -2%;
}

/* --- Footnote Markers --- */
.footnote-marker {
    font-family: var(--font-mono);
    font-size: 0.7em;
    color: var(--neon-amber);
    text-shadow: 0 0 6px rgba(255, 184, 48, 0.3);
    cursor: pointer;
    position: relative;
    margin-left: 2px;
    transition: color 0.3s ease;
    vertical-align: super;
}

.footnote-marker:hover {
    color: #ffd470;
}

/* --- Footnote Popup --- */
.footnote-popup {
    display: none;
    position: fixed;
    max-width: 360px;
    padding: 1.2rem 1.4rem;
    background: rgba(20, 25, 41, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 255, 204, 0.2);
    border-radius: 4px;
    z-index: 100;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--text-muted);
    line-height: 1.6;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 255, 204, 0.08);
}

.footnote-popup.is-visible {
    display: block;
}

/* --- Index Terms --- */
.index-terms {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 255, 204, 0.08);
}

/* --- Constellation Scatter Plot --- */
.constellation-plot {
    width: 100%;
    max-width: 300px;
    height: auto;
}

.scatter-dot--cyan {
    fill: var(--neon-cyan);
    filter: drop-shadow(0 0 4px rgba(0, 255, 204, 0.4));
}

.scatter-dot--magenta {
    fill: var(--neon-magenta);
    filter: drop-shadow(0 0 4px rgba(255, 45, 120, 0.4));
}

.scatter-dot {
    animation: driftDot 30s ease-in-out infinite alternate;
}

.scatter-dot:nth-child(odd) {
    animation-duration: 25s;
}

.scatter-dot:nth-child(3n) {
    animation-duration: 40s;
    animation-direction: alternate-reverse;
}

@keyframes driftDot {
    0% { transform: translate(0, 0); }
    25% { transform: translate(3px, -2px); }
    50% { transform: translate(-2px, 4px); }
    75% { transform: translate(4px, 1px); }
    100% { transform: translate(-1px, -3px); }
}

.scatter-label {
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    fill: var(--text-muted);
    opacity: 0.7;
}

/* --- Annotation Note --- */
.annotation-note {
    padding: 1rem;
    background: rgba(20, 25, 41, 0.6);
    border-left: 2px solid rgba(0, 255, 204, 0.2);
    border-radius: 0 4px 4px 0;
}

.annotation-note__label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--neon-cyan);
    opacity: 0.6;
    display: block;
    margin-bottom: 0.5rem;
}

.annotation-note__text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* === ZONE 2 — The Contradiction === */
.zone--contradiction {
    background: var(--deep-surface);
    padding-top: 8vh;
    padding-bottom: clamp(4rem, 8vh, 10rem);
}

.zone-2__layout {
    position: relative;
    display: flex;
    gap: 4%;
    padding-left: 4%;
    padding-right: 8%;
}

/* --- Pull Quote --- */
.pull-quote {
    margin: 3rem 0;
    padding: 1.5rem 0 1.5rem 1.5rem;
    border-left: 3px solid var(--neon-magenta);
    position: relative;
}

.pull-quote p {
    font-family: var(--font-headline);
    font-style: italic;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    line-height: 1.45;
    color: var(--neon-magenta);
    text-shadow: 0 0 8px rgba(255, 45, 120, 0.2);
}

/* --- Flow Ribbons --- */
.flow-ribbons {
    width: 100%;
    max-width: 300px;
    height: auto;
}

.flow-ribbon {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    animation: drawRibbon 4s ease-out forwards;
}

.flow-ribbon:nth-child(2) {
    animation-delay: 0.5s;
}

.flow-ribbon:nth-child(3) {
    animation-delay: 1s;
}

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

/* --- Bar Spectrum --- */
.bar-spectrum {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 2rem 8%;
    margin-top: 4rem;
}

.bar-spectrum__bar {
    display: block;
    height: 2px;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-amber));
    animation: pulseBar 6s ease-in-out infinite alternate;
}

.bar-spectrum__bar:nth-child(even) {
    animation-direction: alternate-reverse;
}

@keyframes pulseBar {
    0% { opacity: inherit; }
    50% { opacity: 0.15; }
    100% { opacity: inherit; }
}

/* === ZONE 3 — The Synthesis === */
.zone--synthesis {
    background: var(--void-bg);
    padding-top: 8vh;
    padding-bottom: clamp(4rem, 8vh, 10rem);
}

.zone-3__layout {
    position: relative;
    padding-left: 8%;
    padding-right: 8%;
}

.synthesis-channel {
    max-width: 48rem;
    margin: 0 auto;
}

/* --- Network Graph --- */
.network-graph-container {
    margin: 3rem auto;
    max-width: 600px;
}

.network-graph {
    width: 100%;
    height: auto;
}

.network-node {
    fill: var(--neon-cyan);
    filter: drop-shadow(0 0 6px rgba(0, 255, 204, 0.5));
    animation: pulseNode 4s ease-in-out infinite alternate;
}

.network-node--center {
    fill: var(--neon-cyan);
    filter: drop-shadow(0 0 10px rgba(0, 255, 204, 0.6));
}

.network-node:nth-child(odd) {
    animation-delay: -2s;
}

@keyframes pulseNode {
    0% { opacity: 0.8; }
    100% { opacity: 1; }
}

.network-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    fill: var(--text-muted);
    text-anchor: middle;
}

.network-edge {
    animation: fadeEdge 5s ease-in-out infinite alternate;
}

.network-edge:nth-child(even) {
    animation-delay: -2.5s;
}

@keyframes fadeEdge {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* === ZONE 4 — The Colophon === */
.zone--colophon {
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--void-bg);
}

.zone-4__content {
    text-align: center;
}

.zone-4__domain {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 1rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.zone-4__dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--neon-cyan);
    margin: 1.5rem auto 0;
    box-shadow: 0 0 8px rgba(0, 255, 204, 0.5);
    animation: pulseDot 3s ease-in-out infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 0.5; box-shadow: 0 0 8px rgba(0, 255, 204, 0.3); }
    50% { opacity: 1; box-shadow: 0 0 16px rgba(0, 255, 204, 0.6); }
}

/* --- Magnetic Elements --- */
.magnetic-element {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .zone-0__content {
        opacity: 1;
    }

    .standard-rule {
        opacity: 1;
    }
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .zone-1__layout,
    .zone-2__layout {
        flex-direction: column;
        padding-left: 6%;
        padding-right: 6%;
    }

    .main-channel,
    .main-channel--right,
    .annotation-channel,
    .annotation-channel--left {
        width: 100%;
    }

    .annotation-channel--left {
        order: 1;
    }

    .margin-number,
    .margin-number--right {
        font-size: clamp(4rem, 20vw, 8rem);
        left: 0;
        right: auto;
    }

    .standard-rule--main {
        left: 4%;
    }

    .standard-rule--annotation {
        display: none;
    }

    .zone-3__layout {
        padding-left: 6%;
        padding-right: 6%;
    }

    .pull-quote p {
        font-size: 1.1rem;
    }
}
