/* ==============================================
   PRESIDENTS — Dark/Light Mode Glassmorphism
   ============================================== */

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

:root {
    /* Dark Mode Default */
    --bg-primary: #080810;
    --bg-secondary: #0d0d18;
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b8;
    --text-muted: #6a6a80;
    --surface-glass: rgba(255,255,255,0.025);
    --surface-glass-hover: rgba(255,255,255,0.05);
    --border-glass: rgba(255,255,255,0.07);
    --border-glass-hover: rgba(255,255,255,0.12);
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #06b6d4;
    --accent-gold: #f59e0b;
    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6, #06b6d4);
    --gradient-text: linear-gradient(135deg, #f5d678, #f5a623, #f56c6c, #8b5cf6);
    --gradient-party-rep: linear-gradient(135deg, #ef4444, #dc2626);
    --gradient-party-dem: linear-gradient(135deg, #3b82f6, #2563eb);
    --font-sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: Georgia, 'Times New Roman', serif;
    --font-heading: system-ui, -apple-system, 'Segoe UI', sans-serif;
    --radius-sm: 8px;
    --radius-base: 12px;
    --radius-lg: 18px;
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light {
    --bg-primary: #f0eee8;
    --bg-secondary: #e5e3dd;
    --text-primary: #111;
    --text-secondary: #555;
    --text-muted: #888;
    --surface-glass: rgba(255,255,255,0.6);
    --surface-glass-hover: rgba(255,255,255,0.8);
    --border-glass: rgba(0,0,0,0.06);
    --border-glass-hover: rgba(0,0,0,0.12);
    --gradient-text: linear-gradient(135deg, #8b6914, #c9633e, #7c3aed);
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background var(--transition-base), color var(--transition-base);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

#bgCanvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0; pointer-events: none;
}

.app { position: relative; z-index: 2; }

.glass {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* NAV */
.navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 100; padding: 0 24px; }
.nav-container {
    max-width: 1400px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    height: 64px;
}
.brand-icon { font-size: 1.3rem; }
.brand-icon.brand-flag { width: 32px; height: 20px; border-radius: 3px; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; }
.brand-icon.brand-flag img { width: 100%; height: 100%; display: block; object-fit: cover; }
.badge-flag { display: inline-flex; align-items: center; vertical-align: middle; border-radius: 1px; overflow: hidden; }
.badge-flag img { display: block; width: 16px; height: 10px; }
.brand-text { font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.05em; }
.brand-text .accent { color: var(--accent-gold); }
.nav-links { display: flex; gap: 8px; list-style: none; }
.nav-link {
    padding: 6px 16px; color: var(--text-secondary); text-decoration: none;
    font-size: 0.85rem; font-weight: 500; border-radius: var(--radius-pill, 50px);
    transition: all var(--transition-base);
}
.nav-link:hover, .nav-link.active { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.theme-toggle {
    width: 34px; height: 34px; background: var(--surface-glass); border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm); cursor: pointer;
    color: var(--text-muted); font-size: 1.1rem; transition: all var(--transition-base);
}
.theme-toggle:hover { color: var(--text-primary); background: var(--surface-glass-hover); transform: rotate(15deg); }

/* HERO */
.hero { min-height: 0; display: flex; align-items: center; justify-content: center; padding: 100px 24px 32px; text-align: center; }
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 16px; background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.15);
    border-radius: 50px; font-size: 0.8rem; color: var(--accent-gold); font-weight: 500; margin-bottom: 18px;
}
.badge-star { animation: pulse 2s ease-in-out infinite; font-size: 0.5rem; }
.hero-title { font-family: var(--font-display); font-size: clamp(2.5rem, 6vw, 5rem); font-weight: 900; line-height: 1.1; margin-bottom: 20px; }
.hero-subtitle { font-size: clamp(1rem, 2vw, 1.2rem); color: var(--text-secondary); max-width: 650px; margin: 0 auto 24px; line-height: 1.6; }
.hero-stats { display: flex; justify-content: center; align-items: center; gap: 24px; margin-bottom: 12px; }
.hero-stat { display: flex; flex-direction: column; align-items: center; }
.hero-stat .stat-value { font-family: var(--font-display); font-size: 2.5rem; font-weight: 800; }
.hero-stat .stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 4px; }
.hero-stat-divider { font-size: 1.5rem; color: var(--text-muted); font-weight: 300; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px; font-size: 0.95rem; font-weight: 600; border-radius: var(--radius-base);
    cursor: pointer; border: none; font-family: var(--font-sans); text-decoration: none;
    transition: all var(--transition-base);
}
.btn-primary { background: var(--gradient-primary); color: white; box-shadow: 0 4px 24px rgba(99,102,241,0.25); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(99,102,241,0.35); }
.btn-secondary { background: var(--surface-glass); border: 1px solid var(--border-glass); color: var(--text-primary); }
.btn-secondary:hover { background: var(--surface-glass-hover); }
.btn svg { width: 18px; height: 18px; }

/* SECTIONS */
.section { padding: 100px 24px; max-width: 1400px; margin: 0 auto; }
.section.alt { background: var(--bg-secondary); max-width: 100%; padding: 100px 24px 100px; }
.section-header { text-align: center; max-width: 700px; margin: 0 auto 48px; }
.section-label {
    display: inline-block; font-size: 0.75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.15em; color: var(--accent-gold);
    padding: 4px 12px; background: rgba(245,158,11,0.08); border-radius: 50px;
    border: 1px solid rgba(245,158,11,0.15); margin-bottom: 16px;
}
.section-title { font-family: var(--font-display); font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; margin-bottom: 12px; }
.section-subtitle { font-size: 1.05rem; color: var(--text-secondary); line-height: 1.7; }

/* TIMELINE / FLOW DIAGRAM */
.era-filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 16px 20px; margin-bottom: 30px; }
.era-btn {
    padding: 6px 14px; font-size: 0.8rem; font-weight: 500; background: transparent;
    border: 1px solid transparent; border-radius: 50px; color: var(--text-muted);
    cursor: pointer; transition: all var(--transition-base); font-family: var(--font-sans);
}
.era-btn:hover { color: var(--text-secondary); background: rgba(255,255,255,0.03); }
.era-btn.active { color: var(--accent-gold); background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.2); }

