/* ===================================================================
   DistrictSeal — Signing Chamber stylesheet
   Base layout + biometric modal
   =================================================================== */

:root {
  --bg: #0b0d14;
  --panel: #121723;
  --panel-2: #171c2b;
  --text: #e6e8ef;
  --muted: #8b93a7;
  --gold: #e9c46a;
  --gold-2: #f4a261;
  --danger: #e5484d;
  --ok: #3ddc84;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

h1, h2, h3 {
  margin: 0 0 12px 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }

p { margin: 0 0 12px 0; }

a {
  color: var(--gold);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* -------------------------------------------------------------------
   Utility
   ------------------------------------------------------------------- */

.hidden { display: none !important; }

.lede {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.err {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin: 8px 0;
}

/* -------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------- */

button,
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: var(--gold);
  color: #14171f;
  transition: background 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

button:hover:not(:disabled),
.btn:hover {
  background: var(--gold-2);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  background: rgba(233, 196, 106, 0.25);
  color: rgba(20, 23, 31, 0.55);
  cursor: not-allowed;
}

button.secondary,
.btn.secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--text);
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* -------------------------------------------------------------------
   Gate (WebAuthn entry card)
   ------------------------------------------------------------------- */

.gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 30%, rgba(233, 196, 106, 0.06), transparent 60%),
    var(--bg);
  z-index: 100;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.brand h1 {
  font-size: 32px;
  color: var(--gold);
  letter-spacing: 0.02em;
  margin: 0;
}

/* -------------------------------------------------------------------
   Split layout: PDF pane + side panel
   ------------------------------------------------------------------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  height: 100vh;
  width: 100vw;
}

.pdf-pane {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px;
  background: #f4f4f4;
  scroll-behavior: smooth;
}

.pdf-page-wrapper {
  max-width: 860px;
  margin: 0 auto 24px auto;
  background: #ffffff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.pdf-page {
  display: block;
  width: 100%;
  height: auto;
}

.side {
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 28px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side h1 {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 6px 0;
  font-weight: 700;
}

.side h2 {
  font-size: 18px;
  margin: 12px 0 6px 0;
  color: var(--text);
}

/* -------------------------------------------------------------------
   Consent / summary
   ------------------------------------------------------------------- */

#highlights {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.summary-point {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.check input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
}

/* -------------------------------------------------------------------
   Liveness (in-page)
   ------------------------------------------------------------------- */

.words {
  font-size: 26px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.05em;
  margin: 12px 0;
  text-align: center;
}

#cam {
  width: 100%;
  max-width: 380px;
  border-radius: 12px;
  background: #000;
  transform: scaleX(-1);
}

/* ===================================================================
   Full-screen biometric modal — base
   =================================================================== */

.bio-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(5, 8, 15, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(6px);
}

.bio-modal.hidden { display: none; }

.bio-modal-inner {
  position: relative;
  width: min(560px, 92vw);
  min-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bio-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 18px;
  text-align: center;
}

.bio-stage.hidden { display: none; }

.bio-ring {
  position: relative;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  border: 26px solid #ffffff;
  box-shadow:
    0 0 30px 8px rgba(255, 255, 255, 0.85),
    0 0 90px 30px rgba(255, 255, 255, 0.55),
    0 0 160px 60px rgba(255, 255, 255, 0.25);
  overflow: hidden;
  background: #000;
  animation: ringPulse 3.4s ease-in-out infinite;
}

.bio-ring video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  display: block;
}

@keyframes ringPulse {
  0%, 100% {
    box-shadow:
      0 0 30px 8px rgba(255, 255, 255, 0.85),
      0 0 90px 30px rgba(255, 255, 255, 0.55),
      0 0 160px 60px rgba(255, 255, 255, 0.25);
  }
  50% {
    box-shadow:
      0 0 42px 12px rgba(255, 255, 255, 1),
      0 0 110px 40px rgba(255, 255, 255, 0.7),
      0 0 180px 70px rgba(255, 255, 255, 0.35);
  }
}

