:root {
  color-scheme: dark;

  --tinta: #0e1012;
  --hueso: #e9e3d4;
  --hueso-medio: rgba(233, 227, 212, 0.78);
  --hueso-tenue: rgba(233, 227, 212, 0.55);
  --rojo: #c3362f;
  --rojo-claro: #d64a40;
  --linea: rgba(233, 227, 212, 0.16);

  --display: "Anton", "Arial Narrow", Impact, sans-serif;
  --texto: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --curva: cubic-bezier(0.2, 0.9, 0.3, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(2.25rem, 8vh, 5.5rem) clamp(1.25rem, 6vw, 3rem);
  background-color: var(--tinta);
  background-image:
    radial-gradient(120% 110% at 50% 45%, transparent 40%, rgba(0, 0, 0, 0.55) 100%),
    radial-gradient(80rem 46rem at 50% -18%, rgba(195, 54, 47, 0.26), transparent 62%);
  background-attachment: fixed;
  color: var(--hueso);
  font-family: var(--texto);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* Grano de impresión */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* Filete rojo de cabecera */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  z-index: 2;
  background: var(--rojo);
}

.escena {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  place-items: center;
}

.hoja {
  width: min(100%, 32rem);
}

/* ---------- cabecera ---------- */

.titulo {
  margin: 0 0 0.9rem;
  font-family: var(--display);
  font-size: clamp(2.9rem, 11.5vw, 4.2rem);
  font-weight: 400;
  line-height: 0.86;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}

.sangria {
  display: block;
  text-align: right;
}

.subtitulo {
  margin: 0 0 clamp(2.25rem, 5.5vh, 3.25rem);
  font-size: 0.95rem;
  color: var(--hueso-tenue);
  letter-spacing: 0.01em;
}

/* ---------- pasos ---------- */

.paso[hidden] {
  display: none;
}

.paso:not([hidden]) {
  animation: entrar 0.32s var(--curva) both;
}

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

.etiqueta {
  display: block;
  margin: 0 0 0.3rem;
  font-size: 0.9rem;
  color: var(--hueso-tenue);
}

.campo {
  width: 100%;
  padding: 0.35rem 0 0.55rem;
  border: 0;
  border-bottom: 2px solid var(--linea);
  border-radius: 0;
  background: transparent;
  color: var(--hueso);
  font: inherit;
  font-size: clamp(1.35rem, 5.5vw, 1.65rem);
  font-weight: 500;
  appearance: none;
  transition:
    border-color 0.2s var(--curva),
    box-shadow 0.2s var(--curva);
}

.campo::placeholder {
  color: rgba(233, 227, 212, 0.3);
}

.campo:hover {
  border-bottom-color: rgba(233, 227, 212, 0.3);
}

.campo:focus {
  outline: none;
  border-bottom-color: var(--rojo);
  box-shadow: 0 18px 26px -26px rgba(195, 54, 47, 0.9);
}

.campo:-webkit-autofill {
  -webkit-text-fill-color: var(--hueso);
  transition: background-color 9999s ease-out;
}

.pista {
  margin: 0.9rem 0 0;
  font-size: 0.87rem;
  color: var(--hueso-tenue);
}

.aviso {
  margin: 0.85rem 0 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #e0756a;
}

.aviso[hidden] {
  display: none;
}

/* ---------- texto ---------- */

.dialogo {
  margin: 0 0 0.9rem;
  font-family: var(--display);
  font-size: clamp(1.9rem, 7vw, 2.6rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}

.dialogo:focus {
  outline: none;
}

.parrafo {
  margin: 0 0 0.95rem;
  max-width: 36ch;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--hueso-medio);
}

.tenue {
  font-size: 0.92rem;
  color: var(--hueso-tenue);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  background: rgba(233, 227, 212, 0.08);
}

/* ---------- botones ---------- */

.boton {
  width: 100%;
  margin-top: clamp(1.75rem, 5vh, 2.4rem);
  padding: 1rem 1.25rem;
  border: 0;
  border-radius: 0;
  background: var(--rojo);
  color: #fff4e8;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.6);
  transition:
    transform 0.14s var(--curva),
    box-shadow 0.14s var(--curva),
    background 0.2s;
}

.boton:hover {
  background: var(--rojo-claro);
  transform: translate(-1px, -1px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.6);
}

.boton:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
}

.boton:disabled {
  cursor: progress;
  filter: grayscale(0.4) brightness(0.85);
  transform: none;
}

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

.enlace {
  display: inline-block;
  margin-top: 1.15rem;
  padding: 0.35rem 0;
  border: 0;
  background: none;
  color: var(--hueso-tenue);
  font: inherit;
  font-size: 0.9rem;
  text-decoration: underline;
  text-decoration-color: rgba(233, 227, 212, 0.25);
  text-underline-offset: 0.3em;
  cursor: pointer;
  transition:
    color 0.2s,
    text-decoration-color 0.2s;
}

.enlace:hover {
  color: var(--hueso);
  text-decoration-color: var(--rojo);
}

.enlace:focus-visible {
  outline: 2px solid var(--rojo);
  outline-offset: 4px;
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 1.6rem;
  margin-top: 0.35rem;
}

/* ---------- el nombre revelado ---------- */

.revelado {
  position: relative;
  padding-top: 0.25rem;
}

.etiqueta-regalo {
  margin: 0 0 0.45rem;
  font-size: 0.98rem;
  color: var(--hueso-medio);
  animation: entrar 0.35s var(--curva) both;
}

.nombre-final {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3.4rem, 17vw, 6.4rem);
  font-weight: 400;
  line-height: 0.84;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  overflow-wrap: break-word;
  animation: aparecer 0.45s var(--curva) both;
}

.nombre-final:focus {
  outline: none;
}

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

.sello {
  display: inline-block;
  margin: 1.1rem 0 0;
  padding: 0.32em 0.4em 0.36em 0.72em;
  border: 3px solid var(--rojo);
  color: var(--rojo);
  font-family: var(--display);
  font-size: 1.05rem;
  line-height: 1;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transform: rotate(-3deg);
  animation: sellar 0.4s 0.22s cubic-bezier(0.2, 1.5, 0.45, 1) both;
}

@keyframes sellar {
  from {
    opacity: 0;
    transform: rotate(-3deg) scale(1.7);
  }
  to {
    opacity: 0.95;
    transform: rotate(-3deg) scale(1);
  }
}

.filo {
  height: 3px;
  width: 4.5rem;
  margin: clamp(1.5rem, 4vh, 2rem) 0 1.1rem;
  background: var(--rojo);
  transform-origin: left center;
  animation: trazar 0.5s 0.15s var(--curva) both;
}

@keyframes trazar {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.cierre {
  margin: 0 0 0.45rem;
  max-width: 32ch;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--hueso-medio);
}

.cierre-tenue {
  margin: 0;
  font-size: 0.92rem;
  color: var(--hueso-tenue);
}

/* ---------- ajustes finos ---------- */

@media (max-width: 380px) {
  .nombre-final {
    font-size: 2.9rem;
  }

  .sello {
    font-size: 0.95rem;
  }
}

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