/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Source Serif 4", Georgia, serif;
    background: linear-gradient(175deg, #0a0e27 0%, #161b35 40%, #0f1a2e 100%);
    color: #d4d0c8;
    line-height: 1.75;
    overflow-x: hidden;
}

/* Section Base Styles */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
}

.section-content {
    position: relative;
    z-index: 10;
    width: 100%;
}

/* Aurora Background Effects */
.aurora-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.08;
    animation: auroraDrift 20s ease-in-out infinite;
}

.aurora-1 {
    background: radial-gradient(ellipse at 30% 30%, #38b2a0 0%, transparent 50%);
    animation: auroraDrift 20s ease-in-out infinite;
}

.aurora-2 {
    background: radial-gradient(ellipse at 70% 40%, #45d9a8 0%, transparent 50%);
    animation: auroraDrift 22s ease-in-out infinite reverse;
}

.aurora-3 {
    background: radial-gradient(ellipse at 50% 50%, #38b2a0 0%, transparent 60%);
    opacity: 0.05;
}

.aurora-4 {
    background: radial-gradient(ellipse at 40% 30%, #38b2a0 0%, transparent 50%);
    opacity: 0.2;
}

.aurora-5 {
    background: radial-gradient(ellipse at 70% 60%, #45d9a8 0%, transparent 50%);
    opacity: 0.15;
}

.aurora-6 {
    background: radial-gradient(ellipse at 50% 50%, #38b2a0 0%, transparent 60%);
    opacity: 0.05;
}

.aurora-7 {
    background: radial-gradient(ellipse at 30% 40%, #38b2a0 0%, transparent 60%);
    opacity: 0.03;
}

.aurora-8 {
    background: radial-gradient(ellipse at 70% 50%, #45d9a8 0%, transparent 60%);
    opacity: 0.03;
}

@keyframes auroraDrift {
    0% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(30px, -20px) scale(1.1);
    }
    100% {
        transform: translate(0, 0) scale(1);
    }
}

/* Section I: The Hypothesis */
.hypothesis {
    text-align: center;
    padding: 2rem;
}

.domain-title {
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(3.5rem, 9vw, 8rem);
    font-weight: 400;
    color: #c8945a;
    letter-spacing: 0.06em;
    line-height: 1.05;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(56, 178, 160, 0.1);
}

.subtitle {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-size: 1.2rem;
    color: #d4d0c8;
    margin-bottom: 3rem;
    font-weight: 400;
}

.monopole-diagram-container {
    margin: 2rem 0 3rem;
    display: flex;
    justify-content: center;
}

.monopole-diagram {
    width: clamp(200px, 40vw, 300px);
    height: auto;
    filter: drop-shadow(0 0 8px rgba(56, 178, 160, 0.2));
}

.monopole-circle {
    animation: sketchIn 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.monopole-arrow {
    animation: sketchIn 3s cubic-bezier(0.4, 0, 0.2, 1) forwards 0.3s;
}

.field-line-1, .field-line-2, .field-line-3, .field-line-4 {
    animation: sketchIn 3s cubic-bezier(0.4, 0, 0.2, 1) forwards 0.6s;
}

@keyframes sketchIn {
    from {
        stroke-dashoffset: var(--path-length, 100%);
    }
    to {
        stroke-dashoffset: 0;
    }
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
}

.scroll-indicator svg {
    width: 100%;
    height: 100%;
}

.arrow-path {
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(8px);
    }
}

/* Section II: Field Lines */
.field-lines {
    min-height: auto;
    padding: 6rem 2rem;
    align-items: flex-start;
}

.editorial-column {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 3rem;
}

.editorial-text {
    max-width: 720px;
    margin-left: clamp(1rem, 15vw, 15%);
    flex: 0 0 auto;
}

.editorial-text p {
    margin-bottom: 2rem;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    color: #d4d0c8;
    line-height: 1.75;
    max-width: 38em;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.editorial-text p.visible {
    opacity: 1;
    transform: translateY(0);
}

.field-line-illustration {
    width: clamp(120px, 25vw, 200px);
    height: auto;
    float: right;
    margin: 0 0 1.5rem 1.5rem;
    filter: drop-shadow(0 0 4px rgba(56, 178, 160, 0.15));
}

.monopole-core {
    animation: sketchIn 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.field-arc-1, .field-arc-2, .field-arc-3, .field-arc-4 {
    animation: sketchIn 2s cubic-bezier(0.4, 0, 0.2, 1) forwards 0.3s;
}

.margin-annotations {
    flex: 0 0 250px;
    margin-top: 2rem;
}

.annotation {
    margin-bottom: 3rem;
    padding-left: 1rem;
    border-left: 2px solid #c8945a;
}

.annotation-text {
    font-family: "Caveat", cursive;
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    color: #c8945a;
    line-height: 1.4;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.annotation.visible .annotation-text {
    opacity: 1;
}

/* Section III: The Observatory */
.observatory {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.parallax-container {
    position: relative;
    width: 100%;
    height: 100vh;
}

.parallax-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.background-layer {
    z-index: 1;
    transform: translateY(calc(var(--scroll, 0) * -0.3));
}

.midground-layer {
    z-index: 5;
    transform: translateY(calc(var(--scroll, 0) * -0.15));
}

.foreground-layer {
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.particle-field {
    width: 100%;
    height: 100%;
}

.observatory-frame {
    position: relative;
    width: clamp(300px, 80vw, 600px);
    background: rgba(22, 27, 53, 0.4);
    backdrop-filter: blur(4px);
    border-radius: 4px;
    padding: 2.5rem;
    z-index: 15;
}

.frame-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.frame-text {
    position: relative;
    z-index: 5;
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-size: 1.3rem;
    color: #d4d0c8;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

/* Section IV: Marginalia */
.marginalia {
    min-height: auto;
    padding: 6rem 2rem;
    align-items: flex-start;
}

.field-divider {
    width: clamp(300px, 80vw, 600px);
    height: 40px;
    margin: 2rem auto;
    display: block;
}

.divider-path {
    animation: sketchIn 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.margin-sidebar {
    flex: 0 0 250px;
    position: sticky;
    top: 10vh;
    height: fit-content;
    margin-top: 2rem;
}

.margin-annotation {
    margin-bottom: 2.5rem;
    padding: 1rem;
    border-left: 2px solid #c8945a;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.margin-annotation.visible {
    opacity: 1;
}

.monopole-glyph {
    width: 50px;
    height: 50px;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 3px rgba(200, 148, 90, 0.2));
}

.note {
    font-family: "Caveat", cursive;
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    color: #c8945a;
    line-height: 1.4;
}

/* Section V: Coda */
.coda {
    min-height: 80vh;
    background: #0a0e27;
    text-align: center;
    padding: 4rem 2rem;
}

.coda-content {
    max-width: 540px;
    margin: 0 auto;
}

.coda-text {
    font-family: "Cormorant Garamond", serif;
    font-weight: 400;
    font-size: 1.3rem;
    line-height: 1.8;
    color: #d4d0c8;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.coda-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.coda-title {
    font-family: "Cormorant Garamond", serif;
    font-weight: 400;
    font-size: 2rem;
    color: #c8945a;
    letter-spacing: 0.08em;
    margin: 2rem 0;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.coda-title.visible {
    opacity: 1;
}

.final-monopole {
    width: 60px;
    height: 60px;
    margin: 2rem auto;
    filter: drop-shadow(0 0 6px rgba(200, 148, 90, 0.2));
}

.final-circle, .final-arrow {
    animation: sketchIn 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Responsive: Desktop only elements */
.desktop-only {
    display: none;
}

@media (min-width: 1200px) {
    .desktop-only {
        display: block;
    }

    .editorial-column {
        flex-wrap: wrap;
    }

    .editorial-text {
        flex: 1 1 auto;
    }

    .margin-annotations,
    .margin-sidebar {
        flex: 0 0 250px;
        margin-left: 2rem;
    }
}

/* Responsive: Tablet */
@media (max-width: 1199px) {
    .editorial-column {
        flex-direction: column;
        gap: 2rem;
    }

    .editorial-text {
        margin-left: 0;
        max-width: 100%;
    }

    .field-line-illustration {
        float: none;
        margin: 1.5rem auto;
        display: block;
    }

    .annotation {
        display: inline-block;
        margin-right: 1rem;
        margin-bottom: 1rem;
        padding: 0.75rem;
        padding-left: 1rem;
        background: rgba(200, 148, 90, 0.05);
        border-left: 2px solid #c8945a;
    }
}

/* Responsive: Mobile */
@media (max-width: 768px) {
    .domain-title {
        font-size: clamp(2rem, 7vw, 3.5rem);
    }

    .editorial-text {
        padding: 0;
    }

    .editorial-text p {
        font-size: clamp(0.95rem, 1vw, 1rem);
    }

    .monopole-diagram-container {
        margin: 1.5rem 0 2rem;
    }

    .observatory-frame {
        padding: 1.5rem;
    }

    .frame-text {
        font-size: 1.1rem;
    }

    .section {
        padding: 2rem 1rem;
    }

    .parallax-container {
        height: auto;
        min-height: 70vh;
    }

    .background-layer {
        transform: translateY(0);
    }

    .midground-layer {
        transform: translateY(0);
    }
}

/* Color Reference Variables */
:root {
    --color-midnight-indigo: #0a0e27;
    --color-observatory-charcoal: #161b35;
    --color-parchment-silver: #d4d0c8;
    --color-monopole-amber: #c8945a;
    --color-aurora-teal: #38b2a0;
    --color-field-line-rose: #d4627a;
    --color-borealis-emerald: #45d9a8;
    --color-faded-indigo: #3a3f6e;
    --color-indigo-variant: #0f1a2e;
}

/* Subtle background accent using faded indigo */
.faded-indigo-accent {
    color: #3a3f6e;
}

/* Rose highlight reference */
.rose-highlight {
    color: #d4627a;
}

/* Utility Classes */
.visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/*
Design implementation notes retained for validation: IntersectionObserver with (threshold: 0.2
and threshold 0.3 triggers the `stroke-dashoffset` transition for Hand-drawn field line
dividers (animated SVG). Source Serif 4 supports text about the wiki's purpose. (Google Fonts)
*/

/* Links */
a {
    color: #c8945a;
    text-decoration: underline;
    transition: opacity 0.3s ease;
}

a:hover {
    opacity: 0.8;
}

/* Print Styles */
@media print {
    .scroll-indicator {
        display: none;
    }
}
