/* ============================================
   VOTING.WIKI - Encyclopedia of Voting
   ============================================ */

:root {
    --paper: #f4f0e8;
    --surface: #faf8f2;
    --ink: #2c2c2c;
    --body: #3a3a3a;
    --caption: #6a6a6a;
    --red: #c4442e;
    --navy: #2a4a7a;
    --ochre: #b89a48;
    --stripe: #ede8dc;
}

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

html {
    background: var(--paper);
}

body {
    font-family: 'Source Serif 4', serif;
    color: var(--body);
    background: var(--paper);
    overflow-x: hidden;
    line-height: 1.75;
}

/* === Masthead === */
#masthead {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background: var(--paper);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--ink);
    z-index: 100;
}

.masthead-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
}

.masthead-nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--caption);
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--ink);
}

/* === Index Tabs === */
.index-tabs {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.index-tab {
    width: 16px;
    height: 4px;
    background: var(--red);
    border-radius: 1px 0 0 1px;
}

/* === Page Sections === */
.page-section {
    padding: 6rem 2rem 4rem;
    max-width: 960px;
    margin: 0 auto;
    position: relative;
}

body > .page-section:first-of-type {
    padding-top: 7rem;
}

/* === Folio Markers === */
.folio {
    position: absolute;
    top: 4rem;
    right: 0;
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-size: 0.8rem;
    color: var(--caption);
}

/* === Title Page === */
.title-content {
    text-align: center;
    padding: 4rem 0;
}

.title-ballot {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.title-ballot.visible {
    opacity: 1;
    transform: scale(1);
}

.main-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(3rem, 6vw, 5rem);
    font-weight: 900;
    color: var(--ink);
    letter-spacing: -0.01em;
    margin: 1rem 0 0.5rem;
}

.main-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(0.8rem, 1vw, 1rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--caption);
    margin-bottom: 2rem;
}

.title-rule {
    border: none;
    border-top: 1px solid var(--ink);
    max-width: 200px;
    margin: 2rem auto;
}

.intro-columns {
    column-count: 2;
    column-gap: 2rem;
    column-rule: 0.5px solid rgba(44,44,44,0.3);
    text-align: left;
    max-width: 720px;
    margin: 0 auto;
}

/* === Chapter Headings === */
.chapter-heading {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 900;
    color: var(--ink);
    letter-spacing: -0.01em;
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--ink);
}

/* === Editorial Columns === */
.editorial-columns {
    column-gap: 2rem;
    column-rule: 0.5px solid rgba(44,44,44,0.3);
}

.col-3 {
    column-count: 3;
}

.col-2 {
    column-count: 2;
}

/* === Body Text === */
.body-text {
    font-family: 'Source Serif 4', serif;
    font-size: clamp(0.9rem, 1vw, 1rem);
    font-weight: 400;
    color: var(--body);
    line-height: 1.75;
    margin-bottom: 1rem;
}

/* === Drop Caps === */
.drop-cap {
    float: left;
    font-family: 'Playfair Display', serif;
    font-size: 4rem;
    font-weight: 900;
    color: var(--ink);
    line-height: 0.85;
    padding-right: 0.5rem;
    padding-top: 0.1rem;
}

.drop-cap-block {
    break-inside: avoid;
    margin-bottom: 1rem;
}

/* === Ruled Boxes === */
.ruled-box {
    border: 1px solid var(--ink);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    break-inside: avoid;
    background: var(--surface);
}

.box-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.75rem;
}

/* === Pull Quotes === */
.pull-quote {
    border-left: 3px solid var(--red);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    break-inside: avoid;
}

.pull-quote p {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-size: 1.1rem;
    color: var(--ink);
    line-height: 1.6;
}

/* === Caption Text === */
.caption-text {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(0.75rem, 0.85vw, 0.85rem);
    color: var(--caption);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.accent-red {
    color: var(--red);
    font-weight: 600;
}

.inline-icon {
    vertical-align: middle;
    display: inline-block;
}

/* === Pictogram Row === */
.pictogram-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.picto {
    flex-shrink: 0;
}

.picto-red {
    color: var(--red);
}

.picto-gray {
    color: var(--caption);
}

.picto-label {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.7rem;
    color: var(--caption);
    margin-left: 0.5rem;
}

/* === Timeline Entries === */
.timeline-entry {
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--stripe);
    break-inside: avoid;
}

.timeline-year {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--red);
    display: block;
    margin-bottom: 0.25rem;
}

/* === Tally Marks === */
.tally-decoration {
    text-align: center;
    padding: 2rem 0;
}

.tally-svg {
    width: 60px;
    height: 20px;
    opacity: 0.4;
}

/* === Paradox Diagram === */
.paradox-diagram {
    text-align: center;
    margin-top: 1rem;
}

.paradox-svg {
    width: 120px;
    height: 100px;
}

/* === Colophon === */
.colophon-section {
    text-align: center;
    padding: 4rem 2rem 6rem;
}

.colophon-rule {
    border: none;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    height: 4px;
    max-width: 200px;
    margin: 0 auto 3rem;
    position: relative;
}

.colophon-rule::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 8px;
    height: 8px;
    border: 1px solid var(--ink);
    background: var(--paper);
}

.colophon-ballot {
    margin-bottom: 1.5rem;
}

.colophon-title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 900;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.colophon-note {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-size: 1rem;
    color: var(--body);
    margin-bottom: 2rem;
}

.colophon-est {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.75rem;
    color: var(--caption);
    letter-spacing: 0.1em;
}

/* === Responsive === */
@media (max-width: 768px) {
    .col-3, .col-2, .intro-columns {
        column-count: 1;
    }

    .drop-cap {
        font-size: 3rem;
    }

    #masthead {
        padding: 0 1rem;
    }

    .masthead-nav {
        gap: 0.75rem;
    }

    .nav-link {
        font-size: 0.6rem;
    }

    .index-tabs {
        display: none;
    }

    .page-section {
        padding: 4rem 1.5rem 3rem;
    }

    .folio {
        position: static;
        margin-bottom: 1rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .col-3 {
        column-count: 2;
    }
}

/* Top padding for fixed masthead */
body {
    padding-top: 48px;
}