.bio-instruction {
  margin-top: 6px;
  color: #d6d9e3;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.bio-words {
  font-size: 40px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--gold, #e9c46a);
  text-transform: lowercase;
  min-height: 52px;
}

.bio-countdown {
  font-size: 72px;
  font-weight: 700;
  color: #ffffff;
  min-height: 90px;
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.6);
}

.bio-spinner {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, 0.12);
  border-top-color: #e9c46a;
  animation: bioSpin 0.9s linear infinite;
}

@keyframes bioSpin {
  to { transform: rotate(360deg); }
}

.bio-progress-label {
  font-size: 20px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.bio-progress-sub {
  font-size: 14px;
  color: #a5a9b8;
  max-width: 400px;
}

.bio-progress-track {
  width: min(420px, 84vw);
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bio-progress-bar {
  height: 100%;
  width: 12%;
  border-radius: 999px;
  background: linear-gradient(90deg, #e9c46a, #f4a261);
  transition: width 3.6s ease;
}

.bio-result-icon {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  color: #0b0d14;
  font-weight: 700;
}

.bio-result-icon-ok {
  background: #3ddc84;
  box-shadow: 0 0 30px 8px rgba(61, 220, 132, 0.4);
}
.bio-result-icon-ok::after { content: "✓"; }

.bio-result-icon-fail {
  background: #e5484d;
  box-shadow: 0 0 30px 8px rgba(229, 72, 77, 0.4);
}
.bio-result-icon-fail::after { content: "✕"; }

.bio-result-title {
  font-size: 26px;
  font-weight: 600;
  color: #ffffff;
  margin: 8px 0 0;
}

.bio-result-msg {
  color: #c1c5d3;
  max-width: 420px;
  font-size: 15px;
  line-height: 1.5;
}

.bio-result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

.bio-result-actions .secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.bio-result-actions .hidden { display: none; }

/* ===================================================================
   Responsive — split layout
   =================================================================== */

@media (max-width: 960px) {
  .split {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .side {
    border-left: 0;
    border-top: 1px solid var(--border);
    max-height: 45vh;
  }
}

/* ===================================================================
   DistrictSeal — soft layout overrides
   ===================================================================
   Everything below is an intentional override of the base above.
   The base remains for reference; the overrides are what ship.
   =================================================================== */

/* -------------------------------------------------------------------
   Modal — vertical stack with breathing room
   ------------------------------------------------------------------- */

.bio-modal {
  padding: 40px 24px;
}

.bio-modal-inner {
  width: min(960px, 96vw);
  min-height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.bio-stage {
  width: 100%;
  max-width: 640px;
  min-height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

/* -------------------------------------------------------------------
   Instruction banner — wide single line, sits above the frame
   ------------------------------------------------------------------- */

.bio-banner {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  max-width: 640px;
  min-height: 56px;
  padding: 16px 24px;
  margin: 0;

  background: linear-gradient(
    180deg,
    rgba(233, 196, 106, 0.10),
    rgba(233, 196, 106, 0.04)
  );
  border: 1px solid rgba(233, 196, 106, 0.28);
  border-radius: 14px;

  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 8px 24px rgba(0, 0, 0, 0.35);
}

.bio-banner-text,
.bio-banner span {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f1d894;
  white-space: nowrap;
  text-align: center;
}

.bio-banner.hidden { display: none; }

/* -------------------------------------------------------------------
   Camera frame — moderate size, softer glow
   ------------------------------------------------------------------- */

.bio-ring {
  width: min(52vh, 52vw);
  height: min(52vh, 52vw);
  max-width: 520px;
  max-height: 520px;
  border-radius: 20px;
  border: 10px solid #ffffff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.15) inset,
    0 0 24px 4px rgba(255, 255, 255, 0.30),
    0 0 60px 20px rgba(255, 255, 255, 0.12),
    0 20px 60px rgba(0, 0, 0, 0.55);
  animation: none;
  margin: 0 auto;
  overflow: hidden;
}

.bio-ring video {
  border-radius: 10px;
}

/* -------------------------------------------------------------------
   Oval face guide — thin, subtle
   ------------------------------------------------------------------- */

.bio-oval-guide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.42);
  z-index: 2;
}

.bio-oval-guide ellipse {
  stroke-width: 0.5;
  stroke-dasharray: 2 3;
}

/* -------------------------------------------------------------------
   Progress ring — thin gold arc, rotates from top
   ------------------------------------------------------------------- */

.bio-progress-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  color: #e9c46a;
  z-index: 3;
  transform: rotate(-90deg);
  opacity: 0.9;
}

.bio-progress-ring ellipse {
  stroke-width: 0.9;
  stroke-linecap: round;
}

#bio-progress-arc {
  transition: stroke-dasharray 0.20s ease-out;
}

/* -------------------------------------------------------------------
   Directional arrow — smaller, softer
   ------------------------------------------------------------------- */

.bio-direction-arrow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  pointer-events: none;
  color: #ffffff;
  opacity: 0.85;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.55));
}

