/* ==========================================================================
   logic.quest — Swiss-rational logic puzzle adventure
   Colors: #e8e0d0, #d4ccc0, #c0b8a0, #2a2820, #6a6458, #5a4a30, #34d399, #8a7e6a
   Fonts: Space Mono, Source Serif 4, Fira Code
   ========================================================================== */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: #e8e0d0;
    color: #2a2820;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.6vw, 19px);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ==========================================================================
   Swiss Grid Underlay
   ========================================================================== */

.swiss-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 400ms ease;
    background-image:
        linear-gradient(to right, rgba(192, 184, 160, 0.4) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(192, 184, 160, 0.4) 1px, transparent 1px);
    background-size: 60px 60px;
}

.swiss-grid--visible {
    opacity: 1;
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: clamp(40px, 6vh, 80px) 0;
    display: flex;
    align-items: center;
}

.section--light {
    background-color: #e8e0d0;
}

.section--dark {
    background-color: #d4ccc0;
}

.section__inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 15%;
    padding-right: clamp(24px, 5vw, 80px);
}

/* ==========================================================================
   Hero / Opening Viewport
   ========================================================================== */

#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.site-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(36px, 6vw, 72px);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2a2820;
    line-height: 1.1;
    margin-bottom: 2rem;
    min-height: 1.2em;
}

.site-title .char {
    display: inline-block;
    opacity: 0;
    transition: opacity 100ms ease;
}

.site-title .char--visible {
    opacity: 1;
}

.hero-statement {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(18px, 2.2vw, 26px);
    font-weight: 400;
    color: #6a6458;
    line-height: 1.6;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 300ms ease, transform 300ms ease;
    max-width: 500px;
}

.hero-statement--visible {
    opacity: 1;
    transform: translateX(0);
}

/* ==========================================================================
   Challenge Sections
   ========================================================================== */

.challenge-header {
    display: flex;
    align-items: baseline;
    gap: clamp(12px, 2vw, 24px);
    margin-bottom: clamp(20px, 3vh, 40px);
}

.challenge-number {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(36px, 6vw, 72px);
    letter-spacing: 0.08em;
    color: #5a4a30;
    line-height: 1;
    flex-shrink: 0;
}

.challenge-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(12px, 1.4vw, 18px);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6a6458;
}

.challenge-body {
    max-width: 700px;
}

.puzzle-statement {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.6vw, 19px);
    line-height: 1.75;
    color: #2a2820;
    margin-bottom: 1rem;
}

.puzzle-question {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 600;
    font-size: clamp(16px, 1.6vw, 19px);
    line-height: 1.75;
    color: #2a2820;
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   Solution Toggle
   ========================================================================== */

.show-solution-btn {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6a6458;
    background: none;
    border: 1px solid #c0b8a0;
    padding: 8px 20px;
    cursor: pointer;
    transition: color 300ms ease, border-color 300ms ease;
}

.show-solution-btn:hover {
    color: #2a2820;
    border-color: #8a7e6a;
}

.show-solution-btn--active {
    color: #5a4a30;
    border-color: #5a4a30;
}

.solution-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 400ms ease;
}

.solution-content--open {
    max-height: 500px;
}

.proof-steps {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 2px solid #c0b8a0;
}

