/* =====================================================================
   DEBATABLE — Knowledgebase Topic Page
   Brand-aligned with index.css design system
   ===================================================================== */

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

:root {
    --navy:       #0A1628;
    --navy-mid:   #0D1B2E;
    --navy-light: #1A2744;
    --blue:       #2563EB;
    --blue-hover: #1D4ED8;
    --blue-lt:    #60A5FA;
    --green:      #10B981;
    --green-lt:   #34D399;
    --green-dark: #059669;
    --purple:     #8B5CF6;
    --white:      #FFFFFF;
    --gray-50:    #F8FAFC;
    --gray-100:   #F1F5F9;
    --gray-200:   #E2E8F0;
    --gray-300:   #CBD5E1;
    --gray-400:   #94A3B8;
    --gray-500:   #64748B;
    --gray-600:   #475569;
    --gray-700:   #334155;
    --gray-900:   #0F172A;
    --amber:      #F59E0B;
    --red:        #EF4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background: var(--white);
    margin: 0;
}

/* ── NAV ───────────────────────────────────────────────────────────── */
.d-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(226,232,240,0.6);
    padding: 1.1rem 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.d-nav__inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.d-nav__logo img { max-width: 180px; display: block; }
.d-nav__logo     { text-decoration: none; }

.d-nav__links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.d-nav__link {
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: color 0.2s;
}
.d-nav__link:hover { color: var(--navy); }

/* ── HAMBURGER ── */
.d-hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 0.25rem;
}
.d-hamburger-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--navy);
    transition: all 0.3s;
}
.d-hamburger-btn.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.d-hamburger-btn.is-open span:nth-child(2) { opacity: 0; }
.d-hamburger-btn.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── MOBILE MENU ── */
.d-mobile-menu {
    display: none;
    position: fixed;
    top: 68px; left: 0; right: 0;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    z-index: 999;
}
.d-mobile-menu.is-open { max-height: 400px; }
.d-mobile-menu a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--gray-100);
}
.d-mobile-menu a:last-child { border-bottom: none; }

/* ── BUTTONS ── */
.d-btn, .btn-primary {
    display: inline-block;
    background: var(--green);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9375rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}
.d-btn:hover, .btn-primary:hover {
    filter: brightness(0.88);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(16,185,129,0.35);
}

.d-btn--nav {
    background: var(--green);
    color: white;
    padding: 0.6rem 1.25rem;
    font-size: 0.875rem;
}

.btn-secondary {
    display: inline-block;
    background: rgba(255,255,255,0.10);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    border: 1px solid rgba(255,255,255,0.25);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.18);
    transform: translateY(-1px);
}

.btn-small {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-small:hover { filter: brightness(0.88); }

/* ── HERO ───────────────────────────────────────────────────────────── */
.wiki-hero {
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 60%, #0b2a1a 100%);
    color: white;
    padding: 9rem 2.5rem 5rem;
    position: relative;
    overflow: hidden;
}

.wiki-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 40%, rgba(16,185,129,0.18) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(37,99,235,0.10) 0%, transparent 50%);
    pointer-events: none;
}

