/* =============================================
   TIMELINE HISTORY — Scrollytelling Etapa 4
   3 de febrero de 1813 — pin and scrub con GSAP
   ============================================= */

.tlh-section {
  background: #0a0a0a;
  color: #fff;
  position: relative;
  overflow: hidden;
}

/* ─── Default layout (mobile / no-JS / reduced motion):
       stack vertical, todo visible, sin pin. ─── */
.tlh-sticky-wrap {
  padding: 5rem 5vw;
}

.tlh-aside {
  position: sticky;
  top: 80px;
  z-index: 2;
  margin-bottom: 3rem;
  padding: 1rem 0;
  background: linear-gradient(180deg, rgba(10,10,10,0.92) 0%, rgba(10,10,10,0.82) 70%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tlh-frames {
  position: relative;
}

.tlh-frame {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 5rem;
}

/* ─── Desktop scrollytelling layout (solo cuando JS marca la
       sección como `is-scrollytelling`). Pin horizontal con
       absolute frames apilados, primera visible. ─── */
@media (min-width: 769px) {
  .tlh-section.is-scrollytelling .tlh-sticky-wrap {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 4rem;
    height: 100vh;
    padding: 6vh 5vw;
    align-items: center;
  }

  .tlh-section.is-scrollytelling .tlh-aside {
    position: relative;
    top: 0;
    margin-bottom: 0;
    padding: 0;
    background: none;
    backdrop-filter: none;
  }

  .tlh-section.is-scrollytelling .tlh-frames {
    position: relative;
    height: 100%;
  }

  .tlh-section.is-scrollytelling .tlh-frame {
    position: absolute;
    inset: 0;
    grid-template-columns: 1.15fr 1fr;
    gap: 3rem;
    margin-bottom: 0;
    align-items: center;
    opacity: 0;
    will-change: opacity, transform;
  }

  .tlh-section.is-scrollytelling .tlh-frame[data-frame="1"] {
    opacity: 1;
  }
}

@media (min-width: 1200px) {
  .tlh-section.is-scrollytelling .tlh-sticky-wrap {
    grid-template-columns: 380px 1fr;
    gap: 5rem;
    padding: 6vh 6vw;
  }
}

/* ─── Aside content ─── */
.tlh-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--c-rojo);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.25rem;
}
.tlh-eyebrow::before {
  content: '';
  width: 32px;
  height: 2px;
  background: var(--c-rojo);
  flex-shrink: 0;
}

.tlh-date {
  display: flex;
  flex-direction: column;
  line-height: 1;
  margin-bottom: 2rem;
}
.tlh-date__day {
  font-size: clamp(5rem, 11vw, 10rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #fff;
  line-height: 0.85;
}
.tlh-date__month {
  font-size: clamp(1.2rem, 2.5vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-top: 0.5rem;
  color: rgba(255,255,255,0.85);
}
.tlh-date__year {
  font-size: clamp(1.6rem, 3.5vw, 2.75rem);
  font-weight: 800;
  color: var(--c-granadero);
  margin-top: 0.5rem;
  letter-spacing: -0.01em;
}

/* Progress indicator (current / total) */
.tlh-progress {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}
.tlh-progress__current {
  font-size: clamp(1.4rem, 2vw, 1.75rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.tlh-progress__divider {
  margin: 0 4px;
  opacity: 0.4;
}
.tlh-progress__total {
  font-weight: 500;
}

.tlh-progress-bar {
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.08);
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
  border-radius: 2px;
}
.tlh-progress-bar__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--c-rojo), var(--c-granadero));
  transform: scaleX(0);
  transform-origin: left center;
  /* sin transition: la actualizamos vía rAF en scroll */
}

.tlh-scroll-hint {
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
}

/* ─── Frame: media + content ─── */
.tlh-frame__media {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--depth-4);
  aspect-ratio: 4 / 5;
  max-height: 70vh;
}

@media (min-width: 769px) {
  .tlh-section.is-scrollytelling .tlh-frame__media {
    aspect-ratio: auto;
    height: 72vh;
    max-height: none;
  }
}

.tlh-frame__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.tlh-frame__media::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.55) 100%),
    linear-gradient(110deg, transparent 60%, rgba(10,10,10,0.20) 100%);
  pointer-events: none;
}

.tlh-frame__content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 52ch;
}

.tlh-frame__time {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-granadero);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.tlh-frame__time::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--c-granadero);
  flex-shrink: 0;
}

