/* logical.day — Brutalist Logic as Luxury */

:root {
    --void-black: #050505;
    --charcoal-grain: #0A0A0A;
    --graphite: #1A1A1A;
    --theorem-gold: #C5A127;
    --burnished-gold: #8B7120;
    --gold-whisper: rgba(197, 161, 39, 0.25);
    --bright-gold: #E8D48B;
    --dim-gold: #7A6A3A;
    --elastic: cubic-bezier(0.68, -0.55, 0.27, 1.55);
    --elastic-tight: cubic-bezier(0.68, -0.3, 0.27, 1.3);
    --elastic-loose: cubic-bezier(0.68, -0.8, 0.27, 1.8);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    color: var(--bright-gold);
    background: var(--void-black);
    line-height: 1.65;
    letter-spacing: 0.005em;
    overflow-x: hidden;
}

/* ---- Scenes ---- */
.scene {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(3rem, 8vw, 6rem) clamp(1rem, 4vw, 4rem);
    overflow: hidden;
}

/* ---- Brutal Rules ---- */
.brutal-rule {
    width: 100%;
    height: 4px;
    background: var(--theorem-gold);
}

.brutal-rule-last {
    background: var(--theorem-gold);
}

/* ---- Section labels ---- */
.section-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--dim-gold);
    display: block;
    margin-bottom: 1.5rem;
}

.section-label-black {
    color: var(--void-black);
    opacity: 0.6;
}

/* ---- Reveal ---- */
[data-reveal] {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s var(--elastic-tight), transform 0.6s var(--elastic-tight);
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Bubbles ---- */
.bubble-cluster {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.bubble {
    position: absolute;
    left: var(--bx);
    top: var(--by);
    width: var(--bs);
    height: var(--bs);
    border-radius: 50%;
    background: var(--theorem-gold);
    animation: bubblePulse var(--pd) var(--elastic) infinite;
    animation-delay: var(--pdelay);
}

.bubble-black {
    background: var(--void-black);
}

@keyframes bubblePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(var(--pscale)); }
}

/* ============ THE AXIOM ============ */
.scene-axiom {
    flex-direction: column;
    text-align: center;
}

.axiom-content {
    position: relative;
    z-index: 1;
}

.axiom-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: clamp(3.5rem, 9vw, 8rem);
    color: var(--theorem-gold);
    letter-spacing: -0.03em;
    line-height: 0.95;
}

/* ============ THE THEOREM ============ */
.scene-theorem {
    background: var(--void-black);
}

.theorem-split {
    display: flex;
    gap: 3rem;
    max-width: 1000px;
    width: 100%;
    align-items: center;
}

.theorem-text {
    flex: 0 0 60%;
    max-width: 480px;
    margin-left: auto;
}

.theorem-body {
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.65;
    margin-bottom: 1.5rem;
    max-width: 38em;
}

.theorem-shape-wrap {
    flex: 0 0 40%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.morphing-shape {
    width: 200px;
    height: 200px;
    background: var(--theorem-gold);
    animation: morphCycle 12s var(--elastic-loose) infinite;
}

@keyframes morphCycle {
    0%   { clip-path: circle(50%); }
    20%  { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }
    40%  { clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%); }
    60%  { clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%); }
    80%  { clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%); }
    100% { clip-path: circle(50%); }
}

/* ============ THE PROOF ============ */
.scene-proof {
    flex-direction: column;
    padding: 0;
}

.proof-strip {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem clamp(2rem, 10vw, 10%);
    min-height: 33.33vh;
}

.proof-strip-gold {
    background: var(--theorem-gold);
    color: var(--void-black);
}

.proof-strip-black {
    background: var(--void-black);
}

.proof-label {
    color: var(--void-black);
    opacity: 0.5;
}

.strip-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--void-black);
}

.strip-text-gold {
    color: var(--theorem-gold);
}

/* ============ THE PARADOX ============ */
.scene-paradox {
    background: var(--void-black);
}