.proof-step {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

.proof-step.rule {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(192, 184, 160, 0.6);
}

.notation {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 15px;
    letter-spacing: 0.03em;
    color: #5a4a30;
    white-space: nowrap;
}

.step-label {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 15px;
    color: #6a6458;
    font-style: italic;
}

/* ==========================================================================
   Neon-Glow Conclusion
   ========================================================================== */

.conclusion {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 600;
    font-size: clamp(17px, 1.8vw, 21px);
    color: #2a2820;
    margin-top: 1.25rem;
    padding: 0.5rem 0;
    transition: color 600ms ease, text-shadow 600ms ease;
}

.conclusion--glow {
    color: #34d399;
    text-shadow:
        0 0 2px #34d399,
        0 0 6px #34d399,
        0 0 12px #34d399;
}

/* ==========================================================================
   Proof Section (Boss Battle)
   ========================================================================== */

.section--proof {
    min-height: 100vh;
}

.proof-narrative {
    margin-bottom: clamp(24px, 4vh, 48px);
}

.proof-intro {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 600;
    font-size: clamp(18px, 2vw, 24px);
    color: #2a2820;
    line-height: 1.6;
}

.proof-chain {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.proof-chain-step {
    display: flex;
    align-items: baseline;
    gap: clamp(10px, 1.5vw, 20px);
    padding: clamp(10px, 1.5vh, 18px) 0;
    border-bottom: 1px solid rgba(192, 184, 160, 0.4);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 300ms ease, transform 300ms ease;
    flex-wrap: wrap;
}

.proof-chain-step--revealed {
    opacity: 1;
    transform: translateY(0);
}

.proof-chain-step--final {
    border-bottom: none;
    margin-top: 0.5rem;
    padding-top: clamp(16px, 2vh, 28px);
    border-top: 2px solid #5a4a30;
}

.step-num {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 16px;
    color: #5a4a30;
    min-width: 28px;
    flex-shrink: 0;
}

.proof-chain-step .notation {
    min-width: 80px;
    flex-shrink: 0;
}

.proof-chain-step .step-label {
    font-style: normal;
    color: #2a2820;
}

.conclusion-final {
    font-weight: 600;
    font-style: normal;
    color: #2a2820;
    transition: color 600ms ease, text-shadow 600ms ease;
}

.conclusion-final--glow {
    color: #34d399;
    text-shadow:
        0 0 2px #34d399,
        0 0 6px #34d399,
        0 0 12px #34d399;
}

/* ==========================================================================
   QED Section
   ========================================================================== */

.section--qed {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.section__inner--qed {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-left: 0;
    text-align: center;
}

.qed-text {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(48px, 10vw, 120px);
    letter-spacing: 0.12em;
    color: #2a2820;
    margin-bottom: 3rem;
}

.mountain-landscape {
    width: 100%;
    max-width: 800px;
    height: 120px;
    position: relative;
    background-color: transparent;
}

.mountain-landscape::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #8a7e6a;
    clip-path: polygon(
        0% 100%,
        0% 80%,
        5% 70%,
        10% 60%,
        15% 55%,
        20% 45%,
        25% 35%,
        28% 30%,
        30% 25%,
        32% 20%,
        35% 15%,
        37% 12%,
        40% 8%,
        42% 5%,
        44% 3%,
        46% 1%,
        48% 0%,
        50% 2%,
        52% 6%,
        54% 12%,
        56% 18%,
        58% 22%,
        60% 28%,
        62% 32%,
        64% 35%,
        66% 30%,
        68% 25%,
        70% 20%,
        72% 22%,
        74% 28%,
        76% 35%,
        78% 40%,
        80% 45%,
        82% 50%,
        85% 55%,
        88% 60%,
        90% 65%,
        93% 70%,
        96% 78%,
        100% 85%,
        100% 100%
    );
}

/* ==========================================================================
   Magnetic Effect (applied via JS)
   ========================================================================== */

.magnetic {
    transition: transform 150ms ease-out;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .section__inner {
        padding-left: 6%;
        padding-right: 6%;
    }

    .section__inner--qed {
        padding-left: 6%;
        padding-right: 6%;
    }

    .challenge-header {
        flex-direction: column;
        gap: 4px;
    }

    .proof-chain-step {
        flex-direction: column;
        gap: 4px;
    }

    .proof-chain-step .notation {
        min-width: unset;
    }

    .proof-step {
        flex-direction: column;
        gap: 4px;
    }

    .mountain-landscape {
        height: 80px;
    }
}
