/* Rigel HR Tech kiosk — Blue Giant dark marketing surface.
   Token values copied from rigel-web/app/globals.css (.rg-theme), which is
   authoritative. Orange = the pain phrase only; cyan = interactive states only.
   No lemon (that means MATCHED), no green. */

@font-face {
  font-family: "Montserrat";
  src: url("fonts/montserrat-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --rg-void: #05091a; --rg-night: #0a1330; --rg-navy-panel: #16265a;
  --rg-star: #eaf2ff; --rg-orange: #ff8a3d;
  --text-hi: var(--rg-star); --text: #b8c4dc; --text-muted: #6b7794;
  --support: rgba(185,212,255,.7);
  --border: rgba(255,255,255,.10); --border-strong: rgba(255,255,255,.18);
  --accent: #41C4EC; --accent-hover: #47D6FF; --accent-contrast: #06122e;
  --accent-soft: rgba(65,196,236,.14); --accent-line: rgba(65,196,236,.40);
  --hl: rgba(234,242,255,.08);
  --danger: #F2603C;
  --radius-md: 10px; --radius-lg: 14px; --radius-xl: 18px;
  --ease-out: cubic-bezier(.22,1,.36,1);
  --grad-glass: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  --grad-sky: radial-gradient(120% 90% at 70% -10%, #16265a 0%, #0a1330 55%, #05091a 100%);
  --font-body: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: max(16px, min(4vw, 40px));
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--rg-void);
}
body {
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* no double-tap zoom */
}

[hidden] { display: none !important; }

/* The app follows the *visual* viewport (set from JS), so when the iPad
   keyboard opens the whole layout shrinks above it instead of being covered. */
.app {
  position: fixed;
  left: 0; right: 0;
  top: var(--app-top, 0px);
  height: var(--app-h, 100%);
  display: flex;
  flex-direction: column;
  background: var(--grad-sky);
  padding:
    max(env(safe-area-inset-top), 12px)
    max(env(safe-area-inset-right), var(--gutter))
    max(env(safe-area-inset-bottom), 16px)
    max(env(safe-area-inset-left), var(--gutter));
  overflow: hidden;
}

/* Home Screen web app: clear the status bar and the fade iOS draws under it. */
.is-standalone .app { padding-top: max(calc(env(safe-area-inset-top) + 16px), 48px); }

.topbar { flex: none; display: flex; align-items: center; height: 44px; }
.logo { height: 30px; width: auto; display: block; }

h1, h2, h3 { color: var(--text-hi); font-weight: 700; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(30px, 4.6vw, 56px); line-height: 1.08; outline: none; }
.sub { margin: 10px 0 0; font-size: clamp(17px, 1.8vw, 22px); color: var(--text); line-height: 1.4; }
.eyebrow {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: .14em;
  color: var(--support);
  display: inline-block;
  padding: 6px 0;
  /* long-press target: no selection callout, no scroll gesture stealing it */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ── Screen 1 ─────────────────────────────────────────────────────────── */
.screen-poll .head { flex: none; padding: clamp(8px, 2.5vh, 28px) 0 clamp(14px, 3vh, 32px); }
.choices {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: minmax(72px, 1fr);
  gap: clamp(10px, 1.6vw, 18px);
}
@media (orientation: landscape) and (min-width: 700px) {
  .choices { grid-template-columns: 1fr 1fr; }
}
.choice {
  -webkit-appearance: none; appearance: none;
  font: inherit;
  text-align: left;
  color: var(--text-hi);
  background: var(--grad-glass);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: clamp(14px, 2.4vw, 32px);
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  transition: transform .12s var(--ease-out), border-color .12s, background-color .12s;
}
.choice .idx {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(14px, 1.3vw, 18px);
  letter-spacing: .08em;
  color: var(--text-muted);
}
.choice .txt {
  font-weight: 600;
  font-size: clamp(22px, 2.9vw, 38px);
  line-height: 1.18;
  letter-spacing: -0.01em;
}
.choice em { font-style: normal; color: var(--rg-orange); }
.choice:active, .choice.is-chosen {
  border-color: var(--accent);
  background-color: var(--accent-soft);
  transform: scale(.985);
}
.choice.is-chosen .idx { color: var(--accent); }
/* Portrait phones: index sits beside the text so four rows fit. */
@media (max-height: 640px), (max-width: 520px) and (orientation: portrait) {
  .choice { flex-direction: row; align-items: center; justify-content: flex-start; gap: 16px; }
}

/* Focus — visible on keyboard use, never on touch. */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.choice:focus-visible { outline-offset: 2px; border-color: var(--accent); }

/* ── Screen 2 ─────────────────────────────────────────────────────────── */
.details { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; max-width: 760px; margin: 0 auto; }
.details-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: clamp(8px, 2.5vh, 28px) 4px 12px;
}
.screen-details .head { margin-bottom: clamp(14px, 3vh, 28px); }
.fields { display: grid; gap: 14px; }
.field label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-hi);
  margin: 0 0 6px;
}
.field input {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  height: 64px;
  padding: 0 18px;
  font: inherit;
  font-size: 20px; /* ≥16px: Safari won't zoom on focus */
  color: var(--text-hi);
  background: rgba(255,255,255,.05);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-lg);
}
.field input:focus { border-color: var(--accent); background: rgba(65,196,236,.06); outline: none; }
.field input[aria-invalid="true"] { border-color: var(--rg-orange); }
.err { margin: 6px 0 0; font-size: 16px; color: var(--rg-orange); }

