/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box;  }

:root {
    /* PCDP brand palette */
    --night-skies:  #1c3664;   /* primary dark blue */
    --high-noon:    #508cb4;   /* medium blue */
    --bright-copper:#cb6828;   /* orange-copper accent */
    --always-sunny: #fed24a;   /* yellow */
    --palo-verde:   #a9bc42;   /* green */
    --turquoise:    #58c3ba;   /* teal */
    --sunset:       #7c5d82;   /* purple */
    --pcdp-gray:    #999999;

    /* Semantic aliases */
    --ink:       var(--night-skies);
    --paper:     #ffffff;
    --cream:     #eef2f8;
    --accent:    var(--bright-copper);
    --accent2:   var(--high-noon);
    --gold:      var(--always-sunny);
    --border:    #c0cce0;
    --shadow:    rgba(28,54,100,.15);

    --party-r:     #b91c1c;
    --party-d:     var(--night-skies);
    --party-l:     #b45309;
    --party-g:     #15803d;
    --party-other: #6b7280;
}

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

body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Montserrat', Arial, sans-serif;
    font-weight: 400;
    min-height: 100vh;
    line-height: 1.6;
}

/* ── Decorative header band ── */
.header-band {
    background: var(--ink);
    padding: 0.35rem 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
}
.header-band a.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--gold);
    font-size: 0.7rem;
    letter-spacing: .15em;
    font-weight: 600;
    text-decoration: none;
    padding: 0.3rem 0.75rem;
    margin-top: 1rem;
    border: 1px solid var(--gold);
    border-radius: 999px;
}
.lang-toggle-icon {
    font-size: 0.9rem;
}

/* ── Hero / search section ── */
.hero {
    background: var(--ink);
    color: var(--paper);
    padding: 1.5rem 1.5rem 4rem;
    text-align: center;
    position: relative;
    overflow: visible;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 60px,
            rgba(255,255,255,.03) 60px,
            rgba(255,255,255,.03) 61px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 60px,
            rgba(255,255,255,.03) 60px,
            rgba(255,255,255,.03) 61px
        );
    overflow: hidden;
    pointer-events: none;
}

.hero-logo {
    display: block;
    margin: 0 auto 1.5rem;
    max-width: 280px;
    width: 80%;
    /* Invert to white since the logo is dark blue on the dark hero background */
    filter: brightness(0) invert(1);
}

.hero-eyebrow {
    font-size: 0.7rem;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 500;
    margin-bottom: 1rem;
}

.hero h1 {
    font-family: 'Rockwell Nova', 'Rockwell', Georgia, serif;
    font-size: clamp(2.2rem, 6vw, 3.8rem);
    line-height: 1.1;
    margin-bottom: 0.5rem;
    letter-spacing: -.01em;
}

.hero h1 em {
    font-style: italic;
    color: var(--gold);
}

.hero-sub {
    font-size: 1rem;
    color: rgba(245,240,232,.65);
    margin-bottom: 2.5rem;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Search box ── */
.search-wrap {
    position: relative;
    max-width: 560px;
    margin: 0 auto;
    z-index: 100;
}

.search-input-row {
    display: flex;
    align-items: stretch;
    background: var(--paper);
    border: 2px solid var(--gold);
    border-radius: 4px;
    overflow: visible;
    box-shadow: 0 8px 32px rgba(0,0,0,.35);
}

.search-icon {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    color: var(--gold);
    flex-shrink: 0;
}

#address-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 1rem 0.5rem 1rem 0;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    color: var(--ink);
    outline: none;
    min-width: 0;
}
#address-input::placeholder { color: #9c8f7e; }

.search-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0 1.5rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.search-btn:hover { background: #a93226; }

/* ── Autocomplete dropdown ── */
#autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 12px 40px var(--shadow);
    list-style: none;
    z-index: 1000;
    max-height: 280px;
    overflow-y: auto;
    display: none;
}
#autocomplete-list.open { display: block; }

#autocomplete-list li span.addr-text { white-space: pre; }

#autocomplete-list li {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--ink);
    border-bottom: 1px solid var(--cream);
    transition: background .12s;
    display: flex;
    align-items: center;
    gap: 0rem;
}
#autocomplete-list li:last-child { border-bottom: none; }
#autocomplete-list li:hover,
#autocomplete-list li.active  { background: var(--cream); }
#autocomplete-list li .pin-icon { color: var(--accent); flex-shrink: 0; }
#autocomplete-list li mark {
    background: none;
    color: var(--accent);
    font-weight: 600;
}

.autocomplete-empty {
    padding: 1rem;
    color: #888;
    font-size: 0.9rem;
    text-align: center;
}

