/* voting.wiki — scholarly encyclopedia layout
   Palette: #FFFFFF, #F8F9FA, #1B2A4A, #374151, #6B7280, #2563EB, #DC2626, #059669, #D1D5DB, #EBF5FF
   Typography: Libre Baskerville (headings), DM Sans (labels), Source Sans 3 (body)
*/

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

:root {
    --white: #FFFFFF;
    --offwhite: #F8F9FA;
    --navy: #1B2A4A;
    --slate: #374151;
    --gray: #6B7280;
    --civic-blue: #2563EB;
    --ballot-red: #DC2626;
    --civic-green: #059669;
    --border: #D1D5DB;
    --pale-blue: #EBF5FF;

    --content-max: 840px;
    --left-gutter: 80px;
    --timeline-w: 120px;
    --toc-w: 200px;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--white);
    color: var(--slate);
    font-family: "Source Sans 3", system-ui, -apple-system, sans-serif;
    font-size: 16.5px;
    line-height: 1.72;
    font-weight: 400;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: var(--civic-blue);
    text-decoration: none;
    border-bottom: 1px solid rgba(37, 99, 235, 0.25);
    transition: border-color 150ms ease, color 150ms ease;
}

a:hover {
    border-bottom-color: var(--civic-blue);
}

em {
    font-style: italic;
    color: var(--navy);
}

strong {
    font-weight: 600;
    color: var(--navy);
}

/* ============ Header ============ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 60;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.brand-name {
    font-family: "Libre Baskerville", Georgia, serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--navy);
    letter-spacing: 0.01em;
}

.brand-tag {
    font-family: "DM Sans", sans-serif;
    font-size: 12px;
    color: var(--gray);
    padding-left: 14px;
    border-left: 1px solid var(--border);
    letter-spacing: 0.02em;
}

.header-nav {
    display: flex;
    gap: 28px;
}

.header-nav a {
    font-family: "DM Sans", sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--slate);
    border-bottom: none;
    text-transform: none;
    letter-spacing: 0.02em;
    transition: color 150ms ease;
}

.header-nav a:hover {
    color: var(--civic-blue);
}

/* ============ Floating TOC ============ */
.floating-toc {
    position: fixed;
    top: 110px;
    left: 24px;
    width: var(--toc-w);
    background: var(--white);
    border: 1px solid var(--border);
    padding: 18px 18px 14px;
    z-index: 50;
    opacity: 0;
    transform: translateX(-12px);
    transition: opacity 240ms ease, transform 240ms ease;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(27, 42, 74, 0.04);
}

.floating-toc.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.toc-title {
    font-family: "DM Sans", sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gray);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toc-list a {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 6px 4px;
    font-family: "Source Sans 3", sans-serif;
    font-size: 13.5px;
    color: var(--slate);
    border-bottom: none;
    border-left: 2px solid transparent;
    padding-left: 8px;
    transition: color 200ms ease, border-color 200ms ease, font-weight 200ms ease;
}

.toc-list a:hover {
    color: var(--civic-blue);
}

.toc-list a.active {
    color: var(--civic-blue);
    font-weight: 600;
    border-left-color: var(--civic-blue);
}

.toc-num {
    font-family: "DM Sans", sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray);
    min-width: 12px;
}

.toc-list a.active .toc-num {
    color: var(--civic-blue);
}

.toc-progress {
    margin-top: 14px;
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    overflow: hidden;
}

.toc-progress-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--civic-blue);
    transition: width 120ms linear;
}

/* ============ Timeline rail (right) ============ */
.timeline-rail {
    position: fixed;
    top: 110px;
    right: 24px;
    width: var(--timeline-w);
    height: calc(100vh - 140px);
    z-index: 40;
    pointer-events: none;
}

.timeline-heading {
    font-family: "DM Sans", sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--gray);
    margin-bottom: 14px;
    text-align: left;
    padding-left: 18px;
}

.timeline-track {
    position: relative;
    width: 100%;
    height: calc(100% - 40px);
    pointer-events: auto;
}

