/* ========================================
   monopole.ai — Styles
   Victorian-ornate + Dark-neon
   ======================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #0a0a14;
    color: #d4d0c8;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* Noise texture overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    filter: url(#noiseFilter);
    opacity: 0.04;
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: 9999;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---------- Typography ---------- */
h1, .wordmark {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
}

h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    letter-spacing: 0.03em;
    font-variant: small-caps;
    color: #d4d0c8;
    margin-bottom: 1.2rem;
}

.annotation {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: #00f5d4;
    margin-top: 1rem;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}

/* ========================================
   SECTION 1: The Chamber (Hero)
   ======================================== */
.chamber {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #0a0a14;
}

/* HUD rings */
.hud-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(0, 245, 212, 0.15);
    pointer-events: none;
}

.hud-ring-1 {
    width: 70vmin;
    height: 70vmin;
    animation: hudSpin 60s linear infinite;
    border-style: dashed;
    border-width: 1px;
}

.hud-ring-2 {
    width: 55vmin;
    height: 55vmin;
    animation: hudSpin 45s linear infinite reverse;
    border-color: rgba(191, 0, 255, 0.12);
}

.hud-ring-3 {
    width: 85vmin;
    height: 85vmin;
    animation: hudSpin 90s linear infinite;
    border-color: rgba(0, 245, 212, 0.07);
    border-style: dotted;
}

@keyframes hudSpin {
    to { transform: rotate(360deg); }
}

/* Monopole field visualization */
.monopole-field {
    position: absolute;
    width: 50vmin;
    height: 50vmin;
    display: flex;
    align-items: center;
    justify-content: center;
}

.monopole-core {
    position: absolute;
    width: 20vmin;
    height: 20vmin;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 245, 212, 0.8) 0%, rgba(0, 245, 212, 0.15) 40%, transparent 70%);
    animation: corePulse 4s ease-in-out infinite;
    z-index: 2;
}

@keyframes corePulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
}

.field-lines-svg {
    width: 100%;
    height: 100%;
    position: absolute;
}

