/**
 * shell.css — persistent header, progress spine, bottom sheets.
 * Author: Frankie (frontend-coder)
 */

/* ── RESET + BASE ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  background: var(--surface-dark);
  color: var(--color-white);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Mobile-first app. On a phone it fills the screen. On a WIDE (desktop) viewport
   we box the whole experience into a centered phone-width frame so it renders as
   intended instead of stretching full-width. Mobile (<600px) is unaffected. */
@media (min-width: 600px) {
  html { background: #05070a; }
  body {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    min-height: 100dvh;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 30px 80px rgba(0,0,0,0.5);
  }
  /* Align the fixed shell header to the centered phone frame. Uses #id so it
     beats the base `.shell-header { left:0; right:0 }` (defined LATER in the file
     and would otherwise win by source order). 250px = half of the 500px frame. */
  #shellHeader {
    left: calc(50vw - 250px);
    right: auto;
    width: 500px;
  }
}

/* ── SHELL HEADER ─────────────────────────────────────────────────────── */
.shell-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-shell);
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  /* Glassmorphic dark base — transitions to light via .shell-header--light */
  background: rgba(11, 14, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}

.shell-header--light {
  background: rgba(247, 248, 250, 0.95);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

/* ── LOGO ─────────────────────────────────────────────────────────────── */
.shell-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Dual-logo strategy:
   Dark screens (capture/liveness): ID-Verify lockup visible (white), 11 Hype hidden.
   Light screens (.shell-logo--dark): 11 Hype lockup visible + inverted to black,
   ID-Verify hidden. Both are in the DOM; visibility toggled by CSS only. */
.logo-mark {
  display: block;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.logo-mark img {
  display: block;
  height: 36px;
  width: auto;
}

/* Default (dark): show ID-Verify logo, hide 11 Hype */
.logo-mark--id-verify   { opacity: 1; }
.logo-mark--eleven-hype { opacity: 0; pointer-events: none; position: absolute; }

/* Light screens (.shell-logo--dark): swap logos */
.shell-logo--dark .logo-mark--id-verify   { opacity: 0; pointer-events: none; position: absolute; }
.shell-logo--dark .logo-mark--eleven-hype {
  opacity: 1;
  pointer-events: auto;
  position: static;
  filter: invert(1);  /* white asset → inverted to black on light header */
}

/* ── PROGRESS SPINE ───────────────────────────────────────────────────── */
.progress-spine {
  flex: 1;
  display: flex;
  justify-content: center;
}

.spine-track {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.spine-step {
  display: flex;
  align-items: center;
}

.step-pip {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.18);
  transition: background var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              width var(--dur-fast) var(--ease-out);
}

/* Done state */
.spine-step--done .step-pip {
  background: rgba(255,255,255,0.55);
}

/* Current state — subtle neutral pulse, never gold/emerald */
.spine-step--current .step-pip {
  width: 20px;
  background: rgba(255,255,255,0.75);
  animation: pip-pulse 2s ease-in-out infinite;
}

@keyframes pip-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .spine-step--current .step-pip { animation: none; }
}

/* On light-surface screens the pips go dark */
.shell-header--light .step-pip          { background: rgba(0,0,0,0.18); }
.shell-header--light .spine-step--done .step-pip { background: rgba(0,0,0,0.40); }
.shell-header--light .spine-step--current .step-pip { background: rgba(0,0,0,0.70); }

/* ── FINISH LATER ─────────────────────────────────────────────────────── */
.finish-later {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.60);
  padding: 8px 0 8px 8px;
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  text-align: right;
  transition: color var(--dur-fast) var(--ease-out);
}

.finish-later:hover { color: rgba(255,255,255,0.90); }
.finish-later:focus-visible {
  outline: 2px solid var(--color-cta);
  outline-offset: 2px;
  border-radius: 4px;
  color: var(--color-white);
}

.shell-header--light .finish-later       { color: rgba(0,0,0,0.45); }
.shell-header--light .finish-later:hover { color: rgba(0,0,0,0.80); }

/* ── SCREEN VIEWPORT ──────────────────────────────────────────────────── */
.screen-viewport {
  flex: 1;
  position: relative;
  /* header is 56px fixed; push content below it */
  padding-top: calc(56px + env(safe-area-inset-top));
  overflow: hidden;
}

/* Screen panels — the cross-fade target */
.screen-panel {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  /* reduced-motion: no transforms, just opacity */
  transition: opacity var(--dur-screen) var(--ease-out);
  pointer-events: none;
}

.screen-panel.screen--visible {
  opacity: 1;
  pointer-events: auto;
  /* Stay absolute inset:0 (from the base rule) so the panel — and the light
     screen inside it — FILL the viewport (no dark void below the content).
     overflow-y:auto still lets tall content scroll. */
}

/* Outgoing panel stays absolutely positioned during fade */
.screen-panel.screen--leaving {
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

/* ── SHARED BUTTON PRIMITIVES ─────────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--touch-min);
  padding: 14px 24px;
  background: var(--color-cta);
  color: var(--color-black);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover { background: var(--color-cta-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:focus-visible {
  outline: 3px solid var(--color-cta);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(201, 148, 0, 0.22);
}

.btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--touch-min);
  padding: 12px 24px;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-gray-light);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}

.btn-ghost:hover { color: var(--color-white); }
.btn-ghost:focus-visible {
  outline: 2px solid var(--color-cta);
  outline-offset: 2px;
}

.btn-text-link {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-gray);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px 0;
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  transition: color var(--dur-fast) var(--ease-out);
}

.btn-text-link:hover { color: var(--color-gray-light); }
.btn-text-link:focus-visible {
  outline: 2px solid var(--color-cta);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── BOTTOM SHEET ─────────────────────────────────────────────────────── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  background: rgba(0,0,0,0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.sheet-backdrop.sheet--open {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 20px 24px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(100%);
  transition: transform var(--dur-screen) var(--ease-out);
  max-width: 600px;
  margin: 0 auto;
}

.sheet-backdrop.sheet--open .bottom-sheet {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .bottom-sheet { transition: none; }
  .sheet-backdrop { transition: none; }
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: rgba(0,0,0,0.18);
  border-radius: var(--radius-pill);
  margin: 0 auto 8px;
  flex-shrink: 0;
}

.sheet-heading {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-black);
  text-align: center;
}

.sheet-body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-gray);
  text-align: center;
  line-height: 1.6;
}

/* Ghost button dark variant inside light sheet */
.bottom-sheet .btn-ghost {
  color: var(--color-gray);
}
.bottom-sheet .btn-ghost:hover { color: var(--color-black); }

/* Tips list in "Having trouble" sheet */
.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0;
}

.tips-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: var(--color-gray);
  line-height: 1.5;
}

.tips-list li svg {
  flex-shrink: 0;
  color: var(--color-gray-light);
  margin-top: 1px;
}