.timeline-wrapper { overflow-x: auto; overflow-y: visible; padding: 20px 0; scrollbar-width: none; }
.timeline-wrapper::-webkit-scrollbar { display: none; }
.timeline-scroll { position: relative; display: flex; align-items: center; min-width: max-content; padding: 60px 40px; }
.timeline-connections { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.timeline-nodes { display: flex; align-items: center; gap: 0; position: relative; z-index: 1; }

.pres-node { display: flex; flex-direction: column; align-items: center; cursor: pointer; margin: 0 6px; transition: all var(--transition-base); position: relative; }

/* --- IMAGE UPDATE: Node --- */
.pres-node .node-circle {
    width: 70px; height: 70px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-heading); font-size: 1.1rem; font-weight: 700; overflow: hidden;
    background: var(--surface-glass); border: 2px solid var(--border-glass);
    transition: all var(--transition-base); position: relative;
}
.pres-node .node-circle img {
    width: 100%; height: 100%; object-fit: cover; object-position: top center;
    transition: transform var(--transition-base);
}
.pres-node:hover .node-circle { transform: scale(1.15); border-color: var(--accent-gold); box-shadow: 0 0 20px rgba(245,158,11,0.2); }
.pres-node:hover .node-circle img { transform: scale(1.1); }

.pres-node .node-number {
    position: absolute; top: -8px; right: -8px;
    width: 22px; height: 22px; background: var(--bg-primary);
    border: 1px solid var(--border-glass); border-radius: 50%;
    font-size: 0.65rem; display: flex; align-items: center; justify-content: center; color: var(--text-muted); z-index: 2;
}
.pres-node .node-name {
    font-size: 0.7rem; font-weight: 600; color: var(--text-secondary);
    margin-top: 8px; text-align: center; max-width: 80px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pres-node .node-years { font-size: 0.6rem; color: var(--text-muted); margin-top: 2px; }

/* Era Divider */
.era-divider { min-width: 80px; display: flex; flex-direction: column; align-items: center; margin: 0 15px; position: relative; }
.era-divider .divider-label {
    font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--accent-gold); text-align: center; background: rgba(245,158,11,0.05);
    padding: 6px 8px; border: 1px solid rgba(245,158,11,0.15);
    border-radius: var(--radius-sm); white-space: nowrap;
}
.scroll-hint { text-align: center; padding: 16px; font-size: 0.75rem; color: var(--text-muted); font-style: italic; }

