/* ==========================================================================
   Voter sign-in (index.php) + secret PIN (vote/otp.php)
   Mobile-first. All classes prefixed `lg-`. Redesigned 2026-09-08.
   The previous pages are index.legacy.php / vote/otp.legacy.php with
   custom-design.css. No icon font: every icon is inline SVG so the page
   still renders when the venue has no internet.
   ========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700;800&display=swap");

:root {
  --lg-brand: #14a44d;
  --lg-brand-deep: #0e8a46;
  --lg-brand-ink: #06301f;
  --lg-lime: #9ef0b4;
  --lg-green-soft: #e6f7ec;
  --lg-amber: #b26a00;
  --lg-amber-soft: #fff3d6;
  --lg-red: #c62828;
  --lg-red-soft: #fde4e1;
  --lg-bg: #f4f8f5;
  --lg-card: #ffffff;
  --lg-ink: #14231b;
  --lg-muted: #66756c;
  --lg-line: #dfe8e2;
  --lg-field: #f6faf7;
  --lg-radius: 18px;
  --lg-shadow: 0 20px 50px rgba(5, 42, 28, 0.16);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* flex/grid display rules below must not defeat the hidden attribute */
.lg [hidden] { display: none !important; }
body.lg {
  margin: 0;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--lg-bg);
  color: var(--lg-ink);
  line-height: 1.4;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}
.lg-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.lg svg { display: inline-block; vertical-align: middle; }

/* ---- hero -------------------------------------------------------------- */
.lg-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(160deg, #052a1c 0%, #0b4a30 46%, #127a4b 100%);
  padding: 16px 20px 74px;
  padding-top: calc(16px + env(safe-area-inset-top));
}
/* concentric rings, an echo of the old teal circle */
.lg-hero::before,
.lg-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.10);
  pointer-events: none;
}
.lg-hero::before { width: 520px; height: 520px; right: -190px; top: -160px; background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.10), transparent 62%); }
.lg-hero::after  { width: 760px; height: 760px; right: -310px; top: -280px; }

.lg-hero-top {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.lg-logo-wrap {
  display: inline-flex; align-items: center;
  background: #fff; border-radius: 14px; padding: 6px 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.lg-logo-wrap img { height: 34px; width: auto; display: block; }

.lg-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
}
.lg-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #9ef0b4; box-shadow: 0 0 0 0 rgba(158, 240, 180, .6); }
.lg-pill.is-open .dot { animation: lg-pulse 1.8s ease-out infinite; }
.lg-pill.is-scheduled .dot { background: #ffcf5c; }
.lg-pill.is-closed .dot { background: #ff8a80; }
@keyframes lg-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(158, 240, 180, .65); }
  70%  { box-shadow: 0 0 0 9px rgba(158, 240, 180, 0); }
  100% { box-shadow: 0 0 0 0 rgba(158, 240, 180, 0); }
}

.lg-hero-body {
  position: relative; z-index: 1; text-align: center; margin-top: 14px;
  display: flex; flex-direction: column; align-items: center;
}
.lg-hero-text { width: 100%; }
/* .lg-box is the animated ballot-box wrapper from layouts/ballot-box.php (.bx) */
.lg-box {
  order: -1;
  width: 132px;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.38));
  animation: lg-float 6s ease-in-out infinite;
}
@keyframes lg-float {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50%      { transform: translateY(-9px) rotate(1.5deg); }
}
.lg-eyebrow {
  margin: 8px 0 0;
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: #b6f0c8;
}
.lg-h1 {
  margin: 6px 0 8px;
  font-size: 27px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em;
}
.lg-h1 em { font-style: normal; color: var(--lg-lime); }
.lg-lead {
  margin: 0 auto; max-width: 420px;
  font-size: 13.5px; font-weight: 500; line-height: 1.5;
  color: rgba(255, 255, 255, 0.78);
}

