/* ---------- Fuentes (auto-hospedadas: no dependen del WiFi del evento) ---------- */
@font-face {
  font-family: "Quicksand";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/quicksand-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Quicksand";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/quicksand-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Quicksand";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/quicksand-latin-700-normal.woff2") format("woff2");
}

/* ---------- Tokens del diseño ---------- */
:root {
  --bg: #111111;
  --text: #ffffff;
  --label: #e9ebf0;
  --input-bg: #f7f7f7;
  --input-text: #1f1f1f;
  --placeholder: #4a4a4a;
  --primary: #1473e6;
  --primary-hover: #0f63c9;
  --error: #ff7a7a;
  --radius-input: 6px;
  --radius-btn: 10px;
  --gutter: 22px;
  --max-w: 420px;
  color-scheme: dark;
}

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

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Quicksand", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background-color: var(--bg);
  /* Fondo del diseño atenuado para que coincida con la pantalla de referencia */
  background-image:
    linear-gradient(180deg,
      rgba(17, 17, 17, .45) 0%,
      rgba(17, 17, 17, .72) 30%,
      rgba(17, 17, 17, .92) 55%,
      var(--bg) 75%),
    url("../img/fondo.jpg");
  background-repeat: no-repeat;
  background-position: top center;
  background-size: cover;
  -webkit-font-smoothing: antialiased;
}

/* En pantallas grandes el fondo se queda fijo y cubre toda la ventana */
@media (min-width: 768px) {
  body { background-attachment: fixed; }
}

.page {
  width: 100%;
  max-width: calc(var(--max-w) + var(--gutter) * 2);
  margin: 0 auto;
  padding:
    clamp(72px, 18vh, 171px)
    calc(var(--gutter) + env(safe-area-inset-right))
    calc(48px + env(safe-area-inset-bottom))
    calc(var(--gutter) + env(safe-area-inset-left));
}

@media (min-height: 900px) and (min-width: 768px) {
  .page { padding-top: 14vh; }
}

/* ---------- Logo ---------- */
.brand {
  margin: 0 0 44px;
  text-align: center;
  line-height: 0;
}
.brand img {
  width: 238px;
  max-width: 70%;
  height: auto;
}

/* ---------- Formulario ---------- */
.form { margin: 0; }

.field {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.label {
  display: block;
  margin: 0 0 10px 9px;
  padding: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--label);
}

.input {
  display: block;
  width: 100%;
  height: 46px;
  padding: 0 15px;
  border: 2px solid transparent;
  border-radius: var(--radius-input);
  background: var(--input-bg);
  color: var(--input-text);
  font: 500 16px/1 "Quicksand", system-ui, sans-serif; /* 16px evita el zoom automático en iOS */
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--placeholder); opacity: 1; }
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 115, 230, .35);
}
.input[aria-invalid="true"] {
  border-color: var(--error);
}
.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(255, 122, 122, .3);
}

/* Separación entre correo y teléfono (comparten etiqueta) */
.group .error + .sr-only + .input { margin-top: 14px; }
.group .error:not(:empty) + .sr-only + .input { margin-top: 10px; }

.error {
  margin: 6px 0 0 9px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--error);
}
.error:empty { display: none; }

.form-error {
  margin: 20px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius-input);
  background: rgba(255, 122, 122, .12);
  color: var(--error);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}
.form-error:empty { display: none; }

/* ---------- Botón ---------- */
.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  height: 47px;
  margin-top: 37px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--primary);
  color: #fff;
  font: 700 20px/1 "Quicksand", system-ui, sans-serif;
  cursor: pointer;
  transition: background-color .15s ease, transform .08s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: scale(.985); }
.btn:focus-visible {
  outline: 3px solid rgba(255, 255, 255, .85);
  outline-offset: 3px;
}
.btn-icon { width: 20px; height: 20px; flex: none; }

.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"] .btn-text,
.btn[aria-busy="true"] .btn-icon { visibility: hidden; }
.spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin .7s linear infinite;
}
.btn[aria-busy="true"] .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-secondary {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, .7);
  font-size: 17px;
}
.btn-secondary:hover { background: rgba(255, 255, 255, .08); }

/* ---------- Pantalla de gracias ---------- */
.thanks {
  text-align: center;
  padding-top: 8px;
  outline: none;
}
.thanks-icon {
  width: 72px;
  height: 72px;
  color: var(--primary);
  margin-bottom: 18px;
}
.thanks-title {
  margin: 0 0 10px;
  font-size: 26px;
  font-weight: 700;
}
.thanks-text {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--label);
  line-height: 1.45;
}
.thanks .btn { margin-top: 40px; }

/* ---------- Utilidades ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 1.5s !important; }
}
