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

:root {
    --ink:      #1E2A38;
    --paper:    #FAF6EC;
    --paper-2:  #F1EBDA;
    --navy:     #16324F;
    --navy-2:   #0F2438;
    --maroon:   #8C1D3F;
    --maroon-2: #6E1731;
    --gold:     #B08D2B;
    --success:  #2F6F4E;
    --error:    #A32D3E;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Source Sans 3', system-ui, -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

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

body {
    font-family: var(--font-body);
    background: var(--paper-2);
    color: var(--ink);
    line-height: 1.55;
}

a { color: inherit; }

/* ===================== Admin chrome ===================== */

.navbar {
    background: var(--navy-2);
    color: #fff;
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--gold);
}

.navbar h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 21px;
    letter-spacing: 0.3px;
}

.navbar a {
    color: #fff;
    text-decoration: none;
    margin-left: 18px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    background: rgba(255,255,255,0.1);
    padding: 8px 14px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.15);
}

.navbar a:hover { background: rgba(255,255,255,0.22); }

.container {
    max-width: 900px;
    margin: 40px auto;
    background: #fff;
    padding: 34px;
    border-radius: 6px;
    box-shadow: 0 2px 14px rgba(15,36,56,0.08);
    border: 1px solid #e7e0cc;
}

.container-wide { max-width: 1100px; }

h1, h2, h3 {
    font-family: var(--font-display);
    color: var(--navy-2);
    margin-bottom: 18px;
    font-weight: 600;
}

form label {
    display: block;
    margin-top: 14px;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--ink);
    letter-spacing: 0.2px;
}

form input[type=text],
form input[type=number],
form input[type=password],
form input[type=tel],
form select,
form textarea {
    width: 100%;
    padding: 11px 12px;
    margin-top: 6px;
    border: 1.5px solid #d8d0b8;
    border-radius: 5px;
    font-size: 14.5px;
    font-family: var(--font-body);
    background: #fffdf7;
}

form input[type=file] {
    width: 100%;
    padding: 10px 0;
    margin-top: 6px;
    font-size: 13.5px;
    font-family: var(--font-body);
}

form input:focus, form select:focus, form textarea:focus {
    outline: 2px solid var(--gold);
    outline-offset: 1px;
    border-color: var(--gold);
}

.btn {
    display: inline-block;
    background: var(--navy);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    margin-top: 20px;
    text-decoration: none;
    font-family: var(--font-body);
}

.btn:hover { background: var(--navy-2); }
.btn-danger { background: var(--maroon); }
.btn-danger:hover { background: var(--maroon-2); }

.alert {
    padding: 13px 16px;
    border-radius: 5px;
    margin-bottom: 18px;
    font-size: 14px;
    border-left: 4px solid transparent;
}
.alert-error   { background: #FBEAEA; color: var(--error);   border-color: var(--error); }
.alert-success { background: #E9F3ED; color: var(--success); border-color: var(--success); }
.alert-info    { background: #EAF0F6; color: var(--navy);    border-color: var(--navy); }

table { width: 100%; border-collapse: collapse; margin-top: 15px; }
table th, table td {
    text-align: left;
    padding: 11px 12px;
    border-bottom: 1px solid #eee5cd;
    font-size: 14px;
}
table th {
    background: var(--paper);
    color: var(--navy-2);
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.thumb-sm {
    width: 38px; height: 38px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    border: 1.5px solid var(--gold);
}

.progress-text {
    background: var(--paper);
    border: 1px solid #e7ddc0;
    padding: 12px 16px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--navy-2);
}

.center { text-align: center; }
.small-text { font-size: 13px; color: #6b6355; }

/* ===================== Public ballot page ===================== */

.ballot-page {
    background: var(--navy-2);
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 15% 10%, rgba(176,141,43,0.10), transparent 40%),
        radial-gradient(circle at 85% 90%, rgba(140,29,63,0.12), transparent 40%);
}

.ballot-header {
    text-align: center;
    padding: 56px 20px 40px;
    color: #fff;
}

.ballot-seal {
    width: 68px;
    height: 68px;
    margin: 0 auto 18px;
}

.ballot-eyebrow {
    font-family: var(--font-mono);
    font-size: 12.5px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 10px;
}

.ballot-title {
    font-family: var(--font-display);
    font-size: 40px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

.ballot-subtitle {
    font-size: 15.5px;
    color: #c8d2dc;
    max-width: 520px;
    margin: 0 auto;
}

.ballot-rule {
    width: 60px;
    height: 3px;
    background: var(--gold);
    margin: 22px auto 0;
    border-radius: 2px;
}

.ballot-sheet {
    max-width: 760px;
    margin: 0 auto 70px;
    background: var(--paper);
    border-radius: 10px 10px 4px 4px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
    overflow: hidden;
    position: relative;
}

.ballot-sheet::before {
    content: "";
    display: block;
    height: 6px;
    background: linear-gradient(90deg, var(--maroon), var(--gold), var(--navy));
}

.ballot-instructions {
    padding: 22px 34px 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.ballot-instructions .round-name {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--navy);
    background: #fff;
    border: 1px solid var(--gold);
    padding: 5px 12px;
    border-radius: 20px;
}

.select-limit {
    font-size: 13px;
    color: #6b6355;
    font-weight: 600;
}
.select-limit b { color: var(--maroon); }

.ballot-rows { padding: 10px 34px 8px; }

.ballot-row {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 4px;
    position: relative;
}

/* perforated ballot-stub divider between rows */
.ballot-row:not(:last-child)::after {
    content: "";
    position: absolute;
    bottom: 0; left: -34px; right: -34px;
    height: 0;
    border-bottom: 2px dashed #d9cfaf;
}

.ballot-no {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--gold);
    width: 34px;
    flex-shrink: 0;
    text-align: center;
    font-weight: 600;
}

.candidate-photo-wrap {
    position: relative;
    flex-shrink: 0;
}

.candidate-photo {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--gold);
    background: #fff;
}

.team-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 2px var(--paper);
    object-fit: cover;
}

.candidate-info { flex: 1; min-width: 0; }

.candidate-name {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--navy-2);
}

