/* Tipografía: Alegreya solo en los títulos y en el nombre «Taiga»; Alegreya Sans en todo el resto.
   Autoalojadas en fonts/, licencia OFL (ver OFL-*.txt). Alegreya Sans no tiene 600: ese peso usa Medium. */
@font-face {
  font-family: "Alegreya";
  src: url(../fonts/alegreya.woff2) format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url(../fonts/alegreya-sans-400.woff2) format("woff2");
  font-weight: 100 450;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url(../fonts/alegreya-sans-500.woff2) format("woff2");
  font-weight: 451 650;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url(../fonts/alegreya-sans-700.woff2) format("woff2");
  font-weight: 651 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0c0a07;
  --cream: #f3e9d2;
  --dim: #cdbd9a;
  --muted: #9a8c6f;
  --amber: #e8a33d;
  --line: rgba(243, 233, 210, 0.14);
  --glass: rgba(22, 16, 9, 0.66);
  --radius: 16px;
  --font: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  --display: "Alegreya", Georgia, "Times New Roman", serif;
  --box: min(1240px, 100vw - 120px); /* ancho de la caja central del contenido */
  --ease: cubic-bezier(0.22, 0.8, 0.25, 1);
  --dur: 0.95s;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  /* Alegreya tiene la x más baja que otras letras: se compensa para que no se vea pequeña. */
  font-size-adjust: 0.5;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
}
h1,
h2,
h3,
p,
button {
  margin: 0;
}
.eyebrow {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 14px;
}

/* ---------- El mundo de fondo ----------
   Arriba, el bosque (solo en la portada). Al bajar el primer peldaño sube la tierra, con el
   borde difuminado para que no haya corte, y el bosque se desliza un poco hacia arriba. A partir
   de ahí, fondo de tierra oscura, que se mueve despacio con cada peldaño: bajamos bajo el suelo. */
