/* ============================================
   bable.pro — One Sample From Infinity
   Zen-contemplative probability aesthetic
   ============================================ */

:root {
    --parchment-cream: #F7F3EC;
    --slate-whisper: #E8EDF2;
    --deep-graphite: #2B2D33;
    --fossil-gray: #6B7280;
    --probability-blue: #3B6B9E;
    --bayesian-coral: #C75B3A;
    --graph-rule: #B8C4CE;
    --certainty-gold: #C4A23D;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Crimson Pro', serif;
    --font-data: 'IBM Plex Mono', monospace;
}

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

body {
    background: var(--parchment-cream);
    background-image:
        linear-gradient(var(--graph-rule) 0.5px, transparent 0.5px),
        linear-gradient(90deg, var(--graph-rule) 0.5px, transparent 0.5px);
    background-size: 20px 20px;
    background-position: center center;
    color: var(--deep-graphite);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.72;
    overflow-x: hidden;
}

/* Graph paper at low opacity via pseudo-element */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--graph-rule) 0.5px, transparent 0.5px),
        linear-gradient(90deg, var(--graph-rule) 0.5px, transparent 0.5px);
    background-size: 20px 20px;
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   Typography
   ============================================ */

.section-heading {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 500;
    letter-spacing: -0.03em;
    color: var(--deep-graphite);
    margin-bottom: 1rem;
}

.section-heading-sm {
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-weight: 500;
    letter-spacing: -0.03em;
    color: var(--deep-graphite);
    margin-bottom: 0.75rem;
}

.data-label {
    font-family: var(--font-data);
    font-size: 14px;
    color: var(--bayesian-coral);
    letter-spacing: 0.04em;
    margin-top: 0.75rem;
}

.prob-annotation {
    display: inline-block;
    font-family: var(--font-data);
    font-size: 11px;
    color: var(--fossil-gray);
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.annotation {
    display: block;
    font-family: var(--font-data);
    font-size: 13px;
    color: var(--fossil-gray);
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.numeral {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 500;
    color: var(--probability-blue);
}

a {
    color: var(--probability-blue);
    text-decoration: none;
    border-bottom: 0 solid var(--bayesian-coral);
    transition: border-bottom-width 200ms ease;
}

a:hover {
    border-bottom-width: 1px;
}

/* ============================================
   Header
   ============================================ */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(16px, 3vw, 32px) clamp(32px, 5vw, 80px);
    position: relative;
    z-index: 10;
}

.site-name {
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    font-weight: 500;
    letter-spacing: -0.03em;
    color: var(--deep-graphite);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-family: var(--font-data);
    font-size: 13px;
    color: var(--fossil-gray);
    letter-spacing: 0.04em;
}

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

/* ============================================
   Bento Grid
   ============================================ */

.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2px;
    padding: 0 clamp(32px, 5vw, 80px) clamp(32px, 5vw, 80px);
    position: relative;
    z-index: 1;
}

.grid-cell {
    background: var(--parchment-cream);
    padding: clamp(1rem, 2vw, 2rem);
    position: relative;
    opacity: 0;
    transform: translateY(8px);
    animation: cellReveal 600ms cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.grid-cell.alt-bg {
    background: var(--slate-whisper);
}

@keyframes cellReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Opening Cell */
.opening-cell {
    grid-column: 2 / 9;
    padding: 3rem 2rem;
}

.opening-text {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3.5vw, 2.75rem);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.3;
    color: var(--deep-graphite);
    margin-bottom: 2rem;
}

.bell-curve-hero {
    width: 60%;
    max-width: 500px;
    height: auto;
    display: block;
}

/* Numeral Cells */
.numeral-cell {
    grid-column: span 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
    min-height: 60px;
}

/* Margin Cell */
.margin-cell {
    grid-column: 1 / 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 2rem;
}

/* Core Content */
.core-wide {
    grid-column: 2 / 9;
    padding: 2.5rem 2rem;
}

.core-side {
    grid-column: 9 / 13;
    padding: 2rem;
}

.core-narrow {
    grid-column: span 3;
    padding: 2rem;
}

/* Galton Cell */
.galton-cell {
    grid-column: 2 / 8;
    padding: 2rem;
}

.galton-cell canvas {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 4/3;
    display: block;
    background: var(--parchment-cream);
    border: 1px solid var(--graph-rule);
}

.galton-bins {
    display: flex;
    gap: 2px;
    margin-top: 0.5rem;
    font-family: var(--font-data);
    font-size: 11px;
    color: var(--fossil-gray);
}

.galton-bin {
    flex: 1;
    text-align: center;
}

/* Scatter Divider */
.scatter-divider-cell {
    grid-column: 1 / -1;
    padding: 0;
    background: transparent;
    height: 24px;
    display: flex;
    align-items: center;
}

.scatter-divider {
    width: 100%;
    height: 24px;
    position: relative;
}

.scatter-dot {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--graph-rule);
}

/* Convergence Cell */
.convergence-cell {
    grid-column: 2 / 11;
    padding: 3rem 2rem;
}

.bracket-quote {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.bracket {
    font-family: var(--font-display);
    font-size: 3rem;
    color: var(--bayesian-coral);
    line-height: 1;
    flex-shrink: 0;
}

.bracket-quote p {
    font-size: 1.1rem;
    line-height: 1.8;
    padding-top: 0.5rem;
}

/* Character Cells */
.char-cell {
    grid-column: span 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 600;
    color: var(--probability-blue);
    min-height: 80px;
}

/* Hover lift on interactive cells */
.galton-cell:hover,
.core-wide:hover,
.core-side:hover {
    box-shadow: 0 2px 8px rgba(43, 45, 51, 0.08);
    transform: translateY(-2px);
    transition: box-shadow 200ms ease, transform 200ms ease;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    padding: 2rem clamp(32px, 5vw, 80px);
    position: relative;
    z-index: 1;
}

.footer-line {
    height: 1px;
    background: var(--graph-rule);
    margin-bottom: 1rem;
}

.footer-text {
    font-family: var(--font-data);
    font-size: 12px;
    color: var(--fossil-gray);
    letter-spacing: 0.04em;
}

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

@media (max-width: 768px) {
    body {
        background-size: 16px 16px;
    }

    body::before {
        background-size: 16px 16px;
    }

    .bento-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem 1rem;
    }

    .opening-cell,
    .core-wide,
    .core-side,
    .core-narrow,
    .galton-cell,
    .margin-cell,
    .convergence-cell,
    .numeral-cell,
    .char-cell,
    .scatter-divider-cell {
        grid-column: 1 / -1;
    }

    .header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .opening-text {
        font-size: clamp(1.25rem, 5vw, 2rem);
    }

    .bell-curve-hero {
        width: 90%;
    }

    .prob-annotation {
        display: block;
        margin-bottom: 0.25rem;
    }

    .margin-cell {
        flex-direction: row;
        gap: 1rem;
        padding: 1rem;
    }
}

/* ============================================
   Print
   ============================================ */

@media print {
    body {
        background-image: none;
        background: white;
    }

    body::before {
        display: none;
    }

    .grid-cell {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .galton-cell canvas {
        display: none;
    }

    .bell-curve-hero path {
        stroke: black;
    }
}

@media (prefers-reduced-motion: reduce) {
    .grid-cell {
        opacity: 1;
        transform: none;
        animation: none;
    }
}