.candidate-meta {
    font-size: 12.5px;
    color: #6b6355;
    margin-top: 2px;
}

.candidate-meta .team-name {
    color: var(--maroon);
    font-weight: 600;
}

/* Ballot checkbox styled like an official paper checkbox with ink stamp */
.ballot-check {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    position: relative;
}

.ballot-check input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    margin: 0;
}

.ballot-check .box {
    width: 100%;
    height: 100%;
    border: 2.5px solid var(--navy);
    border-radius: 4px;
    background: #fffdf7;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
}

.ballot-check .stamp {
    font-family: var(--font-display);
    font-size: 30px;
    color: var(--maroon);
    opacity: 0;
    transform: scale(1.8) rotate(-18deg);
    transition: opacity 0.12s;
    line-height: 1;
}

.ballot-check input:checked ~ .box {
    border-color: var(--maroon);
}
.ballot-check input:focus-visible ~ .box {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
.ballot-check input:checked ~ .box .stamp {
    opacity: 1;
    animation: stampIn 0.22s ease-out;
}

@keyframes stampIn {
    0%   { opacity: 0; transform: scale(2.6) rotate(-18deg); }
    60%  { opacity: 1; transform: scale(1.5) rotate(-14deg); }
    100% { opacity: 1; transform: scale(1.8) rotate(-18deg); }
}

.ballot-row.selected { background: rgba(140,29,63,0.045); border-radius: 6px; }

.ballot-footer {
    padding: 26px 34px 34px;
    text-align: center;
    border-top: 1px solid #e6dbba;
    margin-top: 6px;
}

.btn-cast {
    background: var(--maroon);
    color: #fff;
    border: none;
    padding: 15px 44px;
    border-radius: 30px;
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: 0.4px;
    cursor: pointer;
    font-family: var(--font-body);
    box-shadow: 0 8px 20px rgba(140,29,63,0.3);
}

.btn-cast:hover { background: var(--maroon-2); }

.ballot-footer .fine-print {
    font-size: 12px;
    color: #948a75;
    margin-top: 14px;
}

.ballot-empty {
    text-align: center;
    padding: 50px 20px;
    color: #6b6355;
}

@media (max-width: 600px) {
    .ballot-title { font-size: 30px; }
    .ballot-rows, .ballot-instructions, .ballot-footer { padding-left: 18px; padding-right: 18px; }
    .candidate-name { font-size: 16px; }
    .ballot-row:not(:last-child)::after { left: -18px; right: -18px; }
}

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
    .ballot-check input:checked ~ .box .stamp { animation: none; }
}

/* ===================== Footer credit ===================== */

.site-footer {
    text-align: center;
    font-size: 12.5px;
    color: #948a75;
    padding: 22px 20px 30px;
    letter-spacing: 0.2px;
}

.ballot-page .site-footer {
    color: #7c8894;
}

.site-footer .footer-brand {
    color: var(--gold);
    font-weight: 600;
}