.timeline-line {
    position: absolute;
    left: 22px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-fill {
    position: absolute;
    left: 22px;
    top: 0;
    width: 2px;
    height: 0%;
    background: var(--civic-blue);
    transition: height 120ms linear;
}

.timeline-nodes {
    list-style: none;
    position: relative;
    height: 100%;
}

.timeline-node {
    position: absolute;
    left: 0;
    top: var(--pos);
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 200ms ease;
}

.timeline-node .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 50%;
    margin-left: 17px;
    transition: background 200ms ease, border-color 200ms ease, width 200ms ease, height 200ms ease;
    flex-shrink: 0;
}

.timeline-node.major .dot {
    width: 14px;
    height: 14px;
    margin-left: 15px;
    border-color: var(--civic-blue);
    background: var(--white);
}

.timeline-node.passed .dot {
    background: var(--civic-blue);
    border-color: var(--civic-blue);
}

.timeline-node.major.passed .dot {
    background: var(--civic-blue);
    border-color: var(--civic-blue);
}

.timeline-node .year {
    font-family: "DM Sans", sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: var(--navy);
    letter-spacing: 0.02em;
    line-height: 1;
}

.timeline-node .label {
    display: block;
    font-family: "Source Sans 3", sans-serif;
    font-size: 10px;
    color: var(--gray);
    line-height: 1.2;
    max-width: 80px;
}

.timeline-node-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.timeline-node .year + .label {
    margin-top: 2px;
}

/* Wrap year + label */
.timeline-node {
    align-items: center;
}

.timeline-node > .year,
.timeline-node > .label {
    display: block;
}

.timeline-node {
    flex-wrap: wrap;
}

.timeline-node .year {
    flex-basis: 100%;
}

/* Re-collapse for cleaner layout */
.timeline-node {
    flex-wrap: nowrap;
    align-items: flex-start;
    padding-top: 0;
}

.timeline-node .year-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-top: 0;
}

/* ============ Main article ============ */
.article {
    max-width: var(--content-max);
    margin: 0 auto 0 var(--left-gutter);
    padding: 56px calc(var(--timeline-w) + 60px) 80px var(--toc-w);
    position: relative;
}

@media (max-width: 1480px) {
    .article {
        margin-left: var(--left-gutter);
        padding-left: 32px;
    }
}

@media (max-width: 1100px) {
    .floating-toc { display: none; }
    .timeline-rail { display: none; }
    .article {
        margin: 0 auto;
        padding: 48px 32px 80px;
    }
}

/* ============ Hero ============ */
.article-hero {
    padding: 16px 0 40px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 56px;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "DM Sans", sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 22px;
}

.eyebrow-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--civic-green);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.article-title {
    font-family: "Libre Baskerville", Georgia, serif;
    font-weight: 700;
    font-size: 56px;
    line-height: 1.08;
    color: var(--navy);
    letter-spacing: 0.01em;
    margin-bottom: 18px;
}

.article-subtitle {
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 20px;
    line-height: 1.5;
    color: var(--gray);
    font-weight: 400;
    font-style: italic;
    margin-bottom: 30px;
    max-width: 720px;
}

.article-abstract {
    background: var(--offwhite);
    border-left: 4px solid var(--civic-blue);
    padding: 20px 24px;
    margin-bottom: 32px;
}

.article-abstract p {
    font-size: 16.5px;
    color: var(--slate);
}

.hero-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 22px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.hero-meta div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hero-meta dt {
    font-family: "DM Sans", sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gray);
}

.hero-meta dd {
    font-family: "Source Sans 3", sans-serif;
    font-size: 14px;
    color: var(--navy);
    font-weight: 500;
}

/* ============ Sections ============ */
.article-section {
    margin-bottom: 64px;
    scroll-margin-top: 100px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 12px;
    margin-left: -52px;
}

@media (max-width: 1100px) {
    .section-header {
        margin-left: 0;
    }
}

.section-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--civic-blue);
    color: var(--white);
    font-family: "DM Sans", sans-serif;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
    transform: scale(0);
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.article-section.in-view .section-circle {
    transform: scale(1);
}

