/* COH-830 prototype UI, in Cohort branding: the authenticated-app tokens
   (design-system.md), Google Sans, and the standard logo. Comfortable 48px
   control tier for a focused full-screen flow, single column, readable at
   360px. logo.svg, favicon.svg and GoogleSans.woff2 are byte copies of
   public/ and src/app/fonts/ served from this service, so the page fetches
   nothing from a third party. Every URL is relative so the page also works
   under a path prefix such as code-server's /proxy/8830/. */
@font-face {
  font-family: "Google Sans";
  src: url("GoogleSans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #F1F2F4;
  --surface: #FFFFFF;
  --text: #091E42;
  --text-subtle: #44546F;
  --text-subtlest: #626F86;
  --border: #DCDFE4;
  --border-bold: #B3B9C4;
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --focus: #60A5FA;
  --danger: #CA3521;
  --danger-subtle: #FEECEC;
  --success: #1D7A54;
  --success-subtle: #E6F7EE;
  --warning: #8D6900;
  --warning-subtle: #FEF8E6;
  --info-subtle: #E8F2FC;
  --radius-card: 12px;
  --radius: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
/* Components below set display; the hidden attribute must still win. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Google Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; outline: none; }
h1 { font-size: 24px; line-height: 1.25; margin: 8px 0 8px; font-weight: 700; }
h2 { font-size: 17px; line-height: 1.35; margin: 0 0 4px; font-weight: 600; }
p { margin: 0 0 8px; }
.lead { color: var(--text-subtle); margin-bottom: 16px; }
.hint { color: var(--text-subtlest); font-size: 14px; }
.center { text-align: center; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: block; height: 22px; width: auto; }
.tag { font-size: 13px; color: var(--text-subtlest); }

.step { display: flex; flex-direction: column; gap: 16px; }
.step[hidden] { display: none; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row > .button { flex: 1 1 140px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row > .field { flex: 1 1 120px; justify-content: flex-end; }
select.input { appearance: auto; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.prose ul { margin: 0 0 8px; padding-left: 20px; }
.prose li { margin-bottom: 4px; }
.prose h2 { margin-top: 8px; }
.notice { background: var(--info-subtle); border-color: #BFDBFE; }

.label { font-weight: 600; font-size: 14px; }
.input {
  height: 48px; border: 1px solid var(--border-bold); border-radius: var(--radius); padding: 0 12px;
  font: inherit; color: var(--text); background: var(--surface); width: 100%;
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 14px; margin: 0; }
.banner { border-radius: var(--radius); padding: 12px; margin: 0; }
.banner.error { background: var(--danger-subtle); color: #AE2A19; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 16px; border-radius: var(--radius); border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-align: center; text-decoration: none;
}
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-hover); }
.button.secondary { background: var(--surface); color: var(--text); border-color: var(--border-bold); }
.button.secondary:hover { background: #F7F8F9; }
.button:disabled, .button[aria-disabled="true"] { background: #E9EBEE; color: #626F86; border-color: transparent; cursor: not-allowed; }
.button:focus-visible, .input:focus-visible, .choice:focus-within, .checkbox input:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}

.checkbox { display: flex; gap: 12px; align-items: flex-start; }
.checkbox input { width: 24px; height: 24px; margin: 0; flex: 0 0 auto; }

.choices { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-card); cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.choice input { width: 20px; height: 20px; margin: 2px 0 0; flex: 0 0 auto; }
.choice-body { display: flex; flex-direction: column; min-width: 0; }
.choice-title { font-weight: 600; }
.choice-hint { color: var(--text-subtlest); font-size: 14px; }

.slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.status-chip {
  font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 999px;
  background: #F1F2F4; color: var(--text-subtle); white-space: nowrap;
}
.status-chip[data-state="ok"] { background: var(--success-subtle); color: var(--success); }
.status-chip[data-state="busy"] { background: var(--info-subtle); color: #0C4A9E; }
.status-chip[data-state="warn"] { background: var(--warning-subtle); color: var(--warning); }
.status-chip[data-state="error"] { background: var(--danger-subtle); color: #AE2A19; }
.warnings { margin: 0; padding-left: 20px; color: var(--warning); font-size: 14px; }

.spinner { width: 40px; height: 40px; margin: 8px auto; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
.spinner.small { width: 18px; height: 18px; border-width: 3px; margin: 0; border-color: rgba(12,74,158,0.25); border-top-color: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Intro: what the flow asks for, before the data notice. */
.overview { list-style: none; margin: 0; padding: 16px; gap: 16px; }
.overview li { display: flex; gap: 12px; align-items: flex-start; }
.overview strong { display: block; font-weight: 600; }
.overview-text { display: block; color: var(--text-subtle); font-size: 14px; }
.overview-icon {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--info-subtle); color: var(--primary);
}

/* Progress through the capture steps: one bar per photo. */
.progress { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex: 1; min-width: 0; }
.progress li {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-subtlest); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.progress li::before { content: ""; height: 4px; border-radius: 2px; background: var(--border); }
.progress li[data-state="done"]::before, .progress li[data-state="current"]::before { background: var(--primary); }
.progress li[data-state="current"] { color: var(--text); }

/* Camera: full screen, the live image under a dark scrim with a clear guide. */
body[data-step="camera"] { overflow: hidden; }
body[data-step="camera"] .topbar { display: none; }
.step.camera-step { position: fixed; inset: 0; z-index: 10; display: block; background: #000; color: #fff; }
.step.camera-step[hidden] { display: none; }
.camera-view { position: absolute; inset: 0; overflow: hidden; }
.camera-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-view[data-mode="selfie"] video { transform: scaleX(-1); }
.camera-view.flash::after { content: ""; position: absolute; inset: 0; background: #fff; opacity: 0; animation: flash 0.3s ease-out; }
@keyframes flash { from { opacity: 0.8; } to { opacity: 0; } }
.camera-frame {
  position: absolute; border: 3px solid rgba(255, 255, 255, 0.95); border-radius: 16px;
  box-shadow: 0 0 0 200vmax rgba(9, 30, 66, 0.62); transition: border-color 0.2s;
}
.camera-view[data-mode="selfie"] .camera-frame { border-radius: 50%; }
.camera-frame[data-quality="warn"] { border-color: #F5CD47; }

.camera-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 0;
}
.camera-step .progress li { color: rgba(255, 255, 255, 0.7); }
.camera-step .progress li::before { background: rgba(255, 255, 255, 0.3); }
.camera-step .progress li[data-state="done"]::before, .camera-step .progress li[data-state="current"]::before { background: #fff; }
.camera-step .progress li[data-state="current"] { color: #fff; }
.camera-instructions {
  position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 64px); left: 16px; right: 16px;
  max-width: 560px; margin: 0 auto; text-align: center;
}
.camera-instructions h1 { font-size: 20px; margin: 0 0 4px; color: #fff; outline: none; }
.camera-instructions p { margin: 0; font-size: 15px; color: rgba(255, 255, 255, 0.88); }
.camera-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 0 16px max(24px, env(safe-area-inset-bottom));
}
.camera-status {
  margin: 0; max-width: 100%; padding: 8px 16px; border-radius: 999px; text-align: center;
  font-size: 15px; font-weight: 600; background: rgba(9, 30, 66, 0.8); color: #fff;
}
.camera-status[data-tone="warn"] { background: var(--warning-subtle); color: var(--warning); }
.camera-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; max-width: 420px; }
.camera-controls .shutter { grid-column: 2; }
.shutter {
  width: 76px; height: 76px; padding: 0; border-radius: 50%; border: 4px solid #fff; background: #fff;
  box-shadow: inset 0 0 0 4px #000; cursor: pointer;
}
.shutter:active { transform: scale(0.94); }
.shutter:disabled { opacity: 0.5; cursor: default; }
.icon-button {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.18); color: #fff;
}
.camera-option {
  grid-column: 1; justify-self: start; position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; color: #fff; cursor: pointer;
}
.shutter:focus-visible, .icon-button:focus-visible, .camera-option:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }

.camera-step[data-failed] .camera-instructions, .camera-step[data-failed] .camera-bottom { display: none; }
.camera-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 12px;
  padding: 24px 16px; background: var(--text);
}
.camera-fallback > * { width: 100%; max-width: 420px; margin: 0 auto; }
.camera-fallback p { color: #fff; font-size: 16px; margin-bottom: 8px; }
.camera-fallback .button.secondary { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.6); }

