/* =========================================================
   Caso «De 4 a 43» — historia editorial que avanza con el scroll
   Fondo crema, texto negro, acentos amarillos. Línea central en
   escritorio (capítulos alternados) y a la izquierda en móvil.
   ========================================================= */

.tl {
  --paper: #f1ede4;
  --text: rgba(21, 18, 14, .78);
  --rule: rgba(21, 18, 14, .12);
  --mid: clamp(96px, 10vw, 150px);   /* calle central donde va la línea */
  --maxw-tl: 1360px;

  position: relative;
  background: var(--paper);
  color: var(--ink);
  padding-block: clamp(104px, 12vw, 176px) clamp(96px, 11vw, 160px);
  overflow: hidden;
}

/* ---------- Cabecera ---------- */
.tl__head {
  max-width: var(--maxw-tl);
  margin-inline: auto;
  padding-inline: var(--gutter);
  text-align: center;
}
.tl__eyebrow {
  display: inline-flex;
  margin: 0;
  border: 1px solid rgba(21, 18, 14, .25);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.tl__eyebrow span { padding: .75em 1.25em; }
.tl__eyebrow span + span { border-left: 1px solid rgba(21, 18, 14, .25); background: var(--yellow); border-radius: 0 999px 999px 0; }

.tl__intro {   /* titular de presentación del caso, por encima de «De 4 a 43» */
  max-width: 20ch;
  margin: clamp(28px, 3vw, 44px) auto 0;
  font-size: clamp(30px, 3.4vw, 52px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.tl__intro::after {   /* separador corto entre el titular y «De 4 a 43» */
  content: "";
  display: block;
  width: 1px;
  height: clamp(40px, 4.4vw, 68px);
  margin: clamp(24px, 2.6vw, 40px) auto 0;
  background: rgba(21, 18, 14, .3);
}

.tl__title {
  margin: clamp(24px, 2.6vw, 40px) 0 0;
  font-size: clamp(64px, 11vw, 176px);
  font-weight: 800;
  line-height: .88;
  letter-spacing: -.055em;
}
.tl__title span {
  display: block;
  margin-top: .16em;
  font-size: .36em;
  letter-spacing: -.035em;
}
.tl__title span::after {   /* subrayado amarillo de marcador */
  content: "";
  display: block;
  width: 3.2em;
  height: .16em;
  margin: .32em auto 0;
  border-radius: 99px;
  background: var(--yellow);
}
.tl__lead {
  max-width: 46ch;
  margin: clamp(26px, 3vw, 40px) auto 0;
  font-size: clamp(20px, 1.8vw, 26px);
  line-height: 1.45;
  color: var(--text);
}

/* ---------- Capítulos y línea ---------- */
.tl__chapters {
  position: relative;
  display: grid;
  gap: clamp(120px, 13vw, 200px);
  max-width: var(--maxw-tl);
  margin: clamp(88px, 10vw, 150px) auto 0;
  padding: 0 var(--gutter);
  list-style: none;
}

.tl__rail {
  position: absolute;
  top: 0;
  bottom: 0;                       /* con JavaScript, termina en el punto de 2026 */
  left: calc(50% - 2px);
  width: 4px;
  border-radius: 4px;
  background: var(--rule);
  overflow: hidden;
}
.tl__line {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--yellow);
  transform-origin: top;
  transform: scaleY(0);
}
html:not(.js) .tl__line { transform: none; }

.tl__chapter {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--mid) minmax(0, 1fr);
  align-items: center;
}
.tl__chapter > .tl__text { grid-column: 1; grid-row: 1; justify-self: end; text-align: right; }
.tl__chapter > .tl__node { grid-column: 2; grid-row: 1; }
.tl__chapter > :is(.tl__visual, .tl__person) { grid-column: 3; grid-row: 1; }
/* Capítulos alternos: el texto a la derecha y la escena a la izquierda */
.tl__chapter--flip > .tl__text { grid-column: 3; justify-self: start; text-align: left; }
.tl__chapter--flip > .tl__visual { grid-column: 1; }

.tl__node {
  position: relative;
  z-index: 2;
  justify-self: center;
  width: 24px;
  height: 24px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  transition: background-color .4s ease, transform .5s var(--ease-out);
}
.tl__chapter.is-on .tl__node { background: var(--yellow); transform: scale(1.2); }

/* ---------- Textos ---------- */
.tl__text { max-width: 33rem; }

.tl__kicker {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text);
}
.tl__kicker span {
  display: inline-block;
  padding: .35em .75em;
  border-radius: 999px;
  background: var(--ink);
  color: var(--yellow);
  letter-spacing: .12em;
}

