:root {
  color-scheme: dark;

  --noche: #150f12;
  --hueso: #f2e7d5;
  --hueso-medio: rgba(242, 231, 213, 0.77);
  --hueso-tenue: rgba(242, 231, 213, 0.58);
  --brasa: #9e3638;
  --brasa-clara: #b64543;
  --laton: #c3a373;
  --linea: rgba(242, 231, 213, 0.16);

  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --curva: cubic-bezier(0.22, 0.8, 0.24, 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(--noche);
  background-image:
    radial-gradient(120% 110% at 50% 45%, transparent 38%, rgba(0, 0, 0, 0.5) 100%),
    radial-gradient(90rem 52rem at 50% -22%, rgba(168, 63, 58, 0.28), transparent 62%),
    radial-gradient(64rem 44rem at 50% 118%, rgba(195, 163, 115, 0.1), transparent 70%);
  background-attachment: fixed;
  color: var(--hueso);
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

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");
}

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

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

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

.titulo {
  margin: 0 0 0.85rem;
  font-size: clamp(2.9rem, 12vw, 4.4rem);
  font-weight: 380;
  line-height: 0.87;
  letter-spacing: -0.035em;
}

.sangria {
  display: inline-block;
  margin-left: 0.85em;
}

.subtitulo {
  margin: 0 0 clamp(2.5rem, 6vh, 3.5rem);
  font-size: 0.95rem;
  font-style: italic;
  font-weight: 300;
  letter-spacing: 0.01em;
  color: var(--hueso-tenue);
}

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

.paso[hidden] {
  display: none;
}

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

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

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

.campo {
  width: 100%;
  padding: 0.35rem 0 0.55rem;
  border: 0;
  border-bottom: 1px solid var(--linea);
  border-radius: 0;
  background: transparent;
  color: var(--hueso);
  font: inherit;
  font-size: clamp(1.5rem, 6vw, 1.9rem);
  font-weight: 380;
  letter-spacing: -0.01em;
  appearance: none;
  transition:
    border-color 0.25s var(--curva),
    box-shadow 0.25s var(--curva);
}

.campo::placeholder {
  color: rgba(242, 231, 213, 0.3);
}

.campo:hover {
  border-bottom-color: rgba(242, 231, 213, 0.28);
}

.campo:focus {
  outline: none;
  border-bottom-color: var(--laton);
  box-shadow: 0 18px 26px -24px rgba(195, 163, 115, 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.88rem;
  color: var(--hueso-tenue);
}

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

.aviso[hidden] {
  display: none;
}

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

.dialogo {
  margin: 0 0 1rem;
  font-size: clamp(1.7rem, 6vw, 2.1rem);
  font-weight: 420;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.dialogo:focus {
  outline: none;
}

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

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

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  border-radius: 2px;
  background: rgba(242, 231, 213, 0.08);
}

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

.boton {
  width: 100%;
  margin-top: clamp(1.75rem, 5vh, 2.4rem);
  padding: 1rem 1.25rem;
  border: 0;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--brasa-clara), var(--brasa));
  color: #fdf5e9;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 450;
  letter-spacing: 0.005em;
  cursor: pointer;
  box-shadow:
    0 18px 34px -22px rgba(168, 63, 58, 1),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition:
    transform 0.2s var(--curva),
    box-shadow 0.25s var(--curva),
    filter 0.2s;
}

.boton:hover {
  transform: translateY(-1px);
  box-shadow:
    0 22px 40px -20px rgba(168, 63, 58, 1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.boton:active {
  transform: translateY(0);
}

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

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

.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(242, 231, 213, 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(--laton);
}

.enlace:focus-visible {
  outline: 2px solid var(--laton);
  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;
  isolation: isolate;
  padding-top: 0.25rem;
}

.revelado::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -14% -22% 18% -22%;
  background: radial-gradient(48% 52% at 32% 42%, rgba(230, 201, 156, 0.14), transparent 72%);
  pointer-events: none;
}

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

.nombre-final {
  margin: 0;
  font-size: clamp(3.2rem, 15vw, 6rem);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.04em;
  overflow-wrap: break-word;
  background: linear-gradient(96deg, #fbf2e2 5%, #e3c69a 54%, #fbf2e2 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: aparecer 0.85s var(--curva) both;
}

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

@keyframes aparecer {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
    filter: blur(7px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .nombre-final {
    color: var(--hueso);
  }
}

.filo {
  height: 1px;
  margin: clamp(1.5rem, 4vh, 2rem) 0 1.2rem;
  background: linear-gradient(90deg, rgba(195, 163, 115, 0.8), rgba(195, 163, 115, 0.12) 72%, transparent);
  transform-origin: left center;
  animation: trazar 0.9s 0.18s var(--curva) both;
}

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

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

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

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

@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;
  }
}
