/*
 * Noche de Sacerdotes — base visual compartida (formulario y panel).
 *
 * Paleta tomada del flyer (2.png) y del fondo (1.png): negros cálidos, cafés
 * de madera, bronce y dorado de la luz de las velas, marfil para el texto.
 * Tipografías del flyer: condensada pesada para títulos, serif editorial para
 * el resto. La construcción antepone la fuente original si sus archivos están
 * en recursos/fuentes/ (ver recursos/fuentes/LEEME.md).
 *
 * Mobile-first: los estilos sin media query son los del teléfono; las
 * pantallas grandes sólo añaden.
 */

/* Sin archivos de la fuente original: se usan Anton y Kurale (Google Fonts). */

:root {
  --negro: #0b0705;
  --negro-calido: #140e0a;
  --cafe: #22160f;
  --cafe-medio: #3a2618;
  --marron: #5c3d27;
  --bronce: #a87a4b;
  --dorado: #c8a46b;
  --dorado-claro: #e6cd9c;
  --marfil: #f3eadb;
  --blanco-calido: #fbf6ee;
  --tinta: #24140b;

  --texto: var(--marfil);
  --texto-suave: rgba(243, 234, 219, 0.82);
  --texto-tenue: rgba(243, 234, 219, 0.64);
  --linea: rgba(200, 164, 107, 0.45);
  --linea-suave: rgba(200, 164, 107, 0.22);
  --superficie: rgba(14, 9, 6, 0.6);
  --superficie-control: rgba(10, 6, 4, 0.55);
  --aviso: #f2c0a8;
  --aviso-fondo: rgba(96, 36, 20, 0.42);
  --aviso-borde: rgba(242, 192, 168, 0.55);

  --fuente-titulos: "NDS Titulos", "Anton", "Impact", "Arial Narrow", sans-serif;
  --fuente-texto: "NDS Textos", "Kurale", Georgia, "Times New Roman", serif;

  --radio: 14px;
  --radio-grande: 20px;
  --toque: 3.5rem;
  --margen: clamp(1rem, 5vw, 2rem);
  --sombra: 0 18px 40px -22px rgba(0, 0, 0, 0.9);
  --curva: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  background: var(--negro);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  /* Sin fondo propio: el de <html> va debajo de la capa .fondo. */
  color: var(--texto);
  font-family: var(--fuente-texto);
  font-size: 1.0625rem;
  line-height: 1.5;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

/* ── Fondo: la fotografía 1.png, fija detrás del contenido ─────────────────
   Va en una capa fija y no en `background-attachment: fixed`, que iOS no
   respeta. `100lvh` cubre también el espacio que ocupa la barra del navegador
   cuando se oculta, así que el fondo no salta al desplazarse. */
.fondo {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: -1;
  height: 100vh;
  height: 100lvh;
  background-color: var(--negro-calido);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% 28%, transparent 0 38%, rgba(5, 3, 2, 0.55) 100%),
    linear-gradient(180deg, rgba(8, 5, 3, 0.5) 0%, rgba(8, 5, 3, 0.3) 32%, rgba(8, 5, 3, 0.58) 68%, rgba(8, 5, 3, 0.84) 100%),
    url("../img/fondo.jpg");
  background-image:
    radial-gradient(ellipse 120% 80% at 50% 28%, transparent 0 38%, rgba(5, 3, 2, 0.55) 100%),
    linear-gradient(180deg, rgba(8, 5, 3, 0.5) 0%, rgba(8, 5, 3, 0.3) 32%, rgba(8, 5, 3, 0.58) 68%, rgba(8, 5, 3, 0.84) 100%),
    image-set(url("../img/fondo.webp") type("image/webp"), url("../img/fondo.jpg") type("image/jpeg"));
  background-size: cover;
  background-repeat: no-repeat;
  /* En vertical se corre a la izquierda para conservar la luz del candelabro. */
  background-position: 30% center;
}

@media (min-aspect-ratio: 4/5) {
  .fondo {
    background-position: center;
  }
}

/* ── Títulos y ornamentos ─────────────────────────────────────────────────── */
.titulo {
  margin: 0;
  font-family: var(--fuente-titulos);
  font-weight: 400;
  text-transform: uppercase;
  line-height: 0.94;
  letter-spacing: 0.005em;
  color: var(--blanco-calido);
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.55);
  text-wrap: balance;
}

.titulo-linea {
  display: block;
}

.ornamento {
  width: min(16rem, 72%);
  height: auto;
  margin-inline: auto;
  opacity: 0.92;
}

.etiqueta-mayus {
  font-family: var(--fuente-titulos);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ── Tarjetas ─────────────────────────────────────────────────────────────── */
.tarjeta {
  position: relative;
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--radio-grande);
  box-shadow: var(--sombra), inset 0 1px 0 rgba(255, 240, 215, 0.06);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
}

/* Filete interior, como el doble marco de las piezas impresas. */
.tarjeta::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--linea-suave);
  border-radius: calc(var(--radio-grande) - 5px);
  pointer-events: none;
}

