/* Authentech — sistema base (v2)
   Paleta tomada del logo: azul real metálico sobre blanco y lavanda.
   Tipografía: Clash Display (titulares y cifras) + Satoshi (interfaz) + Geist Mono (seriales). */

:root {
  --royal: #0b2bfa;
  --royal-hi: #4a68ff;
  --royal-deep: #001c8c;
  --night: #050a3a;
  --night-2: #0a1470;
  --ink: #0a0f2e;
  --ink-2: #454c70;
  --ink-3: #7a82a6;
  --bg: #f5f6fc;
  --sheet: #ffffff;
  --tint: #eaedff;
  --tint-2: #dbe0ff;
  --peri: #c1cbff;
  --line: #e3e6f3;
  --line-strong: #cbd0e4;
  --stamp: #d9362b;
  --ok: #0a9468;
  --warn: #a96a0c;

  --metal: linear-gradient(100deg, #001c8c 0%, #0b2bfa 38%, #4a68ff 50%, #0b2bfa 62%, #001c8c 100%);
  --foil: linear-gradient(120deg, #a7f0ff 0%, #ffd3f2 34%, #fff4a6 66%, #b9ffd8 100%);
  --sh-1: 0 1px 2px rgba(10, 18, 90, .05), 0 12px 28px -16px rgba(10, 18, 90, .25);
  --sh-2: 0 2px 6px rgba(10, 18, 90, .06), 0 30px 60px -24px rgba(11, 43, 250, .42);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
  --r-card: 24px; --r-ctl: 14px; --r-pill: 999px;

  --font: "Satoshi", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Clash Display", "Satoshi", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --header-h: 72px;
  color-scheme: light;
}

/* La transición entre páginas (@view-transition) va en un <style> del <head> de cada página, no aquí:
   Chromium decide si la hay al llegar al <body> y, si esta hoja todavía no cargó, la cancela con un error. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 72px); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); overflow-x: clip;
  font: 500 16px/1.55 var(--font);
  background:
    radial-gradient(1100px 620px at 100% -6%, var(--tint-2) 0%, rgba(219, 224, 255, 0) 62%),
    radial-gradient(900px 640px at -12% 18%, #eef0ff 0%, rgba(238, 240, 255, 0) 58%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, video, svg { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--royal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 3px solid var(--royal); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
::selection { background: var(--royal); color: #fff; }

/* ---- Tipografía ---- */
.display { font-family: var(--display); font-weight: 600; letter-spacing: -0.02em; word-spacing: 0.08em; line-height: 1.02; }
.h2 { font-family: var(--display); font-weight: 600; letter-spacing: -0.016em; word-spacing: 0.06em; line-height: 1.06; font-size: clamp(30px, 3.6vw, 44px); }
.h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; word-spacing: 0.07em; font-size: 21px; line-height: 1.2; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; }

/* ---- Botones ---- */
.btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 50px; padding: 0 26px; border-radius: var(--r-ctl); border: 0;
  font-weight: 700; font-size: 15.5px; letter-spacing: -0.005em; cursor: pointer; white-space: nowrap; text-decoration: none;
  color: #fff; background: var(--metal);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 -1px 0 rgba(0, 0, 50, .3), 0 12px 24px -12px rgba(11, 43, 250, .7);
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn::after { /* destello metálico al pasar el cursor */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, .5) 50%, transparent 68%);
  transform: translateX(-130%); transition: transform .75s cubic-bezier(.2, .7, .2, 1);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 -1px 0 rgba(0, 0, 50, .3), 0 18px 32px -14px rgba(11, 43, 250, .8); }
