/* World Council election pages — shares the oxfordvacancies.com palette. Mobile-first, 44px targets. */
:root {
  --brand: #14532d;
  --brand-strong: #0f3d21;
  --on-brand: #ffffff;
  --accent: #b45309;
  --bg: #f8faf8;
  --surface: #ffffff;
  --text: #1a2e1f;
  --text-muted: #4b5c50;
  --border: #d4ddd6;
  --error: #b91c1c;
  --error-bg: #fee2e2;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --success: #166534;
  --success-bg: #dcfce7;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
  --radius: 12px;
  --focus: 3px solid #2563eb;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(20, 83, 45, 0.06);
  color-scheme: light only; /* light mode only, by Tim's choice (2026-09-11) */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
}
[hidden] { display: none !important; }
:focus-visible { outline: var(--focus); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; }

/* ── Hero ─────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--brand-strong), #166534);
  color: #fff;
  padding: 1.75rem 1rem 2.5rem;
}
.hero-inner { max-width: 40rem; margin: 0 auto; }
.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}
.hero h1 { margin: 0.25rem 0 0.5rem; font-size: clamp(1.7rem, 5.5vw, 2.3rem); }
.hero p { margin: 0; max-width: 36rem; opacity: 0.94; }
.hero .hero-meta { margin-top: 0.75rem; font-size: 0.92rem; opacity: 0.85; }

/* ── Layout ───────────────────────────────────────────────────── */
.wrap { max-width: 40rem; margin: 0 auto; padding: 0 1rem 4rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
  box-shadow: var(--shadow);
}
.wrap > .card:first-child, .wrap > div:first-child > .card:first-child { margin-top: -1.25rem; }
.step { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 1rem; }
.step-num {
  width: 2rem; height: 2rem; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--brand); color: var(--on-brand);
  font-weight: 800;
}
.step h2 { margin: 0; font-size: 1.2rem; }

