/* ============================================================
   Voice & Ballot — a civic register for public petitions.
   Design concept: a town-hall ledger. Petitions are "entries",
   signatures are tallied like a hand count at a public meeting.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
    --ink: #1C2541;
    --ink-soft: #3C4566;
    --paper: #EAE7DC;
    --paper-raised: #F4F2EA;
    --seal: #A13D2F;
    --seal-dark: #7E2F23;
    --gold: #A97D1F;
    --line: #C7C0AC;
    --text: #232626;
    --text-muted: #5B6470;
    --radius: 3px;
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
    overflow-x: clip;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--text);
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    line-height: 1.55;
}

h1, h2, h3 {
    font-family: 'Fraunces', Georgia, serif;
    color: var(--ink);
    line-height: 1.15;
    margin: 0 0 0.5em;
}

h1 { font-size: 2.2rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }

a { color: var(--seal-dark); }
a:hover { color: var(--seal); }

.mono {
    font-family: 'IBM Plex Mono', monospace;
}

/* ---------- Letterhead header ---------- */
.site-header {
    background: var(--ink);
    color: var(--paper-raised);
    border-bottom: 4px solid var(--seal);
}
.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.site-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.01em;
}
.site-title span { color: var(--gold); }
.site-tagline {
    font-size: 0.85rem;
    color: #C7CBDA;
    margin-top: 2px;
}
nav.main-nav { display: flex; align-items: center; }
nav.main-nav a {
    color: #E4E1D3;
    text-decoration: none;
    margin-left: 18px;
    font-size: 0.95rem;
}
nav.main-nav a:first-child { margin-left: 0; }
nav.main-nav a:hover { color: var(--gold); }
nav.main-nav a.nav-cta {
    background: var(--seal);
    color: #fff;
    padding: 7px 14px;
    border-radius: var(--radius);
    font-weight: 600;
}
nav.main-nav a.nav-cta:hover { background: var(--seal-dark); color: #fff; }

/* Hamburger toggle — CSS-only (checkbox hack), hidden on desktop */
.nav-toggle-checkbox { display: none; }
.nav-toggle-btn {
    display: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
}
.nav-toggle-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

/* ---------- Layout ---------- */
.wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}
.narrow { max-width: 620px; }

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.95rem;
}
.flash.success { background: #E4EEE1; border: 1px solid #9DBB93; color: #2E4A28; }
.flash.error { background: #F3DEDB; border: 1px solid var(--seal); color: var(--seal-dark); }

/* ---------- Ledger card ---------- */
.ledger-card {
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-bottom: 24px;
    position: relative;
}
.ledger-card + .ledger-card { margin-top: -4px; }

.entry-list .ledger-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: start;
}
.entry-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.entry-title {
    margin: 0 0 8px;
    font-size: 1.3rem;
}
.entry-title a { color: var(--ink); text-decoration: none; }
.entry-title a:hover { color: var(--seal); }
.entry-summary { color: var(--text-muted); font-size: 0.95rem; margin: 0; }

/* ---------- Tally counter ----------
   Signatures are rendered as hand-count tally groups (4 strokes + 1
   diagonal closing the group of 5), like a clerk counting a show of
   hands at a town meeting. */
.tally {
    text-align: right;
    min-width: 120px;
}
.tally-count {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--ink);
    display: block;
}
.tally-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.tally-marks {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 6px;
    justify-content: flex-end;
    margin-top: 6px;
    max-width: 140px;
}
.tally-group {
    position: relative;
    width: 16px;
    height: 16px;
}
.tally-group svg { width: 100%; height: 100%; }
.tally-group line {
    stroke: var(--gold);
    stroke-width: 1.6;
    stroke-linecap: round;
}
.tally-group.partial-1 line:nth-child(n+2),
.tally-group.partial-2 line:nth-child(n+3),
.tally-group.partial-3 line:nth-child(n+4),
.tally-group.partial-4 line:nth-child(n+5) { opacity: 0.15; }

.progress-track {
    background: #DAD5C4;
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
    margin: 10px 0 4px;
}
.progress-fill {
    background: var(--seal);
    height: 100%;
    border-radius: 20px;
}

