/* Migas' own look on top of the site's: its greens instead of the lime, the potato as the lead, the app moving
   inside a phone. Loaded by /migas/ and /migas/testers/, and by the home page and /apps/ for Migas' card only:
   every rule here hangs from a class of its own, so nothing reaches the rest of those pages.
   No JavaScript: every movement is CSS, and all of it is off when the system asks for less motion. */
body.migas,
.carta-migas {
  --verde: #2f8d63;
  --verde-oscuro: #15503a;
  --verde-claro: #56d092;
  --piel: #dfa764;
  --lima: #8fe3b8;
  --relleno-principal: #8fe3b8;
}

@media (prefers-color-scheme: dark) {
  body.migas,
  .carta-migas {
    --lima: #56d092;
    --acento-texto: #56d092;
    --boton: #56d092;
  }
}

/* ---------- Migas' card on the home page and in the catalogue ---------- */
.app.carta-migas {
  border-radius: 26px;
  overflow: hidden;
  border-color: rgba(47, 141, 99, 0.5);
  background: linear-gradient(180deg, rgba(86, 208, 146, 0.12), transparent 70%);
}

.carta-migas .escaparate {
  position: relative;
  height: 390px;
  gap: 0;
  padding: 50px 24px 0;
  border-bottom: 0;
  background: radial-gradient(120% 110% at 28% 0%, #46b784 0%, #2f8d63 42%, #15503a 100%);
}

/* The two screens, framed like phones and fanned out. */
.carta-migas .escaparate > img {
  position: relative;
  border: 6px solid #0b0d12;
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: #0b0d12;
  box-shadow: 0 22px 44px rgba(4, 22, 14, 0.45);
  rotate: -5deg;
  translate: 6% 4px;
  transform-origin: 50% 100%;
}

.carta-migas .escaparate > img + img {
  rotate: 6deg;
  translate: -6% 26px;
}

.carta-migas .escaparate > img.patata {
  position: absolute;
  right: 3%;
  bottom: -6px;
  width: 31%;
  max-width: 170px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  rotate: 4deg;
  translate: 0 0;
  filter: drop-shadow(0 12px 12px rgba(4, 22, 14, 0.4));
}

.carta-migas .migajas i {
  background: #fff8e8;
  opacity: 0.22;
}

.carta-migas .migajas i:nth-child(3n) {
  background: #c9f4dc;
  opacity: 0.3;
}

.carta-migas .ficha h3 {
  font-size: 1.9rem;
  letter-spacing: -0.035em;
  margin-bottom: 12px;
}

.carta-migas .ficha h3::after {
  content: "";
  display: block;
  width: 2.1em;
  height: 6px;
  margin-top: 8px;
  border-radius: 99px;
  background: var(--verde-claro);
}

.carta-migas .chip {
  border-radius: 999px;
  border-color: rgba(47, 141, 99, 0.45);
  padding: 5px 11px;
}

.carta-migas .chip.vivo {
  background: var(--verde-claro);
  border-color: var(--verde-claro);
  color: #06120c;
}

/* ---------- the beta notice: a dark strip under the header, the same on the home page, /apps/ and /migas/ ---------- */
.aviso-beta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 9px 18px;
  background: linear-gradient(90deg, #0a0f14, #16302a 50%, #0a0f14);
  color: #fff8e8;
  text-decoration: none;
  font-size: 0.98rem;
  line-height: 1.3;
  border-bottom: 1px solid rgba(86, 208, 146, 0.35);
}

.aviso-beta img {
  width: 46px;
  height: auto;
  margin-block: -4px;
}

.aviso-beta b {
  color: #56d092;
  font-weight: 600;
}

.aviso-beta .ir {
  flex: none;
  padding: 6px 13px;
  border-radius: 999px;
  background: #56d092;
  color: #06120c;
  font-size: 0.68rem;
}

.aviso-beta .ir::after {
  content: " →";
}

/* ---------- hero: words on one side, the app and the potato on the other ---------- */
.heroe {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--linea);
  padding: 72px 24px 64px;
}

.heroe .dentro {
  position: relative;
  max-width: var(--ancho);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}

.heroe .marca-grande {
  font-size: clamp(3.4rem, 9vw, 8rem);
  margin: 18px 0 22px;
}

.heroe .lema {
  margin: 0 0 30px;
}

.heroe .botones {
  justify-content: flex-start;
}

.heroe .nota {
  margin-top: 22px;
}