.wiki-hero-content {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.wiki-breadcrumb {
    font-size: 0.8125rem;
    margin-bottom: 1.5rem;
    opacity: 0.7;
    font-weight: 500;
}
.wiki-breadcrumb a {
    color: white;
    text-decoration: none;
}
.wiki-breadcrumb a:hover { text-decoration: underline; }

.wiki-hero-title {
    font-size: clamp(1.875rem, 4vw, 3rem);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    max-width: 820px;
}

.wiki-hero-meta {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    opacity: 0.75;
    font-size: 0.8125rem;
    font-weight: 500;
}

.wiki-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* ── HERO EMAIL BAR ── */
.kb-cta-bar {
    background: rgba(16, 185, 129, 0.10);
    border: 1px solid rgba(52, 211, 153, 0.30);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    max-width: 600px;
}
.kb-cta-bar__label {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
    margin-bottom: 0.75rem;
}
.kb-cta-bar form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.kb-cta-bar input[type=email] {
    flex: 1;
    min-width: 200px;
    padding: 0.625rem 1rem;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-family: inherit;
}
.kb-cta-bar input[type=email]::placeholder { color: rgba(255,255,255,0.55); }
.kb-cta-bar input[type=email]:focus { outline: none; border-color: var(--green-lt); }
.kb-cta-bar button[type=submit] {
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: filter 0.2s;
    font-family: inherit;
}
.kb-cta-bar button[type=submit]:hover { filter: brightness(0.88); }
.kb-cta-bar__success {
    display: none;
    color: var(--green-lt);
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

/* ── LAYOUT ──────────────────────────────────────────────────────────── */
.wiki-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2.5rem 5rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2.5rem;
    align-items: start;
}

.wiki-main { min-width: 0; }

.wiki-article {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── ARTICLE SECTIONS ─────────────────────────────────────────────────── */
.wiki-section {
    padding: 2rem 2.25rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s, transform 0.2s;
}

.wiki-section:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.wiki-section h2 {
    font-size: 1.375rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--navy);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.wiki-text p {
    font-size: 1.0625rem;
    line-height: 1.75;
    color: var(--gray-600);
    margin-bottom: 1rem;
}
.wiki-text p:last-child { margin-bottom: 0; }

.wiki-text a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 500;
}
.wiki-text a:hover { text-decoration: underline; }

.wiki-text blockquote {
    border-left: 3px solid var(--green);
    padding-left: 1.25rem;
    margin: 1.5rem 0;
    color: var(--gray-500);
    font-style: italic;
    font-size: 1rem;
    line-height: 1.7;
}

.wiki-text .kb-source {
    font-size: 0.8125rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

/* ── LIVE SECTION INDICATOR ─── */
.wiki-section--live {
    border-left: 3px solid var(--amber);
}

.wiki-section--live h2::before {
    content: "● ";
    color: var(--amber);
    font-size: 0.65em;
    vertical-align: middle;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ── DEBATE AT A GLANCE ──────────────────────────────────────────────── */
.kb-glance-section {
    background: var(--navy);
    border-color: var(--navy-light);
    box-shadow: 0 4px 24px rgba(10,22,40,0.35);
}
.kb-glance-section:hover {
    transform: none;
    box-shadow: 0 6px 32px rgba(10,22,40,0.45);
}

.kb-glance-header { margin-bottom: 1.25rem; }

.kb-glance-section .kb-glance-header h2 {
    color: #f1f5f9;
    margin-bottom: 0.35rem;
}

.kb-glance-question {
    display: block;
    font-size: 1rem;
    color: #94a3b8;
    line-height: 1.5;
    font-weight: 400;
}

.kb-glance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kb-glance-side {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
}

.kb-glance-side--for     { border-top: 2px solid var(--green); }
.kb-glance-side--against { border-top: 2px solid var(--amber); }

.kb-glance-side-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}
.kb-glance-side--for .kb-glance-side-label     { color: var(--green-lt); }
.kb-glance-side--against .kb-glance-side-label { color: #fbbf24; }

.kb-glance-bullets {
    margin: 0;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.kb-glance-bullets li {
    font-size: 0.9375rem;
    color: #cbd5e1;
    line-height: 1.5;
}

.kb-glance-stats {
    display: flex;
    gap: 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 1.25rem;
}

.kb-glance-stat {
    flex: 1;
    text-align: center;
    padding: 0 1rem;
    border-right: 1px solid rgba(255,255,255,0.08);
}
.kb-glance-stat:last-child  { border-right: none; }
.kb-glance-stat:first-child { padding-left: 0; }

.kb-glance-stat strong {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    color: #f1f5f9;
    line-height: 1.1;
    letter-spacing: -0.03em;
}
.kb-glance-stat span {
    font-size: 0.75rem;
    color: var(--gray-400);
    display: block;
    margin-top: 0.25rem;
    line-height: 1.4;
}
.kb-glance-stat--live strong { color: #fbbf24; }
.kb-glance-stat--live span   { color: #d97706; }

/* ── WEIGH IN ────────────────────────────────────────────────────────── */
.kb-weigh-in {
    text-align: center;
}

.kb-weigh-in--card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 2.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
}

.kb-weigh-in h3 {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--navy);
    margin-bottom: 0.4rem;
    letter-spacing: -0.02em;
}

.kb-weigh-in__sub {
    font-size: 1rem;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.kb-weigh-in__options {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.kb-weigh-in__opt {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    border: 2px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.15s;
    background: var(--gray-50);
    color: var(--gray-700);
    font-family: inherit;
}
.kb-weigh-in__opt:hover {
    border-color: var(--green);
    color: var(--green-dark);
    background: #f0fdf4;
    transform: translateY(-1px);
}
.kb-weigh-in__opt.selected { background: var(--blue); color: #fff; border-color: var(--blue); }
.kb-weigh-in__opt--yes.selected  { background: var(--green-dark); border-color: var(--green-dark); }
.kb-weigh-in__opt--no.selected   { background: #DC2626; border-color: #DC2626; }

.kb-weigh-in-followup {
    display: none;
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    text-align: left;
}
.kb-weigh-in__stance-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #065f46;
    margin-bottom: 0.5rem;
}
.kb-weigh-in-followup p {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin: 0;
    line-height: 1.5;
}
.kb-weigh-in-followup a { color: var(--green-dark); font-weight: 600; text-decoration: none; }
.kb-weigh-in-followup a:hover { text-decoration: underline; }

.kb-weigh-in__cta {
    font-size: 0.875rem;
    color: var(--gray-400);
    margin-top: 0.75rem;
}
.kb-weigh-in__cta a { color: var(--blue); text-decoration: none; font-weight: 500; }
.kb-weigh-in__cta a:hover { text-decoration: underline; }

/* Inline button-as-link for auth modal triggers */
.kb-weigh-in__signup-btn,
.kb-weigh-in__signin-link,
.kb-comment-signin-link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: var(--blue);
    font-weight: 500;
    text-decoration: none;
}
.kb-weigh-in__signup-btn:hover,
.kb-weigh-in__signin-link:hover,
.kb-comment-signin-link:hover { text-decoration: underline; }

/* Comment section dividers (verified vs public) */
.kb-comments-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gray-400);
    padding: 0.75rem 0 0.4rem;
    border-top: 1px solid var(--gray-100);
    margin-top: 0.5rem;
}
.kb-comments-section-label--verified {
    color: #059669;
    border-top-color: #d1fae5;
}

/* ── TIMELINE ────────────────────────────────────────────────────────── */
.kb-timeline {
    display: flex;
    flex-direction: column;
    margin-top: 0.5rem;
}

.kb-timeline-item {
    display: grid;
    grid-template-columns: 110px 1fr;
    position: relative;
    padding-bottom: 1.75rem;
}
.kb-timeline-item:last-child { padding-bottom: 0; }

.kb-timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 123px;
    top: 1.25rem;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.kb-timeline-item::before {
    content: '';
    position: absolute;
    left: 119px;
    top: 0.25rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-300);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 1px var(--gray-200);
    z-index: 1;
}

.kb-timeline-item--live::before {
    background: var(--amber);
    box-shadow: 0 0 0 1px #fde68a;
    animation: pulse-dot 2s infinite;
}

.kb-timeline-date {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-500);
    text-align: right;
    padding-right: 1.1rem;
    padding-top: 0.05rem;
    line-height: 1.4;
}
.kb-timeline-item--live .kb-timeline-date { color: #d97706; }

.kb-timeline-live-badge {
    display: inline-block;
    background: var(--amber);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.05em;
    vertical-align: middle;
}

.kb-timeline-body {
    font-size: 1rem;
    color: var(--gray-600);
    line-height: 1.65;
    padding-left: 1.5rem;
}
.kb-timeline-body strong { color: var(--navy); font-weight: 700; }

/* ── INLINE DOC CHIPS ────────────────────────────────────────────────── */
.kb-doc-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    text-decoration: none;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: var(--blue);
    transition: all 0.15s;
    white-space: nowrap;
    vertical-align: middle;
    margin-left: 0.35rem;
}
.kb-doc-inline:hover { background: #dbeafe; }

.kb-doc-inline--minutes {
    border-color: #d1fae5;
    background: #f0fdf4;
    color: var(--green-dark);
}
.kb-doc-inline--minutes:hover { background: #dcfce7; }

/* ── TWO-SIDES DEBATE BOX ────────────────────────────────────────────── */
.kb-debate {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.kb-debate__label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--gray-400);
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.kb-debate__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 640px) {
    .kb-debate__grid { grid-template-columns: 1fr; }
}

.kb-debate__side-label {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.kb-debate__side-label--green  { color: var(--green-dark); }
.kb-debate__side-label--blue   { color: var(--blue); }
.kb-debate__side-label--purple { color: var(--purple); }

.kb-debate__side p {
    font-size: 0.9375rem;
    color: var(--gray-600);
    line-height: 1.6;
    margin: 0;
}

/* ── PRIMARY DOCS GRID ───────────────────────────────────────────────── */
.kb-docs-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
}

.kb-doc-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kb-doc-group-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gray-400);
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 0.25rem;
}

.kb-doc-link {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--gray-50);
    text-decoration: none;
    color: inherit;
    transition: all 0.15s;
}
.kb-doc-link:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.07); }