/* ---------- Buttons & forms ---------- */
.btn {
    display: inline-block;
    background: var(--seal);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
}
.btn:hover { background: var(--seal-dark); color: #fff; }
.btn.secondary {
    background: transparent;
    border: 1.5px solid var(--ink);
    color: var(--ink);
}
.btn.secondary:hover { background: var(--ink); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }
.btn[disabled] { background: #B9B4A4; cursor: not-allowed; }

label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    margin: 16px 0 6px;
    color: var(--ink-soft);
}
input[type=text], input[type=email], input[type=password], input[type=number],
textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    font-family: inherit;
    font-size: 0.95rem;
}
textarea { resize: vertical; min-height: 120px; }
.field-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.hairline {
    border: none;
    border-top: 1px solid var(--line);
    margin: 24px 0;
}

.status-pill {
    display: inline-block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 20px;
}
.status-pill.pending { background: #EFE0BE; color: #7A5A17; }
.status-pill.approved { background: #DCEAD8; color: #2E4A28; }
.status-pill.rejected { background: #F3DEDB; color: var(--seal-dark); }

/* ---------- Hero slider (homepage) ---------- */
.hero-band {
    position: relative;
    overflow: hidden;
    background: var(--ink);
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-top: -32px;
    margin-bottom: 40px;
    padding: 56px 24px 44px;
    border-bottom: 4px solid var(--seal);
}
.hero-video-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}
.hero-slide {
    display: none;
    position: absolute;
    inset: 0;
    background-image: linear-gradient(180deg, var(--ink) 0%, #232E52 100%);
    z-index: 0;
}
.hero-slide.active { display: block; animation: heroFade 1s ease; }
.hero-slide.variant-2 { background-image: linear-gradient(200deg, var(--ink) 0%, #3A2A42 100%); }
.hero-slide.variant-3 { background-image: linear-gradient(200deg, var(--ink) 0%, #2E3B2E 100%); }
@keyframes heroFade { from { opacity: 0; } to { opacity: 1; } }

.hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(20,27,49,0.55) 0%, rgba(20,27,49,0.78) 100%);
}

.hero-inner { position: relative; z-index: 3; max-width: 720px; margin: 0 auto; text-align: center; }
.hero-eyebrow {
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 14px;
}
.hero-title {
    font-family: 'Fraunces', Georgia, serif;
    color: #fff;
    font-size: clamp(1.8rem, 4.2vw, 2.7rem);
    line-height: 1.18;
    margin: 0 0 16px;
    min-height: 2.4em;
}
.hero-title .accent { color: var(--gold); }
.hero-sub { color: #C7CBDA; font-size: 1.05rem; max-width: 560px; margin: 0 auto 28px; }
.hero-actions { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 30px; }
.hero-actions .btn.secondary { border-color: #C7CBDA; color: #fff; }
.hero-actions .btn.secondary:hover { background: #fff; color: var(--ink); }
.hero-stats { display: flex; justify-content: center; gap: 48px; flex-wrap: wrap; margin-bottom: 28px; }
.hero-stat { text-align: center; }
.hero-stat-num { display: block; font-size: 2rem; color: #fff; font-weight: 500; }
.hero-stat-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: #9FA6BC; }

.hero-dots { display: flex; justify-content: center; gap: 8px; }
.hero-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: rgba(255,255,255,0.32); border: none; padding: 0; cursor: pointer;
}
.hero-dot.active { background: var(--gold); }

/* ---------- Ad slots ----------
   Plain placeholder boxes with a reserved height, so real ad code can be
   dropped in later without shifting the layout (avoids surprise CLS).
   No third-party script runs here until you paste one in yourself —
   only use code from an ad network you actually trust (e.g. AdSense). */
.ad-slot {
    border: 1px dashed var(--line);
    background: repeating-linear-gradient(45deg, rgba(28,37,65,0.03), rgba(28,37,65,0.03) 10px, transparent 10px, transparent 20px);
    color: var(--text-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-radius: var(--radius);
    margin: 28px 0;
    padding: 10px;
}
.ad-slot.leaderboard { min-height: 90px; }
.ad-slot.rectangle { min-height: 250px; }
.ad-slot.in-feed { min-height: 120px; }

/* ---------- Homepage sections: how it works / why sign ---------- */
.section-band { padding: 8px 0 40px; }
.section-heading { text-align: center; max-width: 560px; margin: 0 auto 28px; }
.steps-grid, .why-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step-card, .why-card {
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 18px;
    text-align: center;
}
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    margin-bottom: 12px;
}
.why-card .why-icon { color: var(--seal); font-size: 1.4rem; margin-bottom: 8px; }
.step-card h3, .why-card h3 { margin-bottom: 6px; }
.step-card p, .why-card p { color: var(--text-muted); font-size: 0.92rem; margin: 0; }

/* ---------- Petition page: two-column layout ---------- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    margin-bottom: 16px;
    color: var(--ink-soft);
    text-decoration: none;
}
.back-link:hover { color: var(--seal); }
.petition-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 28px;
    align-items: start;
}
.petition-sidebar { position: sticky; top: 20px; }

/* ---------- Blog ---------- */
.blog-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

/* ---------- Share block ---------- */
.share-link-row {
    display: flex;
    gap: 8px;
    margin: 12px 0 16px;
}
.share-link-row input {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    background: #fff;
}
.share-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Login/register: "or" divider between Google and email ---------- */
.or-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 20px 0;
}
.or-divider::before, .or-divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid var(--line);
}
.or-divider span { padding: 0 12px; }

/* ---------- Discussion board ---------- */
.discussion-reply {
    border-top: 1px solid var(--line);
    padding-top: 14px;
    margin-top: 14px;
}
.discussion-reply:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.discussion-reply-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.admin-delete-form { display: inline; }
.admin-delete-form .btn { padding: 3px 10px; font-size: 0.75rem; }

/* ---------- Footer ---------- */
.site-footer {
    background: var(--ink);
    color: #B7BCCB;
    padding: 28px 24px;
    font-size: 0.85rem;
    margin-top: 48px;
}
.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.footer-inner a { color: #D8DCE6; margin-right: 16px; text-decoration: none; }
.footer-inner a:hover { color: var(--gold); }

@media (max-width: 900px) {
    .petition-layout { grid-template-columns: 1fr; }
    .petition-sidebar { position: static; }
}

@media (max-width: 640px) {
    body { font-size: 15px; }

    /* Header: logo + hamburger in one row, nav becomes a dropdown panel */
    .header-inner {
        flex-wrap: wrap;
        align-items: center;
        padding: 14px 16px;
        gap: 12px;
    }
    .brand { flex: 1 1 auto; min-width: 0; }
    .site-title { font-size: 1.2rem; }
    .site-tagline { font-size: 0.76rem; }

    .nav-toggle-btn { display: flex; }

    nav.main-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        order: 3;
        margin-top: 8px;
        padding-top: 10px;
        border-top: 1px solid rgba(255,255,255,0.15);
    }
    #nav-toggle:checked ~ nav.main-nav { display: flex; }
    nav.main-nav a {
        margin-left: 0;
        padding: 12px 4px;
        font-size: 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    nav.main-nav a.nav-cta { text-align: center; margin-top: 6px; border-bottom: none; }

    .wrap { padding: 20px 16px 48px; }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }

    .ledger-card { padding: 18px 16px; }

    .entry-list .ledger-card { grid-template-columns: 1fr; }
    .tally { text-align: left; margin-top: 12px; }
    .tally-marks { justify-content: flex-start; }

    /* Forms: full-width buttons and inputs are much easier to tap */
    .btn { display: block; width: 100%; text-align: center; box-sizing: border-box; }
    .btn + .btn { margin-top: 10px; }
    form .btn { width: 100%; }
    input[type=text], input[type=email], input[type=password], input[type=number],
    textarea, select { font-size: 16px; } /* prevents iOS auto-zoom on focus */

    .share-link-row { flex-direction: column; }
    .share-buttons .btn.small { width: 100%; }
    .share-buttons { flex-direction: column; }

    /* Hero */
    .hero-band { margin-top: -20px; margin-bottom: 32px; padding: 40px 16px 32px; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { width: 100%; }
    .hero-stats { gap: 32px; }

    /* Sections */
    .steps-grid, .why-grid { grid-template-columns: 1fr; }
    .ad-slot.rectangle { min-height: 200px; }

    /* Petition page */
    .petition-layout { grid-template-columns: 1fr; }
    .petition-sidebar { position: static; }

    .site-footer { padding: 24px 16px; }
    .footer-inner { flex-direction: column; gap: 16px; }
    .footer-inner a { margin-right: 14px; }
}