.section-title {
    font-family: "Libre Baskerville", Georgia, serif;
    font-weight: 700;
    font-size: 32px;
    color: var(--navy);
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.section-rule {
    border: none;
    border-top: 1px solid var(--border);
    margin-bottom: 28px;
}

.section-body p {
    margin-bottom: 18px;
}

.subsection-title {
    font-family: "Libre Baskerville", Georgia, serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--navy);
    margin-top: 32px;
    margin-bottom: 14px;
    letter-spacing: 0.01em;
}

/* ============ Lists with checkmarks / X marks ============ */
.approval-list,
.rejection-list {
    list-style: none;
    margin: 12px 0 18px;
    padding: 0;
}

.approval-list li,
.rejection-list li {
    position: relative;
    padding-left: 30px;
    padding-top: 4px;
    padding-bottom: 4px;
    margin-bottom: 6px;
    font-size: 16px;
    line-height: 1.6;
}

.approval-list li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 12px;
    width: 14px;
    height: 8px;
    border-left: 2.5px solid var(--civic-green);
    border-bottom: 2.5px solid var(--civic-green);
    transform: rotate(-45deg);
}

.rejection-list li::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 11px;
    width: 12px;
    height: 12px;
    background:
        linear-gradient(45deg, transparent 45%, var(--ballot-red) 45%, var(--ballot-red) 55%, transparent 55%),
        linear-gradient(-45deg, transparent 45%, var(--ballot-red) 45%, var(--ballot-red) 55%, transparent 55%);
}

/* ============ Callouts ============ */
.callout {
    background: var(--pale-blue);
    border-left: 4px solid var(--civic-blue);
    padding: 18px 22px;
    margin: 22px 0;
    border-radius: 0 4px 4px 0;
}

.callout.alt {
    background: var(--offwhite);
    border-left-color: var(--ballot-red);
}

.callout-label {
    font-family: "DM Sans", sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--civic-blue);
    margin-bottom: 8px;
}

.callout.alt .callout-label {
    color: var(--ballot-red);
}

.callout p {
    margin: 0;
    font-size: 16px;
    color: var(--navy);
    line-height: 1.6;
}

/* ============ Comparison panels ============ */
.comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
    margin: 28px 0;
    align-items: stretch;
    border: 1px solid var(--border);
    background: var(--white);
}

.comparison-col {
    padding: 22px 24px;
    background: var(--white);
}

.comparison-col:first-child {
    background: var(--offwhite);
}

.comparison-col:last-child {
    background: var(--offwhite);
}

.comparison-col:nth-child(odd) {
    background: var(--white);
}

.comparison-col {
    background: var(--white);
}

.comparison-tag {
    font-family: "DM Sans", sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
    letter-spacing: 0.03em;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
}

.comparison-divider {
    position: relative;
    width: 40px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-divider::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    background: var(--border);
}

