/* Passport (Face Pass) pages, in Bienvi's "Warm hospitality" design (copied from OneHuman's
   web/static/ui.css, itself from Veille and Benvi/src/styles.css): warm paper by day, logo
   navy for camera steps, the logo gradient only for brand moments. */

@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --radius: 16px;
  --background: #f6f1ea;
  --foreground: #1a1533;
  --card: #fffdf9;
  --secondary: #ece5d9;
  --muted: #efe8dd;
  --muted-foreground: #655e72;
  --accent: #c2410c;
  --success: #1f7a4d;
  --success-text: #1a6b43;
  --destructive: #b42318;
  --primary: #120a33;
  --primary-foreground: #fffdf9;
  --ink: #120a33;
  --border: rgb(26 21 51 / 0.12);
  --input: rgb(26 21 51 / 0.2);
  --ring: rgb(18 10 51 / 0.4);
  --tint: rgb(26 21 51 / 0.05);
  --elev-soft: 0 1px 2px rgb(26 21 51 / 0.05), 0 8px 24px rgb(26 21 51 / 0.06);
  --elev-lift: 0 2px 4px rgb(26 21 51 / 0.06), 0 18px 48px rgb(26 21 51 / 0.12);
  --glass-bg: var(--card);
  --glass-border: var(--border);
  --glass-blur: none;
  --selection: rgb(194 65 12 / 0.18);
  --page-texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.08 0 0 0 0 0.2 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --brand-gradient: linear-gradient(115deg, #531cfb, #9c29ed 30%, #fc25b5 62%, #fc9220);
  --brand-button: linear-gradient(115deg, #5a1ee0, #b21fc6 40%, #d6187f 70%, #d9541a);
  --brand-button-foreground: #fffdf9;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
}

/* Night: the lock screen, the veil, and anyone who picks Night. */
.theme-night {
  color-scheme: dark;
  --background: #100a2e;
  --foreground: #f6f1ea;
  --card: #1a1440;
  --secondary: #261f52;
  --muted: #221b4a;
  --muted-foreground: #b6aecb;
  --accent: #ffb86b;
  --success: oklch(0.83 0.17 158);
  --success-text: oklch(0.82 0.13 155);
  --destructive: oklch(0.72 0.19 22);
  --primary: #f6f1ea;
  --primary-foreground: #120a33;
  --ink: #0a0620;
  --border: rgb(246 241 234 / 0.12);
  --input: rgb(246 241 234 / 0.16);
  --ring: oklch(0.75 0.18 295);
  --tint: rgb(255 255 255 / 0.06);
  --elev-soft: 0 1px 0 oklch(1 0 0 / 0.05) inset, 0 10px 30px oklch(0 0 0 / 0.35);
  --elev-lift: 0 1px 0 oklch(1 0 0 / 0.08) inset, 0 24px 60px oklch(0 0 0 / 0.5);
  --glass-bg: rgb(255 255 255 / 0.055);
  --glass-border: rgb(255 255 255 / 0.1);
  --glass-blur: blur(22px) saturate(160%);
  --selection: oklch(0.7 0.2 295 / 0.45);
  --page-texture: none;
}

* {
  box-sizing: border-box;
  border-color: var(--border);
}

html,
body {
  margin: 0;
  background-color: var(--background);
  background-image: var(--page-texture);
  color: var(--foreground);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--selection);
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 60;
  margin: 0;
}

h1 {
  font-size: 42px;
  line-height: 1.06;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

h3 {
  font-size: 18px;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

.muted {
  color: var(--muted-foreground);
}

.text-gradient {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  font: 600 12px/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

/* ── mark ─────────────────────────────────────────────────────────────── */

.mark {
  width: 44px;
  height: 44px;
  display: block;
  flex: none;
}

.mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── surfaces ─────────────────────────────────────────────────────────── */

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--elev-soft);
  padding: 22px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 12px/1 var(--sans);
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--muted-foreground);
}

.chip.ok {
  color: var(--success-text);
  background: color-mix(in oklab, var(--success) 14%, transparent);
}

/* ── controls ─────────────────────────────────────────────────────────── */

button,
.button {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 20px;
  background: var(--primary);
  color: var(--primary-foreground);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease;
}

button:hover:not(:disabled),
.button:hover {
  box-shadow: var(--elev-soft);
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

/* Primary brand call-to-action: the logo gradient, deepened for white text. */
button.brand,
.button.brand {
  background: var(--brand-button);
  color: var(--brand-button-foreground);
}

button.xl,
.button.xl {
  padding: 15px 26px;
  font-size: 16px;
}

button.secondary,
.button.secondary {
  background: transparent;
  color: var(--foreground);
  border-color: var(--input);
}

button.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted-foreground);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  box-shadow: none;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