.tl__heading {
  margin: 20px 0 0;
  font-size: clamp(38px, 4.6vw, 72px);
  font-weight: 800;
  line-height: .98;
  letter-spacing: -.04em;
  text-wrap: balance;
}
.tl__heading em {
  font-style: normal;
  background: linear-gradient(transparent 62%, var(--yellow) 62%, var(--yellow) 92%, transparent 92%);
}

.tl__text > p:not(.tl__kicker) {
  margin: 26px 0 0;
  text-wrap: pretty;          /* evita palabras sueltas en la última línea */
  font-size: clamp(20px, 1.7vw, 25px);
  line-height: 1.52;
  color: var(--text);
}
.tl__chapter:not(.tl__chapter--flip) .tl__text > p:not(.tl__kicker) { margin-left: auto; }

/* ---------- Personas: Pablo (2007) y Rocío (2020), recortadas sobre un signo amarillo ---------- */
.tl__person {
  position: relative;
  justify-self: start;
  margin: 0 0 0 calc(var(--mid) * -.5);   /* el signo cruza la línea */
}
.tl__person--pablo { width: min(100%, 440px); }
.tl__person--rocio { width: min(100%, 380px); }
.tl__glyph {
  position: absolute;
  left: 0;
  font-weight: 800;
  line-height: .72;
  letter-spacing: -.07em;
  color: var(--yellow);
}
.tl__person--pablo .tl__glyph { bottom: 16%; font-size: clamp(260px, 30vw, 440px); }
.tl__person--rocio .tl__glyph { bottom: 20%; font-size: clamp(240px, 26vw, 380px); letter-spacing: 0; }
.tl__person picture {
  position: relative;
  display: block;
  margin-left: auto;
}
.tl__person--pablo picture { width: 82%; }
.tl__person--rocio picture { width: 60%; margin-right: 6%; }
.tl__person img {
  display: block;
  width: 100%;
  height: auto;          /* proporción original: no se deforma */
}
.tl__person figcaption {
  max-width: 34em;
  text-wrap: balance;
  margin: 18px 0 0 auto;
  font-size: 16px;
  line-height: 1.45;
  text-align: right;
  color: var(--text);
}
/* El pie empieza siempre a la derecha de la línea, aunque la figura la cruce */
.tl__person figcaption { padding-left: calc(var(--mid) * .5 + 16px); }
.tl__person figcaption strong { display: block; color: var(--ink); font-weight: 700; }

/* ---------- Escenas (provisionales, sustituibles por material real) ---------- */
.tl__visual {
  position: relative;
  width: min(100%, 520px);
}
.tl__chapter:not(.tl__chapter--flip) > .tl__visual { justify-self: start; }
.tl__chapter--flip > .tl__visual { justify-self: end; }

.tl__scene {
  margin: 0;
  padding: 8px;
  border-radius: 6px;
  background: #fffaf3;
  box-shadow: 0 1px 0 rgba(21, 18, 14, .06), 0 18px 40px -18px rgba(21, 18, 14, .35);
}
.tl__scene img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--ar, 4 / 3);
  object-fit: cover;
  border-radius: 3px;
}

/* Proporción de cada ventana según su imagen (no se usa style="" por la CSP de _headers) */
.tl__scene--wide { --ar: 16 / 9; }
.tl__scene--square { --ar: 1 / 1; }
.tl__scene--tall { --ar: 640 / 761; }
.tl__scene--photo { --ar: 640 / 561; }

.tl__visual--one .tl__scene { width: 82%; transform: rotate(-2deg); }
.tl__chapter--flip .tl__visual--one .tl__scene { margin-left: auto; }

/* Collage de cuatro: fragmentos pequeños, con aire entre ellos */
.tl__visual--four { height: clamp(360px, 32vw, 460px); }
.tl__visual--four .tl__scene { position: absolute; width: 47%; }
.tl__visual--four .tl__scene:nth-child(1) { top: 0; left: 0; transform: rotate(-3deg); }
.tl__visual--four .tl__scene:nth-child(2) { top: 6%; right: 0; transform: rotate(2deg); }
.tl__visual--four .tl__scene:nth-child(3) { bottom: 2%; left: 6%; width: 40%; transform: rotate(1.5deg); }   /* la cuadrada, algo más estrecha */
.tl__visual--four .tl__scene:nth-child(4) { bottom: 0; right: 3%; transform: rotate(-2deg); z-index: 1; }