.kb-doc-icon {
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.kb-doc-link small {
    font-size: 0.8125rem;
    color: var(--gray-400);
    line-height: 1.4;
    display: block;
    margin-top: 0.2rem;
}

.kb-doc-link--minutes strong { color: var(--green-dark); }
.kb-doc-link--minutes { border-color: #d1fae5; }
.kb-doc-link--minutes:hover { border-color: #a7f3d0; background: #f0fdf4; }

.kb-doc-link--packet strong { color: var(--blue); }
.kb-doc-link--packet { border-color: #dbeafe; }
.kb-doc-link--packet:hover { border-color: #bfdbfe; background: #eff6ff; }

.kb-doc-link--law strong { color: var(--purple); }
.kb-doc-link--law { border-color: #ede9fe; }
.kb-doc-link--law:hover { border-color: #ddd6fe; background: #f5f3ff; }

/* ── DISCUSSION ──────────────────────────────────────────────────────── */
.discussion-section {
    padding: 2rem 2.25rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
}

.discussion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.discussion-header h3 {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: -0.01em;
}

.discussion-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* ── DIG DEEPER divider ───────────────────────────────────────────────── */
.wiki-dig-deeper {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0 0.25rem;
}
.wiki-dig-deeper::before,
.wiki-dig-deeper::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}
.wiki-dig-deeper__label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-400);
    white-space: nowrap;
}

.thread {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--gray-200);
}

.thread-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
}

.thread-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
}

.thread-name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--navy);
}
.thread-time {
    font-size: 0.8125rem;
    color: var(--gray-400);
    margin-top: 0.1rem;
}