/* ── Controles ────────────────────────────────────────────────────────────── */
.control {
  display: block;
  width: 100%;
  min-height: var(--toque);
  margin: 0;
  padding: 0.85rem 1rem;
  font: inherit;
  /* 17 px: por debajo de 16 px, iOS hace zoom al enfocar el campo. */
  font-size: 1.0625rem;
  line-height: 1.3;
  color: var(--marfil);
  background: var(--superficie-control);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.control::placeholder {
  color: rgba(230, 205, 156, 0.55);
  opacity: 1;
}

.control:hover {
  border-color: rgba(200, 164, 107, 0.7);
}

.control:focus-visible,
.control:focus {
  border-color: var(--dorado-claro);
  background: rgba(14, 9, 6, 0.72);
  box-shadow: 0 0 0 3px rgba(200, 164, 107, 0.28);
}

.control[aria-invalid="true"] {
  border-color: var(--aviso-borde);
  box-shadow: 0 0 0 1px var(--aviso-borde);
}

/* ── Botones ──────────────────────────────────────────────────────────────── */
.boton {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 3.75rem;
  padding: 0.9rem 1.25rem;
  font-family: var(--fuente-titulos);
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tinta);
  background: linear-gradient(180deg, var(--blanco-calido) 0%, #ece0cb 100%);
  border: 0;
  border-radius: var(--radio);
  box-shadow: 0 12px 26px -14px rgba(0, 0, 0, 0.95), inset 0 -2px 0 rgba(120, 80, 40, 0.22);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.15s var(--curva), box-shadow 0.2s, background 0.2s, opacity 0.2s;
}

@media (hover: hover) {
  .boton:hover {
    background: linear-gradient(180deg, #fffaf2 0%, #f2e6d1 100%);
    box-shadow: 0 16px 30px -14px rgba(0, 0, 0, 0.95), 0 0 0 1px var(--dorado-claro), inset 0 -2px 0 rgba(120, 80, 40, 0.22);
  }
}

.boton:active {
  transform: translateY(1px) scale(0.985);
}

.boton:focus-visible {
  outline: 3px solid var(--dorado-claro);
  outline-offset: 3px;
}

.boton:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.boton[aria-busy="true"] {
  cursor: progress;
  opacity: 0.9;
  font-size: clamp(1.05rem, 4.6vw, 1.2rem);
  letter-spacing: 0.03em;
}

.boton-secundario {
  color: var(--marfil);
  background: rgba(14, 9, 6, 0.4);
  border: 1px solid var(--linea);
  box-shadow: none;
}

@media (hover: hover) {
  .boton-secundario:hover {
    background: rgba(200, 164, 107, 0.14);
    box-shadow: 0 0 0 1px var(--dorado-claro);
  }
}

/* Dorado del flyer: para la acción que debe destacar sobre el fondo oscuro. */
.boton-dorado {
  color: var(--tinta);
  background: linear-gradient(180deg, #f0d9a6 0%, var(--dorado) 100%);
  border: 0;
  box-shadow:
    0 12px 28px -12px rgba(200, 164, 107, 0.55),
    0 0 0 1px rgba(240, 217, 166, 0.5),
    inset 0 1px 0 rgba(255, 248, 230, 0.6),
    inset 0 -2px 0 rgba(110, 72, 30, 0.3);
}

@media (hover: hover) {
  .boton-dorado:hover {
    background: linear-gradient(180deg, #f6e3b8 0%, #d4b07a 100%);
    box-shadow:
      0 16px 32px -12px rgba(200, 164, 107, 0.7),
      0 0 0 1px var(--dorado-claro),
      inset 0 1px 0 rgba(255, 248, 230, 0.6),
      inset 0 -2px 0 rgba(110, 72, 30, 0.3);
  }
}

.boton-giro {
  display: none;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid rgba(36, 20, 11, 0.25);
  border-top-color: var(--tinta);
  border-radius: 50%;
  animation: girar 0.8s linear infinite;
}

.boton[aria-busy="true"] .boton-giro {
  display: inline-block;
}

@keyframes girar {
  to {
    transform: rotate(360deg);
  }
}

/* ── Avisos ───────────────────────────────────────────────────────────────── */
.aviso,
.campo-error {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  color: var(--aviso);
}

/* Un ícono acompaña siempre al texto: el error no depende sólo del color. */
.aviso::before,
.campo-error::before {
  content: "";
  flex: none;
  width: 1.1em;
  height: 1.1em;
  margin-top: 0.18em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 1.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17Zm0 3.6c.6 0 1 .5 1 1.1l-.3 5.1a.7.7 0 0 1-1.4 0L9 6.2c0-.6.4-1.1 1-1.1Zm0 8.4a1.1 1.1 0 1 1 0 2.2 1.1 1.1 0 0 1 0-2.2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 1.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17Zm0 3.6c.6 0 1 .5 1 1.1l-.3 5.1a.7.7 0 0 1-1.4 0L9 6.2c0-.6.4-1.1 1-1.1Zm0 8.4a1.1 1.1 0 1 1 0 2.2 1.1 1.1 0 0 1 0-2.2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.aviso {
  padding: 0.85rem 1rem;
  font-size: 1rem;
  line-height: 1.4;
  background: var(--aviso-fondo);
  border: 1px solid var(--aviso-borde);
  border-radius: var(--radio);
}

.campo-error {
  margin: 0.5rem 0 0;
  font-size: 0.975rem;
  line-height: 1.35;
}

/* ── Sólo para lectores de pantalla ───────────────────────────────────────── */
.solo-lector {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Entrada discreta ─────────────────────────────────────────────────────── */
.aparecer {
  animation: aparecer 0.7s var(--curva) both;
}

.aparecer:nth-child(2) {
  animation-delay: 0.08s;
}

.aparecer:nth-child(3) {
  animation-delay: 0.16s;
}

@keyframes aparecer {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

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