/* GALLERY GRID */
.view-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 16px 20px; margin-bottom: 24px; max-width: 1400px; margin: 0 auto 24px; }
.gallery-filter-input {
    flex: 1; min-width: 200px; padding: 10px 16px; background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-glass); border-radius: var(--radius-sm);
    color: var(--text-primary); font-family: var(--font-sans); font-size: 0.9rem;
}
.gallery-filter-input:focus { outline: none; border-color: var(--accent-gold); }
.gallery-filter-input::placeholder { color: var(--text-muted); }
.view-sort { display: flex; gap: 6px; align-items: center; font-size: 0.8rem; color: var(--text-muted); }
.sort-btn {
    padding: 4px 12px; background: transparent; border: 1px solid transparent;
    border-radius: 50px; color: var(--text-muted); font-size: 0.75rem; cursor: pointer;
    font-family: var(--font-sans); transition: all var(--transition-base);
}
.sort-btn:hover { color: var(--text-secondary); }
.sort-btn.active { color: var(--accent-gold); background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.15); }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; max-width: 1400px; margin: 0 auto; padding: 0 24px; }

.pres-card {
    padding: 24px 20px; background: var(--surface-glass); border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg); cursor: pointer; transition: all var(--transition-base);
    position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 12px;
}
.pres-card:hover { background: var(--surface-glass-hover); border-color: var(--border-glass-hover); transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.pres-card .card-number { font-family: var(--font-heading); font-size: 2rem; font-weight: 800; opacity: 0.08; position: absolute; top: 12px; right: 16px; }

/* --- IMAGE UPDATE: Card --- */
.pres-card .card-header { display: flex; align-items: center; gap: 16px; position: relative; z-index: 2; }
.pres-card .card-img {
    width: 60px; height: 60px; border-radius: 50%; object-fit: cover;
    border: 2px solid var(--border-glass-hover); box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all var(--transition-base);
}
.pres-card:hover .card-img { transform: scale(1.1); border-color: var(--accent-gold); }
.pres-card .card-text { flex: 1; min-width: 0; }
.pres-card .card-name { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.pres-card .card-party {
    font-size: 0.7rem; padding: 2px 8px; border-radius: 50px; display: inline-block; margin-bottom: 4px; font-weight: 600;
}
.pres-card .card-party.rep { background: rgba(239,68,68,0.1); color: #ef4444; }
.pres-card .card-party.dem { background: rgba(59,130,246,0.1); color: #3b82f6; }
.pres-card .card-party.whig { background: rgba(168,85,247,0.1); color: #a855f7; }
.pres-card .card-party.fed { background: rgba(245,158,11,0.1); color: #f59e0b; }
.pres-card .card-party.other { background: rgba(34,197,94,0.1); color: #22c55e; }
.pres-card .card-term { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 8px; }
.pres-card .card-accomplishment {
    font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* COMPARE VIEW */
.compare-container { max-width: 1200px; margin: 0 auto; }
.compare-selector { display: flex; align-items: flex-end; gap: 16px; padding: 24px; margin-bottom: 30px; flex-wrap: wrap; }
.compare-side { flex: 1; min-width: 200px; }
.compare-side label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; display: block; }
.compare-select { width: 100%; padding: 12px 16px; background: rgba(255,255,255,0.03); border: 1px solid var(--border-glass); border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font-sans); font-size: 0.9rem; }
.compare-select option { background: var(--bg-secondary); }
.compare-vs { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--accent-gold); padding-bottom: 8px; }
.compare-results { min-height: 400px; }
.compare-placeholder { text-align: center; padding: 80px 24px; }
.compare-placeholder .compare-icon { font-size: 3rem; }
.compare-placeholder p { color: var(--text-muted); margin-top: 12px; }
.compare-output { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.compare-card { padding: 24px; background: var(--surface-glass); border: 1px solid var(--border-glass); border-radius: var(--radius-lg); }
.compare-card h3 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 16px; }
.compare-card .detail-row { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-glass); font-size: 0.85rem; }
.compare-card .detail-label { color: var(--text-muted); min-width: 80px; flex-shrink: 0; }
.compare-card .detail-value { color: var(--text-primary); }
.compare-card .accomplishment-list { list-style: none; padding: 0; }
.compare-vs-detail { grid-column: 1 / -1; padding: 20px; text-align: center; background: var(--surface-glass); border: 1px solid var(--border-glass); border-radius: var(--radius-lg); }
.compare-vs-detail h3 { font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 8px; color: var(--accent-gold); }
.compare-vs-detail p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }

/* MODAL */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px); z-index: 200; display: none; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.active { display: flex; }
.modal { width: 100%; max-width: 720px; max-height: 85vh; overflow-y: auto; padding: 36px; position: relative; animation: modalIn 0.3s ease;
    background: rgba(12,12,18,0.95) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15);
}
body.light .modal {
    background: rgba(250,250,252,0.97) !important;
    border: 1px solid rgba(0,0,0,0.08);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.9) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-close {
    position: absolute; top: 16px; right: 16px; width: 36px; height: 36px;
    background: var(--surface-glass); border: 1px solid var(--border-glass); border-radius: 50%;
    color: var(--text-muted); font-size: 1.1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all var(--transition-base);
}
.modal-close:hover { background: var(--surface-glass-hover); color: var(--text-primary); }

.modal-header { display: flex; align-items: center; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.modal-number { font-family: var(--font-heading); font-size: 3rem; font-weight: 900; background: var(--gradient-text); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* --- IMAGE UPDATE: Modal --- */
.modal-header .modal-img {
    width: 100px; height: 100px; border-radius: 50%; object-fit: cover;
    border: 3px solid var(--accent-gold); box-shadow: 0 8px 24px rgba(245,158,11,0.2);
    animation: modalIn 0.5s ease;
}

.modal-header-info { flex: 1; }
.modal-header-info h2 { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; }
.modal-header-info .modal-term { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.modal-header-info .modal-party { display: inline-block; font-size: 0.75rem; padding: 3px 10px; border-radius: 50px; margin-top: 6px; font-weight: 600; }
.modal-body h3 { font-family: var(--font-heading); font-size: 1rem; font-weight: 600; color: var(--accent-gold); margin-bottom: 12px; margin-top: 24px; }
.modal-body h3:first-of-type { margin-top: 0; }
.modal-body .detail-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border-glass); font-size: 0.9rem; }
.modal-body .detail-label { color: var(--text-muted); min-width: 120px; }
.modal-body .detail-value { color: var(--text-primary); }
.modal-body .accomplishment-list { list-style: none; padding: 0; }
.modal-body .accomplishment-list li { padding: 8px 12px; margin-bottom: 6px; background: rgba(255,255,255,0.02); border-left: 3px solid var(--accent-gold); border-radius: 0 6px 6px 0; font-size: 0.9rem; color: var(--text-secondary); line-height: 1.5; }
.modal-body .quote-block { padding: 16px 20px; background: rgba(245,158,11,0.03); border: 1px solid rgba(245,158,11,0.1); border-radius: var(--radius-sm); font-style: italic; color: var(--text-secondary); line-height: 1.7; margin: 16px 0; }
.modal-body .quote-block cite { display: block; margin-top: 8px; font-style: normal; font-size: 0.8rem; color: var(--text-muted); }

/* SEARCH */
.search-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 300; display: none; padding: 15vh 0 0; }
.search-overlay.active { display: block; }
.search-glass { max-width: 600px; margin: 0 auto; padding: 4px; z-index: 10; position: relative; }
#searchInput { width: 100%; padding: 16px 20px; font-size: 1.1rem; background: transparent; border: none; color: var(--text-primary); font-family: var(--font-sans); outline: none; border-radius: var(--radius-lg); }
#searchInput::placeholder { color: var(--text-muted); }
.search-results { max-height: 400px; overflow-y: auto; padding: 8px; }
.search-result-item {
    padding: 12px 16px; border-radius: var(--radius-sm); cursor: pointer;
    display: flex; align-items: center; gap: 12px; transition: background var(--transition-base);
}
.search-result-item:hover { background: var(--surface-glass-hover); }
.search-result-item .sr-number { font-family: var(--font-heading); font-weight: 700; color: var(--accent-gold); min-width: 30px; }
.search-result-item .sr-name { font-weight: 600; }
.search-result-item .sr-meta { font-size: 0.8rem; color: var(--text-muted); margin-left: auto; }
.search-backdrop { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); cursor: default; }

