@font-face {
  font-family: "Doto";
  src: url("assets/fonts/doto-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --black: #000;
  --white: #f5f5f7;
  --muted: #a1a1a6;
  --dot-off: rgb(255 255 255 / 0.14);
  --orange: #ff6a1a;
  --cyan: #12d6dc;
  --green: #34c759;
  --red: #ff453a;

  --pitch: 10px; /* separación entre puntos de la barra; main.js lee este valor */

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  color-scheme: dark;
  scrollbar-color: var(--muted) var(--black);
}

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

::selection { background: var(--orange); color: var(--black); }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(20px, 3.2vw, 44px) clamp(16px, 4.4vw, 64px);
  background: var(--black);
  color: var(--white);
  font-family: "Doto", ui-monospace, monospace;
  font-weight: 800;
  font-variation-settings: "ROND" 100;
  line-height: 1.3;
  overflow-x: hidden;
}

img { display: block; }

/* El emblema, medio devorado por el negro */

/* El margen interior deja sitio al halo del desenfoque para que la máscara no lo corte */
.teaser {
  --bleed: 80px;
  position: fixed;
  z-index: -1;
  left: 50%;
  top: calc(2vh - var(--bleed));
  width: calc(min(84vh, 80vw) + var(--bleed) * 2);
  padding: var(--bleed);
  transform: translateX(-50%);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent 62%);
  mask-image: linear-gradient(180deg, #000 30%, transparent 62%);
  animation: emerge 2.4s var(--ease-out) both;
}

.teaser__frame {
  position: relative;
  aspect-ratio: 908 / 1090;
}

.teaser img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Arriba nítido; hacia abajo solo queda la copia desenfocada, y después negro */
.teaser__sharp {
  -webkit-mask-image: linear-gradient(180deg, #000 22%, transparent 44%);
  mask-image: linear-gradient(180deg, #000 22%, transparent 44%);
}

.teaser__blur {
  filter: blur(26px);
  opacity: 0.8;
}

@keyframes emerge {
  from { opacity: 0; transform: translateX(-50%) translateY(5vh) scale(1.04); }
  to { opacity: 1; transform: translateX(-50%); }
}

.rise { animation: rise 900ms var(--ease-out) var(--d, 0ms) both; }

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

/* Texto */

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 1.0625rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.wordmark { color: var(--white); }

.hero {
  align-self: end;
  padding-bottom: clamp(28px, 6vh, 64px);
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 9vw, 6rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-wrap: balance;
}

.hero p {
  margin: clamp(14px, 2.4vh, 24px) 0 0;
  color: var(--muted);
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  font-weight: 900;
  letter-spacing: 0.02em;
}

.hero time { color: var(--white); }

/* Barra de puntos */

.progress__top,
.progress__foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 1.0625rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.percent {
  color: var(--white);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.percent__sign {
  margin-left: 0.15em;
  font-size: 0.42em;
  color: var(--orange);
}

.dots {
  position: relative;
  height: calc(var(--pitch) * 2);
  margin: 14px 0 12px;
  background: radial-gradient(circle, var(--dot-off) 0 2.2px, transparent 2.8px) 0 0 / var(--pitch) var(--pitch);
}

.dots__fill {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, var(--white) 0 2.4px, transparent 3px) 0 0 / var(--pitch) var(--pitch);
  clip-path: inset(0 100% 0 0);
}

/* La columna que se está "imprimiendo" ahora mismo */
.dots__head {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--pitch);
  height: 100%;
  background: radial-gradient(circle, var(--cyan) 0 2.4px, transparent 3px) 0 0 / var(--pitch) var(--pitch);
  animation: blink 1.1s steps(1, end) infinite;
}

@keyframes blink { 50% { opacity: 0.2; } }

/* La barra aparece barriendo de izquierda a derecha */
.js .dots { animation: sweep 1.1s var(--ease-out) 2000ms both; }

@keyframes sweep {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

/* Escritura con cursor */
.js [data-type]:not(.is-ready) { visibility: hidden; }
.ch { visibility: hidden; }
.ch.on { visibility: visible; }

.caret {
  position: relative;
  display: inline-block;
  width: 0;
  height: 1em;
  vertical-align: -0.12em;
}

.caret::after {
  content: "";
  position: absolute;
  left: 0.06em;
  top: 0;
  bottom: 0;
  width: max(2px, 0.07em);
  background: var(--orange);
}

.caret.is-idle::after { animation: blink 1s steps(1, end) infinite; }

/* Estado de la impresión: cada paso termina con un Hecho! en verde o, a veces, un Error en rojo */
#etiqueta.is-done { color: var(--green); }
#etiqueta.is-error { color: var(--red); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

[data-complete] .dots__head { display: none; }

@media (max-width: 680px) {
  .teaser { width: calc(138vw + var(--bleed) * 2); top: calc(4vh - var(--bleed)); }
  .hero { align-self: center; padding: 34vh 0 0; }
  .top { font-size: 0.9375rem; }
  .progress__foot { flex-wrap: wrap; gap: 4px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .teaser { animation: fade-teaser 400ms ease both; }
  .rise { animation: fade 400ms ease both; }
  .dots__head { animation: none; }
  .js .dots { animation: none; }

  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes fade-teaser { from { opacity: 0; } to { opacity: 1; } }
}