/* ── Fields ───────────────────────────────────────────────────── */
.field { margin-bottom: 1.1rem; }
.field:last-child { margin-bottom: 0; }
.lbl { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.req { color: var(--error); }
input[type="text"] {
  width: 100%;
  min-height: 46px;
  padding: 0.6rem 0.85rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
input[type="text"]:focus { outline: var(--focus); outline-offset: 1px; border-color: var(--brand); }
.hint { margin: 0.4rem 0 0; color: var(--text-muted); font-size: 0.9rem; }
.hint-ok { color: var(--success); font-weight: 600; }
.hint-ok:not([hidden]) + .hint { display: none; }
/* House field confirmed (prefilled from registration, or picked from the list): green border + check mark */
input.house-verified {
  border-color: var(--success);
  padding-right: 2.75rem;
  /* Solid green circle with a white check */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='11' fill='%23166534'/%3E%3Cpath d='M18 8.5 10.5 16 6 11.5' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.5rem;
}
.hint.center { text-align: center; }
.error { display: block; margin-top: 0.4rem; color: var(--error); font-size: 0.9rem; font-weight: 600; }

/* RadioButtonList / CheckBoxList in Flow layout: <span class="choices"><input><label><br /><input><label>…
   The native input is kept (focusable, posted) but visually replaced by an indicator drawn on the label. */
.choices { display: grid; gap: 0.5rem; }
.choices.inline { grid-template-columns: 1fr 1fr; }
.choices br { display: none; }
.choices input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.choices label {
  position: relative;
  display: block;
  min-height: 48px;
  padding: 0.8rem 0.9rem 0.8rem 3rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.choices label::before {
  content: "";
  position: absolute; left: 0.95rem; top: 50%;
  width: 1.25rem; height: 1.25rem;
  transform: translateY(-50%);
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.choices input[type="radio"] + label::before { border-radius: 50%; }
.choices label:hover { border-color: var(--brand); }
.choices label:hover::before { border-color: var(--brand); }
.choices input:checked + label {
  border-color: var(--brand);
  background: var(--success-bg);
  box-shadow: inset 0 0 0 1px var(--brand);
  font-weight: 600;
}
.choices input:checked + label::before { background: var(--brand); border-color: var(--brand); }
.choices input[type="radio"]:checked + label::before { box-shadow: inset 0 0 0 3px var(--surface); }
.choices input[type="checkbox"]:checked + label::after {
  content: "";
  position: absolute; left: calc(0.95rem + 0.42rem); top: 50%;
  width: 0.3rem; height: 0.6rem;
  border: solid var(--on-brand); border-width: 0 2px 2px 0;
  transform: translateY(-60%) rotate(45deg);
}
.choices input:focus-visible + label { outline: var(--focus); outline-offset: 2px; }
.choices input:disabled + label { opacity: 0.5; cursor: not-allowed; }

/* ── Autocomplete ─────────────────────────────────────────────── */
.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
  margin: 0; padding: 0.25rem 0; list-style: none;
  max-height: 16rem; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}
.ac-list li { min-height: 44px; padding: 0.7rem 0.9rem; cursor: pointer; }
.ac-list li:hover, .ac-list li[aria-selected="true"] { background: var(--success-bg); }
.ac-list mark { background: transparent; color: var(--brand); font-weight: 700; }

/* ── Banners ──────────────────────────────────────────────────── */
.banner {
  display: flex; gap: 0.6rem; align-items: flex-start;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 500;
}
.banner svg { flex-shrink: 0; margin-top: 0.15rem; }
.banner-error { background: var(--error-bg); border-color: var(--error); color: var(--error); }
.banner-warn { background: var(--warn-bg); color: var(--warn); }
.banner-info { background: var(--info-bg); color: var(--info); margin: 1rem 0 0; }

.banner-success { background: var(--success-bg); color: var(--success); }
.banner-success a, .banner-warn a { color: inherit; font-weight: 700; }

/* ── Registration lookup ("Is this you?") ─────────────────────── */
.match-block { margin-bottom: 1rem; }
.match-list { display: grid; gap: 0.5rem; margin: 0 0 0.6rem; }
.match-card {
  display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 0.75rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
.match-card:hover { border-color: var(--brand); background: var(--success-bg); }
.match-name { grid-column: 1; font-weight: 700; }
.match-meta { grid-column: 1; color: var(--text-muted); font-size: 0.9rem; }
.match-go { grid-column: 2; grid-row: 1 / span 2; font-size: 1.8rem; line-height: 1; color: var(--brand); }
.link-btn { display: inline-block; padding: 0.4rem 0; color: var(--brand); font-weight: 600; }
.card .btn { margin-top: 0.25rem; }
input[type="text"][readonly] { background: var(--bg); color: var(--text-muted); }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--brand);
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font: inherit; font-size: 1.05rem; font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
}
.btn:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-secondary { background: transparent; color: var(--brand); }
.btn-secondary:hover { background: var(--success-bg); }
.btn-auto { width: auto; min-height: 44px; font-size: 0.95rem; padding: 0.5rem 1.1rem; }
.submit-row { margin-top: 1.25rem; }
.toolbar { display: flex; justify-content: flex-end; margin: 0.75rem 0 0; }

/* ── Confirm sheet (<dialog>) ─────────────────────────────────── */
.sheet {
  width: min(30rem, calc(100vw - 2rem));
  margin: auto;
  padding: 1.25rem 1.4rem 1.4rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog:not([open]) { display: none; } /* browsers without <dialog> support would otherwise render it inline */
.btn:disabled { opacity: 0.6; cursor: wait; }
.sheet h2 { margin: 0 0 0.25rem; font-size: 1.2rem; }
.sheet h3 { margin: 0.9rem 0 0.3rem; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.sheet-kv { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.6rem; margin: 0.9rem 0 0; }
.sheet-kv dt { color: var(--text-muted); font-weight: 600; }
.sheet-kv dd { margin: 0; font-weight: 600; }
.sheet ul { margin: 0; padding-left: 1.2rem; }
.sheet li { margin: 0.15rem 0; }
.sheet-actions { display: grid; gap: 0.6rem; margin-top: 1.25rem; }
@media (max-width: 40rem) {
  .sheet {
    width: 100vw; max-width: 100vw;
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
    padding-bottom: max(1.4rem, env(safe-area-inset-bottom));
  }
}

/* ── Done state ───────────────────────────────────────────────── */
.done { text-align: center; padding: 2rem 1.25rem; }
.done-icon {
  width: 4rem; height: 4rem; margin: 0 auto 0.75rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--success-bg); color: var(--success);
}
.done h2 { margin: 0 0 0.4rem; font-size: 1.5rem; }
.done p { margin: 0.35rem 0; color: var(--text-muted); }

/* ── Results ──────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-top: -1.5rem; }
@media (min-width: 40rem) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}
.stat-v { display: block; font-size: 1.8rem; font-weight: 800; line-height: 1.1; color: var(--brand); }
.stat-v:empty::before { content: "0"; }
.stat-l { display: block; margin-top: 0.15rem; color: var(--text-muted); font-size: 0.85rem; }
.section-title { margin: 0 0 0.2rem; font-size: 1.2rem; }
.section-note { margin: 0 0 0.9rem; color: var(--text-muted); font-size: 0.92rem; }
.rows { display: grid; gap: 0.5rem; }
.rows:not(:has(.rrow))::after {
  content: "No votes yet.";
  display: block; padding: 1rem; text-align: center;
  color: var(--text-muted); border: 1px dashed var(--border); border-radius: 10px;
}
.rrow {
  display: grid; grid-template-columns: 2rem 1fr auto; gap: 0.7rem; align-items: center;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.rrow.lead { border-color: var(--brand); background: var(--success-bg); }
.rank { font-weight: 800; text-align: center; color: var(--text-muted); }
.lead .rank { color: var(--brand); }
.rname { font-weight: 600; }
.bar { height: 6px; margin-top: 0.4rem; border-radius: 999px; background: var(--border); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.votes { text-align: right; white-space: nowrap; }
.votes b { display: block; font-size: 1.1rem; line-height: 1.1; }
.votes small { color: var(--text-muted); }
.pill {
  display: inline-flex; align-items: center;
  padding: 0.1rem 0.6rem; margin-left: 0.4rem;
  border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  background: var(--brand); color: var(--on-brand);
  vertical-align: middle;
}
.footnote { margin: 1.5rem 0 0; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