.consent {
  display: flex; align-items: flex-start; gap: 14px;
  margin: 20px 0 6px;
  padding: 10px 0;
  min-height: 64px;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.consent input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.consent .box {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 2px solid var(--border-strong);
  background: rgba(255,255,255,.04);
  display: grid; place-items: center;
}
.consent input:checked + .box { background: var(--accent); border-color: var(--accent); }
.consent input:checked + .box::after {
  content: ""; width: 9px; height: 16px;
  border: solid var(--accent-contrast); border-width: 0 3px 3px 0;
  transform: translateY(-2px) rotate(45deg);
}
.consent input:focus-visible + .box { outline: 3px solid var(--accent); outline-offset: 3px; }
.consent-txt { font-size: 18px; line-height: 1.45; color: var(--text); padding-top: 3px; }

.linkish {
  -webkit-appearance: none; appearance: none;
  background: none; border: 0;
  font: inherit; font-size: 16px;
  color: var(--support);
  text-decoration: underline; text-underline-offset: 3px;
  padding: 12px 0; margin-left: 46px;
  min-height: 44px;
}
.linkish:active { color: var(--accent); }

.actions {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--hl);
}

.btn {
  -webkit-appearance: none; appearance: none;
  font: inherit;
  font-weight: 700;
  font-size: 20px;
  min-height: 64px;
  padding: 0 24px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-strong);
  background: transparent;
  color: var(--text-hi);
  -webkit-user-select: none; user-select: none;
  transition: transform .12s var(--ease-out), background-color .12s, border-color .12s;
}
.btn:active { transform: scale(.98); }
.btn-ghost:active { border-color: var(--accent); background: var(--accent-soft); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:active { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { border-color: rgba(242,96,60,.55); color: #ffb39e; }
.btn-danger:active { background: rgba(242,96,60,.14); }

/* Keyboard open (iPad): drop the subline so the active field + buttons fit. */
.kb-open .screen-details .sub { display: none; }
.kb-open .screen-details h1 { font-size: 26px; }
.kb-open .screen-details .head { margin-bottom: 10px; }
.kb-open .topbar { display: none; }
.kb-open .actions .btn { min-height: 56px; }

/* ── Screen 3 ─────────────────────────────────────────────────────────── */
.thanks {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding-bottom: 6vh;
}
.thanks h1 { font-size: clamp(40px, 7vw, 88px); }
.thanks .body { font-size: clamp(20px, 2.4vw, 30px); line-height: 1.45; color: var(--text); margin: 20px 0 0; max-width: 30ch; }
.thanks .url { font-family: var(--font-mono); font-weight: 500; font-size: 16px; letter-spacing: .06em; color: var(--support); margin: 22px 0 0; }
.btn-next { margin-top: clamp(24px, 5vh, 48px); min-width: 240px; }
.countdown { margin-top: 18px; width: 240px; height: 3px; border-radius: 3px; background: var(--hl); overflow: hidden; }
.countdown span { display: block; height: 100%; width: 100%; background: var(--accent-line); transform-origin: left; }
.countdown span.run { animation: drain 8s linear forwards; }
@keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ── Overlays ─────────────────────────────────────────────────────────── */
.overlay {
  position: absolute; inset: 0;
  z-index: 20;
  background: rgba(5,9,26,.82);
  display: flex; align-items: stretch; justify-content: center;
  padding:
    max(env(safe-area-inset-top), 16px)
    max(env(safe-area-inset-right), 16px)
    max(env(safe-area-inset-bottom), 16px)
    max(env(safe-area-inset-left), 16px);
}
.overlay-card {
  width: 100%; max-width: 900px;
  display: flex; flex-direction: column;
  background: var(--rg-night);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.overlay-bar {
  flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 10px 10px 20px;
  border-bottom: 1px solid var(--hl);
}
.overlay-bar h2 { font-size: 20px; }
.btn-close { min-height: 56px; font-size: 18px; }
.overlay-body { flex: 1; min-height: 0; position: relative; background: #fff; }
.overlay-body iframe { width: 100%; height: 100%; border: 0; display: block; }
.offline-note {
  position: absolute; inset: 0; margin: 0;
  display: grid; place-items: center; text-align: center;
  padding: 32px; font-size: 20px; line-height: 1.5;
  background: var(--rg-night); color: var(--text);
}

.staff-card { max-width: 720px; }
.staff-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.staff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.k { font-family: var(--font-mono); font-weight: 500; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.v { font-size: 30px; font-weight: 700; color: var(--text-hi); }
.v.small { font-size: 17px; font-weight: 600; }
.staff-note { font-size: 15px; color: var(--text); margin: 12px 0 0; min-height: 1em; }
.staff-note.warn { color: var(--rg-orange); }
.row { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.row.buttons .btn { flex: 1 1 160px; }
select {
  font: inherit; font-size: 18px;
  min-height: 48px; padding: 0 12px;
  color: var(--text-hi); background: rgba(255,255,255,.05);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-md);
}
.staff h3 { font-size: 16px; margin: 24px 0 8px; }
.tally { width: 100%; border-collapse: collapse; font-size: 16px; }
.tally td { padding: 8px 6px; border-bottom: 1px solid var(--hl); color: var(--text); }
.tally td.n { text-align: right; font-family: var(--font-mono); color: var(--text-hi); white-space: nowrap; }
.danger { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--hl); }
.confirm p { font-size: 16px; color: var(--text-hi); margin: 14px 0 0; }

@media (max-width: 520px) {
  .staff-grid { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr 1.6fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .choice:active, .choice.is-chosen, .btn:active { transform: none; }
}
