/* ============================================
   Voting Platform — "Ceremonial" Theme (Bright)
   Cream/White + Gold. Serif display / geometric sans body.
   ============================================ */

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

:root {
    --paper: #fbf8f2;
    --paper-soft: #f3ede0;
    --card: #ffffff;
    --border: rgba(201, 162, 39, 0.25);
    --gold: #b8860b;
    --gold-bright: #d4a017;
    --gold-dim: rgba(184, 134, 11, 0.10);
    --ink-text: #241f14;
    --text-hi: #241f14;
    --text-mid: #4a4436;
    --text-dim: #8a8272;
    --success: #2f8a53;
    --success-bg: #e6f7ed;
    --error: #c0392b;
    --error-bg: #fdecea;
    --navy: #1b2a4a;
    --navy-bright: #2c4a7c;
    --navy-dim: rgba(27, 42, 74, 0.08);
    --navy-border: rgba(27, 42, 74, 0.22);
    --radius: 14px;
    --radius-sm: 8px;
    --shadow-lift: 0 16px 40px -18px rgba(90, 70, 20, 0.25);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Sora', sans-serif;
    background:
        radial-gradient(ellipse 900px 500px at 15% -10%, rgba(184, 134, 11, 0.08), transparent 60%),
        radial-gradient(ellipse 700px 600px at 100% 10%, rgba(184, 134, 11, 0.06), transparent 55%),
        var(--paper);
    background-attachment: fixed;
    color: var(--text-mid);
    line-height: 1.55;
    position: relative;
}

/* subtle grain overlay */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.02;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3 {
    font-family: 'Fraunces', serif;
    color: var(--text-hi);
    letter-spacing: -0.01em;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 10px;
}

h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: 0;
}

a { color: var(--gold); }

.container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 20px 80px;
    animation: fadeInUp 0.6s ease both;
}

.container.narrow {
    max-width: 440px;
}

/* ---- Progress dots (category ballot) ---- */
.progress-rail {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 22px;
}

.progress-dot {
    height: 6px;
    flex: 1;
    border-radius: 4px;
    background: rgba(184, 134, 11, 0.12);
    overflow: hidden;
    position: relative;
}

.progress-dot.done, .progress-dot.current {
    background: var(--gold-dim);
}

.progress-dot.done::after, .progress-dot.current::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--gold), var(--gold-bright));
    border-radius: 4px;
    animation: fillDot 0.5s ease both;
}

.progress-dot.done::after { width: 100%; animation: none; }
.progress-dot.current::after { animation: fillDot 0.7s ease both; }

@keyframes fillDot { from { width: 0; } to { width: 100%; } }

.progress-label {
    font-size: 0.78rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 6px;
    font-weight: 600;
}

/* ---- Cards ---- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-lift);
    animation: fadeInUp 0.5s ease both;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-mid);
    margin: 14px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
select {
    width: 100%;
    padding: 13px 14px;
    background: var(--paper-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-hi);
    font-size: 1rem;
    font-family: 'Sora', sans-serif;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px var(--navy-dim);
}

input::placeholder { color: var(--text-dim); }

button, .btn-danger, a.btn-link {
    display: inline-block;
    margin-top: 18px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--navy-bright), var(--navy));
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Sora', sans-serif;
    letter-spacing: 0.02em;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    text-decoration: none;
    text-align: center;
}

button:hover, a.btn-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -8px rgba(22, 33, 62, 0.45);
}

button:active, a.btn-link:active { transform: translateY(0); }

.btn-danger, a.btn-link.btn-danger {
    background: linear-gradient(135deg, #e07a70, var(--error));
    color: #fff;
    margin-left: 8px;
}

.btn-secondary, a.btn-link.btn-secondary {
    background: var(--card);
    color: var(--navy);
    border: 1px solid var(--navy-border);
    box-shadow: none;
}

.btn-secondary:hover, a.btn-link.btn-secondary:hover {
    border-color: var(--navy);
    background: var(--navy-dim);
    box-shadow: none;
}

.notice {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    margin: 14px 0;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.notice-success { background: var(--success-bg); color: var(--success); border-color: rgba(47, 138, 83, 0.25); }
.notice-error { background: var(--error-bg); color: var(--error); border-color: rgba(192, 57, 43, 0.25); }

/* ---- Candidate ballot options ---- */
.candidate-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.candidate-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    border: 1px solid var(--border);
    background: var(--paper-soft);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
    animation: fadeInUp 0.45s ease both;
}

