/* ============================================
   rational.today - Analytical Frost
   Bauhaus-era analytical broadsheet
   ============================================ */

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

:root {
    /* Palette: Analytical Frost */
    --bg-primary: #F4F3EE;
    --bg-secondary: #E8E6DF;
    --text-primary: #1B1B1E;
    --text-secondary: #5C5C66;
    --accent-red: #C4362A;
    --rule-lines: #C8C5BC;
    --highlight-field: #FFFDF5;
    --diagram-stroke: #3A3A42;

    /* Typography Scale */
    --masthead-size: clamp(3rem, 8vw, 7rem);
    --headline-size: clamp(1.6rem, 3vw, 2.8rem);
    --body-size: clamp(1rem, 1.2vw, 1.15rem);
    --mono-size: clamp(0.75rem, 0.9vw, 0.9rem);

    /* Grid */
    --gutter: 16px;
    --max-width: 1280px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Archivo', sans-serif;
    font-weight: 400;
    font-size: var(--body-size);
    line-height: 1.72;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    position: relative;
}

/* ---- Grid of Propositions Background Texture ---- */
#grid-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(circle, var(--rule-lines) 0.8px, transparent 0.8px);
    background-size: 48px 48px;
    background-position: 24px 24px;
    opacity: 0.15;
}

/* ---- All content above background ---- */
#masthead,
.broadsheet-section,
#colophon {
    position: relative;
    z-index: 1;
}

/* ============================================
   MASTHEAD
   ============================================ */
#masthead {
    min-height: 15vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3vh 2rem 0;
}

.masthead-inner {
    text-align: center;
    width: 100%;
    max-width: var(--max-width);
}

.masthead-seal {
    margin: 0 auto 1.5rem;
}

.masthead-title {
    font-family: 'Archivo Black', sans-serif;
    font-weight: 400;
    font-size: var(--masthead-size);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    line-height: 1.1;
}

.masthead-rule {
    width: 80%;
    height: 1px;
    background-color: var(--rule-lines);
    margin: 1.5rem auto;
}

.dateline {
    font-family: 'DM Mono', monospace;
    font-size: var(--mono-size);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 1rem;
}

/* ---- Bias Ticker ---- */
.bias-ticker-container {
    width: 100%;
    overflow: hidden;
    border-top: 1px solid var(--rule-lines);
    border-bottom: 1px solid var(--rule-lines);
    padding: 0.5rem 0;
    background: var(--bg-primary);
}

.bias-ticker {
    display: flex;
    white-space: nowrap;
    animation: ticker-scroll 60s linear infinite;
}