/* ── Main content area ── */
.main {
    max-width: 860px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

.main p {
    margin-bottom: 2rem; /* increase/decrease to taste */
}

.main p:last-child {
    margin-bottom: 0;
}

/* ── Address result banner ── */
.address-banner {
    background: var(--cream);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent2);
    border-radius: 4px;
    padding: 1rem 1.25rem;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.address-banner svg { color: var(--accent2); flex-shrink: 0; }
.address-banner .label { font-size: 0.7rem; letter-spacing: .15em; text-transform: uppercase; color: #6b6055; font-weight: 500; }
.address-banner .value { font-family: 'Rockwell Nova', 'Rockwell', Georgia, serif; font-size: 1.1rem; color: var(--ink); }

/* ── Section divider ── */
.section-rule {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.section-rule::before,
.section-rule::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.section-rule-text {
    font-size: 0.65rem;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: #9c8f7e;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Office card ── */
.office-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 1.25rem;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow);
    animation: fadeUp .35s ease both;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.office-header {
    background: var(--ink);
    color: var(--paper);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.office-title {
    font-family: 'Rockwell Nova', 'Rockwell', Georgia, serif;
    font-size: 1.05rem;
    letter-spacing: .01em;
}
.office-district {
    font-size: 0.75rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 500;
}

/* ── Candidate rows ── */
.candidate-row {
    border-bottom: 1px solid var(--cream);
}
.candidate-row:last-child { border-bottom: none; }

.candidate-main {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.25rem;
    gap: 1rem;
}

.party-pip {
    width: 4px;
    align-self: stretch;
    border-radius: 2px;
    flex-shrink: 0;
    min-height: 1.5rem;
}
.party-r .party-pip  { background: var(--party-r); }
.party-d .party-pip  { background: var(--party-d); }
.party-l .party-pip  { background: var(--party-l); }
.party-g .party-pip  { background: var(--party-g); }
.party-other .party-pip { background: var(--party-other); }

.candidate-name {
    font-weight: 600;
    font-size: 0.98rem;
    color: var(--ink);
    flex: 1;
}

.party-badge {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 2px;
    white-space: nowrap;
}
.party-r .party-badge  { background: #fef2f2; color: var(--party-r); }
.party-d .party-badge  { background: #eff6ff; color: var(--party-d); }
.party-l .party-badge  { background: #fffbeb; color: var(--party-l); }
.party-g .party-badge  { background: #f0fdf4; color: var(--party-g); }
.party-other .party-badge { background: #f3f4f6; color: var(--party-other); }

/* ── Candidate resources ── */
.candidate-resources {
    padding: 0 1.25rem 0.9rem 2.5rem;   /* indent to clear the party pip column */
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

/* Candidate photo */
.resource-image {
    max-width: 120px;
    max-height: 140px;
    border-radius: 4px;
    border: 1px solid var(--border);
    object-fit: cover;
    margin-bottom: 0.25rem;
}

/* HTML text block */
.resource-html {
    font-size: 0.88rem;
    color: #4a4035;
    line-height: 1.55;
    max-width: 640px;
}
.resource-html p   { margin-bottom: 0.4rem; }
.resource-html p:last-child { margin-bottom: 0; }

/* Link row (website / social / article) */
.resource-link-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
}
.resource-link-row svg {
    flex-shrink: 0;
    color: var(--accent2);
}
.resource-link-row a {
    color: var(--accent2);
    text-decoration: none;
    font-weight: 500;
}
.resource-link-row a:hover {
    text-decoration: underline;
    color: var(--accent);
}

/* Social-media chip row */
.resource-social-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.1rem;
}
.social-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    background: var(--cream);
    transition: background .15s, border-color .15s;
}
.social-chip:hover {
    background: #fff;
    border-color: var(--accent2);
    color: var(--accent2);
}
.social-chip svg { flex-shrink: 0; }

/* ── Empty / error states ── */
.state-box {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #7a6f63;
}
.state-box .state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.state-box h2 { font-family: 'Rockwell Nova', 'Rockwell', Georgia, serif; font-size: 1.4rem; margin-bottom: 0.4rem; color: var(--ink); }
.state-box p  { font-size: 0.95rem; max-width: 360px; margin: 0 auto; }

.revision-notice {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 4px;
    padding: 0.85rem 1.25rem;
    color: #92400e;
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 1rem 0 1.5rem;
}
.revision-notice-icon { flex-shrink: 0; font-size: 1.05rem; }

.error-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    padding: 1rem 1.25rem;
    color: var(--party-r);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* ── Footer ── */
footer {
    background: var(--ink);
    color: #ffffff;
    text-align: center;
    padding: 1.5rem;
    font-size: 1rem;
    letter-spacing: .04em;
}

.footer-disclaimer-box {
    display: inline-block;
    border: 4px solid #ffffff;
    padding: 0.75rem 1rem;
}

/* ── Vote instruction badge on office header ── */
.vote-instruction {
    font-size: 0.7rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    margin-left: auto;
    white-space: nowrap;
}
.vote-instruction.vote-normal {
    background: var(--bright-copper);
    color: #fff;
}
.vote-instruction.vote-only-one {
    background: var(--bright-copper);
    color: #fff;
}

/* ── Office info (?) button ── */
.office-info-btn {
    background: none;
    border: 1.5px solid rgba(255,255,255,.45);
    color: rgba(255,255,255,.85);
    border-radius: 50%;
    width: 22px; height: 22px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background .15s, color .15s;
    margin-left: auto;
    line-height: 1;
}
.office-info-btn:hover {
    background: rgba(255,255,255,.2);
    color: #fff;
}

/* When both vote-instruction AND info btn present, don't double-push */
.office-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

/* ── More Info button ── */
.more-info-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--accent2);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    cursor: pointer;
    margin-top: 0.3rem;
    transition: background .15s, color .15s;
    align-self: flex-start;
}
.more-info-btn:hover {
    background: var(--cream);
    color: var(--ink);
}

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28,54,100,.55);
    z-index: 9000;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal-box {
    background: #fff;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(28,54,100,.35);
}
.modal-header {
    background: var(--night-skies);
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1;
}
.modal-title {
    font-family: 'Rockwell Nova', 'Rockwell', Georgia, serif;
    font-size: 1rem;
}
.modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,.75);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}
.modal-close:hover { color: #fff; }
.modal-body {
    padding: 1.25rem;
    font-size: 0.92rem;
    line-height: 1.65;
    color: #2a2a2a;
}
.modal-body p { margin-bottom: 0.75rem; }
.modal-body p:last-child { margin-bottom: 0; }

/* ── Info panels (voter tips + election calendar) ── */
.info-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.75rem;
    align-items: start;
}
@media (max-width: 600px) {
    .info-panels { grid-template-columns: 1fr; }
}

.info-panel {
    border-radius: 6px;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
}
.info-panel-title {
    font-family: 'Rockwell Nova', 'Rockwell', Georgia, serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.info-panel.panel-tips {
    background: #eef6fb;
    border-color: var(--high-noon);
}
.info-panel.panel-tips .info-panel-title { color: var(--night-skies); }

.info-panel.panel-calendar {
    background: #f0f7ee;
    border-color: var(--palo-verde);
}
.info-panel.panel-calendar .info-panel-title { color: #4a6018; }

.info-panel.panel-links {
    background: #fef8ee;
    border-color: var(--bright-copper);
    grid-column: 1 / -1;
}
.info-panel.panel-links .info-panel-title { color: #7a3a0a; }

/* ── Collapsible info panels ── */
.info-panel-header {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.info-panel-header .info-panel-title { margin-bottom: 0; flex: 1; }
.info-panel-chevron {
    flex-shrink: 0;
    transition: transform .15s;
    color: inherit;
    opacity: 0.7;
}
.info-panel.open .info-panel-chevron { transform: rotate(180deg); }
.info-panel-summary {
    font-size: 0.82rem;
    color: var(--ink);
    opacity: 0.75;
    margin-top: 0.5rem;
    margin-bottom: 0;
    display: block;
}
.info-panel.open .info-panel-summary { display: none; }
.info-panel-body {
    display: none;
    margin-top: 0.75rem;
}
.info-panel.open .info-panel-body { display: block; }

.tip-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.tip-list li {
    display: flex;
    gap: 0.5rem;
    font-size: 0.88rem;
    line-height: 1.45;
    align-items: flex-start;
}
.tip-list li .tip-icon { flex-shrink: 0; font-size: 1rem; margin-top: 0.05rem; }

.cal-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.cal-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.85rem;
    border-bottom: 1px dashed #c8dfc4;
    padding-bottom: 0.35rem;
}
.cal-list li:last-child { border-bottom: none; padding-bottom: 0; }
.cal-list .cal-label { color: #3a4a2a; font-weight: 500; }
.cal-list .cal-date  { color: #4a6018; font-weight: 600; white-space: nowrap; }

.links-placeholder {
    font-size: 0.88rem;
    color: #7a6030;
    font-style: italic;
}

.candidate-inline {
    overflow: hidden; /* clearfix, so container grows to contain the float */
}

.candidate-inline-photo {
    float: left;
    width: 70px;
    height: 85px;
    object-fit: cover;
    object-position: top;
    border-radius: 4px;
    border: 1px solid var(--border);
    margin: 0 0.75rem 0 0;
}

.candidate-inline-text {
    /* no flex/width needed — text wraps around the float automatically */
}

/* ── Districts toggle ── */
.districts-toggle-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--accent2);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    cursor: pointer;
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background .15s, color .15s;
}
.districts-toggle-btn:hover {
    background: var(--cream);
    color: var(--ink);
}

/* ── District bubbles ── */
.district-bubbles {
    display: none;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}
.district-bubbles.open {
    display: flex;
}
.district-bubble {
    display: inline-flex;
    align-items: center;
    background: var(--night-skies);
    color: #fff;
    /* border-radius: 20px; */
    border-radius: 4px;
    padding: 0.25rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Spinner ── */
.spinner {
    display: none;
    width: 18px; height: 18px;
    border: 2px solid rgba(245,240,232,.3);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin-left: 0.5rem;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading .spinner { display: inline-block; }