/* Crumbs adrift behind everything: the app is called Migas. */
.migajas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.migajas i {
  position: absolute;
  width: 14px;
  height: 11px;
  border-radius: 46% 54% 58% 42% / 52% 44% 56% 48%;
  background: var(--piel);
  opacity: 0.5;
}

.migajas i:nth-child(3n) {
  background: var(--verde-claro);
  opacity: 0.45;
}

.migajas i:nth-child(4n) {
  width: 22px;
  height: 17px;
  opacity: 0.32;
}

.migajas i:nth-child(1) { left: 4%; top: 18%; }
.migajas i:nth-child(2) { left: 12%; top: 72%; }
.migajas i:nth-child(3) { left: 23%; top: 9%; }
.migajas i:nth-child(4) { left: 31%; top: 86%; }
.migajas i:nth-child(5) { left: 44%; top: 14%; }
.migajas i:nth-child(6) { left: 52%; top: 78%; }
.migajas i:nth-child(7) { left: 61%; top: 6%; }
.migajas i:nth-child(8) { left: 69%; top: 90%; }
.migajas i:nth-child(9) { left: 78%; top: 20%; }
.migajas i:nth-child(10) { left: 86%; top: 66%; }
.migajas i:nth-child(11) { left: 93%; top: 10%; }
.migajas i:nth-child(12) { left: 97%; top: 82%; }
.migajas i:nth-child(13) { left: 38%; top: 48%; }
.migajas i:nth-child(14) { left: 8%; top: 44%; }

/* The phone, with a real recording of the app playing in it. */
.escaparate-movil {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 560px;
}

.movil {
  position: relative;
  width: min(290px, 62vw);
  aspect-ratio: 9 / 20;
  border-radius: 38px;
  border: 8px solid #0b0d12;
  outline: 1px solid rgba(255, 255, 255, 0.18);
  background: #0b0d12;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(8, 20, 14, 0.35), 0 0 70px rgba(86, 208, 146, 0.28);
  transform: perspective(1400px) rotateY(-12deg) rotateZ(1.5deg);
}

.movil video,
.movil img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.escaparate-movil .patata {
  position: absolute;
  left: 2%;
  bottom: -2%;
  width: min(210px, 44vw);
  filter: drop-shadow(0 14px 14px rgba(8, 20, 14, 0.28));
}

/* ---------- figures ---------- */
.cifras {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--linea);
  border-left: 1px solid var(--linea);
}

.cifras > div {
  padding: 30px 26px 28px;
  border-right: 1px solid var(--linea);
  border-bottom: 1px solid var(--linea);
}

.cifras b {
  display: block;
  font-size: clamp(2.6rem, 5.4vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--verde);
}

.cifras span {
  display: block;
  margin-top: 12px;
  color: var(--tenue);
}

@media (prefers-color-scheme: dark) {
  .cifras b {
    color: var(--verde-claro);
  }
}

/* ---------- screens in phone frames ---------- */
.pantallas {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}

.pantallas figure {
  margin: 0;
}

.pantallas img {
  width: 100%;
  aspect-ratio: 9 / 20;
  border-radius: 26px;
  border: 6px solid #0b0d12;
  background: #0b0d12;
  box-shadow: 0 18px 34px rgba(8, 20, 14, 0.22);
}

.pantallas figcaption {
  margin-top: 16px;
  color: var(--tenue);
}

.pantallas figcaption b {
  display: block;
  color: var(--tinta);
  font-weight: 600;
}

/* ---------- what it does: a small moving drawing per card ---------- */
.icono {
  display: block;
  width: 54px;
  height: 54px;
  margin-bottom: 22px;
  color: var(--verde);
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icono .relleno {
  fill: currentColor;
  stroke: none;
}

@media (prefers-color-scheme: dark) {
  .icono {
    color: var(--verde-claro);
  }
}

/* ---------- the streak and its mascot ---------- */
.racha {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.racha .tarima {
  position: relative;
  aspect-ratio: 1;
  max-width: min(360px, 44svh);
  width: 100%;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(86, 208, 146, 0.3), transparent 72%);
}

.racha .tarima img {
  position: absolute;
  inset: 4%;
  width: 92%;
  height: 92%;
}

.racha .dias {
  margin: 0;
  font-size: clamp(3rem, 7vw, 5.6rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 0.9;
  color: var(--verde);
}

.racha .dias small {
  font-size: 0.24em;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--tenue);
  margin-left: 0.3em;
}

.hitos {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 8px;
}

.hitos li {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 11px 16px;
  border: 1px solid var(--linea);
  border-radius: 14px;
}

.hitos b {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--verde);
  white-space: nowrap;
}