.world {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: #120d08;
}
.world .forest {
  position: absolute;
  inset: -6%;
  background: url(../img/scene/dawn.webp) center / cover;
  transition: translate 1.25s cubic-bezier(0.55, 0, 0.2, 1);
  will-change: translate;
}
.world .shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 6, 3, 0.82) 0%, rgba(8, 6, 3, 0.5) 34%, rgba(8, 6, 3, 0) 62%),
    radial-gradient(ellipse at center, rgba(8, 6, 3, 0) 35%, rgba(8, 6, 3, 0.5) 100%),
    linear-gradient(180deg, rgba(8, 6, 3, 0.45) 0%, rgba(8, 6, 3, 0.05) 30%, rgba(8, 6, 3, 0.3) 100%);
  transition: translate 1.25s cubic-bezier(0.55, 0, 0.2, 1);
}
.world .earth {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 160vh;
  translate: 0 105vh;
  transition: translate 1.25s cubic-bezier(0.55, 0, 0.2, 1);
  will-change: translate;
  /* los primeros 60vh son el borde: de transparente a sólido */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, 0.5) 24vh, #000 60vh);
  mask-image: linear-gradient(180deg, transparent 0, rgba(0, 0, 0, 0.5) 24vh, #000 60vh);
  background: #120d08;
}
.world .earth i {
  position: absolute;
  inset: 0;
  /* Resplandores cálidos y bandas de tierra que se desplazan con la profundidad. */
  background:
    radial-gradient(60vw 34vh at 78% 30%, rgba(232, 163, 61, 0.1), transparent 70%),
    radial-gradient(50vw 28vh at 12% 66%, rgba(111, 168, 74, 0.08), transparent 70%),
    radial-gradient(70vw 18vh at 50% 82%, rgba(122, 82, 48, 0.16), transparent 70%),
    linear-gradient(180deg, #1a130c 0%, #120d08 55%, #1a130c 100%);
  background-size: 100% 110vh;
  background-repeat: repeat-y;
  background-position: 0 calc(var(--depth, 0) * -34vh);
  transition: background-position 1.25s cubic-bezier(0.55, 0, 0.2, 1);
}
.world .earth i::after {
  /* grano fino, como tierra */
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .9 0 0 0 0 .72 0 0 0 0 .45 0 0 0 .9 -.25'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}
.underground .world .earth {
  translate: 0 -60vh;
}
.underground .world .forest {
  translate: 0 -7vh;
}
.underground .world .shade {
  translate: 0 -7vh;
}
.world canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- Cabecera ---------- */
.top {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  pointer-events: none;
}
.top > * {
  pointer-events: auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--display); /* el nombre de la app va en Alegreya */
  font-size: 15px;
  letter-spacing: 0.24em;
  font-weight: 700;
}
.mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
.flags {
  display: inline-flex;
  gap: 8px;
}
.flags button {
  width: 34px;
  height: 34px;
  padding: 4px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: rgba(16, 12, 7, 0.55);
  backdrop-filter: blur(10px);
  cursor: pointer;
  opacity: 0.6;
  transition:
    opacity 0.15s,
    border-color 0.15s,
    transform 0.15s;
}
.flags button:hover {
  opacity: 1;
  transform: scale(1.06);
}
.flags button[aria-pressed="true"] {
  opacity: 1;
  border-color: var(--amber);
}
.flags svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Texto ----------
   Sin paneles: el texto va directamente sobre el fondo. Bajo tierra el fondo es sólido y oscuro,
   así que se lee bien; en la portada el bosque lleva un degradado a la izquierda. */
.hero-copy h1,
.cap h2 {
  font-family: var(--display);
  text-wrap: balance;
}
.cap {
  max-width: 560px;
}
.cap h2 {
  font-size: clamp(34px, 3.4vw, 54px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.cap p {
  margin-top: 16px;
  font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.55;
  color: var(--dim);
  text-wrap: pretty;
}
.cap p.small {
  font-size: 15px;
  color: var(--muted);
}
.premium-step .cap h2 {
  color: var(--amber);
  font-size: clamp(38px, 4.6vw, 64px);
}
.legal {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

/* ---------- Portada: el nombre ----------
   Importancia por diseño, no por tamaño: el abeto, el degradado cálido de la palabra, un brillo
   suave y una pequeña regla de ámbar. */
.hero-copy h1 {
  font-size: clamp(72px, 8vw, 128px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-weight: 700;
  /* la cola de la g baja más que la caja de la línea: sin este margen, el degradado la recorta */
  padding-bottom: 0.24em;
  margin-bottom: -0.14em;
  background: linear-gradient(180deg, #fff6df 8%, #f3cf8e 52%, #e0a24a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 8px 36px rgba(232, 163, 61, 0.28));
}
.rule {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 20px;
}
.rule::before,
.rule::after {
  content: "";
  height: 2px;
  border-radius: 2px;
  background: var(--amber);
}
.rule::before {
  width: 56px;
}
.rule::after {
  width: 18px;
  opacity: 0.4;
}
.rule i {
  width: 8px;
  height: 8px;
  background: var(--amber);
  transform: rotate(45deg);
}
.eyebrow {
  margin-bottom: 0;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 12px 26px 13px;
  border-radius: 12px;
  background: var(--amber);
  color: #2a1a05;
  font-weight: 700;
  font-size: 19px;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(232, 163, 61, 0.28);
  transition:
    transform 0.15s,
    filter 0.15s;
}
.btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}
.btn:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
}
.btn[aria-disabled="true"] {
  cursor: default;
}
.cap p.hash {
  margin-top: 6px;
}
.hash code {
  display: block;
  margin-top: 2px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  color: var(--dim);
  user-select: all;
}
.note {
  margin-top: 14px;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--dim);
}

.piece img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.55));
}
.piece.combo img.main {
  filter: drop-shadow(0 4px 40px rgba(0, 0, 0, 0.5));
}

.dots,
.hint {
  display: none;
}

/* ---------- Versión plana: sin JavaScript o con «reducir animaciones» ---------- */
.stage {
  padding: 110px 0 50px;
}
.step {
  width: min(960px, 100% - 48px);
  margin: 0 auto 90px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.hero-step {
  gap: 36px;
}
.combo {
  position: relative;
}
.combo .over {
  margin-top: 14px;
}
.step .cap,
.hero-copy {
  max-width: 600px;
}
.step .legal {
  margin-top: 8px;
}

/* En la versión plana no hay bosque: todo el fondo es la tierra. */
html:not(.stair) .world .earth {
  translate: 0 -60vh;
}
html:not(.stair) .world .forest,
html:not(.stair) .world .shade {
  display: none;
}

/* ---------- La escalera: un peldaño por pantalla ---------- */
.stair,
.stair body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}
.stair .stage {
  position: fixed;
  inset: 0;
  padding: 0;
}
.stair .step {
  position: absolute;
  inset: 0;
  width: auto;
  margin: 0;
  display: block;
  gap: 0;
  perspective: 1600px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    visibility 0s linear 0.9s;
}
.stair .step.is-current {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 0.6s ease 0.45s,
    visibility 0s;
}

