:root {
  --background: hsl(43, 38%, 90%);
  --foreground: hsl(222, 26%, 14%);
  --card: hsl(43, 44%, 94%);
  --primary-foreground: hsl(43, 44%, 94%);
  --muted-foreground: hsl(220, 12%, 38%);
  --twilight: hsl(214, 26%, 30%);
  --oxblood: hsl(348, 46%, 27%);
  --swamp: hsl(82, 24%, 33%);
  --parchment-deep: hsl(40, 26%, 84%);
  --ink: var(--foreground);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  overflow-x: clip;
  background: var(--background);
  color: var(--foreground);
}

h1, h2, .carta__papel, .cita p, .btn, .btn-musica, .indice {
  font-family: "EB Garamond", serif;
}

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

a {
  color: inherit;
}

.pagina {
  min-height: 100dvh;
}

.envoltorio {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.envoltorio--portada {
  max-width: 56rem;
  padding: 6rem 1.5rem;
}

.envoltorio--carta {
  max-width: 48rem;
}

.envoltorio--final {
  max-width: 48rem;
  text-align: center;
}

.oxblood { color: var(--oxblood); }
.swamp { color: var(--swamp); }
.cursiva { font-style: italic; }

.icono-sm { width: 1rem; height: 1rem; }
.icono-md { width: 1.75rem; height: 1.75rem; }
.icono-lg { width: 1.75rem; height: 1.75rem; }
.fill { fill: currentColor; }

.etiqueta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.etiqueta--centro {
  justify-content: center;
}

.linea {
  display: inline-block;
  width: 2.5rem;
  height: 1px;
  background: var(--ink);
}

h1 {
  margin: 0;
  font-size: clamp(2.75rem, 8vw, 4.5rem);
  font-weight: 600;
  line-height: 1.05;
}

h2 {
  margin: 1.5rem 0 0;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 600;
  line-height: 1.15;
}

.texto {
  max-width: 28rem;
  margin: 1.5rem 0 0;
  line-height: 1.7;
  color: var(--muted-foreground);
}

.indice {
  pointer-events: none;
  user-select: none;
  font-size: clamp(7rem, 16vw, 11rem);
  font-weight: 700;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--ink);
  opacity: 0.22;
}

.indice--portada {
  position: absolute;
  top: -4rem;
  right: 0;
  opacity: 0.3;
}

.indice--izq,
.indice--der {
  position: absolute;
  top: 1.5rem;
}

.indice--izq { left: 0.5rem; }
.indice--der { right: 0.5rem; }

.indice--centro {
  display: block;
  margin: 1.5rem auto 0;
  opacity: 0.25;
}

.portada,
.seccion,
.final {
  position: relative;
  overflow: hidden;
}

.portada {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100dvh;
  border-bottom: 2px solid var(--ink);
}

.seccion {
  border-bottom: 2px solid var(--ink);
  padding: 6rem 0;
}

.carta {
  background: var(--parchment-deep);
}

.final {
  padding: 7rem 0;
  border-bottom: 0;
}

.bloque {
  pointer-events: none;
  position: absolute;
  border: 2px solid var(--ink);
  opacity: 0.6;
}

.bloque--twilight {
  right: -2rem;
  top: 1.5rem;
  width: 7rem;
  height: 7rem;
  background: var(--twilight);
}

.bloque--swamp {
  left: -2rem;
  bottom: 3rem;
  width: 5.5rem;
  height: 5.5rem;
  background: var(--swamp);
}

.bloque--oxblood {
  left: -2rem;
  top: 2rem;
  width: 5.5rem;
  height: 5.5rem;
  background: var(--oxblood);
}

.bloque--twilight-final {
  right: -2rem;
  bottom: 2rem;
  width: 6.5rem;
  height: 6.5rem;
  background: var(--twilight);
}

.icono-abs {
  position: absolute;
  pointer-events: none;
  width: 1.5rem;
  height: 1.5rem;
}

.icono-abs--a { left: 12%; top: 18%; color: var(--twilight); width: 1.5rem; }
.icono-abs--b { right: 18%; top: 30%; color: var(--oxblood); width: 1.25rem; }
.icono-abs--c { right: 12%; bottom: 22%; color: var(--twilight); width: 1.75rem; }
.icono-abs--d { left: 20%; top: 24%; color: var(--oxblood); }
.icono-abs--e { right: 24%; bottom: 28%; color: var(--twilight); width: 1.5rem; }

.portada__titulo-wrap {
  position: relative;
  margin-top: 2rem;
}

.portada__lead {
  max-width: 36rem;
  margin: 2rem 0 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted-foreground);
}

.portada__lead strong {
  color: var(--foreground);
}

.portada__acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 2.5rem;
}

.btn,
.btn-musica {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--ink);
  background: var(--oxblood);
  color: var(--primary-foreground);
  font-size: 1.125rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 10px 10px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.2s ease-out;
}

.btn:hover,
.btn-musica:hover {
  transform: translateY(-2px);
}

.btn:active,
.btn-musica:active {
  transform: scale(0.98);
}