/* Collage de tres: pequeñas, solapadas y algo giradas */
.tl__visual--three { height: clamp(380px, 35vw, 480px); }
.tl__visual--three .tl__scene { position: absolute; width: 54%; }
.tl__visual--three .tl__scene:nth-child(1) { top: 0; left: 0; transform: rotate(-3deg); }
.tl__visual--three .tl__scene:nth-child(2) { top: 9%; right: 0; transform: rotate(2.5deg); z-index: 1; }
.tl__visual--three .tl__scene:nth-child(3) { bottom: 0; left: 14%; width: 48%; transform: rotate(-1deg); z-index: 2; }

.tl__visual--two { height: clamp(340px, 33vw, 450px); }
.tl__visual--two .tl__scene { position: absolute; width: 62%; }
.tl__visual--two .tl__scene:nth-child(1) { top: 0; right: 0; transform: rotate(2deg); }
.tl__visual--two .tl__scene:nth-child(2) { bottom: 0; left: 0; width: 54%; transform: rotate(-3deg); z-index: 1; }

/* ---------- 2026: el 43 sobre la línea ---------- */
.tl__chapter--end {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  text-align: center;
}
.tl__chapter--end > * { grid-column: 1 !important; grid-row: auto !important; }
.tl__chapter--end .tl__kicker { margin-top: 22px; }
.tl__count {
  position: relative;
  z-index: 1;
  margin: 18px 0 0;
  padding-inline: .06em;
  background: var(--paper);          /* tapa la línea: la historia termina aquí */
  font-size: clamp(220px, 32vw, 480px);
  font-weight: 800;
  line-height: .76;
  letter-spacing: -.07em;
  color: var(--yellow);
  font-variant-numeric: tabular-nums;
}
.tl__chapter--end .tl__heading { position: relative; z-index: 1; margin-top: 24px; background: var(--paper); padding-inline: .3em; }
.tl__end-text {
  position: relative;
  z-index: 1;
  max-width: 38ch;
  margin: 20px 0 0;
  padding: 0 .6em .2em;
  background: var(--paper);
  font-size: clamp(19px, 1.6vw, 24px);
  line-height: 1.5;
  color: var(--text);
}
.tl__end-text strong { color: var(--ink); font-weight: 700; }