/* The stage where the potatoes take turns only exists where scrolling can drive it. */
.racha .tarima.viva {
  display: none;
}

/* Without scroll-driven animation the four potatoes stand side by side instead of taking turns. */
.racha .tarima.quieta {
  aspect-ratio: auto;
  border-radius: 0;
  background: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-width: none;
}

.racha .tarima.quieta img {
  position: static;
  width: 100%;
  height: auto;
}

/* ---------- closing band ---------- */
.cierre-migas {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 36px;
  align-items: center;
}

.cierre-migas img {
  width: min(220px, 40vw);
}

.cierre-migas h2 {
  margin-bottom: 18px;
}

.cierre-migas .botones {
  justify-content: flex-start;
  margin-top: 26px;
}

/* ---------- testers: a hero that looks like the trailer, dark whatever the theme ---------- */
.beta {
  position: relative;
  overflow: hidden;
  background: radial-gradient(120% 90% at 70% 20%, #16302a 0%, #0a0f14 55%, #05070c 100%);
  color: #fff8e8;
  padding: 72px 24px 72px;
  border-bottom: 1px solid rgba(255, 248, 232, 0.14);
}

.beta .dentro {
  position: relative;
  max-width: var(--ancho);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 52px;
  align-items: center;
}

.beta .mono {
  color: var(--verde-claro);
}

.beta h1 {
  font-size: clamp(3.4rem, 9.5vw, 8.4rem);
  letter-spacing: -0.05em;
  line-height: 0.92;
  margin: 18px 0 26px;
}

.beta h1 em {
  font-style: normal;
  display: block;
  width: 0.9em;
  height: 0.07em;
  margin-top: 0.22em;
  border-radius: 99px;
  background: var(--verde-claro);
}

.beta .lema {
  color: rgba(255, 248, 232, 0.78);
  margin: 0 0 30px;
}

.beta .botones {
  justify-content: flex-start;
}

.beta .boton {
  color: #fff8e8;
  border-color: rgba(255, 248, 232, 0.4);
}

.beta .boton.principal {
  background-color: var(--verde-claro);
  border-color: var(--verde-claro);
  color: #06120c;
  border-radius: 999px;
  box-shadow: 0 0 34px rgba(86, 208, 146, 0.4);
}

.beta .nota {
  color: rgba(255, 248, 232, 0.6);
  margin-top: 22px;
}

.cine {
  position: relative;
}

.cine video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 22px;
  border: 1px solid rgba(255, 248, 232, 0.18);
  background: #000;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), 0 0 80px rgba(86, 208, 146, 0.18);
}