.thread-content p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
}
.thread-content p:last-child { margin-bottom: 0; }

.thread-actions { margin-top: 0.875rem; display: flex; gap: 0.75rem; }

.thread-action {
    padding: 0.4rem 0.875rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--gray-500);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.thread-action:hover { border-color: var(--blue); color: var(--blue); }

/* ── SIDEBAR ─────────────────────────────────────────────────────────── */
.wiki-sidebar {
    position: sticky;
    top: 84px;
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-section {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.sidebar-section h4 {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--gray-400);
    margin-bottom: 0.875rem;
}

/* ── Sidebar: nav links (scroll spy) ── */
.related-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.related-link {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--gray-600);
    text-decoration: none;
    transition: all 0.15s;
    border-left: 2px solid transparent;
}
.related-link:hover {
    background: var(--gray-50);
    color: var(--navy);
    border-left-color: var(--green);
}
.related-link.is-active {
    background: #f0fdf4;
    color: var(--green-dark);
    font-weight: 600;
    border-left-color: var(--green);
}

/* ── Sidebar: perspectives ── */
.perspective-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.perspective-item {
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-100);
    transition: all 0.15s;
}
.perspective-item:hover { background: #f0fdf4; border-color: #d1fae5; }

.perspective-icon {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.2rem;
}
.perspective-author {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

/* ── Sidebar: stats ── */
.stat-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.875rem;
}
.stat-row span   { color: var(--gray-500); }
.stat-row strong { color: var(--navy); font-weight: 700; }

/* ── Sidebar: live alert ── */
.sidebar-alert {
    background: linear-gradient(135deg, #fef2f2 0%, #fff5f5 100%);
    border-color: rgba(239,68,68,0.2);
}
.sidebar-alert h4 { color: #b91c1c !important; }
.sidebar-alert p {
    font-size: 0.9rem;
    color: var(--gray-600);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}
.sidebar-alert__btn {
    display: block;
    background: #ef4444;
    color: #fff;
    text-align: center;
    padding: 0.6rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
    transition: filter 0.2s;
}
.sidebar-alert__btn:hover { filter: brightness(0.88); }

/* ── Sidebar: email signup ── */
.sidebar-signup {
    background: linear-gradient(135deg, #f0fdf4 0%, #f7fffe 100%);
    border-color: #bbf7d0;
}
.sidebar-signup h4 { color: var(--green-dark) !important; }
.sidebar-signup p {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}
.sidebar-signup input[type=email] {
    width: 100%;
    padding: 0.55rem 0.875rem;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    box-sizing: border-box;
    font-family: inherit;
}
.sidebar-signup input[type=email]:focus { outline: none; border-color: var(--green); }
.sidebar-signup button[type=submit] {
    width: 100%;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.2s;
    font-family: inherit;
}
.sidebar-signup button[type=submit]:hover { filter: brightness(0.88); }
.sidebar-signup__success {
    display: none;
    color: var(--green-dark);
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* ── Sidebar: app CTA ── */
.sidebar-app-cta {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    border-color: rgba(37,99,235,0.3);
}
.sidebar-app-cta h4 { color: #93c5fd !important; }
.sidebar-app-cta p {
    font-size: 0.875rem;
    color: #cbd5e1;
    line-height: 1.55;
    margin-bottom: 0.875rem;
}
.sidebar-app-cta a {
    display: block;
    background: var(--blue);
    color: #fff;
    text-align: center;
    padding: 0.625rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none;
    transition: filter 0.2s;
}
.sidebar-app-cta a:hover { filter: brightness(0.88); }

/* ── AUTH MODAL ──────────────────────────────────────────────────────── */
/* CSS vars required by auth.css (normally in app.css, not loaded here) */
:root {
    --primary:    #1e3a8a;
    --accent:     #0ea5e9;
    --accent-light: #38bdf8;
    --bg-light:   #f8fafc;
    --bg-cream:   #fef9e7;
    --text-dark:  #0f172a;
    --text-muted: #64748b;
    --border:     #e2e8f0;
}

.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9500;
    align-items: center;
    justify-content: center;
}
.modal.active { display: flex; }

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 1rem; right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

/* ── TOAST ───────────────────────────────────────────────────────────── */
.kb-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.875rem 1.25rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 9999;
    transform: translateX(120%);
    transition: transform 0.25s ease;
    background: var(--navy);
    color: #fff;
}
.kb-toast.is-visible  { transform: translateX(0); }
.kb-toast--error      { background: #7f1d1d; }
.kb-toast--success    { background: #065f46; }

/* ── FOOTER ──────────────────────────────────────────────────────────── */
.kb-footer {
    background: var(--navy);
    color: white;
    padding: 4rem 2.5rem 2.5rem;
    margin-top: 2rem;
}

.kb-footer__inner {
    max-width: 1400px;
    margin: 0 auto 3rem;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
}

.kb-footer__brand h3 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}
.kb-footer__brand p {
    color: rgba(255,255,255,0.55);
    font-size: 0.9375rem;
    line-height: 1.7;
    margin-bottom: 0.75rem;
}
.kb-footer__brand small { color: rgba(255,255,255,0.35); font-size: 0.8125rem; }

.kb-footer__col h4 {
    font-weight: 700;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255,255,255,0.5);
}
.kb-footer__col a {
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    display: block;
    margin-bottom: 0.625rem;
    font-size: 0.9375rem;
    transition: color 0.2s;
}
.kb-footer__col a:hover { color: white; }

.kb-footer__bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    text-align: center;
    color: rgba(255,255,255,0.35);
    font-size: 0.8125rem;
}
.kb-footer__bottom a {
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    margin: 0 0.5rem;
}
.kb-footer__bottom a:hover { color: rgba(255,255,255,0.7); }

/* ── ACCORDION SECTIONS ──────────────────────────────────────────────── */
.wiki-accordion {
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.wiki-accordion:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }

.wiki-accordion__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 2rem;
    cursor: pointer;
    list-style: none;
    background: var(--white);
    user-select: none;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--navy);
    transition: background 0.15s;
}
.wiki-accordion__summary::-webkit-details-marker { display: none; }
.wiki-accordion__summary:hover { background: var(--gray-50); }

.wiki-accordion__chevron {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--gray-400);
    transition: transform 0.25s ease;
}
details[open] > .wiki-accordion__summary .wiki-accordion__chevron {
    transform: rotate(180deg);
}
.wiki-accordion__body {
    border-top: 1px solid var(--gray-100);
}
.wiki-accordion__body .wiki-section {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}
.wiki-accordion__body .wiki-section:hover {
    transform: none;
    box-shadow: none;
}
@keyframes accordion-open {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
details[open] .wiki-accordion__body {
    animation: accordion-open 0.2s ease-out;
}

/* ── COMMENT FORM ────────────────────────────────────────────────────── */
.kb-comment-form {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-100);
}
.kb-comment-stance {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}
.kb-comment-stance-label { font-weight: 500; }
.kb-comment-stance-change {
    font-size: 0.8125rem;
    color: var(--blue);
    text-decoration: none;
    margin-left: auto;
}
.kb-comment-stance-change:hover { text-decoration: underline; }

