/* ── Ranked Choice Ballot — modernist civic form ────────────────────
   Cool slate backdrop, crisp white card, deep indigo, oversized rank
   numerals, drag-lift shadows, generous whitespace. */

:root {
  --slate: #e8eaf1;
  --card: #ffffff;
  --ink: #171a26;
  --ink-soft: #676d82;
  --indigo: #3730a3;
  --indigo-bright: #4f46e5;
  --line: #dcdfe9;
  --lift: rgba(23, 26, 38, 0.16);
  --err: #d33f49;
  --ok: #17825c;
  --font: 'Inter Tight', sans-serif;
}

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

.hidden { display: none !important; }

body {
  font-family: var(--font);
  background: var(--slate);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.page { display: flex; flex-direction: column; min-height: 100vh; }

.wrap { width: 100%; max-width: 640px; margin: 0 auto; padding: 0 20px; }

main { flex: 1 0 auto; padding-bottom: 70px; }

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 60px 0 30px; }

.kicker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--indigo-bright);
  background: rgba(79, 70, 229, 0.08);
  border-radius: 999px;
  padding: 6px 18px;
  margin-bottom: 18px;
}

.hero h1 {
  font-weight: 800;
  font-size: clamp(1.9rem, 7vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.hero .sub { max-width: 460px; margin: 14px auto 0; color: var(--ink-soft); font-size: 1.02rem; }

/* ── Notes ────────────────────────────────────────────────────────── */
.note {
  margin: 20px 0;
  padding: 16px 20px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  text-align: center;
}

/* ── Ballot card ──────────────────────────────────────────────────── */
.ballot-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 26px 32px;
  box-shadow: 0 24px 60px rgba(23, 26, 38, 0.08);
}

.rank-hint {
  text-align: center;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

.hint-mobile { display: none; }

/* Rank rows */
.rank-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }

.rank-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fbfbfd;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.rank-row:active { cursor: grabbing; }

.rank-row.dragging {
  opacity: 0.95;
  border-color: var(--indigo-bright);
  box-shadow: 0 18px 40px var(--lift);
  transform: scale(1.02);
  background: #fff;
}

.rank-row.drag-over { border-top: 3px solid var(--indigo-bright); }

.rank-num {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  background: var(--indigo);
  color: #fff;
  transition: background 0.2s ease;
}

.rank-row:first-child .rank-num { background: var(--indigo-bright); box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35); }

.rank-title { flex: 1; font-weight: 600; font-size: 1rem; min-width: 0; }

.rank-arrows { display: flex; flex-direction: column; gap: 4px; }

.arrow-btn {
  width: 30px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.75rem;
  cursor: pointer;
  line-height: 1;
  transition: all 0.12s ease;
}

.arrow-btn:hover:not(:disabled) { border-color: var(--indigo-bright); color: var(--indigo-bright); }
.arrow-btn:disabled { opacity: 0.3; cursor: default; }

.grip {
  flex-shrink: 0;
  color: var(--line);
  font-size: 1.1rem;
  letter-spacing: 2px;
  cursor: grab;
}

/* ── Vote form ────────────────────────────────────────────────────── */
.vote-form { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 24px; }

.field-row { display: flex; gap: 10px; }

input[type="email"] {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: #fbfbfd;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="email"]:focus {
  outline: none;
  border-color: var(--indigo-bright);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

input.error { border-color: var(--err); }
input::placeholder { color: var(--ink-soft); opacity: 0.7; }

.fine { margin-top: 12px; text-align: center; color: var(--ink-soft); font-size: 0.84rem; }

.form-error { color: var(--err); font-weight: 600; text-align: center; margin-top: 12px; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.98rem;
  padding: 14px 26px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
  line-height: 1.2;
  white-space: nowrap;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--indigo-bright); outline-offset: 2px; }

.btn-primary {
  background: var(--indigo);
  color: #fff;
  box-shadow: 0 12px 30px rgba(55, 48, 163, 0.3);
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Done ─────────────────────────────────────────────────────────── */
.done-card { text-align: center; }

.done-mark {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  font-weight: 800;
  color: #fff;
  background: var(--ok);
}

.done-card h2 { font-weight: 800; font-size: 1.6rem; letter-spacing: -0.02em; }

.card-sub { color: var(--ink-soft); margin: 6px 0 20px; }

.final-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  max-width: 400px;
  margin: 0 auto;
}

.final-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fbfbfd;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font-weight: 600;
}

.final-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.88rem;
  background: var(--indigo);
  color: #fff;
}

/* ── Toast ────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 14px 26px;
  border-radius: 12px;
  font-weight: 600;
  z-index: 120;
  max-width: 92vw;
  text-align: center;
}

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
  flex-shrink: 0;
  text-align: center;
  padding: 24px 20px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

#wbx-powered-by-slot { margin-top: 12px; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .field-row { flex-direction: column; }
  .btn-primary { width: 100%; }
  .hint-desktop { display: none; }
  .hint-mobile { display: inline; }
  .grip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