/* Cada pieza se mueve con las propiedades individuales (translate, rotate, scale)
   para que el transform solo se encargue de centrarla. */
.stair .hero-copy,
.stair .piece,
.stair .cap {
  position: absolute;
  transition:
    translate var(--dur) var(--ease),
    rotate var(--dur) var(--ease),
    scale var(--dur) var(--ease),
    opacity 0.7s ease;
  will-change: translate, rotate, scale, opacity;
}
.stair .step:not(.is-current) .hero-copy,
.stair .step:not(.is-current) .piece,
.stair .step:not(.is-current) .cap {
  opacity: 0;
  /* sale rápido, para no mezclarse con lo que entra */
  transition:
    translate var(--dur) var(--ease),
    rotate var(--dur) var(--ease),
    scale var(--dur) var(--ease),
    opacity 0.28s ease;
}
.stair .step.is-current .hero-copy,
.stair .step.is-current .piece,
.stair .step.is-current .cap {
  transition:
    translate var(--dur) var(--ease),
    rotate var(--dur) var(--ease),
    scale var(--dur) var(--ease),
    opacity 0.6s ease 0.1s;
}

/* Peldaño 1 */
/* Todo el contenido vive en una caja centrada (--box), para que no se pegue a los bordes
   y el centro de la pantalla no quede vacío. */
.stair .hero-copy {
  left: calc(50vw - var(--box) / 2);
  top: 48%;
  width: calc(var(--box) * 0.36);
  max-width: none;
  transform: translateY(-50%);
  z-index: 3;
}
.stair .hero-copy h1 {
  font-size: clamp(76px, 8.6vw, 148px);
}
.stair .step:not(.is-current).is-after .hero-copy {
  translate: 0 5vh;
}
.stair .step:not(.is-current).is-before .hero-copy {
  translate: 0 -8vh;
}

/* Peldaños con pieza y texto: la pieza a un lado, el texto en el otro */
.stair .piece {
  left: calc(50vw + var(--side) * var(--box) * 0.2);
  top: 47%;
  transform: translate(-50%, -50%);
  z-index: 2;
}
.stair .piece img {
  max-height: 68vh;
  object-fit: contain;
}
.stair .piece.combo {
  width: calc(var(--box) * 0.6);
}
.stair .piece.inventory {
  width: calc(var(--box) * 0.62);
}
.stair .piece.modpacks {
  width: calc(var(--box) * 0.58);
}
.stair .piece.manage {
  width: calc(var(--box) * 0.5);
}
.stair .piece.playtime {
  width: calc(var(--box) * 0.54);
}
.stair .step:not(.is-current).is-after .piece {
  translate: calc(var(--side) * 14vw) 9vh;
  rotate: 0 1 0 calc(var(--side) * -16deg);
  scale: 0.9;
}
.stair .step:not(.is-current).is-before .piece {
  translate: calc(var(--side) * -10vw) -8vh;
  rotate: 0 1 0 calc(var(--side) * 14deg);
  scale: 0.92;
}

/* La hotbar se solapa con la pieza de la instancia por la esquina de abajo a la derecha. */
.stair .combo .over {
  position: absolute;
  right: -3%;
  top: 76%;
  width: 86%;
  margin: 0;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.55));
}

.stair .cap {
  top: 50%;
  width: calc(var(--box) * 0.4);
  max-width: none;
  transform: translateY(-50%);
  z-index: 3;
}
.stair .cap[data-side="left"] {
  left: calc(50vw - var(--box) / 2);
}
.stair .cap[data-side="right"] {
  right: calc(50vw - var(--box) / 2);
}
.stair .step:not(.is-current).is-after .cap[data-side="left"] {
  translate: -60px 40px;
}
.stair .step:not(.is-current).is-after .cap[data-side="right"] {
  translate: 60px 40px;
}
.stair .step:not(.is-current).is-before .cap {
  translate: 0 -50px;
}

