/* ========================================
   bability.pro v2 - Styles
   Generative Art Canvas / Probability Space
   ======================================== */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #0B0E17;
    color: #E8ECF2;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.8vw, 20px);
    line-height: 1.65;
    overflow-x: hidden;
}

/* --- Typography --- */
h1, h2 {
    font-family: 'Space Grotesk', sans-serif;
}

h2.section-title {
    font-weight: 700;
    font-size: clamp(28px, 5vw, 64px);
    letter-spacing: 0.04em;
    color: #E8ECF2;
    margin-bottom: 1.2em;
}

.body-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.8vw, 20px);
    line-height: 1.65;
    color: #E8ECF2;
    margin-bottom: 1.2em;
}

.callout {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(18px, 2vw, 24px);
    color: #D4886B;
    margin-top: 1.5em;
    line-height: 1.5;
}

.data-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(12px, 1.2vw, 15px);
    color: #7EB8DA;
}

/* --- Formulae Layer (z-index 1 / depth layer 2) --- */
#formulae-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.formula {
    position: absolute;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: clamp(14px, 2vw, 22px);
    color: #E8ECF2;
    opacity: 0.15;
    white-space: nowrap;
    will-change: transform;
}

.formula-1 { left: 8%; top: 15%; }
.formula-2 { left: 72%; top: 25%; }
.formula-3 { left: 35%; top: 55%; }
.formula-4 { left: 85%; top: 70%; }
.formula-5 { left: 15%; top: 80%; }
.formula-6 { left: 60%; top: 10%; }
.formula-7 { left: 45%; top: 40%; }

/* --- Rooms (z-index 0 background canvas, z-index 2 foreground content) --- */
.room {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    background-color: #0B0E17;
}

.room-alt {
    background-color: #161B2E;
}

.room-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 65%;
    height: 100%;
    z-index: 0;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.room-canvas.active {
    opacity: 1;
}

.room-text-panel {
    position: relative;
    z-index: 2;
    margin-left: auto;
    margin-right: 5%;
    width: 30%;
    padding: 2.5em 2em;
    background-color: rgba(11, 14, 23, 0.85);
    border: 1px solid #2A3A5C;
    border-radius: 2px;
}

/* --- Hero Section --- */
#hero {
    justify-content: center;
    align-items: center;
    flex-direction: column;
    min-height: 100vh;
}

#galton-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
}

#hero-content.visible {
    opacity: 1;
    transform: translateY(0);
}

#logotype {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(36px, 6vw, 80px);
    letter-spacing: 0.08em;
    color: #E8ECF2;
    margin-bottom: 0.2em;
}

#subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(18px, 2.5vw, 28px);
    color: #7EB8DA;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 800ms ease-out 400ms, transform 800ms ease-out 400ms;
}

#subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Galton Board Slider --- */
#galton-controls {
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 800ms ease-out 3s;
}

#galton-controls.visible {
    opacity: 1;
}

.slider-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: #7EB8DA;
    text-transform: lowercase;
}

#peg-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 140px;
    height: 2px;
    background: #2A3A5C;
    outline: none;
    border-radius: 1px;
}

#peg-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #7EB8DA;
    cursor: pointer;
}

#peg-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #7EB8DA;
    border: none;
    cursor: pointer;
}

/* --- Transition Zones --- */
.transition-zone {
    width: 100%;
    height: 20vh;
    position: relative;
}

.transition-1-2 {
    background: linear-gradient(to bottom, #0B0E17, #161B2E);
}

.transition-2-3 {
    background: linear-gradient(to bottom, #161B2E, #0B0E17);
}

.transition-3-4 {
    background: linear-gradient(to bottom, #0B0E17, #161B2E);
}

.transition-4-5 {
    background: linear-gradient(to bottom, #161B2E, #0B0E17);
}

.transition-5-6 {
    background: linear-gradient(to bottom, #0B0E17, #161B2E);
}

/* --- Closing Section --- */
#closing {
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
}

#closing-content {
    position: relative;
    z-index: 2;
    max-width: 700px;
    padding: 2em;
}

.closing-text {
    font-size: clamp(17px, 2vw, 22px);
    line-height: 1.75;
}

.closing-callout {
    font-size: clamp(24px, 4vw, 48px);
    margin-top: 1.5em;
    color: #7EB8DA;
}

/* --- Convergence indicator --- */
.convergence-glow {
    color: #5EBB8A;
}

/* --- Density Band --- */
.density-band {
    width: 100%;
    height: 60px;
    background: radial-gradient(ellipse at center, rgba(126, 184, 218, 0.08) 0%, transparent 70%);
}

/* --- Section title letter animation --- */
.section-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.section-title.animate .char {
    opacity: 1;
    transform: translateY(0);
}

/* --- Interaction Pulse --- */
.interaction-pulse {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 136, 107, 0.6) 0%, transparent 70%);
    pointer-events: none;
    z-index: 3;
    animation: pulse-out 400ms ease-out forwards;
}

@keyframes pulse-out {
    0% {
        transform: scale(0.3);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* --- Responsive (< 768px) --- */
@media (max-width: 768px) {
    .room {
        flex-direction: column;
        justify-content: flex-end;
        padding-bottom: 5vh;
    }

    .room-canvas {
        width: 100%;
        height: 55%;
        top: 0;
        left: 0;
    }

    .room-text-panel {
        width: 90%;
        margin: 0 auto;
        position: relative;
    }

    #galton-controls {
        bottom: 4%;
    }

    .formula {
        display: none;
    }
}