.field-line {
    stroke: url(#fieldGrad);
    stroke-width: 1.2;
    stroke-linecap: round;
    stroke-dasharray: 250;
    stroke-dashoffset: 250;
    animation: fieldExtend 3s ease-out forwards;
}

/* Stagger field line animations */
.fl-0  { animation-delay: 0s; stroke: #00f5d4; }
.fl-1  { animation-delay: 0.08s; stroke: #00f5d4; }
.fl-2  { animation-delay: 0.16s; stroke: #0be0c2; }
.fl-3  { animation-delay: 0.24s; stroke: #17cbb0; }
.fl-4  { animation-delay: 0.32s; stroke: #3da0d4; }
.fl-5  { animation-delay: 0.4s; stroke: #6a60e8; }
.fl-6  { animation-delay: 0.48s; stroke: #8a40f0; }
.fl-7  { animation-delay: 0.56s; stroke: #a020f0; }
.fl-8  { animation-delay: 0.64s; stroke: #bf00ff; }
.fl-9  { animation-delay: 0.72s; stroke: #00f5d4; }
.fl-10 { animation-delay: 0.8s; stroke: #00f5d4; }
.fl-11 { animation-delay: 0.88s; stroke: #0be0c2; }
.fl-12 { animation-delay: 0.96s; stroke: #17cbb0; }
.fl-13 { animation-delay: 1.04s; stroke: #3da0d4; }
.fl-14 { animation-delay: 1.12s; stroke: #6a60e8; }
.fl-15 { animation-delay: 1.2s; stroke: #8a40f0; }
.fl-16 { animation-delay: 1.28s; stroke: #a020f0; }
.fl-17 { animation-delay: 1.36s; stroke: #bf00ff; }
.fl-18 { animation-delay: 1.44s; stroke: #00f5d4; }
.fl-19 { animation-delay: 1.52s; stroke: #00f5d4; }
.fl-20 { animation-delay: 0.1s; stroke: #3da0d4; }
.fl-21 { animation-delay: 0.3s; stroke: #6a60e8; }
.fl-22 { animation-delay: 0.5s; stroke: #bf00ff; }
.fl-23 { animation-delay: 0.7s; stroke: #8a40f0; }
.fl-24 { animation-delay: 0.9s; stroke: #a020f0; }
.fl-25 { animation-delay: 1.1s; stroke: #6a60e8; }
.fl-26 { animation-delay: 1.3s; stroke: #3da0d4; }
.fl-27 { animation-delay: 1.5s; stroke: #00f5d4; }

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

/* After extending, oscillate */
.field-line.animated {
    animation: fieldOscillate 5s ease-in-out infinite;
}

@keyframes fieldOscillate {
    0%, 100% { stroke-dashoffset: 0; opacity: 0.7; }
    50% { stroke-dashoffset: 30; opacity: 1; }
}

/* Spark particles */
.spark {
    fill: #ff006e;
    opacity: 0;
    animation: sparkFlash 3s ease-in-out infinite;
}

.sp-0 { animation-delay: 0.5s; }
.sp-1 { animation-delay: 1.2s; }
.sp-2 { animation-delay: 2.0s; }
.sp-3 { animation-delay: 0.8s; }
.sp-4 { animation-delay: 1.6s; }
.sp-5 { animation-delay: 2.4s; }
.sp-6 { animation-delay: 0.3s; }
.sp-7 { animation-delay: 1.9s; }

@keyframes sparkFlash {
    0%, 85%, 100% { opacity: 0; r: 2; }
    90% { opacity: 1; r: 4; }
    95% { opacity: 0.5; r: 2; }
}

/* Hero wordmark */
.wordmark {
    position: relative;
    z-index: 10;
    font-size: clamp(4rem, 12vw, 10rem);
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #d4d0c8;
    line-height: 1;
}

.letter {
    display: inline-block;
    opacity: 0;
    animation: letterReveal 0.6s ease-out forwards;
}

@keyframes letterReveal {
    0% {
        opacity: 0;
        text-shadow: none;
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 20px #00f5d4, 0 0 40px #00f5d4, 0 0 60px rgba(0, 245, 212, 0.4);
    }
    100% {
        opacity: 1;
        text-shadow: 0 0 5px rgba(0, 245, 212, 0.2);
    }
}

.wordmark-sub {
    position: relative;
    z-index: 10;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(1rem, 2.5vw, 2rem);
    color: #00f5d4;
    letter-spacing: 0.2em;
    margin-top: -0.5rem;
    text-align: center;
}

/* Scroll chevron */
.scroll-chevron {
    position: absolute;
    bottom: 3rem;
    z-index: 10;
    animation: chevronPulse 2s ease-in-out infinite;
}

@keyframes chevronPulse {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(8px); }
}

/* ========================================
   SECTION 2: The Apparatus Gallery
   ======================================== */
.apparatus {
    position: relative;
    padding: 8rem 5vw 6rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Module base */
.module {
    position: relative;
    background: #12121f;
    padding: 3rem 3.5rem;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(30px) rotate(0deg);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.module.revealed {
    opacity: 1;
}

.module p {
    max-width: 65ch;
}

/* Module noise overlay */
.module::after {
    content: '';
    position: absolute;
    inset: 0;
    filter: url(#noiseFilter);
    opacity: 0.06;
    mix-blend-mode: overlay;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.module:hover::after {
    opacity: 0.08;
}

/* Individual module positioning */
.module-a {
    max-width: 65%;
    margin-right: auto;
    transform: translateY(30px) rotate(0.3deg);
}
.module-a.revealed { transform: rotate(0.3deg); }

.module-b {
    max-width: 70%;
    margin-left: auto;
    margin-top: -40px;
    transform: translateY(30px) rotate(-0.4deg);
    transition-timing-function: cubic-bezier(0.33, 0, 0.67, 1);
    transition-duration: 1s;
}
.module-b.revealed { transform: rotate(-0.4deg); }

.module-c {
    max-width: 60%;
    margin-right: auto;
    margin-left: 8%;
    margin-top: -20px;
    transform: translateY(30px) rotate(0.2deg);
}
.module-c.revealed { transform: rotate(0.2deg); }

.module-d {
    max-width: 75%;
    margin-left: auto;
    margin-right: 3%;
    margin-top: -30px;
    transform: translateY(30px) rotate(-0.3deg);
    transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
.module-d.revealed { transform: rotate(-0.3deg); }

/* Frame Type A: Double-rule with corner rosettes */
.frame-a {
    position: absolute;
    inset: 0;
    border: 2px solid rgba(201, 168, 76, 0.5);
    pointer-events: none;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.frame-a::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(201, 168, 76, 0.3);
}

.module:hover .frame-a {
    border-color: #c9a84c;
    box-shadow: 0 0 15px rgba(0, 245, 212, 0.15);
}

.corner-rosette {
    position: absolute;
    width: 30px;
    height: 30px;
    z-index: 2;
}

.corner-tl { top: -8px; left: -8px; }
.corner-tr { top: -8px; right: -8px; }
.corner-bl { bottom: -8px; left: -8px; }
.corner-br { bottom: -8px; right: -8px; }

/* Frame Type B: Neon rule with arrow terminals */
.frame-b {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(0, 245, 212, 0.4);
    pointer-events: none;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.frame-b::before,
.frame-b::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border: 1px solid #00f5d4;
    opacity: 0.6;
}

.frame-b::before {
    top: 50%;
    left: -5px;
    transform: translateY(-50%) rotate(45deg);
}

.frame-b::after {
    top: 50%;
    right: -5px;
    transform: translateY(-50%) rotate(45deg);
}

.module:hover .frame-b {
    border-color: #00f5d4;
    box-shadow: 0 0 15px rgba(0, 245, 212, 0.15);
}

/* Frame Type C: Greek key inspired */
.frame-c {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(201, 168, 76, 0.3);
    pointer-events: none;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 8px, rgba(201, 168, 76, 0.15) 8px, rgba(201, 168, 76, 0.15) 10px);
    background-size: 10px 10px;
    background-position: 0 0;
    background-repeat: repeat;
    -webkit-mask-image: linear-gradient(to right, black 0px, black 2px, transparent 2px, transparent calc(100% - 2px), black calc(100% - 2px), black 100%),
                        linear-gradient(to bottom, black 0px, black 2px, transparent 2px, transparent calc(100% - 2px), black calc(100% - 2px), black 100%);
    mask-composite: add;
    -webkit-mask-composite: source-over;
}

.module:hover .frame-c {
    border-color: #c9a84c;
    box-shadow: 0 0 15px rgba(0, 245, 212, 0.15);
}

/* Module hover elevation */
.apparatus {
    perspective: 1000px;
}

.module {
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.4s ease;
}

.module:hover {
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

/* ========================================
   SECTION 3: The Field Map
   ======================================== */
.fieldmap {
    position: relative;
    height: 200vh;
    margin-top: 4rem;
}

.fieldmap-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.radial-diagram {
    width: 90vmin;
    height: 90vmin;
    max-width: 800px;
    max-height: 800px;
}

.concentric {
    fill: none;
    stroke: #00f5d4;
    stroke-width: 0.5;
}

.c-1 { opacity: 0.6; }
.c-2 { opacity: 0.5; }
.c-3 { opacity: 0.4; }
.c-4 { opacity: 0.35; }
.c-5 { opacity: 0.25; }
.c-6 { opacity: 0.2; }
.c-7 { opacity: 0.15; }
.c-8 { opacity: 0.1; }
.c-9 { opacity: 0.05; }

.radial-line {
    stroke: #00f5d4;
    stroke-width: 0.8;
    opacity: 0.3;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.5s ease-out;
}

.radial-line.active {
    stroke-dashoffset: 0;
}

.center-dot {
    fill: #00f5d4;
    opacity: 0.9;
    filter: drop-shadow(0 0 10px #00f5d4);
}

.diagram-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    fill: #c9a84c;
    letter-spacing: 0.1em;
    opacity: 0.6;
}

.diagram-text-outer {
    font-size: 8px;
    fill: #7a7670;
    opacity: 0.4;
}

/* ========================================
   SECTION 4: The Archive (Footer)
   ======================================== */
.archive {
    position: relative;
    padding: 4rem 5vw;
    margin-top: 0;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
}

.archive.revealed {
    opacity: 1;
    transform: translateY(0);
}

.archive-inner {
    background: #12121f;
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 4rem;
    border: 2px solid rgba(201, 168, 76, 0.4);
    position: relative;
}

.archive-inner::after {
    content: '';
    position: absolute;
    inset: 0;
    filter: url(#noiseFilter);
    opacity: 0.06;
    mix-blend-mode: overlay;
    pointer-events: none;
}

.archive h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #c9a84c;
}

.archive-ornament {
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, transparent, #c9a84c, transparent);
    margin: 1.5rem 0;
}

.archive-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem 3rem;
}

.archive-entry {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.archive-label {
    font-family: 'Cormorant Garamond', serif;
    font-variant: small-caps;
    font-weight: 600;
    font-size: 0.85rem;
    color: #7a7670;
    letter-spacing: 0.05em;
}

.archive-value {
    font-family: 'Source Serif 4', serif;
    font-weight: 300;
    font-size: 0.95rem;
    color: #d4d0c8;
    line-height: 1.5;
}

.archive-value.mono {
    color: #00f5d4;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .module {
        max-width: 95% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        margin-top: 1.5rem !important;
        padding: 2rem 1.8rem;
    }

    .archive-grid {
        grid-template-columns: 1fr;
    }

    .archive-inner {
        padding: 2rem 1.5rem;
    }
}
