/* ============================================================
   GROUPYCIDE — tema "scheda di voto / timbro"
   Il sito stampa decisioni: ogni scheda è un ballottaggio,
   ogni bottone è un timbro, il risultato in testa prende
   una fascetta dorata come un vincitore da fiera di paese.
   ============================================================ */

:root {
    --bg: #eff1f6;
    --paper: #ffffff;
    --ink: #171521;
    --muted: #6b6879;
    --border: #dcdce6;
    --border-soft: #e9e8f0;

    --accent: #e63946;       /* timbro / azioni decisive */
    --accent-dark: #c62839;
    --teal: #2a9d8f;         /* aperto / positivo */
    --teal-dark: #218074;
    --gold: #f4a300;         /* opzione in testa */

    --font-display: "Archivo Black", "Arial Black", sans-serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", "Courier New", monospace;

    --radius: 14px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    background-image:
        radial-gradient(circle at 1px 1px, rgba(23,21,33,0.05) 1px, transparent 0);
    background-size: 22px 22px;
    margin: 0;
    padding: 24px 16px 60px;
    color: var(--ink);
    line-height: 1.5;
}

.container {
    max-width: 760px;
    margin: 0 auto;
}

/* ---------- Masthead ---------- */

.masthead {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.masthead-nav {
    margin-left: auto;
    align-self: center;
    white-space: nowrap;
}

.stamp-mark {
    flex: none;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    transform: rotate(-12deg);
    background: var(--paper);
}

.brand {
    font-family: var(--font-display);
    font-size: 30px;
    margin: 0;
    letter-spacing: 0.5px;
}

.brand-dot {
    color: var(--accent);
}

.subtitle {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 14px;
    font-style: italic;
}

h1, h2, h3 {
    margin-top: 0;
    font-family: var(--font-display);
    letter-spacing: 0.2px;
}

h1 { font-size: 22px; }
h2 {
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
}
h3 { font-size: 16px; }

/* ---------- Card / scheda ---------- */

.card {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px 18px 26px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(23,21,33,0.06);
    position: relative;
    overflow: hidden;
}

/* bordo perforato a sinistra, come una matrice di biglietto */
.card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background-image: radial-gradient(circle, var(--bg) 2.5px, transparent 2.6px);
    background-size: 8px 14px;
    background-position: center;
}

.vote-box {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(23,21,33,0.06);
}

/* ---------- Forms ---------- */

input, select {
    font-family: var(--font-body);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--paper);
    color: var(--ink);
    font-size: 14px;
}

input:focus, select:focus, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    font-size: 14px;
}

.inline-form {
    display: inline-block;
    margin: 0;
}

/* ---------- Bottoni: timbri ---------- */

button, .btn {
    font-family: var(--font-body);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12.5px;
    letter-spacing: 0.6px;
    background: var(--ink);
    color: #fff;
    border: 2px solid var(--ink);
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.12s ease;
    display: inline-block;
    text-decoration: none;
}

button:hover, .btn:hover {
    transform: rotate(-1deg) scale(1.02);
    opacity: 0.92;
}

button:active, .btn:active {
    transform: rotate(0deg) scale(0.97);
}

.btn-danger {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 2px solid var(--border);
}

.btn-small {
    padding: 6px 10px;
    font-size: 11px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 15px;
    cursor: pointer;
    padding: 4px 6px;
    text-transform: none;
    letter-spacing: 0;
}
.btn-icon:hover { color: var(--accent); transform: scale(1.15); }

.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
}

/* ---------- Link generici (non bottoni) ---------- */

a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
a:hover { text-decoration: underline; }

hr {
    border: none;
    border-top: 2px dashed var(--border);
    margin: 26px 0;
}

/* ---------- Stato sondaggio ---------- */

.status-ok, .status-closed {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 999px;
}
.status-ok { background: rgba(42,157,143,0.12); color: var(--teal-dark); }
.status-closed { background: rgba(230,57,70,0.12); color: var(--accent-dark); }

.status {
    font-weight: 600;
}

/* ---------- Risultati live ---------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.cell {
    position: relative;
    text-align: center;
    padding: 14px 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border-soft);
}

.cell.leader {
    background: rgba(244,163,0,0.10);
    border: 1px solid var(--gold);
}

.cell.leader .label::before {
    content: "🏆 ";
}

.cell .label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.bar {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.bar div {
    height: 100%;
    background: var(--teal);
    transition: width 0.6s ease;
}
.cell.leader .bar div {
    background: var(--gold);
}

.cell small {
    display: block;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
}

.cell .voters {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.4;
    word-break: break-word;
}

.fade {
    animation: fade 0.3s ease;
}
@keyframes fade {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    button, .btn, .bar div, .fade { transition: none; animation: none; }
}

@media (max-width: 480px) {
    .masthead { gap: 12px; flex-wrap: wrap; }
    .brand { font-size: 24px; }
    .masthead-nav { margin-left: 68px; }
}