.tlh-frame__title {
  font-size: clamp(1.75rem, 3.5vw, 3rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.025em;
  color: #fff;
}

.tlh-frame__text {
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);
  line-height: 1.7;
  color: rgba(255,255,255,0.72);
  font-weight: 300;
}

/* ─── Featured frame (cita Cabral): borde dorado granadero ─── */
.tlh-frame--featured .tlh-frame__content {
  position: relative;
  padding-left: 2rem;
  border-left: 3px solid var(--c-granadero);
}

.tlh-quote {
  font-size: clamp(1.65rem, 3.2vw, 2.5rem);
  font-weight: 700;
  line-height: 1.18;
  font-style: italic;
  color: #fff;
  position: relative;
  margin: 0.5rem 0;
}

/* Split-text: cada palabra está en un wrapper con
   overflow:hidden, así el inner puede asomarse desde abajo
   sin desbordar la línea. Aplica tanto a la cita Cabral
   como a los títulos de cada frame. */
.tlh-quote__word,
.tlh-title__word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}
.tlh-quote__word       { line-height: 1.18; }
.tlh-title__word       { line-height: 1.06; }

.tlh-quote__word-inner,
.tlh-title__word-inner {
  display: inline-block;
  will-change: transform;
}

.tlh-quote::before {
  content: '«';
  font-family: 'Georgia', 'Times New Roman', serif;
  font-style: normal;
  font-size: 1.6em;
  position: absolute;
  left: -0.9em;
  top: -0.35em;
  color: var(--c-granadero);
  opacity: 0.55;
  line-height: 1;
  font-weight: 400;
}

.tlh-quote__author {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--c-granadero);
  font-style: normal;
  text-transform: uppercase;
}

/* =============================================
   DUST PARTICLES — Frame 5 "El Combate" (Etapa 6 · ítem 3)
   Inyectadas vía JS, animadas con @keyframes y custom
   properties por partícula. Solo aparecen cuando frame 5
   está visible. prefers-reduced-motion las oculta.
   ============================================= */
.tlh-dust {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;        /* sobre la imagen y sobre el ::after gradient */
  opacity: 0;
  transition: opacity 0.6s ease;
}
.tlh-dust.is-active { opacity: 1; }

.tlh-dust__particle {
  position: absolute;
  left:   var(--x);
  bottom: var(--y);
  width:  var(--size);
  height: var(--size);
  background: var(--color, rgba(255, 255, 255, 0.9));
  border-radius: 50%;
  opacity: 0;
  filter: blur(0.5px);
  animation: tlhDustFloat var(--dur) linear infinite var(--delay);
  animation-play-state: paused;  /* perf: pausada hasta que el frame esté visible */
  will-change: transform, opacity;
}

.tlh-dust.is-active .tlh-dust__particle {
  animation-play-state: running;
}

@keyframes tlhDustFloat {
  0%   { opacity: 0;            transform: translate3d(0, 0, 0); }
  10%  { opacity: var(--peak);  }
  85%  { opacity: var(--peak);  }
  100% { opacity: 0;            transform: translate3d(var(--drift), calc(var(--rise) * -1), 0); }
}

@media (prefers-reduced-motion: reduce) {
  .tlh-dust { display: none !important; }
}

/* ─── Reduced motion: pisa el layout de scrollytelling ─── */
@media (prefers-reduced-motion: reduce) {
  .tlh-section.is-scrollytelling .tlh-sticky-wrap,
  .tlh-section .tlh-sticky-wrap {
    grid-template-columns: 1fr !important;
    height: auto !important;
    padding: 4rem 5vw !important;
  }
  .tlh-section.is-scrollytelling .tlh-aside,
  .tlh-section .tlh-aside {
    position: sticky !important;
    top: 80px !important;
    margin-bottom: 3rem !important;
    background: linear-gradient(180deg, rgba(10,10,10,0.92), rgba(10,10,10,0.82) 70%, transparent) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    padding: 1rem 0 !important;
  }
  .tlh-section.is-scrollytelling .tlh-frame,
  .tlh-section .tlh-frame {
    position: relative !important;
    inset: auto !important;
    opacity: 1 !important;
    transform: none !important;
    margin-bottom: 4rem !important;
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  .tlh-section.is-scrollytelling .tlh-frame__media,
  .tlh-section .tlh-frame__media {
    aspect-ratio: 4/5 !important;
    height: auto !important;
    max-height: 60vh !important;
  }
}
