/* voting.wiki — Documentation Clean Slate */

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

/* ===== BASE ===== */
html {
    scroll-behavior: smooth;
    scroll-margin-top: 80px;
}

body {
    background: #FFFFFF;
    color: #1A1A2E;
    font-family: 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.75;
}

/* ===== HERO ===== */
.hero {
    padding: 3.5rem 2rem 2.5rem;
    text-align: center;
    border-bottom: 1px solid #E5E7EB;
    background: #FFFFFF;
}

.hero-inner {
    max-width: 640px;
    margin: 0 auto;
}

.hero-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 0.35rem;
}

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

.hero-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 30px;
    color: #1A1A2E;
    letter-spacing: -0.01em;
}

.hero-sub {
    font-size: 1.1rem;
    color: #4A4A6A;
    margin-bottom: 1.5rem;
}

/* ===== SEARCH ===== */
.search-bar {
    position: relative;
    max-width: 500px;
    margin: 0 auto 1.25rem;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    font-size: 0.95rem;
    font-family: 'Source Sans Pro', sans-serif;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    background: #F8F9FA;
    color: #1A1A2E;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ===== CATEGORY PILLS ===== */
.category-pills {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.pill {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.4rem 0.85rem;
    border-radius: 4px;
    background: #F8F9FA;
    color: #4A4A6A;
    cursor: pointer;
    border: 1px solid #E5E7EB;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.pill:hover {
    background: #DBEAFE;
    color: #2563EB;
    border-color: #2563EB;
}

.pill.active {
    background: #DBEAFE;
    color: #2563EB;
    border-color: #2563EB;
}

/* ===== FEATURED CARD ===== */
.featured-card {
    max-width: 500px;
    margin: 0 auto;
    text-align: left;
    padding: 1.1rem 1.25rem;
    background: #F8F9FA;
    border: 1px solid #E5E7EB;
    border-left: 3px solid #2563EB;
    border-radius: 4px;
}

.featured-label {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #2563EB;
    display: block;
    margin-bottom: 0.35rem;
}

.featured-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: #1A1A2E;
    letter-spacing: -0.01em;
    margin-bottom: 0.3rem;
}

.featured-excerpt {
    font-size: 0.9rem;
    color: #4A4A6A;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.featured-link {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: #2563EB;
    text-decoration: none;
    transition: color 0.2s;
}

.featured-link:hover {
    color: #1A1A2E;
}

/* ===== CONTENT LAYOUT ===== */
.content-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    max-width: 1020px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    gap: 2.5rem;
}

/* ===== SIDEBAR TOC ===== */
.sidebar {
    position: sticky;
    top: 2rem;
    align-self: start;
    height: fit-content;
}

.toc {
    background: #F8F9FA;
    padding: 1.1rem;
    border-radius: 6px;
    border: 1px solid #E5E7EB;
}

.toc-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: #1A1A2E;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

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

.toc-link {
    display: block;
    font-size: 0.85rem;
    color: #4A4A6A;
    text-decoration: none;
    padding: 0.35rem 0.6rem;
    margin-bottom: 0.15rem;
    border-left: 3px solid transparent;
    border-radius: 0 3px 3px 0;
    transition: all 0.2s;
}

.toc-link:hover {
    color: #2563EB;
    background: rgba(219, 234, 254, 0.4);
}

.toc-link.active {
    color: #2563EB;
    border-left-color: #2563EB;
    background: #DBEAFE;
    font-weight: 600;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    max-width: 720px;
    min-width: 0;
}

section[id] {
    scroll-margin-top: 2rem;
}

.article-heading {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 24px;
    color: #1A1A2E;
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
}

.article-subheading {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: #1A1A2E;
    letter-spacing: -0.01em;
    margin-top: 1.25rem;
    margin-bottom: 0.6rem;
}

.article-text {
    font-size: 17px;
    color: #1A1A2E;
    margin-bottom: 1rem;
    max-width: 72ch;
    line-height: 1.75;
}

.divider {
    border: none;
    border-top: 1px solid #E5E7EB;
    margin: 2.25rem 0;
}

