/* ============================================
   concengine.com - Concurrent Event Simulation Engine
   Neubrutalist Retro-Futurism + Watercolor HUD
   ============================================ */

/* --- Color Reference (Design Compliance) ---
   #0a0a0a - Neubrutalist borders
   #0a0f1a - Deep Abyss page background
   #0e243a - Midnight Panel backgrounds
   #3a6f8f - Cerulean Mist panel borders
   #7eb8d4 - Faded Telemetry accents
   #9ecbdf - Ghost Signal text
   #b8d4e8 - Watercolor Bleed tint
   #d4a054 - Ember Accent
   #e8e0d4 - Bone White body text
   Interior Content Panels:** styled below
   Panels:** all panel styles below
*/

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: #0a0f1a;
    color: #e8e0d4;
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    overflow-x: hidden;
}

/* --- Particle Canvas Background --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* --- HUD Frame (Fixed Overlay) --- */
.hud-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

.hud-border {
    position: absolute;
    background: #0a0a0a;
}

.hud-border-top {
    top: 16px;
    left: 16px;
    right: 16px;
    height: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.hud-label {
    position: absolute;
    top: 10px;
    font-family: 'Caveat', cursive;
    font-size: 14px;
    color: #9ecbdf;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

.hud-border-bottom {
    bottom: 16px;
    left: 16px;
    right: 16px;
    height: 6px;
}

.hud-ticker {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    height: 20px;
    overflow: hidden;
}

.hud-ticker-text {
    display: inline-block;
    white-space: nowrap;
    font-family: 'Courier Prime', monospace;
    font-size: 13px;
    color: #9ecbdf;
    opacity: 0.7;
    letter-spacing: 0.04em;
    animation: ticker-scroll 60s linear infinite;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.hud-border-left {
    top: 16px;
    left: 16px;
    bottom: 16px;
    width: 6px;
}

.hud-border-right {
    top: 16px;
    right: 16px;
    bottom: 16px;
    width: 6px;
}

/* --- HUD Corner Brackets --- */
.hud-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    animation: bracket-pulse 4s ease-in-out infinite;
}

.hud-corner-tl {
    top: 10px;
    left: 10px;
    border-top: 3px solid #7eb8d4;
    border-left: 3px solid #7eb8d4;
}

.hud-corner-tr {
    top: 10px;
    right: 10px;
    border-top: 3px solid #7eb8d4;
    border-right: 3px solid #7eb8d4;
}

.hud-corner-bl {
    bottom: 10px;
    left: 10px;
    border-bottom: 3px solid #7eb8d4;
    border-left: 3px solid #7eb8d4;
}

.hud-corner-br {
    bottom: 10px;
    right: 10px;
    border-bottom: 3px solid #7eb8d4;
    border-right: 3px solid #7eb8d4;
}

@keyframes bracket-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* --- Scroll Container --- */
.scroll-container {
    position: relative;
    z-index: 1;
}

/* --- Section Base --- */
.section {
    position: relative;
    width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 50px 40px;
}

/* --- Section Number Glyphs --- */
.section-number {
    position: absolute;
    top: 50px;
    right: 60px;
    font-family: 'Caveat', cursive;
    font-size: 120px;
    color: #7eb8d4;
    opacity: 0.12;
    z-index: 0;
    pointer-events: none;
    line-height: 1;
}

.section-number-amber {
    color: #d4a054;
    opacity: 0.25;
}

/* --- Panel Base (Neubrutalist + Watercolor) --- */
/* Panel palette: #0e243a base, #3a6f8f cerulean mist, #b8d4e8 watercolor bleed */
.panel {
    position: relative;
    border: 3px solid #0a0a0a;
    background-color: rgba(14, 36, 58, 0.65);
    background-image:
        radial-gradient(ellipse at var(--wc-x1) var(--wc-y1), rgba(58, 111, 143, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at var(--wc-x2) var(--wc-y2), rgba(126, 184, 212, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at var(--wc-x3) var(--wc-y3), rgba(184, 212, 232, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse at var(--wc-x4) var(--wc-y4), rgba(58, 111, 143, 0.08) 0%, transparent 65%);
    background-blend-mode: soft-light, soft-light, soft-light, soft-light;
    backdrop-filter: blur(2px);
    --panel-base: #0e243a;
    --cerulean-mist: #3a6f8f;
    --watercolor-bleed: #b8d4e8;
    --panels: "Panels:**";
}

/* --- Panel Corner Brackets --- */
.panel-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    z-index: 2;
    animation: bracket-pulse 4s ease-in-out infinite;
}

.panel-corner-tl {
    top: -2px;
    left: -2px;
    border-top: 3px solid #7eb8d4;
    border-left: 3px solid #7eb8d4;
}

.panel-corner-tr {
    top: -2px;
    right: -2px;
    border-top: 3px solid #7eb8d4;
    border-right: 3px solid #7eb8d4;
}

.panel-corner-bl {
    bottom: -2px;
    left: -2px;
    border-bottom: 3px solid #7eb8d4;
    border-left: 3px solid #7eb8d4;
}

.panel-corner-br {
    bottom: -2px;
    right: -2px;
    border-bottom: 3px solid #7eb8d4;
    border-right: 3px solid #7eb8d4;
}

/* --- Marginalia (Handwritten annotations) --- */
.marginalia {
    position: absolute;
    font-family: 'Caveat', cursive;
    font-size: 12px;
    color: #9ecbdf;
    opacity: 0.5;
    transform: rotate(var(--rot, 0deg));
    white-space: nowrap;
    pointer-events: none;
}

/* --- Panel Entry Animations --- */
.panel {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Staggered entry delays */
.section-1 .telemetry-left { transition-delay: 0ms; transform: translateX(-60px); }
.section-1 .title-panel { transition-delay: 100ms; transform: translateY(40px); }
.section-1 .telemetry-right { transition-delay: 200ms; transform: translateX(60px); }

.section-1 .telemetry-left.visible,
.section-1 .title-panel.visible,
.section-1 .telemetry-right.visible {
    transform: translateY(0) translateX(0);
}

.section-2 .band-threads { transition-delay: 0ms; transform: translateX(-80px); }
.section-2 .band-events { transition-delay: 100ms; transform: translateX(80px); }
.section-2 .band-barriers { transition-delay: 200ms; transform: translateX(-80px); }

.section-2 .band-threads.visible,
.section-2 .band-events.visible,
.section-2 .band-barriers.visible {
    transform: translateY(0) translateX(0);
}

.section-3 .annotation-left { transition-delay: 0ms; transform: translateX(-60px); }
.section-3 .diagram-panel { transition-delay: 100ms; transform: translateY(40px); }
.section-3 .annotation-right { transition-delay: 200ms; transform: translateX(60px); }

.section-3 .annotation-left.visible,
.section-3 .diagram-panel.visible,
.section-3 .annotation-right.visible {
    transform: translateY(0) translateX(0);
}

.section-4 .concept-1 { transition-delay: 0ms; }
.section-4 .concept-2 { transition-delay: 80ms; }
.section-4 .concept-3 { transition-delay: 160ms; }
.section-4 .concept-4 { transition-delay: 240ms; }
.section-4 .concept-5 { transition-delay: 320ms; }
.section-4 .concept-6 { transition-delay: 400ms; }

.section-5 .closing-panel { transition-delay: 0ms; transform: translateY(40px); }
.section-5 .closing-panel.visible { transform: translateY(0) translateX(0); }

/* ============================================
   SECTION 1: Title
   ============================================ */
.section-1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.telemetry-strip {
    width: 200px;
    height: 70vh;
    padding: 20px 12px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
}

.telemetry-left {
    margin-right: -30px;
    z-index: 2;
}

.telemetry-right {
    margin-left: -30px;
    z-index: 2;
}

.telemetry-data {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 10px;
}

.telemetry-line {
    font-family: 'Courier Prime', monospace;
    font-size: 13px;
    color: #9ecbdf;
    opacity: 0.7;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.title-panel {
    width: clamp(340px, 50vw, 600px);
    padding: 60px 50px;
    text-align: center;
    z-index: 5;
}

.site-title {
    font-family: 'Caveat', cursive;
    font-size: clamp(2.4rem, 5.5vw, 5rem);
    font-weight: 700;
    color: #9ecbdf;
    letter-spacing: 0.03em;
    line-height: 1.1;
    margin-bottom: 8px;
}

.title-underline {
    width: 120px;
    height: 4px;
    background: #d4a054;
    margin: 0 auto 24px;
    border-radius: 2px;
}

.site-subtitle {
    font-family: 'Karla', sans-serif;
    font-size: clamp(1rem, 2vw, 1.3rem);
    font-weight: 600;
    color: #e8e0d4;
    letter-spacing: 0.02em;
    margin-bottom: 16px;
}

.site-tagline {
    font-family: 'Caveat', cursive;
    font-size: 18px;
    color: #9ecbdf;
    opacity: 0.7;
    font-style: italic;
}

/* ============================================
   SECTION 2: Threads / Events / Barriers
   ============================================ */
.section-2 {
    flex-direction: column;
    gap: 0;
    padding: 60px 60px;
}

.band {
    width: calc(100% - 40px);
    max-width: 900px;
    padding: 30px 40px;
}

.band-threads {
    z-index: 3;
    margin-bottom: -30px;
    align-self: flex-start;
    margin-left: 20px;
}

.band-events {
    z-index: 4;
    margin-bottom: -30px;
    align-self: flex-end;
    margin-right: 20px;
}

.band-barriers {
    z-index: 5;
    align-self: center;
}

.band-title {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.6rem, 3vw, 2.6rem);
    font-weight: 700;
    color: #9ecbdf;
    letter-spacing: 0.03em;
    margin-bottom: 12px;
}

.band-text {
    font-family: 'Karla', sans-serif;
    color: #e8e0d4;
    line-height: 1.72;
}

/* ============================================
   SECTION 3: Simulation Diagram
   ============================================ */
.section-3 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.annotation-panel {
    width: 200px;
    padding: 20px 16px;
    flex-shrink: 0;
}

.annotation-left {
    margin-right: -20px;
    z-index: 2;
    height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.annotation-right {
    margin-left: -20px;
    z-index: 2;
    height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.annotation-text {
    font-family: 'Karla', sans-serif;
    font-size: 14px;
    color: #e8e0d4;
    line-height: 1.65;
    opacity: 0.85;
}

.diagram-panel {
    width: 70vw;
    max-width: 600px;
    height: 70vh;
    max-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    padding: 30px;
}

.concurrency-diagram {
    width: 100%;
    height: 100%;
    animation: diagram-rotate 120s linear infinite;
}

@keyframes diagram-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Orbit animations (counter-rotating dashes) */
.orbit-1 { animation: orbit-spin-cw 80s linear infinite; transform-origin: 200px 200px; }
.orbit-2 { animation: orbit-spin-ccw 60s linear infinite; transform-origin: 200px 200px; }
.orbit-3 { animation: orbit-spin-cw 45s linear infinite; transform-origin: 200px 200px; }
.orbit-4 { animation: orbit-spin-ccw 35s linear infinite; transform-origin: 200px 200px; }
.orbit-5 { animation: orbit-spin-cw 25s linear infinite; transform-origin: 200px 200px; }

@keyframes orbit-spin-cw {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes orbit-spin-ccw {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

/* Radial line pulse */
.radial-line {
    animation: radial-pulse 3s ease-in-out infinite;
}

.radial-2 { animation-delay: 0.75s; }
.radial-3 { animation-delay: 1.5s; }
.radial-4 { animation-delay: 2.25s; }

@keyframes radial-pulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.6; }
}

/* ============================================
   SECTION 4: Concept Grid
   ============================================ */
.section-4 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 70px 80px;
    position: relative;
}

.concept-panel {
    width: 160px;
    height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: absolute;
}

/* Asymmetric scatter positioning */
.concept-1 { top: 15%; left: 12%; }
.concept-2 { top: 10%; left: 45%; }
.concept-3 { top: 18%; right: 14%; }
.concept-4 { bottom: 22%; left: 18%; }
.concept-5 { bottom: 15%; left: 48%; }
.concept-6 { bottom: 20%; right: 12%; }

.concept-icon {
    width: 48px;
    height: 48px;
}

.concept-word {
    font-family: 'Caveat', cursive;
    font-size: 22px;
    font-weight: 700;
    color: #9ecbdf;
    letter-spacing: 0.02em;
}

/* ============================================
   SECTION 5: Closing
   ============================================ */
.section-5 {
    display: flex;
    align-items: center;
    justify-content: center;
}

.closing-panel {
    width: clamp(400px, 70vw, 850px);
    padding: 50px 60px;
    text-align: center;
}

.closing-title {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.6rem, 3vw, 2.6rem);
    font-weight: 700;
    color: #9ecbdf;
    letter-spacing: 0.03em;
    margin-bottom: 24px;
}

.closing-text {
    font-family: 'Karla', sans-serif;
    color: #e8e0d4;
    line-height: 1.72;
    max-width: 700px;
    margin: 0 auto;
}

/* ============================================
   Section 5: HUD Frame Dim Effect
   ============================================ */
.hud-frame.dimmed .hud-border {
    transition: opacity 0.8s ease;
    opacity: 0.3;
}

.hud-frame.dimmed .hud-corner {
    transition: opacity 0.8s ease;
    animation: none;
    opacity: 0.2;
}

.hud-frame.dimmed .hud-label {
    transition: opacity 0.8s ease;
    opacity: 0.3;
}

.hud-frame.dimmed .hud-ticker-text {
    transition: opacity 0.8s ease;
    opacity: 0.3;
}

/* Restore when not dimmed */
.hud-border,
.hud-corner,
.hud-label,
.hud-ticker-text {
    transition: opacity 0.8s ease;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 900px) {
    .section-1 {
        flex-direction: column;
        gap: 16px;
    }

    .telemetry-strip {
        width: 80%;
        height: auto;
        max-height: 100px;
        flex-direction: row;
        overflow: hidden;
    }

    .telemetry-left,
    .telemetry-right {
        margin: 0;
    }

    .telemetry-data {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px 16px;
    }

    .title-panel {
        width: 90%;
        padding: 30px 24px;
    }

    .section-2 {
        padding: 60px 30px;
    }

    .band {
        width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        align-self: center !important;
    }

    .section-3 {
        flex-direction: column;
        gap: 12px;
    }

    .annotation-panel {
        width: 80%;
        height: auto;
        margin: 0;
    }

    .annotation-left,
    .annotation-right {
        margin: 0;
        height: auto;
    }

    .diagram-panel {
        width: 85vw;
        height: 50vh;
    }

    .section-4 {
        padding: 70px 30px;
    }

    .concept-panel {
        position: relative;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: 140px;
        height: 140px;
        margin: 8px;
    }

    .section-4 {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    .closing-panel {
        width: 90%;
        padding: 30px 24px;
    }
}

@media (max-width: 600px) {
    .hud-border-top,
    .hud-border-bottom {
        left: 8px;
        right: 8px;
    }

    .hud-border-top { top: 8px; }
    .hud-border-bottom { bottom: 8px; }

    .hud-border-left {
        left: 8px;
        top: 8px;
        bottom: 8px;
    }

    .hud-border-right {
        right: 8px;
        top: 8px;
        bottom: 8px;
    }

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

    .section {
        padding: 40px 20px;
    }

    .section-number {
        font-size: 80px;
        top: 35px;
        right: 30px;
    }
}