/* FOOTER */
.footer { padding: 40px 24px; text-align: center; font-size: 0.8rem; color: var(--text-muted); border-top: 1px solid var(--border-glass); }
.footer .accent { color: var(--accent-gold); }

/* UTILS */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,0.3); }

/* Local fonts, keyboard navigation and compact screens. */
button { font: inherit; color: inherit; }
.pres-node, .search-result-item { background: transparent; border: 0; text-align: left; }
.pres-node { text-align: center; }
.pres-card { text-align: left; font: inherit; color: inherit; }
.card-text, .card-name, .card-term, .card-accomplishment { display: block; }
.search-result-item { width: 100%; }
.search-close { padding: 8px 16px; background: var(--surface-glass); border: 1px solid var(--border-glass); border-radius: 8px; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent-gold) !important; outline-offset: 4px; }
.section { scroll-margin-top: 90px; }
.compare-card, .detail-value { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 700px) {
    .navbar { padding: 0 10px; }
    .nav-container { height: auto; min-height: 64px; flex-wrap: wrap; gap: 8px; padding: 10px 0; }
    .nav-links { order: 3; width: 100%; justify-content: center; }
    .nav-link { padding: 6px 12px; }
    .hero { padding-top: 116px; }
    .hero-title { font-size: clamp(2rem, 9vw, 3.5rem); }
    .hero-stats, .view-controls, .view-sort, .compare-selector { flex-wrap: wrap; }
    .compare-output { grid-template-columns: minmax(0, 1fr); }
    .compare-side { width: 100%; min-width: 0; }
    .compare-select { width: 100%; max-width: 100%; }
    .gallery-grid { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
    .modal { padding: 20px; max-width: calc(100vw - 24px); }
    .modal-header { flex-direction: column; }
    .modal-body .detail-row { flex-direction: column; gap: 4px; }
    .search-glass { margin: 0 12px; }
    .search-result-item { flex-wrap: wrap; }
    .search-result-item .sr-meta { width: 100%; margin-left: 0; }
    .section { scroll-margin-top: 120px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Presidential Line interaction controls. */
.timeline-wrapper { cursor: grab; user-select: none; touch-action: pan-x pan-y; }
.timeline-wrapper.dragging, .timeline-wrapper.dragging .pres-node { cursor: grabbing; }
.timeline-wrapper img { -webkit-user-drag: none; }
.timeline-controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px; }
.timeline-controls button { padding: 10px 16px; border-radius: 8px; border: 1px solid var(--border-glass-hover); background: var(--surface-glass); cursor: pointer; }
.timeline-controls button:disabled { opacity: 0.35; cursor: default; }
.timeline-controls .scroll-hint { padding: 12px 0; }
@media (max-width: 600px) { .timeline-controls .scroll-hint { order: 3; flex-basis: 100%; } }

/* Compact introduction with a clear explanation of the presidential count. */
.hero-content { width: 100%; max-width: 1100px; }
.hero-count-note { max-width: 660px; margin: 0 auto 24px; font-size: 0.85rem; line-height: 1.6; color: var(--text-secondary); }
#timeline { padding-top: 40px; }
@media (max-width: 700px) {
    .hero-stats { gap: 12px; flex-wrap: nowrap; }
    .hero-stat { flex: 1; min-width: 0; }
    .hero-stat .stat-value { font-size: 2rem; }
    .hero-stat .stat-label { font-size: 0.65rem; letter-spacing: 0.03em; }
    .hero-badge { font-size: 0.7rem; padding: 6px 10px; }
    .hero-count-note { font-size: 0.8rem; }
    #timeline { padding-top: 24px; }
}