input,
select {
  font: inherit;
  color: var(--foreground);
  background: var(--card);
  border: 1px solid var(--input);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-foreground);
}

/* Day / Night / Auto (Bienvi's ThemeSwitch). */
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--tint);
  gap: 2px;
}

.seg button {
  background: transparent;
  color: var(--muted-foreground);
  padding: 6px 14px;
  font-size: 13px;
  box-shadow: none;
}

.seg button[aria-pressed="true"] {
  background: var(--card);
  color: var(--foreground);
  box-shadow: var(--elev-soft);
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--foreground);
  grid-auto-flow: column;
}

.switch input {
  appearance: none;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: var(--input);
  position: relative;
  padding: 0;
  border: 0;
  cursor: pointer;
  flex: none;
  transition: background 0.2s ease;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fffdf9;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform 0.2s ease;
}

.switch input:checked {
  background: var(--success);
}

.switch input:checked::after {
  transform: translateX(16px);
}

details.more > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--muted-foreground);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

details.more > summary::-webkit-details-marker {
  display: none;
}

details.more > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s ease;
}

details.more[open] > summary::after {
  transform: rotate(-135deg) translateY(-2px);
}

/* ── layout ───────────────────────────────────────────────────────────── */

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.stack {
  display: grid;
  gap: 12px;
}

.note {
  font-size: 13px;
  color: var(--muted-foreground);
}

.status {
  min-height: 1.5em;
  font-size: 14px;
}

.status:empty {
  min-height: 0;
}

.status.error {
  color: var(--destructive);
}

.status.ok {
  color: var(--success-text);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--input);
  display: inline-block;
  flex: none;
}

.dot.on {
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--success) 22%, transparent);
}

[hidden] {
  display: none !important;
}

/* ── face orb (Bienvi's IdentityOrb) ──────────────────────────────────── */

.orb {
  --size: 200px;
  position: relative;
  width: var(--size);
  height: var(--size);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  display: block;
  color: #fffdf9;
}

button.orb:hover:not(:disabled) {
  box-shadow: none;
}

button.orb:hover:not(:disabled) .orb-ring {
  transform: scale(1.02);
}

.orb-glow {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--brand-gradient);
  filter: blur(28px);
  opacity: 0.22;
  transition: opacity 0.7s ease;
  animation: mark-breathe 3.2s ease-in-out infinite;
}

.orb-ring {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  padding: 10px;
  background: var(--brand-gradient);
  box-shadow: var(--elev-lift);
  transition: transform 0.2s ease;
}

.orb-core {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #120a33;
}

.orb-core svg {
  grid-area: 1 / 1;
  width: 42%;
  height: 42%;
  stroke-width: 1.1;
  opacity: 0.88;
}

.orb .i-check,
.orb .i-alert {
  display: none;
}

.orb-scan {
  position: absolute;
  left: 22%;
  right: 22%;
  top: 50%;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 20px 3px rgb(252 37 181 / 0.8);
  opacity: 0;
}

.orb[data-state="scanning"] .orb-ring {
  animation: pulse-ring 2s ease-out infinite;
}

.orb[data-state="scanning"] .orb-scan {
  animation: scan 2.4s ease-in-out infinite;
}

.orb[data-state="ready"] .orb-glow {
  opacity: 0.45;
}

.orb[data-state="ready"] .i-face,
.orb[data-state="problem"] .i-face {
  display: none;
}

.orb[data-state="ready"] .i-check {
  display: block;
  width: 40%;
  height: 40%;
  padding: 7%;
  border-radius: 50%;
  background: #fffdf9;
  color: #120a33;
  stroke-width: 3;
  opacity: 1;
  animation: pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.orb[data-state="problem"] .orb-ring {
  filter: grayscale(0.4);
  opacity: 0.8;
}

.orb[data-state="problem"] .i-alert {
  display: block;
  width: 40%;
  height: 40%;
  padding: 8%;
  border-radius: 50%;
  background: #f0b44c;
  color: #2b1a00;
  stroke-width: 2;
  opacity: 1;
}

/* ── motion (from Bienvi) ─────────────────────────────────────────────── */

@keyframes scan {
  0% {
    transform: translateY(-46px);
    opacity: 0;
  }
  15%,
  85% {
    opacity: 1;
  }
  100% {
    transform: translateY(46px);
    opacity: 0;
  }
}

@keyframes mark-breathe {
  0%,
  100% {
    opacity: 0.18;
    transform: scale(0.9);
  }
  50% {
    opacity: 0.4;
    transform: scale(1.05);
  }
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 oklch(0.75 0.2 295 / 0.5);
  }
  70% {
    box-shadow: 0 0 0 26px oklch(0.75 0.2 295 / 0);
  }
  100% {
    box-shadow: 0 0 0 0 oklch(0.75 0.2 295 / 0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.86) translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.rise {
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
