/* styles.css — license scanner
   Visual direction: the world this lives in is motorcycle range training —
   asphalt, hi-vis safety gear, painted lane lines. Base is dark asphalt so a
   bright camera viewport and the scan reticle carry the screen; the single
   accent is hi-vis safety yellow, used only on the primary action and the
   reticle, nowhere else. System font stack on purpose: this runs on a student's
   phone in a parking lot on a weak connection, and a web-font that fails to
   load would degrade the one screen that has to work. Reliability is the look. */

:root {
  --asphalt: #16181c;
  --asphalt-2: #1f2228;
  --line: #2c3038;
  --ink: #f3f4f6;
  --ink-dim: #9aa0aa;
  --hivis: #e8ff2b;      /* safety yellow — the one accent */
  --hivis-press: #cfe600;
  --danger: #ff6b5e;
  --ok: #57d98a;
  --radius: 14px;
  --pad: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--asphalt); color: var(--ink); }
body { -webkit-font-smoothing: antialiased; }

.scan {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(28px, env(safe-area-inset-top)) var(--pad) max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stage { display: none; }
.stage[data-active] { display: block; animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .stage[data-active] { animation: none; }
}

/* A painted lane-line motif, used as the section opener instead of a generic rule. */
.markline {
  height: 6px;
  width: 64px;
  margin-bottom: 22px;
  background: repeating-linear-gradient(90deg, var(--hivis) 0 14px, transparent 14px 24px);
  border-radius: 2px;
}

.title { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 14px; }
.title.sm { font-size: 24px; }
.lede { font-size: 16px; line-height: 1.5; color: var(--ink-dim); margin: 0 0 22px; }
.lede strong { color: var(--ink); font-weight: 700; }

.how { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 10px; }
.how li {
  position: relative; padding-left: 30px; font-size: 15px; color: var(--ink);
}
.how li::before {
  content: ""; position: absolute; left: 0; top: 7px; width: 12px; height: 12px;
  border: 2px solid var(--hivis); border-radius: 50%;
}

/* Buttons */
.btn {
  -webkit-appearance: none; appearance: none; border: 0; width: 100%;
  font-size: 17px; font-weight: 700; border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; margin-top: 12px; font-family: inherit;
  transition: transform .06s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-go { background: var(--hivis); color: #15170c; }
.btn-go:hover { background: var(--hivis-press); }
.btn-ghost { background: transparent; color: var(--ink-dim); font-weight: 600; }
.btn-ghost:hover { color: var(--ink); }
.btn:focus-visible { outline: 3px solid var(--hivis); outline-offset: 2px; }

/* Camera viewport */
.viewport {
  position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 62dvh;
  background: #000; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line);
}
#video { width: 100%; height: 100%; object-fit: cover; display: block; }

.reticle { position: absolute; inset: 14% 8%; pointer-events: none; }
.corner { position: absolute; width: 28px; height: 28px; border: 3px solid var(--hivis); }
.corner.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.corner.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.corner.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.corner.br { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.reticle-hint {
  position: absolute; left: 0; right: 0; bottom: -34px; text-align: center;
  font-size: 13px; color: var(--ink-dim); margin: 0;
}
.scan-status {
  position: absolute; left: 12px; right: 12px; top: 12px; text-align: center;
  font-size: 13px; font-weight: 600; color: var(--ink);
  background: rgba(0,0,0,.55); padding: 7px 10px; border-radius: 8px;
  backdrop-filter: blur(2px);
}
.scan-status[data-tone="ok"] { color: var(--ok); }
.scan-status[data-tone="err"] { color: var(--danger); }
.scan-diag {
  position: absolute; left: 12px; bottom: 10px;
  font-size: 11px; color: rgba(255,255,255,.6); font-variant-numeric: tabular-nums;
  background: rgba(0,0,0,.4); padding: 3px 7px; border-radius: 6px;
}

.camera-actions { margin-top: 16px; }

/* Confirm form */
.fields { display: grid; gap: 14px; margin: 0 0 8px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row:has(input[name="postalCode"]) { grid-template-columns: 2fr 1fr 1.4fr; }
.field { display: grid; gap: 6px; }
.field span { font-size: 12.5px; font-weight: 600; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .04em; }
.field input {
  font-size: 16px; /* 16px avoids iOS zoom-on-focus */ font-family: inherit;
  background: var(--asphalt-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 13px 12px; width: 100%;
}
.field input:focus { outline: none; border-color: var(--hivis); }
.field input.flagged { border-color: var(--danger); }

.warnings { background: rgba(255,107,94,.12); border: 1px solid rgba(255,107,94,.4); border-radius: 10px; padding: 12px 14px; margin: 0 0 18px; }
.warnings ul { margin: 0; padding-left: 18px; }
.warnings li { font-size: 14px; color: #ffd9d4; line-height: 1.45; }

.done-mark {
  width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #07210f;
  font-size: 34px; font-weight: 900; display: grid; place-items: center; margin: 0 0 22px;
}