.candidate-option:nth-child(1) { animation-delay: 0.05s; }
.candidate-option:nth-child(2) { animation-delay: 0.1s; }
.candidate-option:nth-child(3) { animation-delay: 0.15s; }
.candidate-option:nth-child(4) { animation-delay: 0.2s; }
.candidate-option:nth-child(5) { animation-delay: 0.25s; }
.candidate-option:nth-child(6) { animation-delay: 0.3s; }

.candidate-option:hover {
    border-color: var(--navy);
    transform: translateX(2px);
}

.candidate-option:has(input:checked) {
    border-color: var(--navy);
    background: var(--navy-dim);
    box-shadow: 0 0 0 1px var(--navy) inset;
}

.candidate-option input[type="radio"] {
    width: 22px;
    height: 22px;
    accent-color: var(--navy);
    flex-shrink: 0;
    order: 2;
}

.candidate-photo {
    width: min(384px, 100%);
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--border);
    flex-shrink: 0;
    transition: border-color 0.2s ease;
    box-shadow: 0 4px 14px -4px rgba(36, 31, 20, 0.25);
    order: 1;
}

.candidate-option:has(input:checked) .candidate-photo {
    border-color: var(--navy);
}

.candidate-photo-placeholder {
    width: min(384px, 100%);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-dim), var(--paper-soft));
    border: 3px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fraunces', serif;
    font-size: clamp(2.5rem, 18vw, 6rem);
    color: var(--gold);
    box-shadow: 0 4px 14px -4px rgba(36, 31, 20, 0.15);
    order: 1;
}

.candidate-option span.name {
    font-size: 1.05rem;
    color: var(--text-hi);
    font-weight: 500;
    order: 3;
}

.link-row {
    margin-top: 24px;
    font-size: 0.9rem;
}

/* ---- Admin ---- */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 10px;
}

/* ---- Dashboard: seal, stat tiles, grouped nav ---- */
.dashboard-eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 4px;
}

.dashboard-seal-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 8px 0 30px;
}

.dashboard-seal-wrap .laurel { width: 22px; height: 32px; }

.dashboard-seal {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--gold);
    background: radial-gradient(circle at 32% 26%, rgba(212, 160, 23, 0.20), var(--card) 72%);
    box-shadow: 0 14px 32px -16px rgba(184, 134, 11, 0.55), inset 0 0 0 4px rgba(184, 134, 11, 0.08);
    animation: fadeInUp 0.5s ease both;
}

.dashboard-seal.closed {
    border-color: var(--error);
    background: radial-gradient(circle at 32% 26%, rgba(192, 57, 43, 0.16), var(--card) 72%);
    box-shadow: 0 14px 32px -16px rgba(192, 57, 43, 0.4), inset 0 0 0 4px rgba(192, 57, 43, 0.08);
}

.dashboard-seal-status {
    font-family: 'Fraunces', serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.03em;
    color: var(--gold);
}

.dashboard-seal.closed .dashboard-seal-status { color: var(--error); }

.dashboard-seal-sub {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-dim);
    margin-top: 3px;
}

.dashboard-toggle-row { text-align: center; margin: 0 0 32px; }

.stat-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 0 0 30px;
}

.stat-tile {
    position: relative;
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px 15px;
    box-shadow: var(--shadow-lift);
}

.stat-tile::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--gold-bright));
}

.stat-tile-icon {
    width: 17px;
    height: 17px;
    color: var(--gold);
    opacity: 0.85;
    margin-bottom: 10px;
    display: block;
}

.stat-tile .stat-number {
    display: block;
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 1.7rem;
    color: var(--gold);
}

.stat-tile-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-dim);
}

.nav-section { margin-bottom: 26px; }

.nav-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 700;
    color: var(--text-dim);
    margin: 0 0 10px;
}

.nav-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

a.nav-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0;
    padding: 13px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-hi);
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    box-shadow: none;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

a.nav-tile:hover {
    border-color: var(--navy);
    background: var(--navy-dim);
    transform: translateY(-2px);
    box-shadow: none;
}

a.nav-tile svg {
    width: 17px;
    height: 17px;
    color: var(--gold);
    flex-shrink: 0;
}