/* Input row wraps textarea + mic button side by side */
.kb-comment-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.kb-comment-input {
    flex: 1;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--gray-900);
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.5;
}
.kb-comment-input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}
.kb-comment-input::placeholder { color: var(--gray-400); }

/* Mic button */
.kb-audio-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    color: var(--gray-500);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    margin-top: 0.1rem;
}
.kb-audio-btn:hover {
    background: #dbeafe;
    border-color: var(--blue);
    color: var(--blue);
}
.kb-audio-btn.is-recording {
    background: #fee2e2;
    border-color: #dc2626;
    color: #dc2626;
    animation: mic-pulse 1s ease-in-out infinite;
}
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.3); }
    50%       { box-shadow: 0 0 0 5px rgba(220,38,38,0); }
}

/* Verified speaker badge on comments */
.kb-verified-speaker-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: #d1fae5;
    color: #065f46;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    margin-left: 0.4rem;
    white-space: nowrap;
}
.kb-audio-badge {
    display: inline-flex;
    align-items: center;
    background: #f3e8ff;
    color: #6b21a8;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    margin-left: 0.4rem;
    white-space: nowrap;
}

/* Highlighted thread for verified speakers */
.thread--verified {
    background: rgba(16,185,129,0.04);
    border-left: 3px solid #10b981;
    padding-left: 0.75rem;
    border-radius: 0 8px 8px 0;
}