/* ===== CROSS-REFERENCE ===== */
.crossref {
    border-left: 3px solid #2563EB;
    padding: 0.85rem 1.1rem;
    margin-bottom: 1rem;
    background: #F8F9FA;
    border-radius: 0 4px 4px 0;
}

.crossref-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: #1A1A2E;
    margin-bottom: 0.5rem;
}

.crossref-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: #2563EB;
    text-decoration: none;
    margin-bottom: 0.3rem;
    transition: color 0.2s;
}

.crossref-link:hover {
    color: #1A1A2E;
}

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

/* ===== INFO BOX ===== */
.info-box {
    background: #DBEAFE;
    padding: 1rem 1.15rem;
    border-radius: 4px;
    margin: 1rem 0 1.25rem;
}

.info-label {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    color: #2563EB;
    display: block;
    margin-bottom: 0.3rem;
}

.info-text {
    font-size: 0.95rem;
    color: #1A1A2E;
    line-height: 1.65;
}

/* ===== METHOD DIAGRAMS ===== */
.method-diagram {
    margin: 1.25rem 0;
    padding: 1rem;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    overflow-x: auto;
}

.diagram-svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ===== PROS / CONS ===== */
.pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0 1.25rem;
}

.pros, .cons {
    padding: 1rem;
    border-radius: 4px;
}

.pros {
    background: rgba(22, 163, 74, 0.06);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.cons {
    background: rgba(220, 38, 38, 0.06);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.pros-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    color: #16A34A;
    margin-bottom: 0.5rem;
}

.cons-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    color: #DC2626;
    margin-bottom: 0.5rem;
}

.pros-list, .cons-list {
    list-style: none;
    padding: 0;
}

.pros-list li, .cons-list li {
    font-size: 0.9rem;
    padding: 0.2rem 0;
    padding-left: 1.2rem;
    position: relative;
}

.pros-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16A34A;
}

.cons-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #DC2626;
}

/* ===== SIMULATOR ===== */
.simulator-panel {
    background: #F8F9FA;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.sim-section-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: #1A1A2E;
    margin-bottom: 0.75rem;
}