.bio-direction-arrow svg {
  width: 48px;
  height: 48px;
}

.bio-direction-arrow.hidden { display: none; }

.bio-direction-arrow.arrow-left {
  left: 8%;
  animation: arrowNudgeLeft 1.4s ease-in-out infinite;
}

.bio-direction-arrow.arrow-right {
  left: 92%;
  animation: arrowNudgeRight 1.4s ease-in-out infinite;
}

.bio-direction-arrow.arrow-right svg {
  transform: scaleX(-1);
}

@keyframes arrowNudgeLeft {
  0%, 100% { transform: translate(-50%, -50%) translateX(0);     opacity: 0.65; }
  50%      { transform: translate(-50%, -50%) translateX(-10px); opacity: 1;    }
}

@keyframes arrowNudgeRight {
  0%, 100% { transform: translate(-50%, -50%) translateX(0);     opacity: 0.65; }
  50%      { transform: translate(-50%, -50%) translateX(10px);  opacity: 1;    }
}

/* -------------------------------------------------------------------
   Challenge-words card
   ------------------------------------------------------------------- */

.bio-words {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.20em;
  color: #f1d894;
  text-transform: lowercase;

  background: rgba(233, 196, 106, 0.05);
  border: 1px solid rgba(233, 196, 106, 0.22);
  border-radius: 14px;
  padding: 16px 32px;
  min-height: 60px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  position: relative;
  margin: 4px 0 0 0;
}

.bio-words::before {
  content: "READ ALOUD";
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: #e9c46a;
  background: #0b0d14;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(233, 196, 106, 0.22);
}

/* -------------------------------------------------------------------
   Instruction text below the frame
   ------------------------------------------------------------------- */

.bio-instruction {
  margin: 0;
  color: #c9cfdb;
  font-size: 14px;
  letter-spacing: 0.02em;
  line-height: 1.6;
  max-width: 520px;
}

/* -------------------------------------------------------------------
   Countdown — big, soft glow
   ------------------------------------------------------------------- */

.bio-countdown {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 84px;
  font-weight: 300;
  color: #ffffff;
  min-height: 96px;
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow:
    0 0 30px rgba(255, 255, 255, 0.55),
    0 0 60px rgba(255, 255, 255, 0.25);
}

@media (max-height: 820px) {
  .bio-ring {
    width: min(48vh, 48vw);
    height: min(48vh, 48vw);
  }
  .bio-countdown {
    font-size: 64px;
    min-height: 76px;
  }
}