.comparison-divider .vs {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-family: "Libre Baskerville", Georgia, serif;
    font-style: italic;
    font-weight: 700;
    font-size: 14px;
    color: var(--navy);
    transition: transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.comparison.pulse .vs {
    animation: vsPulse 400ms ease-in-out;
}

@keyframes vsPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@media (max-width: 720px) {
    .comparison {
        grid-template-columns: 1fr;
    }
    .comparison-divider {
        width: auto;
        height: 40px;
    }
    .comparison-divider::before {
        top: 50%;
        bottom: auto;
        left: 0;
        right: 0;
        width: 100%;
        height: 1px;
        transform: none;
    }
}

/* ============ Tables ============ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 22px 0 28px;
    font-size: 14.5px;
    background: var(--white);
    border: 1px solid var(--border);
}

.data-table th {
    font-family: "DM Sans", sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
    text-align: left;
    padding: 12px 16px;
    background: var(--offwhite);
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--slate);
    vertical-align: top;
    transition: background 150ms ease;
}

.data-table tbody tr:nth-child(even) td {
    background: var(--offwhite);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover td {
    background: rgba(37, 99, 235, 0.04);
}

.data-table .numeric {
    font-family: "DM Sans", sans-serif;
    font-weight: 500;
    color: var(--navy);
}

.data-table .highlight,
.data-table tbody tr:nth-child(even) td.highlight,
.data-table tbody tr td.highlight {
    background: rgba(37, 99, 235, 0.08);
}

.data-table .ok,
.data-table .no {
    font-family: "DM Sans", sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table .ok { color: var(--civic-green); }
.data-table .no { color: var(--ballot-red); }

.criteria-table th:not(:first-child),
.criteria-table td:not(:first-child) {
    text-align: center;
}

/* ============ Diagram ============ */
.diagram-frame {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 22px;
    margin: 28px 0;
}

.diagram-caption {
    font-family: "DM Sans", sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 14px;
}

.flow-diagram {
    width: 100%;
    height: auto;
    max-height: 240px;
    display: block;
}

/* ============ Citations ============ */
.cite {
    font-family: "DM Sans", sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--civic-blue);
    cursor: pointer;
    padding: 0 2px;
    margin-left: 1px;
    border-bottom: none;
    text-decoration: none;
    transition: color 150ms ease;
}

.cite:hover {
    color: var(--ballot-red);
}

/* ============ References list ============ */
.ref-list {
    list-style: none;
    counter-reset: ref;
    padding: 0;
    margin: 0 0 36px;
}

.ref-list li {
    position: relative;
    padding: 12px 16px 12px 56px;
    border-bottom: 1px solid var(--border);
    font-size: 14.5px;
    color: var(--slate);
    line-height: 1.55;
    transition: background 300ms ease;
}

.ref-list li.flash {
    background: var(--pale-blue);
}

.ref-num {
    position: absolute;
    left: 16px;
    top: 12px;
    font-family: "DM Sans", sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--civic-blue);
    letter-spacing: 0.04em;
    width: 28px;
    text-align: center;
    padding: 1px 6px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--white);
}

/* ============ Contribute block ============ */
.contribute-block {
    margin-top: 32px;
    background: var(--offwhite);
    border: 1px solid var(--border);
    padding: 24px 28px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: center;
}

.contribute-text h3 {
    font-family: "Libre Baskerville", Georgia, serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--navy);
    margin-bottom: 6px;
}

.contribute-text p {
    font-size: 14.5px;
    color: var(--slate);
    margin: 0;
}

.contribute-meta {
    list-style: none;
    display: flex;
    gap: 24px;
}

.contribute-meta li {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.contribute-meta span {
    font-family: "DM Sans", sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.contribute-meta strong {
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 22px;
    color: var(--navy);
    font-weight: 700;
}

@media (max-width: 720px) {
    .contribute-block {
        grid-template-columns: 1fr;
    }
    .contribute-meta {
        flex-wrap: wrap;
    }
}

/* ============ Footer ============ */
.site-footer {
    margin-top: 60px;
    border-top: 1px solid var(--border);
    background: var(--offwhite);
    padding: 28px 0;
}

.footer-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-brand {
    font-family: "Libre Baskerville", Georgia, serif;
    font-weight: 700;
    color: var(--navy);
    font-size: 16px;
}

.footer-meta {
    font-family: "DM Sans", sans-serif;
    font-size: 12px;
    color: var(--gray);
    flex: 1;
    text-align: center;
    letter-spacing: 0.02em;
}

.footer-rev {
    font-family: "DM Sans", sans-serif;
    font-size: 12px;
    color: var(--gray);
}

@media (max-width: 720px) {
    .footer-inner { flex-direction: column; text-align: center; }
    .footer-meta { text-align: center; }
}

/* ============ Footnote flash overlay (decorative) ============ */
.footnote-flash {
    position: fixed;
    pointer-events: none;
    background: var(--pale-blue);
    width: 0;
    height: 0;
    opacity: 0;
}

/* ============ Reduce motion fallback would normally go here, but skipped per spec ============ */