.btn:hover::after { transform: translateX(130%); }
.btn:active { transform: translateY(0); }
.btn--ghost { background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong), var(--sh-1); }
.btn--ghost:hover { box-shadow: inset 0 0 0 1px var(--royal), var(--sh-1); }
.btn--ghost::after, .btn--light::after { background: linear-gradient(105deg, transparent 32%, rgba(11, 43, 250, .12) 50%, transparent 68%); }
.btn--light { background: #fff; color: var(--royal-deep); box-shadow: 0 14px 30px -14px rgba(0, 0, 40, .7); }
.btn--light:hover { box-shadow: 0 20px 36px -14px rgba(0, 0, 40, .8); }
.btn--sm { min-height: 42px; padding: 0 18px; font-size: 14.5px; border-radius: 12px; }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"], .btn[disabled]:hover, .btn[aria-disabled="true"]:hover { cursor: not-allowed; background: var(--tint); color: var(--ink-3); box-shadow: none; transform: none; }
.btn[disabled]::after, .btn[aria-disabled="true"]::after { display: none; }
.btn .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Campos ---- */
.field { display: grid; gap: 7px; }
.field > label { font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.input {
  width: 100%; min-height: 54px; padding: 0 var(--s4); background: var(--sheet);
  border: 1px solid var(--line-strong); border-radius: var(--r-ctl); font-size: 16px; font-weight: 500;
  box-shadow: 0 1px 2px rgba(10, 18, 90, .04);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--ink-3); opacity: .75; font-weight: 400; }
.input:hover { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--royal); box-shadow: 0 0 0 4px rgba(11, 43, 250, .14); }
.input[aria-invalid="true"] { border-color: var(--stamp); }
select.input { appearance: none; padding-right: 44px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237a82a6' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }
/* Teléfono: el prefijo del país pegado al número */
.tel { display: grid; grid-template-columns: auto minmax(0, 1fr); }
.tel__pre { display: grid; place-items: center; min-width: 62px; padding: 0 12px; background: var(--tint); border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--r-ctl) 0 0 var(--r-ctl); font-family: var(--mono); font-size: 14.5px; font-weight: 500; color: var(--ink-2); }
.tel .input { border-radius: 0 var(--r-ctl) var(--r-ctl) 0; }
.field__note { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.form-error { padding: 12px 14px; border-radius: var(--r-ctl); background: #fdecea; border: 1px solid #f3b9b3; color: #8c1d14; font-size: 14.5px; }
.form-note { padding: 12px 14px; border-radius: var(--r-ctl); background: var(--tint); border: 1px solid var(--tint-2); color: var(--ink); font-size: 14.5px; }

/* ---- Marca ---- */
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand__logo { width: 40px; height: 40px; flex: none; border-radius: 12px; box-shadow: 0 0 0 1px rgba(11, 43, 250, .1), 0 8px 16px -8px rgba(11, 43, 250, .55); }
.brand__word { font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: -0.015em; line-height: 1; }
.brand--light { color: #fff; }

/* Superficie de vidrio (sobre zonas oscuras) */
.glass {
  background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .24); border-radius: 20px;
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 24px 50px -24px rgba(0, 0, 40, .7), inset 0 1px 0 rgba(255, 255, 255, .25);
}

/* ---- Preloader (solo la primera vez por sesión) ---- */
#pre {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 30% 18%, #ffffff 0%, #eef0ff 46%, var(--peri) 100%);
  clip-path: inset(0 0 0 0); transition: clip-path .8s cubic-bezier(.76, 0, .24, 1);
}
#pre.is-out { clip-path: inset(0 0 100% 0); }
.pre__box { display: grid; justify-items: center; gap: 26px; }
.pre__mark { position: relative; width: 148px; aspect-ratio: 500 / 480; filter: drop-shadow(0 22px 26px rgba(0, 28, 140, .35)); }
.pre__mark img { width: 100%; height: 100%; clip-path: inset(0 100% 0 0); animation: preWipe .8s .1s cubic-bezier(.65, 0, .2, 1) forwards; }
.pre__mark i { /* destello que recorre la A */
  position: absolute; inset: 0; background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .85) 50%, transparent 62%);
  background-size: 260% 100%; background-position: 130% 0;
  -webkit-mask: url("/brand/mark.png") center / contain no-repeat; mask: url("/brand/mark.png") center / contain no-repeat;
  animation: preGlint 1s .8s ease-out forwards;
}
.pre__word { font-family: var(--display); font-weight: 600; font-size: 32px; letter-spacing: -0.015em; color: var(--ink); display: flex; overflow: hidden; padding-bottom: 4px; }
.pre__word span { display: inline-block; transform: translateY(115%); animation: preRise .55s cubic-bezier(.2, .8, .2, 1) forwards; }
.pre__bar { width: 176px; height: 3px; background: rgba(11, 43, 250, .16); border-radius: 3px; overflow: hidden; }
.pre__bar i { display: block; height: 100%; background: var(--metal); transform: scaleX(0); transform-origin: left; animation: preFill 1.55s .1s cubic-bezier(.5, 0, .2, 1) forwards; }
@keyframes preWipe { to { clip-path: inset(0 0 0 0); } }
@keyframes preGlint { to { background-position: -130% 0; } }
@keyframes preRise { to { transform: none; } }
@keyframes preFill { to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  #pre { transition: none; }
  .pre__mark img { animation: none; clip-path: none; }
  .pre__mark i { animation: none; opacity: 0; }
  .pre__word span { animation: none; transform: none; }
  .pre__bar i { animation: none; transform: none; }
}