@media (max-width: 720px) {
  .bio-modal-inner {
    gap: 18px;
  }
  .bio-banner-text,
  .bio-banner span {
    font-size: 14px;
    letter-spacing: 0.12em;
    white-space: normal;
  }
  .bio-ring {
    width: min(56vh, 88vw);
    height: min(56vh, 88vw);
  }
  .bio-words {
    font-size: 20px;
    letter-spacing: 0.14em;
    padding: 12px 24px;
  }
}

/* -------------------------------------------------------------------
   Branded masthead on the side panel
   ------------------------------------------------------------------- */

.side h1:first-of-type {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  color: var(--muted);
}

.side h1:first-of-type::before {
  content: "DISTRICTSEAL";
  font-size: 18px;
  letter-spacing: 0.06em;
  color: var(--gold);
  font-weight: 700;
  text-transform: none;
}

/* -------------------------------------------------------------------
   Paper-like PDF pages
   ------------------------------------------------------------------- */

.pdf-page-wrapper {
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.10),
    0 18px 40px rgba(0, 0, 0, 0.10);
}

/* -------------------------------------------------------------------
   Slim progress strip on the PDF pane
   ------------------------------------------------------------------- */

.pdf-pane {
  position: relative;
  padding-top: 40px;
}

.pdf-pane::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.05);
  z-index: 1;
  pointer-events: none;
}

.pdf-pane::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--gold);
  transition: width 0.15s ease-out;
  z-index: 2;
  pointer-events: none;
}

/* -------------------------------------------------------------------
   Refined consent block
   ------------------------------------------------------------------- */

#consent-box .check {
  margin-top: 16px;
  padding: 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-top: 2px solid rgba(233, 196, 106, 0.4);
  border-radius: 10px;
  position: relative;
}

#consent-box .check::before {
  content: "AUTHORIZATION";
  position: absolute;
  top: -9px;
  left: 14px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--gold, #e9c46a);
  background: var(--panel);
  padding: 2px 8px;
  border-radius: 4px;
}

#highlights {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

/* -------------------------------------------------------------------
   Softer verified / failed glow
   ------------------------------------------------------------------- */

.bio-result-icon-ok {
  box-shadow:
    0 0 24px 6px rgba(61, 220, 132, 0.28),
    0 0 0 6px rgba(61, 220, 132, 0.10);
}

.bio-result-icon-fail {
  box-shadow:
    0 0 24px 6px rgba(229, 72, 77, 0.28),
    0 0 0 6px rgba(229, 72, 77, 0.10);
}

/* -------------------------------------------------------------------
   Serif headline on the gate and result screens
   ------------------------------------------------------------------- */

.gate .card h2 {
  font-family: Georgia, "Times New Roman", "Iowan Old Style", serif;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

#done h2 {
  font-family: Georgia, "Times New Roman", "Iowan Old Style", serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.bio-result-title {
  font-family: Georgia, "Times New Roman", "Iowan Old Style", serif;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* ===================================================================
   Focus-lost overlay
   =================================================================== */

.focus-lost {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;

  background: rgba(5, 8, 15, 0.96);
  backdrop-filter: blur(8px);
}

.focus-lost.hidden { display: none; }

.focus-lost-card {
  max-width: 480px;
  padding: 32px 36px;
  text-align: center;

  background: #121723;
  border: 1px solid rgba(233, 196, 106, 0.35);
  border-radius: 18px;

  box-shadow:
    0 0 0 1px rgba(233, 196, 106, 0.10) inset,
    0 30px 80px rgba(0, 0, 0, 0.6);
}

.focus-lost-card h2 {
  font-family: Georgia, "Times New Roman", "Iowan Old Style", serif;
  font-size: 24px;
  font-weight: 500;
  color: #f1d894;
  margin: 0 0 14px 0;
  letter-spacing: -0.01em;
}

.focus-lost-card p {
  color: #c9cfdb;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 12px 0;
}

.focus-lost-hint {
  color: #8b93a7 !important;
  font-size: 13px !important;
  margin-top: 18px !important;
  font-style: italic;
}