.paradox-circle {
    width: min(80vw, 80vh);
    height: min(80vw, 80vh);
    position: relative;
    animation: paradoxPulse 4s var(--elastic) infinite;
}

@keyframes paradoxPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.paradox-svg {
    width: 100%;
    height: 100%;
}

.paradox-svg textPath {
    animation: textRotate 60s linear infinite;
}

@keyframes textRotate {
    to { startOffset: 100%; }
}

/* SVG text rotation via JS instead */

/* ============ THE COROLLARY ============ */
.scene-corollary {
    background: var(--charcoal-grain);
}

.noise-overlay {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 4 4' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='0' y='0' width='1' height='1' fill='%23ffffff' opacity='0.03'/%3E%3Crect x='2' y='1' width='1' height='1' fill='%23ffffff' opacity='0.02'/%3E%3Crect x='1' y='3' width='1' height='1' fill='%23ffffff' opacity='0.03'/%3E%3Crect x='3' y='2' width='1' height='1' fill='%23ffffff' opacity='0.02'/%3E%3C/svg%3E");
    background-size: 150px;
    mix-blend-mode: soft-light;
    opacity: 0.12;
    pointer-events: none;
    animation: noiseDrift 150s linear infinite;
}

@keyframes noiseDrift {
    to { background-position: 150px 150px; }
}

.rect-constellation {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    grid-template-rows: repeat(12, 1fr);
    width: 100%;
    max-width: 900px;
    height: 70vh;
    position: relative;
    z-index: 1;
}

.golden-rect {
    border: 1px solid var(--theorem-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--gold-whisper);
}

.gr-filled {
    background: rgba(197, 161, 39, 0.08);
}

.rect-word {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--theorem-gold);
}

.gr-1 { grid-column: 2 / 10; grid-row: 1 / 4; }
.gr-2 { grid-column: 12 / 18; grid-row: 2 / 5; }
.gr-3 { grid-column: 4 / 8; grid-row: 5 / 8; }
.gr-4 { grid-column: 16 / 24; grid-row: 4 / 7; }
.gr-5 { grid-column: 9 / 15; grid-row: 7 / 10; }
.gr-6 { grid-column: 1 / 6; grid-row: 9 / 12; }
.gr-7 { grid-column: 18 / 24; grid-row: 9 / 12; }

/* ============ THE QED ============ */
.scene-qed {
    background: var(--theorem-gold);
    flex-direction: column;
    text-align: center;
}

.qed-content {
    position: relative;
    z-index: 1;
}

.qed-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: clamp(2.5rem, 7vw, 6rem);
    color: var(--void-black);
    letter-spacing: -0.03em;
    line-height: 0.95;
}

/* ---- Mobile ---- */
@media (max-width: 767px) {
    .theorem-split {
        flex-direction: column;
    }

    .theorem-text {
        flex-basis: auto;
        margin-left: 0;
    }

    .morphing-shape {
        width: 140px;
        height: 140px;
    }

    .paradox-circle {
        width: min(85vw, 85vh);
        height: min(85vw, 85vh);
    }

    .paradox-svg text {
        font-size: 8px;
    }

    .rect-constellation {
        height: 60vh;
    }

    .gr-1 { grid-column: 1 / 13; grid-row: 1 / 3; }
    .gr-2 { grid-column: 13 / 24; grid-row: 1 / 3; }
    .gr-3 { grid-column: 1 / 10; grid-row: 3 / 5; }
    .gr-4 { grid-column: 10 / 24; grid-row: 3 / 5; }
    .gr-5 { grid-column: 1 / 13; grid-row: 5 / 7; }
    .gr-6 { grid-column: 1 / 12; grid-row: 9 / 11; }
    .gr-7 { grid-column: 12 / 24; grid-row: 9 / 11; }

    .bubble {
        transform: scale(0.7);
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    [data-reveal] {
        opacity: 1;
        transform: none;
    }

    .morphing-shape {
        clip-path: circle(50%);
        animation: none;
    }

    .bubble {
        animation: none;
    }

    .paradox-circle {
        animation: none;
    }

    .noise-overlay {
        animation: none;
    }
}