/* ---- Avisos (toasts) ---- */
/* No reciben clics: un aviso dura unos segundos y no debe tapar el botón que tenga debajo. */
.toasts { position: fixed; z-index: 900; right: var(--s4); bottom: var(--s4); display: grid; gap: var(--s2); max-width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toasts[popover] { inset: auto var(--s4) var(--s4) auto; margin: 0; border: 0; padding: 0; background: transparent; overflow: visible; }
/* Con la barra inferior del móvil, los avisos van por encima de ella. */
@media (max-width: 899px) {
  body:has(> .tabbar) .toasts, body:has(> .tabbar) .toasts[popover] { bottom: calc(92px + env(safe-area-inset-bottom)); }
}
.toast { background: var(--ink); color: #fff; padding: 13px 18px; border-radius: var(--r-ctl); font-size: 14.5px; font-weight: 500; box-shadow: 0 16px 40px -12px rgba(10, 15, 46, .5); animation: toastIn .25s ease-out; }
.toast--err { background: #8c1d14; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---- Diálogo ---- */
dialog.dlg { border: 0; padding: 0; border-radius: 26px; width: min(480px, calc(100vw - 32px)); background: var(--sheet); color: var(--ink); box-shadow: 0 40px 100px -20px rgba(5, 10, 58, .55); }
dialog.dlg::backdrop { background: rgba(5, 10, 58, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog.dlg[open] { animation: dlgIn .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.dlg__body { padding: var(--s6); display: grid; gap: var(--s4); }
.dlg__actions { display: flex; gap: var(--s3); justify-content: flex-end; flex-wrap: wrap; margin-top: var(--s2); }

/* ---- Esqueleto de carga ---- */
.skel { background: linear-gradient(90deg, #e9ecf8 25%, #f6f7fd 50%, #e9ecf8 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: var(--r-card); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Entrada escalonada de elementos (una sola vez, al cargar) */
.rise { opacity: 0; transform: translateY(18px); animation: riseIn .7s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes riseIn { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  html { scroll-behavior: auto; }
  .rise { animation: none; opacity: 1; transform: none; }
  .btn, .btn::after { transition: none; }
  dialog.dlg[open] { animation: none; }
  .toast { animation: none; }
}

/* Clash Display trae los espacios entre palabras muy cerrados: se abren un poco en todos sus usos. */
.brand__word, .stage__title, .slide__title, .cert__name, .story__steps li h3, .menu__who b, .pre__word { word-spacing: 0.07em; }