/* ---------- Cierre comercial ---------- */
.tl__close {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "frida title" "frida sub" "frida cta";
  align-items: end;
  column-gap: clamp(20px, 3vw, 48px);
  max-width: 1040px;
  margin: clamp(104px, 12vw, 176px) auto 0;
  padding: clamp(36px, 4vw, 56px) var(--gutter) 0;
  border-top: 2px solid var(--ink);
}
.tl__frida { grid-area: frida; display: block; width: clamp(96px, 11vw, 150px); }
.tl__frida img { display: block; width: 100%; height: auto; }
.tl__close-title {
  grid-area: title;
  margin: 0;
  font-size: clamp(32px, 4.2vw, 64px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.04em;
  text-wrap: balance;
}
.tl__close-sub {
  grid-area: sub;
  margin: 16px 0 0;
  font-size: clamp(22px, 2.2vw, 34px);
  font-weight: 700;
  letter-spacing: -.02em;
}
.tl__close-sub span {
  background: linear-gradient(transparent 62%, var(--yellow) 62%, var(--yellow) 92%, transparent 92%);
}
.tl__cta {
  grid-area: cta;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: .6em;
  margin-top: 26px;
  padding: 1em 1.7em;
  border-radius: 999px;
  background: var(--ink);
  color: var(--yellow);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  transition: transform .2s var(--ease-out), background-color .2s ease;
}
.tl__cta:hover { transform: translateY(-2px); background: #000; }
.tl__cta:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ---------- Apariciones (solo con JavaScript) ---------- */
.js .tl__chapter > :not(.tl__node) {
  opacity: 0;
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
}
.js .tl__chapter > .tl__text { transform: translateX(-28px); }
.js .tl__chapter--flip > .tl__text { transform: translateX(28px); }
.js .tl__chapter > :is(.tl__visual, .tl__person) { transform: translateY(36px); transition-delay: .15s; }
.js .tl__chapter--end > * { transform: translateY(24px); }
.js .tl__chapter--end > .tl__count { transition-delay: .1s; }
.js .tl__chapter--end > .tl__heading { transition-delay: .25s; }
.js .tl__chapter--end > .tl__end-text { transition-delay: .35s; }
.js .tl__chapter.is-in > :not(.tl__node) { opacity: 1; transform: none; }

/* Las escenas de cada collage entran escalonadas, manteniendo su giro */
.js .tl__visual .tl__scene { opacity: 0; translate: 0 18px; transition: opacity .7s ease, translate .9s var(--ease-out); transition-delay: calc(.25s + var(--i, 0) * .14s); }
.js .tl__chapter.is-in .tl__visual .tl__scene { opacity: 1; translate: 0 0; }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .tl { --mid: 80px; }
  .tl__visual--three { height: 440px; }
}

/* ---------- Móvil: una columna, la línea a la izquierda ---------- */
@media (max-width: 760px) {
  .tl { --rx: calc(var(--gutter) + 9px); --pad: 48px; }
  .tl__eyebrow { font-size: 10px; letter-spacing: .16em; }
  .tl__eyebrow { flex-direction: column; align-items: center; border-radius: 16px; }   /* la etiqueta pasa a dos pisos */
  .tl__eyebrow span { padding: .7em 1.2em; white-space: nowrap; }
  .tl__eyebrow span + span { align-self: stretch; border-left: 0; border-top: 1px solid rgba(21, 18, 14, .25); border-radius: 0 0 15px 15px; }
  .tl__intro { max-width: 15ch; font-size: clamp(25px, 6.8vw, 30px); }
  .tl__title span::after { width: 2.6em; }
  .tl__chapters { gap: 96px; }
  .tl__rail { left: calc(var(--rx) - 2px); }

  .tl__chapter,
  .tl__chapter--flip {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 32px;
    padding-left: var(--pad);
  }
  .tl__chapter > *,
  .tl__chapter--flip > * { grid-column: 1 !important; grid-row: auto !important; }
  .tl__chapter > .tl__text,
  .tl__chapter--flip > .tl__text { justify-self: start; text-align: left; max-width: none; }
  .tl__chapter:not(.tl__chapter--flip) .tl__text > p:not(.tl__kicker) { margin-left: 0; }
  .tl__chapter > .tl__node { grid-column: auto !important; grid-row: auto !important; } /* se sitúa respecto al capítulo */
  .tl__node {
    position: absolute;
    top: 2px;
    left: calc(var(--rx) - var(--gutter) - 11px);
    width: 22px;
    height: 22px;
  }
  .tl__heading { font-size: clamp(34px, 9.4vw, 44px); }
  .tl__text > p:not(.tl__kicker) { font-size: 19px; }

  .tl__person { justify-self: stretch; width: 100%; margin: 0; }
  .tl__person--pablo .tl__glyph { font-size: 64vw; bottom: 22%; }
  .tl__person--pablo picture { width: 74%; }
  .tl__person--rocio .tl__glyph { font-size: 58vw; bottom: 26%; }
  .tl__person--rocio picture { width: 50%; margin-right: 8%; }
  .tl__person figcaption { font-size: 15px; padding-left: 0; }
  .tl__visual--four { height: 72vw; }
  .tl__visual--four .tl__scene { width: 49%; }
  .tl__visual--four .tl__scene:nth-child(3) { width: 42%; }

  .tl__visual { width: 100%; justify-self: stretch !important; }
  .tl__visual--one .tl__scene { width: 88%; }
  .tl__visual--three { height: 136vw; }
  .tl__visual--three .tl__scene { width: 68%; }
  .tl__visual--three .tl__scene:nth-child(2) { top: 30%; }
  .tl__visual--three .tl__scene:nth-child(3) { width: 62%; left: 4%; }
  .tl__visual--two { height: 104vw; }
  .tl__visual--two .tl__scene { width: 76%; }
  .tl__visual--two .tl__scene:nth-child(2) { width: 68%; }

  .js .tl__chapter > .tl__text, .js .tl__chapter--flip > .tl__text { transform: translateY(24px); }

  .tl__chapter--end { justify-items: start; text-align: left; }
  .tl__chapter--end .tl__node { top: 26px; }
  .tl__count { font-size: 46vw; padding: 0; background: none; }
  .tl__chapter--end .tl__heading, .tl__end-text { padding: 0; background: none; }

  .tl__close {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "frida" "title" "sub" "cta";
    margin-inline: var(--gutter);
    padding-inline: 0;
  }
  .tl__frida { width: 96px; margin-bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .js .tl__chapter > :not(.tl__node),
  .js .tl__visual .tl__scene { opacity: 1; transform: none; translate: none; transition: none; }
  .js .tl__chapter > .tl__person, .js .tl__chapter > .tl__visual { transform: none; }
  .tl__node { transition: none; }
}
