@font-face { font-family: Inter; font-weight: 400; font-style: normal; font-display: swap; src: url(fuentes/Inter-Regular.ttf) format("truetype"); }
@font-face { font-family: Inter; font-weight: 500; font-style: normal; font-display: swap; src: url(fuentes/Inter-Medium.ttf) format("truetype"); }
@font-face { font-family: Inter; font-weight: 600; font-style: normal; font-display: swap; src: url(fuentes/Inter-SemiBold.ttf) format("truetype"); }

:root {
  --fondo: #fafaf8;
  --panel: #f1f1ee;
  --tinta: #111110;
  --suave: #66665f;
  --linea: #d9d9d3;
  --acento: #3347ff;
  --ease: cubic-bezier(.22, .8, .2, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0d0d0e;
    --panel: #161618;
    --tinta: #f2f2ef;
    --suave: #9a9a94;
    --linea: #2f2f33;
    --acento: #8c98ff;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--fondo);
  color: var(--tinta);
  font: 400 17px/1.55 Inter, system-ui, sans-serif;
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Marco ------------------------------------------------------------------ */

.progreso { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 6; }
#barra { display: block; height: 100%; width: 0; background: var(--tinta); transition: width .6s var(--ease); }

.cabecera {
  position: fixed; inset: 0 0 auto 0; z-index: 5; pointer-events: none;
  display: flex; justify-content: space-between;
  padding: 26px clamp(24px, 6vw, 96px);
  font-size: 13px; font-weight: 500; letter-spacing: .02em; color: var(--suave);
}

.mando {
  position: fixed; inset: auto 0 0 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px clamp(24px, 6vw, 96px);
  font-size: 13px; font-weight: 500; color: var(--suave);
  pointer-events: none;
}
.mando b { color: var(--tinta); font-weight: 500; }
.mando .cuenta { font-variant-numeric: tabular-nums; }
.mando .botones { display: flex; gap: 8px; pointer-events: auto; }
.mando button {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent; color: var(--tinta);
  border: 1px solid var(--linea); cursor: pointer;
  transition: border-color .2s, background .2s;
}
.mando button:hover { border-color: var(--tinta); }
.mando button:focus-visible, .repetir:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
.mando svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* Diapositivas ----------------------------------------------------------- */

#carrusel { position: fixed; inset: 0; }

.diapo {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(32px, 6vw, 104px); align-items: center;
  padding: 88px clamp(24px, 6vw, 96px) 84px;
  overflow-y: auto;
  opacity: 0; visibility: hidden;
  transition: opacity .5s var(--ease), visibility 0s .5s;
}
.diapo.activa { opacity: 1; visibility: visible; transition-delay: 0s; }

.texto > * { margin: 0; }
.texto > * + * { margin-top: 18px; }

.rotulo { font-size: 13px; font-weight: 500; letter-spacing: .04em; color: var(--acento); margin-bottom: 22px !important; }

h1, h2 { font-weight: 600; letter-spacing: -.03em; line-height: 1.06; text-wrap: balance; }
h1 { font-size: clamp(44px, 6.4vw, 104px); }
h2 { font-size: clamp(28px, 3.3vw, 52px); }
.texto h2 { margin-bottom: .5em; }

.texto p, .texto li { font-size: clamp(16px, 1.2vw, 19px); }
.entrada { font-size: clamp(18px, 1.8vw, 26px) !important; color: var(--suave); line-height: 1.4; }

ul, ol { padding: 0; margin: 0; list-style: none; }
.texto ul > li { position: relative; padding-left: 1.2em; margin: .7em 0; }
.texto ul > li::before { content: ""; position: absolute; left: 0; top: .78em; width: 7px; height: 1px; background: var(--suave); }
.texto strong { font-weight: 600; }

code {
  font: 500 .88em Inter, sans-serif; font-feature-settings: "ss03";
  background: var(--panel); padding: .1em .45em; border-radius: 6px; white-space: nowrap;
}

.reglas { counter-reset: regla; }
.reglas li { counter-increment: regla; position: relative; padding: .8em 0 .8em 2.6em; border-top: 1px solid var(--linea); }
.reglas li:last-child { border-bottom: 1px solid var(--linea); }
.reglas li::before {
  content: counter(regla); position: absolute; left: 0; top: .8em;
  font-size: 13px; font-weight: 500; color: var(--acento); font-variant-numeric: tabular-nums;
}

/* Entrada escalonada del texto */
.diapo.activa .texto > * { animation: sube .8s var(--ease) both; }
.diapo.activa .texto > :nth-child(2) { animation-delay: .06s; }
.diapo.activa .texto > :nth-child(3) { animation-delay: .12s; }
.diapo.activa .texto > :nth-child(4) { animation-delay: .18s; }
.diapo.activa .texto > :nth-child(5) { animation-delay: .24s; }
.diapo.activa .reglas li { animation: sube .7s var(--ease) both; }
.diapo.activa .reglas li:nth-child(1) { animation-delay: .35s; }
.diapo.activa .reglas li:nth-child(2) { animation-delay: .5s; }
.diapo.activa .reglas li:nth-child(3) { animation-delay: .65s; }
.diapo.activa .reglas li:nth-child(4) { animation-delay: .8s; }
.diapo.activa .reglas li:nth-child(5) { animation-delay: .95s; }
@keyframes sube { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Cierre */
.cierre { grid-template-columns: 1fr; align-content: center; }
.gran { font-size: clamp(40px, 8vw, 128px); line-height: 1.02; text-wrap: initial; }
.gran span { display: inline-block; opacity: 0; transform: translateY(24px); }
.diapo.activa .gran span { animation: sube 1s var(--ease) both; }
.diapo.activa .gran span:nth-child(1) { animation-delay: .1s; }
.diapo.activa .gran span:nth-child(2) { animation-delay: .5s; }
.diapo.activa .gran span:nth-child(3) { animation-delay: .9s; color: var(--acento); }

/* Escena ----------------------------------------------------------------- */

.escena {
  position: relative; margin: 0;
  background: var(--panel); border-radius: 24px;
  padding: clamp(28px, 3.2vw, 52px);
  display: flex; flex-direction: column; justify-content: center; gap: 28px;
  min-height: 280px;
}

.repetir {
  position: absolute; top: 14px; right: 18px;
  font: 500 12px Inter, sans-serif; color: var(--suave);
  background: none; border: 0; padding: 6px 8px; cursor: pointer; border-radius: 6px;
  opacity: 0; transition: opacity .3s, color .2s;
}
.escena:hover .repetir, .repetir:focus-visible { opacity: 1; }
.repetir:hover { color: var(--tinta); }

.arbol {
  position: relative; width: 100%;
  font-size: clamp(13px, 1.08vw, 16px);
  --fila: 32px; --sangria: 26px;
}
.arbol.compacto { --fila: 27px; }

.fila {
  position: absolute; left: 0; top: 0; height: var(--fila);
  display: flex; align-items: center; gap: .6em;
  white-space: nowrap; font-weight: 500; font-feature-settings: "cv11";
  transition: transform .8s var(--ease), opacity .5s var(--ease), color .3s;
  will-change: transform;
}
.fila.nuevo, .arbol.quieto .fila { transition: none; }
.fila.entra, .fila.sale { opacity: 0; }
.fila.tenue { opacity: .36; }
.fila.resalta { color: var(--acento); }
.fila.atajo, .fila.enlace { color: var(--suave); }
.fila.enlace { color: var(--acento); }
.fila.archivo { font-weight: 400; }

.ico { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }

.etq {
  font-size: .84em; font-weight: 400; color: var(--suave);
  margin-left: .9em; opacity: 0; transition: opacity .45s;
}
.etq.on { opacity: 1; }
.fila.resalta .etq { color: var(--acento); }

.guias { position: absolute; inset: 0 auto 0 0; pointer-events: none; }
.guias i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--linea); }

.fila.escribe .nombre::after {
  content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 2px;
  vertical-align: -.16em; background: var(--acento); animation: parpadeo 1s steps(1) infinite;
}
@keyframes parpadeo { 50% { opacity: 0; } }

/* Demostración del color (diapositiva del prefijo) */
.demo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; opacity: 0; transform: translateY(10px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.diapo.fin .demo { opacity: 1; transform: none; }
.vista { background: var(--fondo); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.quien { font-size: 12px; font-weight: 500; color: var(--suave); }
.carpeta-demo { display: flex; align-items: center; gap: .6em; font-weight: 500; font-size: clamp(13px, 1.08vw, 16px); color: var(--suave); transition: color .6s .4s; }
.carpeta-demo.azul { color: var(--suave); }
.diapo.fin .carpeta-demo.azul { color: #2f6bff; }
.pref { font-weight: 500; color: inherit; display: inline-block; max-width: 0; overflow: hidden; vertical-align: bottom; opacity: 0; transition: max-width .6s var(--ease) 1.4s, opacity .4s 1.4s, color .4s 1.4s; }
.diapo.fin .pref { max-width: 3em; opacity: 1; color: var(--acento); }
.nom { white-space: nowrap; }

/* Responsive ------------------------------------------------------------- */

@media (max-width: 860px) {
  .diapo { grid-template-columns: minmax(0, 1fr); align-content: start; gap: 28px; padding-top: 76px; padding-bottom: 112px; }
  .portada, .cierre { align-content: center; }
  .arbol { --fila: 28px; --sangria: 20px; font-size: 13px; }
  .arbol.compacto { --fila: 25px; }
  .etq { display: none; }
  .demo { grid-template-columns: 1fr; }
  .repetir { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-delay: 0s !important; transition-duration: .001s !important; transition-delay: 0s !important; }
}