.ticker-content {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.bias-name {
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    font-variant: small-caps;
    color: var(--text-secondary);
    padding: 0 0.5rem;
}

.ticker-diamond {
    color: var(--accent-red);
    font-size: 0.6rem;
    flex-shrink: 0;
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* ============================================
   BROADSHEET SECTION LAYOUT
   ============================================ */
.broadsheet-section {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 4rem 2rem;
}

/* Three-column grid: 3/12 | 6/12 | 3/12 */
.section-grid.three-column {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: var(--gutter);
}

/* ---- Marginalia Channel ---- */
.marginalia-channel {
    padding-right: var(--gutter);
    border-right: 1px solid var(--rule-lines);
}

.marginalia-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(200, 197, 188, 0.3);
}

.marginalia-item:last-child {
    border-bottom: none;
}

.def-label {
    font-family: 'DM Mono', monospace;
    font-size: var(--mono-size);
    font-weight: 500;
    color: var(--accent-red);
    display: block;
    margin-bottom: 0.4rem;
    letter-spacing: 0.02em;
}

.bias-label {
    font-family: 'DM Mono', monospace;
    font-size: var(--mono-size);
    font-weight: 500;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.4rem;
    letter-spacing: 0.02em;
    font-variant: small-caps;
}

.def-text {
    font-family: 'Archivo', sans-serif;
    font-weight: 300;
    font-size: calc(var(--body-size) * 0.9);
    line-height: 1.4;
    color: var(--text-secondary);
}

.marginalia-diagram {
    margin: 2rem 0;
    display: flex;
    justify-content: center;
}

/* ---- Main Argument ---- */
.main-argument {
    padding: 0 calc(var(--gutter) * 2);
}

.section-headline {
    font-family: 'Archivo Black', sans-serif;
    font-weight: 400;
    font-size: var(--headline-size);
    letter-spacing: 0.04em;
    color: var(--text-primary);
    margin-bottom: 2rem;
    line-height: 1.2;
}

.body-text {
    font-family: 'Archivo', sans-serif;
    font-weight: 400;
    font-size: var(--body-size);
    line-height: 1.72;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.body-text:last-child {
    margin-bottom: 0;
}

.final-paragraph {
    font-weight: 600;
}

/* Pull Quote */
.pull-quote {
    margin: 2.5rem 0;
    padding: 1.5rem 0 1.5rem 1.5rem;
    border-left: 3px solid var(--accent-red);
    background: var(--highlight-field);
}

.pull-quote p {
    font-family: 'Archivo Black', sans-serif;
    font-weight: 400;
    font-size: clamp(1.2rem, 2vw, 2rem);
    line-height: 1.4;
    color: var(--text-primary);
    font-style: normal;
}

/* Geometric Seal (large, center of section 3) */
.geometric-seal-large {
    display: flex;
    justify-content: center;
    margin: 3rem 0;
}

#rotating-seal {
    animation: rotate-seal 720s linear infinite;
}

@keyframes rotate-seal {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ---- Evidence Sidebar ---- */
.evidence-sidebar {
    padding-left: var(--gutter);
    border-left: 1px solid var(--rule-lines);
}

.evidence-item {
    margin-bottom: 2rem;
}

.sidebar-ruled-lines {
    position: relative;
    padding: 1rem 0;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 27px,
        rgba(200, 197, 188, 0.25) 27px,
        rgba(200, 197, 188, 0.25) 28px
    );
}

.sidebar-heading {
    font-family: 'Archivo Black', sans-serif;
    font-weight: 400;
    font-size: calc(var(--body-size) * 0.85);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.sidebar-venn {
    display: block;
    margin: 0.5rem auto 1rem;
}

.sidebar-caption {
    font-family: 'Archivo', sans-serif;
    font-weight: 300;
    font-size: calc(var(--body-size) * 0.85);
    line-height: 1.4;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.sidebar-note {
    font-family: 'Archivo', sans-serif;
    font-weight: 300;
    font-size: calc(var(--body-size) * 0.85);
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.mono-note {
    font-family: 'DM Mono', monospace;
    font-size: var(--mono-size);
    letter-spacing: 0.02em;
}

/* ---- Truth Table ---- */
.truth-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0 1rem;
    font-family: 'DM Mono', monospace;
    font-size: var(--mono-size);
}

.truth-table th,
.truth-table td {
    border: 1px solid var(--rule-lines);
    padding: 0.4rem 0.6rem;
    text-align: center;
    color: var(--text-primary);
}

.truth-table th {
    background: var(--bg-secondary);
    font-weight: 500;
}

.truth-table td {
    font-weight: 400;
}

/* ============================================
   DIAGONAL SECTION BREAKS
   ============================================ */
.diagonal-break {
    position: relative;
    width: 100%;
    height: 60px;
    margin: 3rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diagonal-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--rule-lines);
    transform: rotate(2deg);
    transform-origin: center;
}

.diagonal-node {
    position: relative;
    z-index: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-red);
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-number {
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    color: #FFFDF5;
    letter-spacing: 0.02em;
}

/* ============================================
   SECTION IV - COLLAPSING COLUMNS
   ============================================ */
.section-collapse .collapsible-column {
    transition: opacity 0.6s ease-out, max-width 0.6s ease-out;
    overflow: hidden;
}

.section-collapse .collapsible-column.collapsed {
    opacity: 0;
    max-width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}

.section-collapse #main-argument-collapse {
    transition: grid-column 0.6s ease-out;
}

.final-paragraphs {
    margin-top: 2rem;
}

/* ============================================
   COLOPHON
   ============================================ */
#colophon {
    min-height: 10vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    border-top: 1px solid var(--rule-lines);
}

.colophon-inner {
    text-align: center;
}

.colophon-seal {
    margin: 0 auto 1rem;
}

.colophon-text {
    font-family: 'DM Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.colophon-statement {
    font-family: 'DM Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ============================================
   FADE-IN ANIMATION
   ============================================ */
.fade-in {
    opacity: 0;
    transition: opacity 200ms ease-out;
}

.fade-in.visible {
    opacity: 1;
}

/* ============================================
   DIAGONAL LINE DRAW ANIMATION
   ============================================ */
.diagonal-break .diagonal-line {
    transform-origin: left center;
    transform: rotate(2deg) scaleX(0);
    transition: transform 400ms linear;
}

.diagonal-break .diagonal-node {
    opacity: 0;
    transition: opacity 200ms ease-out 200ms;
}

.diagonal-break.visible .diagonal-line {
    transform: rotate(2deg) scaleX(1);
}

.diagonal-break.visible .diagonal-node {
    opacity: 1;
}

/* ============================================
   RESPONSIVE: Single Column below 768px
   ============================================ */
@media (max-width: 768px) {
    .section-grid.three-column {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .marginalia-channel {
        border-right: none;
        border-bottom: 1px solid var(--rule-lines);
        padding-right: 0;
        padding-bottom: 1.5rem;
    }

    .evidence-sidebar {
        border-left: none;
        border-top: 1px solid var(--rule-lines);
        padding-left: 0;
        padding-top: 1.5rem;
    }

    .main-argument {
        padding: 0;
    }

    .masthead-title {
        font-size: clamp(2rem, 10vw, 4rem);
    }

    .broadsheet-section {
        padding: 2rem 1rem;
    }

    .pull-quote p {
        font-size: clamp(1rem, 4vw, 1.5rem);
    }

    /* On mobile, collapsed columns should hide */
    .section-collapse .collapsible-column.collapsed {
        display: none;
    }
}

/* ============================================
   TABLET (769px - 1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .section-grid.three-column {
        grid-template-columns: 1fr 2.5fr 1fr;
    }

    .broadsheet-section {
        padding: 3rem 1.5rem;
    }
}