.cine .patata {
  position: absolute;
  left: -24%;
  bottom: -9%;
  width: 42%;
  filter: drop-shadow(0 16px 16px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

/* Bullets hanging in the air, as in the trailer's last shot. */
.balas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.balas i {
  position: absolute;
  width: 34px;
  height: 13px;
  border-radius: 3px 60% 60% 3px / 3px 50% 50% 3px;
  background: linear-gradient(180deg, #f7dc8a 0%, #d9a441 45%, #7a5318 100%);
  box-shadow: 0 0 14px rgba(247, 220, 138, 0.25);
  opacity: 0.8;
}

.balas i:nth-child(1) { left: 6%; top: 12%; rotate: 172deg; }
.balas i:nth-child(2) { left: 41%; top: 7%; rotate: 186deg; scale: 0.7; opacity: 0.55; }
.balas i:nth-child(3) { left: 47%; top: 88%; rotate: 176deg; scale: 1.3; filter: blur(2px); }
.balas i:nth-child(4) { left: 92%; top: 16%; rotate: 190deg; scale: 0.8; }
.balas i:nth-child(5) { left: 30%; top: 60%; rotate: 181deg; scale: 0.55; opacity: 0.4; }
.balas i:nth-child(6) { left: 96%; top: 74%; rotate: 170deg; scale: 1.6; filter: blur(3px); opacity: 0.6; }

/* ---------- testers: the three steps as a path ---------- */
.camino {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 26px;
}

/* The rail the steps hang from; the green part is drawn as the page is scrolled. */
.camino::before,
.camino::after {
  content: "";
  position: absolute;
  left: 31px;
  top: 32px;
  bottom: 32px;
  width: 2px;
  background: var(--linea);
}

.camino::after {
  background: var(--verde-claro);
  transform-origin: top;
}

/* Above the rail: the steps animate, which would otherwise let the rail, drawn later, paint over their numbers. */
.camino li {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 26px;
  align-items: start;
}

.camino .num {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--verde-claro);
  background: var(--fondo);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--verde);
}

.camino .paso {
  border: 1px solid var(--linea);
  border-radius: 18px;
  padding: 26px 28px 28px;
}

.camino .paso p {
  color: var(--tenue);
  margin: 0 0 20px;
  max-width: 58ch;
}

.camino .botones {
  justify-content: flex-start;
}

@media (prefers-color-scheme: dark) {
  .camino .num {
    color: var(--verde-claro);
  }
}

/* ---------- testers: why fourteen days and twelve people ---------- */
.porque {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
}

.porque > div {
  border: 1px solid var(--linea);
  border-radius: 18px;
  padding: 28px;
}

.porque b.grande {
  display: block;
  font-size: clamp(3rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--verde);
}

.porque p {
  color: var(--tenue);
  margin: 10px 0 22px;
}

.dias14 {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.dias14 i {
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--verde-claro);
}

.doce {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.doce img {
  width: 100%;
}

@media (prefers-color-scheme: dark) {
  .porque b.grande {
    color: var(--verde-claro);
  }
}

/* ---------- movement ---------- */
@media (prefers-reduced-motion: no-preference) {
  .migajas i {
    animation: flota 9s ease-in-out infinite alternate;
  }

  .migajas i:nth-child(2n) {
    animation-duration: 12s;
    animation-delay: -4s;
  }

  .migajas i:nth-child(3n) {
    animation-duration: 15s;
    animation-delay: -7s;
  }

  @keyframes flota {
    from {
      translate: 0 14px;
      rotate: -18deg;
    }

    to {
      translate: 10px -18px;
      rotate: 24deg;
    }
  }

  .aviso-beta .ir {
    animation: late-boton 2.6s ease-in-out infinite;
  }

  .aviso-beta:hover img {
    animation: salta 0.5s cubic-bezier(0.3, 0, 0.3, 1) infinite alternate;
  }

  /* The card: the potato breathes, and when the card is pointed at the phones open up and she jumps. */
  .carta-migas .escaparate > img {
    transition: rotate 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), translate 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .carta-migas:hover .escaparate > img {
    rotate: -9deg;
    translate: 3% -6px;
  }

  .carta-migas:hover .escaparate > img + img {
    rotate: 10deg;
    translate: -3% 14px;
  }

  .carta-migas .escaparate > img.patata {
    transform-origin: 50% 92%;
    animation: respira 3.2s ease-in-out infinite;
  }

  .carta-migas:hover .escaparate > img.patata {
    rotate: 4deg;
    translate: 0 0;
    animation: salta 0.7s cubic-bezier(0.3, 0, 0.3, 1) infinite alternate;
  }

  @keyframes salta {
    to {
      translate: 0 -26px;
      scale: 0.96 1.05;
    }
  }

  /* The potato lands with a bounce and then never quite stands still. */
  .escaparate-movil .patata,
  .cierre-migas img {
    transform-origin: 50% 92%;
    animation: aterriza 0.9s 0.35s cubic-bezier(0.2, 1.5, 0.4, 1) both, respira 3.2s 1.3s ease-in-out infinite;
  }

  @keyframes aterriza {
    from {
      opacity: 0;
      translate: 0 40px;
      scale: 0.7;
    }
  }

  @keyframes respira {
    50% {
      scale: 1.03 0.97;
      rotate: -2deg;
    }
  }

  .movil {
    animation: asoma 1s 0.15s cubic-bezier(0.2, 0.8, 0.2, 1) both, mece 7s 1.2s ease-in-out infinite alternate;
  }

  @keyframes asoma {
    from {
      opacity: 0;
      translate: 0 70px;
    }
  }

  @keyframes mece {
    to {
      transform: perspective(1400px) rotateY(-7deg) rotateZ(0.6deg) translateY(-8px);
    }
  }

  .pantallas figure {
    transition: translate 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .pantallas figure:hover {
    translate: 0 -10px;
  }

  /* Icons: a scanner line sweeping, sound waves, a pulse, a line being drawn, a twinkle. */
  .icono .barre {
    animation: barre 2.2s ease-in-out infinite alternate;
  }

  @keyframes barre {
    from {
      translate: 0 -9px;
    }

    to {
      translate: 0 9px;
    }
  }

  .icono .onda {
    animation: onda 1.6s ease-out infinite;
    transform-origin: 27px 22px;
  }

  .icono .onda + .onda {
    animation-delay: 0.5s;
  }

  @keyframes onda {
    from {
      opacity: 1;
      scale: 0.6;
    }

    to {
      opacity: 0;
      scale: 1.25;
    }
  }

  .icono .traza {
    stroke-dasharray: 80;
    animation: traza 2.8s ease-in-out infinite;
  }

  @keyframes traza {
    from {
      stroke-dashoffset: 80;
    }

    55%,
    to {
      stroke-dashoffset: 0;
    }
  }

  .icono .late {
    transform-origin: 27px 27px;
    animation: late 1.3s ease-in-out infinite;
  }

  @keyframes late {
    15% {
      scale: 1.18;
    }

    30% {
      scale: 1;
    }
  }

  .icono .parpadea {
    transform-origin: 27px 27px;
    animation: parpadea 2.4s ease-in-out infinite;
  }

  .icono .parpadea + .parpadea {
    animation-delay: 1.2s;
  }

  @keyframes parpadea {
    50% {
      scale: 0.55;
      opacity: 0.35;
    }
  }

  /* Testers hero. */
  .balas i {
    animation: suspendida 8s ease-in-out infinite alternate;
  }

  .balas i:nth-child(2n) {
    animation-duration: 11s;
    animation-delay: -5s;
  }

  @keyframes suspendida {
    from {
      translate: 10px 4px;
    }

    to {
      translate: -14px -6px;
    }
  }

  .cine {
    animation: asoma 1s 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  .cine .patata {
    transform-origin: 50% 92%;
    animation: aterriza 0.9s 0.7s cubic-bezier(0.2, 1.5, 0.4, 1) both, respira 3.2s 1.7s ease-in-out infinite;
  }

  .beta h1 em {
    transform-origin: left;
    animation: raya 0.8s 0.6s cubic-bezier(0.6, 0, 0.2, 1) both;
  }

  @keyframes raya {
    from {
      scale: 0 1;
    }
  }

  .beta .boton.principal {
    animation: late-boton 2.6s 1.6s ease-in-out infinite;
  }

  @keyframes late-boton {
    50% {
      box-shadow: 0 0 54px rgba(86, 208, 146, 0.7);
    }
  }

  /* Things that happen as the page is scrolled. Browsers without this simply show everything in place. */
  @supports (animation-timeline: view()) {
    .cifras b {
      animation: sube-cifra linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 90%;
    }

    @keyframes sube-cifra {
      from {
        opacity: 0;
        translate: 0 0.5em;
      }
    }

    /* The one figure worth counting. */
    .cifras b.cuenta {
      font-size: 0;
    }

    .cifras b.cuenta::before {
      font-size: clamp(2.6rem, 5.4vw, 4.4rem);
      counter-reset: n var(--n);
      content: counter(n);
      animation: cuenta linear both;
      animation-timeline: view();
      animation-range: entry 10% cover 40%;
    }

    @keyframes cuenta {
      from {
        --n: 0;
      }

      to {
        --n: 3500;
      }
    }

    /* The streak: the section is tall, its content stays in view, and the days go up as it is scrolled through. */
    .seccion.racha-larga {
      height: 320vh;
      view-timeline: --racha block;
      padding-block: 0;
    }

    /* Everything in the pinned part has to fit in one screen, or it would spill over the sections around it. */
    .racha-larga .fija {
      position: sticky;
      top: 56px;
      height: calc(100svh - 56px);
      display: grid;
      align-content: start;
      padding-top: clamp(20px, 5svh, 56px);
      overflow: hidden;
    }

    .seccion.racha-larga > .contenedor > header {
      margin-bottom: clamp(12px, 3svh, 32px);
    }

    .racha .tarima.quieta {
      display: none;
    }

    .racha .tarima.viva {
      display: block;
    }

    .racha .tarima.viva img {
      opacity: 0;
      animation: turno linear both;
      animation-timeline: --racha;
    }

    .racha .tarima.viva img:nth-child(1) { animation-name: turno-0; }
    .racha .tarima.viva img:nth-child(2) { animation-range: contain 26% contain 52%; }
    .racha .tarima.viva img:nth-child(3) { animation-range: contain 50% contain 78%; }
    .racha .tarima.viva img:nth-child(4) { animation-name: turno-fin; animation-range: contain 76% contain 100%; }

    @keyframes turno-0 {
      0%, 24% { opacity: 1; scale: 1; }
      30%, 100% { opacity: 0; scale: 0.9; }
    }

    @keyframes turno {
      0% { opacity: 0; scale: 0.8; rotate: -8deg; }
      16%, 84% { opacity: 1; scale: 1; rotate: 0deg; }
      100% { opacity: 0; scale: 0.9; }
    }

    @keyframes turno-fin {
      0% { opacity: 0; scale: 0.8; rotate: -8deg; }
      18%, 100% { opacity: 1; scale: 1; rotate: 0deg; }
    }

    .racha .dias b {
      font-size: 0;
    }

    .racha .dias b::before {
      font-size: clamp(3rem, 7vw, 5.6rem);
      counter-reset: n var(--n);
      content: counter(n);
      animation: dias linear both;
      animation-timeline: --racha;
      animation-range: contain 0% contain 88%;
    }

    @keyframes dias {
      from { --n: 1; }
      26% { --n: 7; }
      54% { --n: 30; }
      to { --n: 100; }
    }

    .hitos li {
      animation: hito linear both;
      animation-timeline: --racha;
    }

    .hitos li:nth-child(1) { animation-range: contain 20% contain 30%; }
    .hitos li:nth-child(2) { animation-range: contain 46% contain 56%; }
    .hitos li:nth-child(3) { animation-range: contain 74% contain 84%; }

    @keyframes hito {
      from {
        opacity: 0.35;
      }

      to {
        opacity: 1;
        border-color: var(--verde-claro);
        background: rgba(86, 208, 146, 0.12);
      }
    }

    /* Testers: the rail fills, and each step lights up as it comes into view. */
    .camino {
      view-timeline: --camino block;
    }

    .camino::after {
      animation: rail linear both;
      animation-timeline: --camino;
      animation-range: entry 40% exit 30%;
    }

    @keyframes rail {
      from {
        scale: 1 0;
      }
    }

    .camino li {
      animation: llega linear both;
      animation-timeline: view();
      animation-range: entry 5% entry 70%;
    }

    @keyframes llega {
      from {
        opacity: 0.25;
        translate: 26px 0;
      }
    }

    .camino .num {
      animation: enciende linear both;
      animation-timeline: view();
      animation-range: entry 40% entry 100%;
    }

    @keyframes enciende {
      from {
        background: var(--fondo);
      }

      to {
        background: var(--verde-claro);
        color: #06120c;
      }
    }

    .dias14 i,
    .doce img {
      animation: brota linear both;
      animation-timeline: view();
      animation-range: entry 20% entry 100%;
    }

    @keyframes brota {
      from {
        opacity: 0;
        scale: 0.3;
      }
    }

    .dias14 i:nth-child(n + 5),
    .doce img:nth-child(n + 4) { animation-range: entry 40% entry 130%; }
    .dias14 i:nth-child(n + 10),
    .doce img:nth-child(n + 8) { animation-range: entry 60% entry 160%; }
  }
}

/* ---------- narrow screens ---------- */
@media (max-width: 860px) {
  .heroe .dentro,
  .beta .dentro,
  .racha,
  .porque {
    grid-template-columns: 1fr;
  }

  .heroe,
  .beta {
    padding: 48px 20px 52px;
  }

  .escaparate-movil {
    min-height: 0;
    padding-block: 10px 30px;
  }

  .cifras {
    grid-template-columns: repeat(2, 1fr);
  }

  /* The screens become a strip to swipe through. */
  .pantallas {
    grid-auto-flow: column;
    grid-auto-columns: 62%;
    grid-template-columns: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 14px;
    margin-inline: -24px;
    padding-inline: 24px;
  }

  .pantallas figure {
    scroll-snap-align: center;
  }

  .cierre-migas {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .cine .patata {
    left: -5%;
    bottom: -12%;
    width: 36%;
  }

  .cine {
    margin-bottom: 24px;
  }

  /* On a phone the pinned streak has little room: the potato shrinks and the sentence under the days goes. */
  .racha {
    gap: 6px;
  }

  .racha .tarima {
    max-width: min(210px, 28svh);
  }

  .racha .lema {
    display: none;
  }

  .hitos li {
    font-size: 0.92rem;
    padding: 9px 13px;
    gap: 12px;
  }

  .camino li {
    grid-template-columns: 48px 1fr;
    gap: 16px;
  }

  .camino .num {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
  }

  .camino::before,
  .camino::after {
    left: 23px;
  }

  .camino .paso {
    padding: 20px;
  }
}