@media (min-width: 600px) {
    .stat-strip { grid-template-columns: repeat(4, 1fr); }
    .nav-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Results ---- */
.results-category {
    margin-bottom: 28px;
    animation: fadeInUp 0.5s ease both;
}

.result-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.result-name {
    flex: 0 0 130px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-hi);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-bar-track {
    flex: 1;
    background: rgba(184, 134, 11, 0.10);
    border-radius: 5px;
    height: 22px;
    overflow: hidden;
    position: relative;
}

.result-bar-fill {
    background: linear-gradient(90deg, var(--gold), var(--gold-bright));
    height: 100%;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}

.result-bar-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    width: 40%;
    animation: shimmer 2.2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(280%); }
}

.result-count {
    flex: 0 0 34px;
    text-align: right;
    font-weight: 700;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.data-table th, .data-table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-mid);
}

.data-table th {
    color: var(--text-dim);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    background: var(--paper-soft);
}

/* ---- Thank you checkmark ---- */
.check-badge {
    width: 84px;
    height: 84px;
    margin: 0 auto 20px;
}

.check-badge circle {
    fill: none;
    stroke: var(--gold);
    stroke-width: 3;
    stroke-dasharray: 220;
    stroke-dashoffset: 220;
    animation: drawCircle 0.7s ease forwards;
}

.check-badge path {
    fill: none;
    stroke: var(--gold-bright);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: drawCheck 0.4s ease forwards 0.6s;
}

@keyframes drawCircle { to { stroke-dashoffset: 0; } }
@keyframes drawCheck { to { stroke-dashoffset: 0; } }

/* ---- Motion primitives ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Header mark (ballot icon) ---- */
.brand-mark {
    width: 44px;
    height: 44px;
    margin-bottom: 14px;
    color: var(--gold);
    position: relative;
    z-index: 1;
}

/* ---- Ambient floating background shapes ---- */
.bg-atmosphere {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.25;
}

.bg-blob.b1 {
    width: 380px; height: 380px;
    top: -120px; left: -100px;
    background: radial-gradient(circle, rgba(184,134,11,0.30), transparent 70%);
    animation: drift1 22s ease-in-out infinite;
}

.bg-blob.b2 {
    width: 320px; height: 320px;
    bottom: -80px; right: -80px;
    background: radial-gradient(circle, rgba(184,134,11,0.20), transparent 70%);
    animation: drift2 26s ease-in-out infinite;
}

.bg-blob.b3 {
    width: 220px; height: 220px;
    top: 40%; right: 10%;
    background: radial-gradient(circle, rgba(212,160,23,0.14), transparent 70%);
    animation: drift3 30s ease-in-out infinite;
}

@keyframes drift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, 60px) scale(1.15); }
}
@keyframes drift2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-50px, -30px) scale(1.1); }
}
@keyframes drift3 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-30px, 40px); }
}

/* Floating particles drifting upward — used on ballot page */
.particle-field {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    bottom: -10px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gold);
    opacity: 0;
    animation: floatUp linear infinite;
}

@keyframes floatUp {
    0% { transform: translateY(0) translateX(0); opacity: 0; }
    10% { opacity: 0.55; }
    90% { opacity: 0.35; }
    100% { transform: translateY(-100vh) translateX(20px); opacity: 0; }
}

/* ---- Laurel motif ---- */
.laurel-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.laurel {
    width: 30px;
    height: 44px;
    color: var(--gold);
    opacity: 0.7;
}

.laurel.right { transform: scaleX(-1); }

/* ---- Confetti (thank-you page) ---- */
.confetti-field {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -20px;
    width: 8px;
    height: 14px;
    opacity: 0.95;
    animation: confettiFall 3.2s ease-in forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(105vh) rotate(540deg); opacity: 0.4; }
}

/* ---- Photo background layer (real images, tinted to match theme) ---- */
.bg-photo {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    filter: grayscale(20%) sepia(20%) saturate(1.25) hue-rotate(-6deg) brightness(1.1) contrast(0.96);
    transform: scale(1.03);
    opacity: 0.9;
}

.bg-photo.silhouette {
    filter: grayscale(30%) sepia(30%) saturate(1.4) hue-rotate(-10deg) brightness(1.35) contrast(0.9);
    opacity: 0.4;
}

.bg-photo-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        linear-gradient(180deg, rgba(251,248,242,0.20) 0%, rgba(251,248,242,0.55) 60%, rgba(251,248,242,0.85) 100%),
        radial-gradient(ellipse 800px 500px at 50% 0%, rgba(184,134,11,0.06), transparent 60%);
}
