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

html {
    scroll-behavior: smooth;
    background: #0d0e12;
    color: #c4c8d4;
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.008em;
}

body {
    overflow-x: hidden;
    min-height: 100vh;
}

/* ===== BACKGROUND LAYER (z-0) ===== */
#bg-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

#bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(#1f2129 1px, transparent 1px),
        linear-gradient(90deg, #1f2129 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.5;
}

#bg-grain {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    opacity: 0.6;
}

#bg-radial {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 40%, rgba(138, 162, 212, 0.04) 0%, transparent 60%);
    animation: bgShift 60s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0% { background: radial-gradient(ellipse at 40% 30%, rgba(138, 162, 212, 0.04) 0%, transparent 60%); }
    50% { background: radial-gradient(ellipse at 60% 50%, rgba(138, 162, 212, 0.06) 0%, transparent 60%); }
    100% { background: radial-gradient(ellipse at 45% 60%, rgba(138, 162, 212, 0.03) 0%, transparent 60%); }
}

/* ===== HUD FRAME (z-1) ===== */
#hud-frame {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    animation: hudFadeIn 2s ease forwards 0.5s;
}

@keyframes hudFadeIn {
    to { opacity: 1; }
}

.hud-corner {
    position: absolute;
    width: 40px;
    height: 40px;
}

.hud-corner-tl {
    top: 3vw; left: 3vw;
    border-top: 1px solid #5a5e6b;
    border-left: 1px solid #5a5e6b;
}

.hud-corner-tr {
    top: 3vw; right: 3vw;
    border-top: 1px solid #5a5e6b;
    border-right: 1px solid #5a5e6b;
}

.hud-corner-bl {
    bottom: 3vw; left: 3vw;
    border-bottom: 1px solid #5a5e6b;
    border-left: 1px solid #5a5e6b;
}

.hud-corner-br {
    bottom: 3vw; right: 3vw;
    border-bottom: 1px solid #5a5e6b;
    border-right: 1px solid #5a5e6b;
}

#hud-readout {
    position: absolute;
    top: 12vh;
    left: 3vw;
    right: 3vw;
    border-top: 1px solid #3a3d47;
    padding-top: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.85rem);
    font-weight: 300;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #5a5e6b;
    display: flex;
    gap: 1.5em;
}

.hud-sep {
    color: #3a3d47;
}

#hud-field, #hud-dec, #hud-status {
    color: #c4c8d4;
}

#hud-side-label {
    position: absolute;
    left: 3vw;
    top: 50%;
    transform: rotate(-90deg) translateX(-50%);
    transform-origin: left center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.6rem, 0.7vw, 0.75rem);
    font-weight: 300;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #5a5e6b;
    white-space: nowrap;
}

/* ===== DIRAC STRING ===== */
#dirac-string {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100vh;
    z-index: 5;
    pointer-events: none;
}

#dirac-string line {
    animation: diracMarch 2s linear infinite;
}

@keyframes diracMarch {
    to { stroke-dashoffset: -24; }
}

/* ===== CONTENT LAYER (z-2) ===== */
#content {
    position: relative;
    z-index: 8;
}

/* ===== HERO ===== */
#hero {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#monopole-svg {
    position: absolute;
    width: min(80vw, 600px);
    height: min(80vw, 600px);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
}

.field-line {
    stroke: #8aa2d4;
    stroke-opacity: 0.6;
    stroke-width: 1;
    fill: none;
}

.equi-circle {
    opacity: 0;
    animation: fadeInCircle 1s ease forwards 3.5s;
}

@keyframes fadeInCircle {
    to { opacity: 1; }
}

#monopole-node {
    animation: nodePulse 4s ease-in-out infinite;
}

@keyframes nodePulse {
    0%, 100% { r: 6; }
    50% { r: 7; }
}

#hero-title {
    position: relative;
    z-index: 2;
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(4rem, 14vw, 12rem);
    letter-spacing: 0.12em;
    line-height: 0.9;
    color: #e2e5ec;
    text-align: center;
}

#hero-tagline {
    position: relative;
    z-index: 2;
    margin-top: 1.5rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 1vw, 0.95rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8aa2d4;
    min-height: 1.5em;
}

#typewriter-cursor {
    animation: cursorBlink 1s step-end infinite;
    color: #8aa2d4;
}

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

.crosshair {
    position: absolute;
    width: 20px;
    height: 20px;
    opacity: 0.4;
}

.crosshair-hero-tl {
    top: 15%;
    left: 15%;
}

.crosshair-hero-br {
    bottom: 15%;
    right: 15%;
}