.kb-comment-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}
.kb-comment-submit-btn {
    padding: 0.6rem 1.25rem;
    font-size: 0.875rem;
}
.kb-comment-note {
    font-size: 0.8125rem;
    color: var(--gray-400);
}
.kb-comment-note a { color: var(--blue); text-decoration: none; }
.kb-comment-note a:hover { text-decoration: underline; }

/* ── STANCE BADGES ───────────────────────────────────────────────────── */
.stance-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.stance-badge.stance--yes    { background: #d1fae5; color: #065f46; }
.stance-badge.stance--no     { background: #fee2e2; color: #991b1b; }
.stance-badge.stance--unsure { background: #fef3c7; color: #92400e; }
.stance-badge.stance--changed {
    background: var(--gray-100);
    color: var(--gray-500);
    text-decoration: line-through;
    font-weight: 500;
}

/* ── DEAD LINK INDICATOR ─────────────────────────────────────────────── */
.kb-doc-link--dead {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}
.kb-doc-dead-badge {
    display: inline-block;
    margin-left: 0.5rem;
    background: var(--gray-200);
    color: var(--gray-500);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    vertical-align: middle;
}

/* ── MOBILE EMAIL SIGNUP (after comments, before responsive breakpoints) ── */
/* Base: hidden on desktop. The @media block below flips it to display:block. */
.kb-mobile-signup {
    display: none;
    background: var(--navy);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 1.5rem 1.25rem;
    margin-top: 0.5rem;
}

.kb-mobile-signup h4 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 0.4rem;
}

.kb-mobile-signup p {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.65);
    margin-bottom: 0.875rem;
    line-height: 1.5;
}

.kb-mobile-signup form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.kb-mobile-signup input[type=email] {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.875rem;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-family: inherit;
}
.kb-mobile-signup input[type=email]::placeholder { color: rgba(255,255,255,0.45); }
.kb-mobile-signup input[type=email]:focus { outline: none; border-color: var(--green-lt); }

.kb-mobile-signup button[type=submit] {
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: filter 0.2s;
    font-family: inherit;
    flex-shrink: 0;
}
.kb-mobile-signup button[type=submit]:hover { filter: brightness(0.88); }

.kb-mobile-signup__success {
    display: none;
    color: var(--green-lt);
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .wiki-container {
        grid-template-columns: 1fr 260px;
        gap: 1.75rem;
    }
    .kb-footer__inner {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .d-nav__links    { display: none; }
    .d-hamburger-btn { display: flex; }
    .d-mobile-menu   { display: block; }

    .wiki-hero { padding: 7rem 1.5rem 3.5rem; }
    .wiki-hero-title { letter-spacing: -0.02em; }

    .wiki-actions { flex-direction: column; }
    .wiki-actions a { text-align: center; }

    /* Sidebar above main on mobile */
    .wiki-container {
        display: flex;
        flex-direction: column;
        padding: 1.5rem 1.25rem 3rem;
        gap: 1.25rem;
    }
    .wiki-sidebar {
        order: -1;
        position: static;
    }
    .wiki-main { order: 1; }

    /* Sidebar sections stack more compactly on mobile */
    .sidebar-section { padding: 1rem 1.25rem; }

    /* De-emphasise lower-priority sidebar sections on mobile */
    .wiki-sidebar .sidebar-section:not(.sidebar-alert):not(.sidebar-signup) {
        /* Show stats row inline, hide the detailed perspective list */
    }

    .wiki-section { padding: 1.5rem 1.25rem; }
    .discussion-section { padding: 1.5rem 1.25rem; }

    .kb-glance-grid { grid-template-columns: 1fr; }

    .kb-glance-stats { flex-direction: column; gap: 1rem; }
    .kb-glance-stat  { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.08); padding: 0 0 1rem; }
    .kb-glance-stat:last-child { border-bottom: none; padding-bottom: 0; }

    .kb-weigh-in__options { flex-direction: column; }
    .kb-weigh-in__opt     { width: 100%; }

    .kb-timeline-item { grid-template-columns: 1fr; }
    .kb-timeline-item::before,
    .kb-timeline-item:not(:last-child)::after { display: none; }
    .kb-timeline-date { text-align: left; padding-right: 0; margin-bottom: 0.25rem; }
    .kb-timeline-body { padding-left: 0; }
    .kb-timeline-item {
        padding-left: 1rem;
        border-left: 2px solid var(--gray-200);
        margin-bottom: 1.25rem;
        padding-bottom: 1.25rem;
    }
    .kb-timeline-item--live { border-left-color: var(--amber); }

    .kb-footer__inner { grid-template-columns: 1fr; gap: 2rem; }
    .kb-footer { padding: 3rem 1.5rem 2rem; }

    .d-nav__inner { padding: 0 1.25rem; }

    .wiki-accordion__summary { padding: 1rem 1.25rem; font-size: 1rem; }
    .kb-comment-actions { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

    /* Stats row on mobile: make it scannable as a horizontal grid */
    .stat-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem 1rem;
    }
    .stat-row { flex-direction: column; gap: 0.15rem; }
    .stat-row strong { font-size: 1.1rem; }

    /* Hide hero CTA bar and sidebar signup on mobile — replaced by post-comments CTA */
    .kb-cta-bar { display: none; }
    .wiki-sidebar .sidebar-signup { display: none; }

    /* Show the mobile-only signup after comments */
    .kb-mobile-signup { display: block; }
}
