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

:root {
    --espresso: #2A2520;
    --warm-graphite: #4A4540;
    --stone: #6B6560;
    --ash: #8A8480;
    --silver: #B0AAA0;
    --parchment: #D4CFC4;
    --cream: #FFFFF8;
    --accent: #C4483E;
    --white: #FFFFFF;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--cream);
    color: var(--warm-graphite);
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background-color: rgba(255, 255, 248, 0.95);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--parchment);
}

.header-inner {
    max-width: 1008px;
    margin: 0 auto;
    padding: 14px 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    color: var(--espresso);
    letter-spacing: 0.02em;
}

.folio-nav {
    display: flex;
    gap: 20px;
}

.folio-link {
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    color: var(--silver);
    cursor: pointer;
    transition: color 0.3s ease, font-weight 0.3s ease;
    user-select: none;
}

.folio-link.active {
    color: var(--espresso);
    font-weight: 700;
}

/* Spread Container */
.spread-container {
    max-width: 1008px;
    margin: 0 auto;
    padding: 80px 48px 0;
    position: relative;
}

/* Column Rule */
.column-rule {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-0.5px);
    width: 1px;
    height: calc(100vh - 60px);
    background-color: var(--parchment);
    opacity: 0;
    z-index: 1;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.column-rule.visible {
    opacity: 1;
}

/* Spread Section */
.spread-section {
    padding: 64px 0;
    border-bottom: 1px solid var(--parchment);
}

.spread-section:last-child {
    border-bottom: none;
}

/* Folio Marker */
.folio-marker {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.ballot-icon {
    flex-shrink: 0;
}

.folio-number {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--ash);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.folio-number.visible {
    opacity: 1;
}

/* Spread Columns */
.spread-columns {
    display: flex;
    gap: 48px;
}

.left-column {
    flex: 1;
    min-width: 0;
}

.right-column {
    flex: 1;
    min-width: 0;
    padding-top: 8px;
}

/* Typography */
h2 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 28px;
    letter-spacing: -0.01em;
    color: var(--espresso);
    margin-bottom: 16px;
}

p {
    margin-bottom: 16px;
}

/* Pull Quote */
.pull-quote {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 22px;
    line-height: 1.5;
    color: var(--espresso);
    border-left: 2px solid var(--accent);
    padding-left: 20px;
    margin-bottom: 24px;
    position: relative;
}

.pq-mark {
    font-size: 48px;
    color: var(--parchment);
    position: absolute;
    left: -8px;
    top: -16px;
    font-style: normal;
    line-height: 1;
}

/* Margin Note */
.margin-note {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.65;
    color: var(--ash);
}

.margin-note em {
    font-style: italic;
}

.margin-note strong {
    font-weight: 500;
    color: var(--stone);
}

/* Cross Reference */
.cross-ref {
    margin-top: 20px;
    padding: 12px 16px;
    border: 1px solid var(--parchment);
    border-radius: 2px;
}

.cross-ref-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ash);
    display: block;
    margin-bottom: 4px;
}

.cross-ref-text {
    font-family: 'Lora', serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--warm-graphite);
}

/* Voting Diagrams */
.voting-diagram {
    margin-top: 24px;
    padding: 20px;
    background-color: var(--white);
    border: 1px solid var(--parchment);
    border-radius: 2px;
}

.candidate-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.candidate {
    display: flex;
    align-items: center;
    gap: 10px;
}

.candidate-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.candidate-label {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: var(--espresso);
    width: 16px;
    flex-shrink: 0;
}

.vote-bar {
    flex: 1;
    height: 8px;
    background-color: var(--parchment);
    border-radius: 4px;
    overflow: hidden;
}

.vote-fill {
    height: 100%;
    background-color: var(--accent);
    border-radius: 4px;
    transition: width 0.8s ease;
}

.vote-count {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--stone);
    width: 36px;
    text-align: right;
    flex-shrink: 0;
}

.diagram-caption {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--ash);
    margin-top: 16px;
    line-height: 1.5;
    font-style: italic;
}

/* RCV Rounds */
.rcv-rounds {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rcv-round {
    position: relative;
}

.round-label {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--ash);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 8px;
}

.round-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.round-bar-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.round-bar-item span:first-child {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: var(--espresso);
    width: 16px;
    flex-shrink: 0;
}

.round-bar-item span:last-child {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--stone);
    width: 36px;
    text-align: right;
    flex-shrink: 0;
}

.round-bar-item.eliminated {
    opacity: 0.4;
    text-decoration: line-through;
}

.round-bar-item.winner .vote-fill {
    background-color: #2A7B3D;
}

/* Approval Grid */
.approval-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.approval-header,
.approval-voter,
.approval-total {
    display: grid;
    grid-template-columns: 80px repeat(3, 1fr);
    gap: 0;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
}

.approval-header {
    border-bottom: 1px solid var(--parchment);
    padding-bottom: 8px;
    margin-bottom: 4px;
    font-weight: 500;
    color: var(--espresso);
    text-align: center;
}

.approval-header span:first-child {
    text-align: left;
}

.approval-voter {
    padding: 6px 0;
    border-bottom: 1px solid rgba(212, 207, 196, 0.4);
    text-align: center;
    color: var(--warm-graphite);
}

.approval-voter span:first-child {
    text-align: left;
    font-size: 12px;
    color: var(--ash);
}

.check-mark {
    color: #2A7B3D;
    font-weight: 700;
}

.no-mark {
    color: var(--parchment);
}

.approval-total {
    padding-top: 8px;
    border-top: 2px solid var(--espresso);
    margin-top: 4px;
    font-weight: 500;
    color: var(--espresso);
    text-align: center;
}

.approval-total span:first-child {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.winner-total {
    color: var(--accent);
    font-weight: 700;
}

/* Theorem Box */
.theorem-box {
    margin-top: 24px;
    padding: 20px 24px;
    border: 1px solid var(--espresso);
    border-radius: 2px;
    background-color: rgba(42, 37, 32, 0.03);
}

.theorem-label {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--espresso);
    display: block;
    margin-bottom: 8px;
}

.theorem-box p {
    font-family: 'Lora', serif;
    font-size: 15px;
    line-height: 1.75;
    color: var(--warm-graphite);
    margin-bottom: 0;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--parchment);
    margin-top: 40px;
}

.footer-inner {
    max-width: 1008px;
    margin: 0 auto;
    padding: 20px 48px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-title {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--espresso);
}

.footer-sep {
    color: var(--parchment);
}

.footer-text {
    font-family: 'Lora', serif;
    font-size: 13px;
    color: var(--ash);
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner,
    .spread-container,
    .footer-inner {
        padding-left: 24px;
        padding-right: 24px;
    }

    .spread-columns {
        flex-direction: column;
        gap: 24px;
    }

    .column-rule {
        display: none;
    }

    h2 {
        font-size: 24px;
    }

    .pull-quote {
        font-size: 18px;
    }
}