/* Peldaño final: «Solo premium» en el centro y el aviso legal abajo */
.stair .premium-step .cap {
  left: 50%;
  right: auto;
  width: min(860px, 90vw);
  text-align: center;
  transform: translate(-50%, -54%);
}
.stair .premium-step .cap[data-side] {
  left: 50%;
  right: auto;
}
.stair .premium-step .legal {
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: min(1400px, 100% - 64px);
  transform: translateX(-50%);
  text-align: center;
  margin: 0;
}

/* Puntos y flecha */
.stair .dots {
  display: flex;
  position: fixed;
  z-index: 40;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
  gap: 4px;
}
.stair .dots button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  position: relative;
}
.stair .dots button::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: rgba(243, 233, 210, 0.4);
  transition:
    background 0.25s,
    transform 0.25s;
}
.stair .dots button:hover::after {
  background: rgba(243, 233, 210, 0.8);
}
.stair .dots button.on::after {
  background: var(--amber);
  transform: scale(1.5);
}
.stair .hint {
  display: grid;
  place-items: center;
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: 56px;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(16, 12, 7, 0.55);
  backdrop-filter: blur(10px);
  cursor: pointer;
  animation: nudge 2.2s ease-in-out infinite;
  transition: opacity 0.4s;
}
.stair .hint svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--cream);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stair.at-end .hint {
  opacity: 0;
  pointer-events: none;
}
@keyframes nudge {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 6px;
  }
}

/* El «bob» de las piezas: flotan muy despacio */
.stair .piece img.main,
.stair .piece > img:only-child {
  animation: bob 7s ease-in-out infinite alternate;
}
.stair .combo .over {
  animation: bob 9s ease-in-out infinite alternate-reverse;
}
@keyframes bob {
  from {
    translate: 0 -6px;
  }
  to {
    translate: 0 6px;
  }
}

/* ---------- Pantallas estrechas ---------- */
@media (max-width: 999px) {
  .world .shade {
    background:
      linear-gradient(180deg, rgba(8, 6, 3, 0.78) 0%, rgba(8, 6, 3, 0.4) 46%, rgba(8, 6, 3, 0.15) 70%, rgba(8, 6, 3, 0.5) 100%);
  }
  .stair .hero-copy {
    left: 24px;
    right: 24px;
    top: 84px;
    width: auto;
    transform: none;
  }
  .stair .hero-copy h1 {
    font-size: clamp(64px, 22vw, 112px);
  }
  .rule {
    margin: 12px 0 14px;
  }
  .stair .piece,
  .stair .piece.combo,
  .stair .piece.modpacks,
  .stair .piece.manage,
  .stair .piece.inventory,
  .stair .piece.playtime {
    left: 50%;
    top: 34%;
    width: 92vw;
  }
  /* en la portada la interfaz va debajo del nombre */
  .stair .hero-step .piece.combo {
    top: 56%;
    width: 94vw;
  }
  .stair .piece img {
    max-height: 40vh;
  }
  .stair .step:not(.is-current).is-after .piece {
    translate: calc(var(--side) * 20vw) 6vh;
  }
  .stair .step:not(.is-current).is-before .piece {
    translate: calc(var(--side) * -20vw) -6vh;
  }
  .stair .cap,
  .stair .cap[data-side="left"],
  .stair .cap[data-side="right"] {
    left: 24px;
    right: 24px;
    top: auto;
    bottom: 11vh;
    width: auto;
    transform: none;
  }
  .stair .step:not(.is-current).is-after .cap {
    translate: 0 40px;
  }
  .stair .step:not(.is-current).is-before .cap {
    translate: 0 -40px;
  }
  .stair .premium-step .cap,
  .stair .premium-step .cap[data-side] {
    left: 24px;
    right: 24px;
    top: 50%;
    bottom: auto;
    width: auto;
    transform: translateY(-54%);
    text-align: center;
  }
  .stair .premium-step .legal {
    bottom: 14px;
    font-size: 11.5px;
    line-height: 1.45;
    width: calc(100% - 40px);
  }
  .stair .dots {
    right: 4px;
  }
  .stair .hint {
    bottom: 22px;
  }
}
@media (max-width: 520px) {
  body {
    font-size: 16px;
  }
  .top {
    padding: 12px 18px;
  }
}
@media (max-height: 640px) and (min-width: 1000px) {
  .stair .piece img {
    max-height: 58vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stair .step,
  .stair .hero-copy,
  .stair .piece,
  .stair .cap {
    transition: none;
  }
}