.lg-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  width: 100%; margin: 20px auto 0; max-width: 520px; text-align: left;
}
.lg-stat {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-radius: 16px; padding: 13px 14px; min-width: 0;
}
.lg-stat-k {
  display: block;
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}
.lg-stat b {
  display: block; margin-top: 5px;
  font-size: 22px; font-weight: 800; line-height: 1.1; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.lg-stat b small { display: block; margin-top: 3px; font-size: 11.5px; font-weight: 600; color: rgba(255, 255, 255, 0.72); letter-spacing: 0; }
.lg-bar { height: 6px; background: rgba(255, 255, 255, 0.18); border-radius: 99px; margin: 9px 0 7px; overflow: hidden; }
.lg-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #7ef0b0, #d2ff9d); transition: width .8s ease; }
.lg-stat-sub { display: block; font-size: 11.5px; font-weight: 600; line-height: 1.35; color: rgba(255, 255, 255, 0.72); }
.lg-clock { font-variant-numeric: tabular-nums; }
.lg-stat.is-off b { font-size: 16px; margin-top: 8px; }

.lg-trust {
  list-style: none; margin: 18px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px;
  font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, 0.86);
}
.lg-trust li { display: inline-flex; align-items: center; gap: 7px; }
.lg-trust svg { width: 16px; height: 16px; stroke: var(--lg-lime); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- sign-in panel ----------------------------------------------------- */
.lg-panel {
  flex: 1; position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  padding: 0 16px 18px;
  margin-top: -54px;
}
.lg-panel-top { display: none; }
.lg-card {
  width: 100%; max-width: 440px;
  background: var(--lg-card);
  border-radius: 22px;
  padding: 26px 22px 24px;
  box-shadow: var(--lg-shadow);
}
.lg-kicker {
  margin: 0 0 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--lg-brand);
}
.lg-card h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.lg-help { margin: 8px 0 18px; font-size: 13.5px; font-weight: 500; line-height: 1.55; color: var(--lg-muted); }
.lg-help b { color: var(--lg-ink); font-weight: 700; }

.lg-notice {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: 14px; padding: 12px 14px; margin: 0 0 16px;
  font-size: 13px; font-weight: 600; line-height: 1.45;
  background: var(--lg-amber-soft); color: var(--lg-amber);
}
.lg-notice.is-closed { background: var(--lg-red-soft); color: var(--lg-red); }
.lg-notice svg { flex: none; width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }

.lg-field { position: relative; display: block; }
.lg-field-ico {
  position: absolute; left: 17px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--lg-brand); pointer-events: none;
}
.lg-field-ico svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lg-field input {
  width: 100%; height: 56px;
  border: 1.5px solid var(--lg-line); border-radius: 16px;
  padding: 0 16px 0 50px;
  background: var(--lg-field); color: var(--lg-ink);
  font: inherit; font-size: 16px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.lg-field input::placeholder { color: #98a59e; font-weight: 500; letter-spacing: 0; text-transform: none; }
.lg-field input:focus { border-color: var(--lg-brand); background: #fff; box-shadow: 0 0 0 4px rgba(20, 164, 77, 0.16); }
.lg-field.is-bad input { border-color: var(--lg-red); box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.14); }

.lg-btn {
  margin-top: 14px; width: 100%; height: 54px;
  border: 0; border-radius: 16px; cursor: pointer;
  background: linear-gradient(135deg, #19b85c, var(--lg-brand-deep));
  color: #fff; font: inherit; font-size: 16px; font-weight: 800; letter-spacing: .01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 12px 26px rgba(14, 138, 70, 0.32);
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.lg-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.lg-btn:hover { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(14, 138, 70, 0.38); }
.lg-btn:active { transform: translateY(0); }
.lg-btn:focus-visible { outline: 3px solid rgba(20, 164, 77, .45); outline-offset: 3px; }
.lg-btn[disabled] { opacity: .75; cursor: progress; transform: none; }
.lg-btn .lg-spin { display: none; }
.lg-btn.is-busy .lg-spin { display: inline-block; animation: lg-spin 1s linear infinite; }
.lg-btn.is-busy .lg-arrow { display: none; }
@keyframes lg-spin { to { transform: rotate(360deg); } }

.lg-steps {
  list-style: none; margin: 24px 0 0; padding: 0;
  display: flex; align-items: flex-start;
}
.lg-steps li {
  flex: 1; position: relative; text-align: center;
  font-size: 11px; font-weight: 700; color: var(--lg-muted); line-height: 1.3;
}
.lg-steps li b {
  display: grid; place-items: center; margin: 0 auto 6px;
  width: 26px; height: 26px; border-radius: 50%;
  background: #eaf0ec; color: var(--lg-muted); font-size: 12px; font-weight: 800;
  position: relative; z-index: 1;
}
.lg-steps li::before {
  content: ""; position: absolute; top: 13px; left: -50%; right: 50%; height: 2px;
  background: #e2eae5;
}
.lg-steps li:first-child::before { display: none; }
.lg-steps li.is-current { color: var(--lg-ink); }
.lg-steps li.is-current b { background: var(--lg-brand); color: #fff; box-shadow: 0 0 0 4px rgba(20, 164, 77, .18); }
.lg-steps li.is-done b { background: var(--lg-green-soft); color: var(--lg-brand-deep); }
.lg-steps li.is-done::before, .lg-steps li.is-current::before { background: var(--lg-brand); }
.lg-steps li.is-done b svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.lg-alt { margin: 20px 0 0; text-align: center; font-size: 13px; font-weight: 500; color: var(--lg-muted); }
.lg-alt a { color: var(--lg-brand-deep); font-weight: 700; text-decoration: none; }
.lg-alt a:hover { text-decoration: underline; }

.lg-foot {
  margin-top: auto; padding-top: 22px;
  font-size: 11.5px; font-weight: 600; color: var(--lg-muted); text-align: center;
}

/* ---- OTP page ---------------------------------------------------------- */
.lg-otp .lg-field input {
  text-align: center; padding-left: 16px;
  font-size: 28px; letter-spacing: .45em; text-indent: .45em; font-weight: 800;
}
.lg-otp .lg-field input::placeholder { font-size: 15px; letter-spacing: 0; text-indent: 0; }
.lg-otp-meta {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--lg-muted);
}
.lg-otp-meta .lg-clock { color: var(--lg-ink); font-weight: 800; }
.lg-otp-meta.is-expired .lg-clock { color: var(--lg-red); }
.lg-link-btn {
  border: 0; background: none; padding: 0; margin: 0; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--lg-brand-deep);
}
.lg-link-btn:hover { text-decoration: underline; }
.lg-link-btn[disabled] { color: var(--lg-muted); cursor: default; text-decoration: none; }
.lg-err { margin: 10px 0 0; min-height: 18px; font-size: 13px; font-weight: 700; color: var(--lg-red); line-height: 1.4; }
.lg-shake { animation: lg-shake .4s ease; }
@keyframes lg-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.lg-sent {
  display: flex; align-items: center; gap: 12px;
  background: var(--lg-green-soft); border-radius: 14px; padding: 12px 14px; margin: 0 0 16px;
  font-size: 13px; font-weight: 600; color: var(--lg-brand-ink); line-height: 1.45;
}
.lg-sent .ico {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--lg-brand);
}
.lg-sent .ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.lg-sent b { font-weight: 800; letter-spacing: .04em; }

/* ---- modals (bottom sheet on phones, centred card from 600px) ---------- */
.lg-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(5, 30, 20, 0.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.lg-modal.is-open { opacity: 1; visibility: visible; }
.lg-modal-card {
  width: 100%; max-width: 440px;
  background: #fff; border-radius: 24px 24px 0 0;
  padding: 26px 22px calc(22px + env(safe-area-inset-bottom));
  text-align: center;
  transform: translateY(28px);
  transition: transform .26s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
}
.lg-modal.is-open .lg-modal-card { transform: none; }
.lg-modal-ico {
  width: 58px; height: 58px; border-radius: 50%; margin: 0 auto 14px;
  display: grid; place-items: center;
  background: var(--lg-green-soft); color: var(--lg-brand);
}
.lg-modal-ico svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.lg-modal-ico.is-bad { background: var(--lg-red-soft); color: var(--lg-red); }
.lg-modal-ico.is-info { background: var(--lg-amber-soft); color: var(--lg-amber); }
.lg-modal h3 { margin: 0 0 8px; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.lg-modal p { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.55; color: var(--lg-muted); white-space: pre-line; }
.lg-modal .lg-name {
  display: block; margin: 12px 0;
  font-size: 20px; font-weight: 800; color: var(--lg-ink); letter-spacing: -.01em;
}
.lg-modal .lg-chip {
  display: inline-block; margin-top: 10px; padding: 6px 12px; border-radius: 999px;
  background: var(--lg-bg); color: var(--lg-ink);
  font-size: 12px; font-weight: 700; letter-spacing: .05em;
}
.lg-modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.lg-modal-actions button, .lg-modal-actions a {
  flex: 1; height: 48px; border: 0; border-radius: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 14.5px; font-weight: 800; text-decoration: none;
  transition: transform .15s, filter .15s;
}
.lg-modal-actions button:hover, .lg-modal-actions a:hover { filter: brightness(1.04); }
.lg-modal-actions button:active { transform: scale(.98); }
.lg-modal-actions .is-ghost { background: #eef3ef; color: var(--lg-ink); }
.lg-modal-actions .is-main  { background: linear-gradient(135deg, #19b85c, var(--lg-brand-deep)); color: #fff; box-shadow: 0 10px 22px rgba(14, 138, 70, .28); }
.lg-modal-actions .is-danger { background: var(--lg-red); color: #fff; }
.lg-modal-actions button[disabled] { opacity: .75; cursor: progress; }
.lg-modal-actions .lg-spin { display: none; width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; }
.lg-modal-actions .is-busy .lg-spin { display: inline-block; animation: lg-spin 1s linear infinite; }

/* compact mode (body.lg-compact — sign-in and PIN pages): on phones only the slim top bar
   (logo · status), the animated ballot box and the election name under it stay above
   the card, so the form is on screen at once. The box keeps headroom for the
   falling paper (~40px). .lg-hero-mini (election name in the bar) is kept in the markup for
   layouts that want it, but is off everywhere for now. */
.lg-hero-mini { display: none; }
@media (max-width: 599px) {
  .lg-compact .lg-hero { padding: 12px 16px 54px; }
  .lg-compact .lg-hero-body { margin-top: 40px; }
  .lg-compact .lg-hero-body > :not(.lg-box):not(.lg-hero-text) { display: none; }
  .lg-compact .lg-hero-text > :not(.lg-eyebrow) { display: none; }
  .lg-compact .lg-box { width: 152px; }
  .lg-compact .lg-eyebrow { margin: 16px 0 0; font-size: 12.5px; letter-spacing: .12em; color: #fff; text-wrap: balance; }
  .lg-compact .lg-eyebrow span { color: #b6f0c8; }
  .lg-compact .lg-hero-top { gap: 10px; }
  .lg-compact .lg-logo-wrap { padding: 5px 9px; }
  .lg-compact .lg-logo-wrap img { height: 28px; }
  .lg-compact .lg-pill { flex: none; }
  .lg-compact .lg-panel { margin-top: -34px; }
}
@media (min-width: 600px) {
  .lg-modal { align-items: center; padding: 20px; }
  .lg-modal-card { border-radius: 24px; padding: 30px 28px 26px; transform: translateY(12px) scale(.97); box-shadow: 0 30px 70px rgba(0, 0, 0, .28); }
}

/* ---- tablet ------------------------------------------------------------ */
@media (min-width: 600px) and (max-width: 991.98px) {
  .lg-hero { padding: 24px 32px 90px; }
  .lg-box { width: 160px; }
  .lg-h1 { font-size: 34px; }
  .lg-lead { font-size: 15px; }
  .lg-panel { margin-top: -64px; }
  .lg-card { padding: 30px 28px 28px; }
}

/* ---- desktop: sign-in left, hero right --------------------------------- */
@media (min-width: 992px) {
  .lg-page { flex-direction: row; }

  .lg-panel {
    order: 1; flex: 0 0 46%; max-width: 640px;
    margin-top: 0; padding: 28px 48px 22px;
    justify-content: center; align-items: stretch;
    background: var(--lg-bg);
  }
  .lg-panel-top { display: flex; align-items: center; justify-content: flex-start; margin-bottom: auto; }
  .lg-panel-top img { height: 44px; width: auto; display: block; }
  .lg-card { margin: 28px auto; max-width: 440px; padding: 34px 32px 30px; }
  .lg-foot { text-align: left; padding-top: 0; }

  .lg-hero {
    order: 2; flex: 1; min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column; justify-content: center;
    padding: 40px 56px;
  }
  .lg-hero::before { width: 760px; height: 760px; right: -240px; top: -220px; }
  .lg-hero::after  { width: 1100px; height: 1100px; right: -420px; top: -400px; }
  .lg-hero-top { position: absolute; top: 28px; left: 56px; right: 56px; justify-content: flex-end; }
  .lg-hero .lg-logo-wrap { display: none; }

  .lg-hero-body {
    text-align: left; margin: 0;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "text box" "stats stats" "trust trust";
    column-gap: 28px; align-items: center; max-width: 720px;
  }
  .lg-hero-text { grid-area: text; }
  .lg-box { grid-area: box; width: 230px; justify-self: end; }
  .lg-eyebrow { margin-top: 0; }
  .lg-h1 { font-size: 44px; margin: 10px 0 14px; }
  .lg-lead { margin: 0; font-size: 16px; max-width: 420px; }
  .lg-stats { grid-area: stats; margin: 34px 0 0; max-width: 560px; }
  .lg-stat { padding: 16px 18px; }
  .lg-stat b { font-size: 26px; }
  .lg-stat b small { display: inline; margin: 0 0 0 2px; font-size: 12.5px; }
  .lg-trust { grid-area: trust; justify-content: flex-start; margin-top: 22px; font-size: 12.5px; }
}
@media (min-width: 1400px) {
  .lg-panel { flex-basis: 44%; padding: 36px 72px 28px; }
  .lg-hero { padding: 48px 96px; }
  .lg-hero-top { left: 96px; right: 96px; }
  .lg-h1 { font-size: 52px; }
  .lg-box { width: 270px; }
}
@media (max-height: 640px) and (min-width: 992px) {
  .lg-box { width: 170px; }
  .lg-h1 { font-size: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .lg-box, .lg-pill .dot, .lg-modal, .lg-modal-card, .lg-bar i { animation: none !important; transition: none !important; }
}