/* "Now turn your card over": a card that flips once, over the live camera. */
.camera-flip {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  background: rgba(9, 30, 66, 0.9); perspective: 800px; cursor: pointer;
}
.flip-card { position: relative; width: 168px; height: 106px; transform-style: preserve-3d; animation: flip 1.2s ease-in-out 0.4s forwards; }
.flip-face { position: absolute; inset: 0; display: flex; gap: 12px; padding: 14px; border-radius: 10px; background: #fff; backface-visibility: hidden; }
.flip-back { transform: rotateY(180deg); align-items: flex-end; }
.flip-photo { width: 42px; height: 54px; border-radius: 4px; background: var(--border-bold); }
.flip-lines { width: 76px; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--border); box-shadow: 0 14px 0 var(--border), 0 28px 0 var(--border); }
.flip-mrz { width: 100%; height: 5px; border-radius: 2px; background: var(--text-subtle); box-shadow: 0 -10px 0 var(--text-subtle), 0 -20px 0 var(--text-subtle); }
.flip-text { margin: 0; font-size: 20px; font-weight: 700; }
@keyframes flip { to { transform: rotateY(180deg); } }
@media (prefers-reduced-motion: reduce) {
  .flip-card { animation: none; transform: rotateY(180deg); }
  .camera-view.flash::after { animation: none; }
}