.ayuda {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.cuadricula {
  display: grid;
  gap: 3rem;
}

.marco {
  margin: 0;
  padding: 0.75rem;
  background: var(--card);
  border: 2px solid var(--ink);
  box-shadow: 12px 12px 0 var(--twilight);
  transform: rotate(-1.5deg);
}

.marco img {
  width: 100%;
  max-height: 36rem;
  object-fit: cover;
  object-position: center 20%;
  border: 2px solid var(--ink);
}

.carrusel__ventana {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--ink);
  aspect-ratio: 3 / 4;
  max-height: 36rem;
  margin: 0 auto;
}

.carrusel__pista {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.carrusel__slide {
  flex: 0 0 100%;
  height: 100%;
}

.carrusel__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

.carrusel__flecha {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  cursor: pointer;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--twilight);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.carrusel__flecha--prev { left: 0.75rem; }
.carrusel__flecha--next { right: 0.75rem; }

.carrusel__flecha:hover {
  color: var(--primary-foreground);
  background: var(--oxblood);
}

.carrusel__flecha:active {
  transform: translateY(-50%) scale(0.94);
}

.carrusel__puntos {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.25rem 0 0.25rem;
}

.carrusel__punto {
  width: 0.75rem;
  height: 0.75rem;
  padding: 0;
  cursor: pointer;
  background: transparent;
  border: 2px solid var(--ink);
  transition: background 0.2s ease, transform 0.2s ease;
}

.carrusel__punto.is-activo {
  background: var(--oxblood);
  transform: rotate(45deg);
}

.marco figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.25rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.nota-swamp {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0 0;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--swamp);
}

.carta__papel {
  margin-top: 2.5rem;
  padding: 2rem;
  border: 2px solid var(--ink);
  background: var(--card);
  box-shadow: 12px 12px 0 var(--oxblood);
  font-size: 1.125rem;
  line-height: 1.75;
}

.carta__papel p {
  margin: 0 0 1.5rem;
}

.carta__cierre {
  margin-top: 0.5rem !important;
  font-size: clamp(1.5rem, 4vw, 1.875rem);
  font-weight: 600;
  font-style: italic;
  color: var(--oxblood);
}

.mundos__grid {
  display: grid;
  gap: 2.5rem;
  margin-top: 3rem;
}

.cita {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 2rem;
  border: 2px solid var(--ink);
  color: var(--primary-foreground);
}

.cita p {
  margin: 1.5rem 0 0;
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 500;
  font-style: italic;
  line-height: 1.3;
}

.cita footer {
  margin-top: auto;
  padding-top: 2rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0.8;
}

.cita--forks {
  background: var(--twilight);
  box-shadow: 10px 10px 0 var(--ink);
}

.cita--pantano {
  background: var(--swamp);
  box-shadow: 12px 12px 0 var(--oxblood);
  transform: rotate(1.2deg);
}

.final .texto {
  margin-left: auto;
  margin-right: auto;
}

.corazones {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin: 2.5rem 0 0;
  color: var(--oxblood);
}

.pie {
  border-top: 2px solid var(--ink);
  /* Espacio extra para que el botón fijo de música no tape el texto. */
  padding: 2.5rem 0 7rem;
}

.pie__fila {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.btn-musica {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 50;
  padding: 0.65rem 1rem;
}

.btn-musica .ico {
  width: 1.25rem;
  height: 1.25rem;
}

.btn-musica .ico-on { display: none; }
.btn-musica[aria-pressed="true"] .ico-on { display: block; }
.btn-musica[aria-pressed="true"] .ico-off { display: none; }

.reproductor-oculto {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-reveal].visible {
  opacity: 1;
  transform: none;
}

[data-staged] > * {
  animation: revelar 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

[data-staged] > *:nth-child(1) { animation-delay: 0.12s; }
[data-staged] > *:nth-child(2) { animation-delay: 0.28s; }
[data-staged] > *:nth-child(3) { animation-delay: 0.44s; }
[data-staged] > *:nth-child(4) { animation-delay: 0.6s; }

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

@media (prefers-reduced-motion: no-preference) {
  .twinkle { animation: twinkle 2.6s ease-in-out infinite; }
  .twinkle-delay { animation: twinkle 3.4s ease-in-out 0.9s infinite; }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

@media (min-width: 768px) {
  .seccion { padding: 8rem 0; }
  .final { padding: 9rem 0; }
  .carta__papel { padding: 3rem; font-size: 1.25rem; }
  .cuadricula {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
  }
  .mundos__grid { grid-template-columns: 1fr 1fr; }
  .cita--pantano { margin-top: 2.5rem; }
  .pie { padding: 2.5rem 0 4rem; }
  .pie__fila { flex-direction: row; }
  .bloque { opacity: 1; }
  .bloque--twilight { right: -2.5rem; top: 2.5rem; width: 20rem; height: 20rem; }
  .bloque--swamp { left: -4rem; bottom: 6rem; width: 16rem; height: 16rem; }
  .bloque--oxblood { left: -3rem; top: 4rem; width: 10rem; height: 10rem; }
  .bloque--twilight-final { right: -3.5rem; bottom: 4rem; width: 12rem; height: 12rem; }
  .indice--izq { left: 2.5rem; }
  .indice--der { right: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal],
  [data-staged] > * {
    opacity: 1;
    transform: none;
    transition: none;
    animation: none;
  }
  .carrusel__pista { transition: none; }
}
