/* logical.day - Bauhaus Geometry on Aged Paper */

:root {
    --paper: #F5F0E5;
    --paper-warm: #EDE8DD;
    --charcoal: #2B2B2B;
    --teal: #5CC8D4;
    --rose: #D4728C;
    --green: #3CB371;
    --violet: #7B68AE;
    --font-display: 'Nunito', sans-serif;
    --font-body: 'Source Sans 3', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--paper);
    color: var(--charcoal);
    font-family: var(--font-body);
    overflow-x: hidden;
}

/* Paper texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(180, 160, 120, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(180, 160, 120, 0.04) 0%, transparent 40%);
}

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

/* ===================== NAV SYMBOL ===================== */
.nav-symbol {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 100;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.nav-symbol:hover {
    opacity: 1;
}

.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(245, 240, 229, 0.95);
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.nav-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    text-align: center;
}

.nav-links a {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2rem;
    color: var(--charcoal);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--violet);
}

/* ===================== LOGICAL SECTIONS ===================== */
.logical-section {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--charcoal);
    margin-bottom: 3rem;
    letter-spacing: 0.01em;
}

.section-sub {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--violet);
    letter-spacing: 0.1em;
    margin-top: 2rem;
    opacity: 0;
    animation: fadeIn 1s ease 1.5s forwards;
}

/* ===================== AXIOM ===================== */
.geometric-frame {
    position: relative;
    width: clamp(300px, 50vw, 500px);
    height: clamp(300px, 50vw, 500px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.frame-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.frame-svg polygon,
.frame-svg rect,
.frame-svg circle {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: drawShape 2s ease forwards;
}

.frame-svg rect {
    animation-delay: 0.4s;
}

.frame-svg circle {
    animation-delay: 0.8s;
}

@keyframes drawShape {
    to { stroke-dashoffset: 0; }
}

.axiom-text {
    position: relative;
    z-index: 1;
    text-align: center;
}

.axiom-text h1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 3rem);
    line-height: 1.3;
    color: var(--charcoal);
    letter-spacing: 0.01em;
    opacity: 0;
    animation: fadeIn 1s ease 1.2s forwards;
}

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

/* ===================== PREMISES ===================== */
.premise-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    max-width: 1000px;
    width: 100%;
}

.premise-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.premise-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.shape-frame {
    margin-bottom: 1.5rem;
}

.shape-frame svg {
    display: block;
}

.premise-label {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: var(--green);
    display: block;
    margin-bottom: 0.75rem;
}

.premise-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--charcoal);
    margin-bottom: 0.75rem;
}

.premise-note {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--rose);
    letter-spacing: 0.1em;
    text-transform: lowercase;
}

/* ===================== THEOREM ===================== */
.theorem-block {
    max-width: 700px;
    width: 100%;
    text-align: center;
    position: relative;
}

.connection-line {
    width: 100%;
    height: 100px;
    margin-bottom: 2rem;
}

.connection-line path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.5s ease;
}

.connection-line.drawn path {
    stroke-dashoffset: 0;
}

.theorem-statement {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.theorem-statement.visible {
    opacity: 1;
    transform: translateY(0);
}

.theorem-marker {
    font-size: 2rem;
    color: var(--green);
    display: block;
    margin-bottom: 1rem;
}

.theorem-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    line-height: 1.6;
    color: var(--charcoal);
}

/* ===================== Q.E.D. ===================== */
.qed-block {
    text-align: center;
}

.qed-shapes {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.qed-circle {
    width: 40px;
    height: 40px;
    border: 2px solid var(--teal);
    border-radius: 50%;
}

.qed-rect {
    width: 40px;
    height: 40px;
    border: 2px solid var(--rose);
}

.qed-tri {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 36px solid transparent;
    border-bottom-color: var(--violet);
    position: relative;
}

.qed-tri::after {
    content: '';
    position: absolute;
    top: 3px;
    left: -17px;
    width: 0;
    height: 0;
    border-left: 17px solid transparent;
    border-right: 17px solid transparent;
    border-bottom: 30px solid var(--paper);
}

.qed-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--charcoal);
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 1s ease;
}

.qed-text.visible {
    opacity: 1;
}

.qed-domain {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--violet);
    letter-spacing: 0.1em;
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 1s ease 0.5s;
}

.qed-domain.visible {
    opacity: 1;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .premise-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .shape-frame svg {
        width: 120px;
        height: auto;
    }

    .geometric-frame {
        width: 280px;
        height: 280px;
    }
}