.sim-candidates {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.sim-candidate {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    background: #FFFFFF;
    border: 2px solid var(--c-color, #2563EB);
    color: var(--c-color, #2563EB);
}

.sim-voters {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.voter-group {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    padding: 0.75rem 1rem;
}

.voter-count-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.voter-count-text {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: #1A1A2E;
}

.voter-count {
    width: 60px;
    padding: 0.25rem 0.4rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    text-align: center;
    color: #1A1A2E;
    background: #F8F9FA;
}

.voter-count:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.voter-pct {
    font-size: 0.8rem;
    color: #4A4A6A;
}

.pref-order {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.pref-item {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    padding: 0.2rem 0.55rem;
    background: #DBEAFE;
    color: #2563EB;
    border-radius: 3px;
    cursor: move;
    user-select: none;
    transition: background 0.15s, transform 0.15s;
}

.pref-item:hover {
    background: #2563EB;
    color: #FFFFFF;
}

.pref-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.sim-run-btn {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.6rem 1.5rem;
    background: #2563EB;
    color: #FFFFFF;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.sim-run-btn:hover {
    background: #1d4ed8;
}

.sim-run-btn:active {
    transform: scale(0.97);
}

/* ===== SIMULATOR RESULTS ===== */
.sim-results {
    margin-top: 1.5rem;
}

.sim-result-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    padding: 1rem 1.15rem;
    margin-bottom: 0.85rem;
}

.result-method {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: #1A1A2E;
    margin-bottom: 0.6rem;
}

.result-bars {
    margin-bottom: 0.5rem;
}

.result-bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.bar-label {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    color: #1A1A2E;
    width: 50px;
    text-align: right;
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    height: 22px;
    background: #F8F9FA;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid #E5E7EB;
}

.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
    display: flex;
    align-items: center;
    padding-left: 6px;
}

.bar-fill.candidate-alice { background: #2563EB; }
.bar-fill.candidate-bob { background: #DC2626; }
.bar-fill.candidate-carol { background: #16A34A; }

.bar-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #FFFFFF;
    font-weight: 400;
    white-space: nowrap;
}

.result-winner {
    font-size: 0.85rem;
    color: #4A4A6A;
    margin-top: 0.3rem;
}

.result-winner strong {
    color: #2563EB;
}

.approval-note {
    font-size: 0.8rem;
    color: #4A4A6A;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.result-rounds {
    margin-bottom: 0.5rem;
}

.rcv-round {
    margin-bottom: 0.6rem;
}

.rcv-round-label {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    color: #4A4A6A;
    margin-bottom: 0.25rem;
}

.rcv-eliminated {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #DC2626;
    margin-top: 0.15rem;
}

/* ===== COMPARISON TABLE ===== */
.table-scroll {
    overflow-x: auto;
    margin: 0.75rem 0 1rem;
}

.compare-table, .directory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.compare-table th, .directory-table th {
    background: #2563EB;
    color: #FFFFFF;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    padding: 0.65rem 0.85rem;
    text-align: center;
    white-space: nowrap;
}

.compare-table th:first-child, .directory-table th:first-child {
    text-align: left;
}

.compare-table td, .directory-table td {
    padding: 0.55rem 0.85rem;
    border: 1px solid #E5E7EB;
    text-align: center;
    vertical-align: middle;
}

.compare-table td:first-child, .directory-table td:first-child {
    text-align: left;
    font-weight: 600;
}

.compare-table tbody tr:nth-child(even),
.directory-table tbody tr:nth-child(even) {
    background: #DBEAFE;
}

.compare-table tbody tr:hover,
.directory-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.08);
}

.compare-table td svg {
    vertical-align: middle;
}

.yes { color: #16A34A; font-weight: 700; }
.no { color: #DC2626; font-weight: 700; }
.mono { font-family: 'IBM Plex Mono', monospace; font-size: 14px; }

/* ===== DIRECTORY FILTER ===== */
.directory-filter {
    position: relative;
    max-width: 340px;
    margin-bottom: 0.75rem;
}

.filter-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.directory-search {
    width: 100%;
    padding: 0.55rem 0.75rem 0.55rem 2.2rem;
    font-size: 0.85rem;
    font-family: 'Source Sans Pro', sans-serif;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    color: #1A1A2E;
    background: #F8F9FA;
    transition: border-color 0.2s;
}

.directory-search:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.directory-count {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: #4A4A6A;
    margin-top: 0.5rem;
}

/* ===== FOOTER ===== */
.footer {
    border-top: 1px solid #E5E7EB;
    padding: 2.5rem 2rem 2rem;
    margin-top: 1rem;
}

.footer-inner {
    max-width: 1020px;
    margin: 0 auto;
}

.footer-cols {
    display: flex;
    gap: 3.5rem;
    margin-bottom: 1.5rem;
}

.footer-col-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: #1A1A2E;
    margin-bottom: 0.5rem;
}

.flink {
    display: block;
    font-size: 0.85rem;
    color: #4A4A6A;
    text-decoration: none;
    margin-bottom: 0.3rem;
    transition: color 0.2s;
}

.flink:hover {
    color: #2563EB;
}

.footer-bottom {
    padding-top: 1rem;
    border-top: 1px solid #E5E7EB;
}

.footer-copy {
    font-size: 0.8rem;
    color: #4A4A6A;
    margin-bottom: 0.25rem;
}

.footer-methodology {
    font-size: 0.75rem;
    color: #4A4A6A;
    opacity: 0.7;
}

/* ===== FADE-IN ANIMATION ===== */
.fade-in {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .content-layout {
        grid-template-columns: 1fr;
        padding: 1.5rem 1rem;
    }

    .sidebar {
        position: static;
        order: -1;
    }

    .toc {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        align-items: center;
    }

    .toc-title {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .toc-link {
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }

    .toc-link.active {
        border-left: none;
        border-bottom-color: #2563EB;
    }

    .pros-cons {
        grid-template-columns: 1fr;
    }

    .footer-cols {
        flex-direction: column;
        gap: 1.5rem;
    }

    .hero {
        padding: 2.5rem 1rem 2rem;
    }

    .simulator-panel {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 24px;
    }

    .article-heading {
        font-size: 20px;
    }

    .compare-table th, .directory-table th {
        font-size: 0.8rem;
        padding: 0.5rem 0.6rem;
    }

    .compare-table td, .directory-table td {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
}