/* ===== CONTENT PANELS ===== */
.content-panel {
    background: rgba(20, 21, 27, 0.85); /* #14151b */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid #3a3d47;
    box-shadow: inset 0 0 20px rgba(90, 94, 107, 0.08);
    padding: 3rem 2.5rem;
    margin: 8vh auto;
    max-width: 680px;
    scroll-margin-top: 15vh;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
    will-change: transform, opacity;
}

.panel-left {
    margin-left: 8vw;
    margin-right: auto;
    transform: translateX(-40px);
}

.panel-right {
    margin-right: 8vw;
    margin-left: auto;
    transform: translateX(40px);
}

.content-panel.visible {
    opacity: 1;
    transform: translateX(0);
}

.panel-title {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.1em;
    color: #e2e5ec;
    margin-bottom: 1.5rem;
    line-height: 1;
}

.content-panel p {
    margin-bottom: 1rem;
    color: #c4c8d4;
    font-weight: 300;
}

.content-panel p:last-child {
    margin-bottom: 0;
}

.text-accent {
    color: #8aa2d4;
    font-weight: 500;
}

/* ===== DOCUMENT INSERTS ===== */
.document-insert {
    background:
        radial-gradient(circle at 15% 20%, rgba(139, 119, 87, 0.25) 0%, transparent 4px),
        radial-gradient(circle at 72% 35%, rgba(139, 119, 87, 0.2) 0%, transparent 6px),
        radial-gradient(circle at 45% 80%, rgba(139, 119, 87, 0.22) 0%, transparent 5px),
        radial-gradient(circle at 88% 65%, rgba(139, 119, 87, 0.18) 0%, transparent 3px),
        radial-gradient(circle at 30% 55%, rgba(139, 119, 87, 0.2) 0%, transparent 7px),
        radial-gradient(circle at 60% 15%, rgba(139, 119, 87, 0.15) 0%, transparent 4px),
        radial-gradient(circle at 82% 90%, rgba(139, 119, 87, 0.2) 0%, transparent 5px),
        radial-gradient(circle at 10% 75%, rgba(139, 119, 87, 0.22) 0%, transparent 6px),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.02) 2px, rgba(0,0,0,0.02) 3px),
        linear-gradient(#e8e0d0, #ddd5c3);
    box-shadow: inset 0 0 40px rgba(80, 65, 40, 0.15), 4px 4px 8px rgba(0,0,0,0.3);
    border-radius: 0;
    border: none;
    padding: 2.5rem 2rem;
    max-width: 580px;
    margin: 6vh auto;
    font-family: 'Lora', serif;
    font-size: 1rem;
    line-height: 1.65;
    color: #2a2520;
    transform: rotate(-1.5deg);
    scroll-margin-top: 15vh;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
    will-change: transform, opacity;
}

.document-insert:nth-of-type(even) {
    transform: rotate(1.8deg);
    margin-left: 12vw;
}

.document-insert:nth-of-type(3n) {
    transform: rotate(-2.2deg);
    margin-right: 10vw;
}

.document-insert.visible {
    opacity: 1;
}

.document-insert:hover {
    transform: rotate(0deg) !important;
    transition: transform 0.4s ease;
}

.doc-quote {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #2a2520;
}

.doc-attribution {
    font-size: 0.85rem;
    color: #5a5040;
    margin-bottom: 1.2rem;
}

.doc-equation {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.1rem;
    text-align: center;
    padding: 0.8rem 0;
    color: #2a2520;
    letter-spacing: 0.03em;
    margin-bottom: 0.8rem;
}

.doc-note {
    font-size: 0.9rem;
    color: #4a4540;
}

.doc-annotation {
    font-size: 0.88rem;
    color: #6a5e4a;
    border-left: 2px solid #d4a84a;
    padding-left: 0.8rem;
    margin: 0.8rem 0;
}

.redacted {
    background: #1a1c23;
    color: transparent;
    padding: 0 4px;
    display: inline;
    user-select: none;
}

/* ===== TERMINAL SECTION ===== */
#terminal-section {
    padding: 15vh 0 20vh;
    text-align: center;
}

.terminal-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.9rem);
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #5a5e6b;
    margin-bottom: 0.5rem;
}

.terminal-text.dim {
    color: #3a3d47;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .content-panel {
        margin-left: 5vw !important;
        margin-right: 5vw !important;
        max-width: none;
        padding: 2rem 1.5rem;
    }

    .document-insert {
        margin-left: 5vw !important;
        margin-right: 5vw !important;
        max-width: none;
    }

    #hud-readout {
        flex-wrap: wrap;
        gap: 0.5em 1em;
        font-size: 0.6rem;
    }

    #hud-side-label {
        display: none;
    }
}