/* Review of the photo just taken. */
.review-media { display: flex; justify-content: center; }
.review-media img { width: 100%; max-height: 52vh; object-fit: contain; border-radius: var(--radius-card); background: #0B1220; }
.review-media[data-mode="selfie"] { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.review-media[data-mode="selfie"] img { aspect-ratio: 3 / 4; max-height: none; object-fit: cover; transform: scaleX(-1); }
.review-status {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--radius);
  background: var(--info-subtle); color: #0C4A9E;
}
.review-status[data-tone="ok"] { background: var(--success-subtle); color: var(--success); }
.review-status[data-tone="warn"] { background: var(--warning-subtle); color: var(--warning); }
.review-status[data-tone="error"] { background: var(--danger-subtle); color: #AE2A19; }
.review-status-icon { flex: 0 0 auto; display: flex; padding-top: 2px; }
.review-status-body { min-width: 0; }
.review-status-body p { margin: 0; font-weight: 600; }
.review-status .warnings { margin-top: 4px; color: inherit; }

/* Result: one clear outcome and the next action; diagnostics fold away. */
.hero { align-items: center; gap: 8px; padding: 24px 16px; text-align: center; }
.hero h2 { font-size: 20px; margin: 4px 0 0; }
.hero p { margin: 0; color: var(--text-subtle); }
.hero-icon { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.hero-icon[data-tone="positive"] { background: var(--success-subtle); color: var(--success); }
.hero-icon[data-tone="negative"] { background: var(--danger-subtle); color: #AE2A19; }
.hero-icon[data-tone="neutral"] { background: var(--warning-subtle); color: var(--warning); }
.hero-actions { width: 100%; margin-top: 8px; }
.tester > summary {
  cursor: pointer; font-weight: 600; padding: 12px 16px; border-radius: var(--radius-card);
  background: var(--surface); border: 1px solid var(--border); list-style-position: inside;
}
.tester[open] > summary { margin-bottom: 16px; }
.tester > summary .hint { font-weight: 400; }
.facts { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 4px 12px; margin: 0; font-size: 14px; }
.facts dt { color: var(--text-subtlest); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.reasons { margin: 0; padding-left: 20px; font-size: 14px; color: var(--text-subtle); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; margin: 8px 0 0; }
details summary { cursor: pointer; font-weight: 600; min-height: 24px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
