/* ==========================================================================
   landing/_items-timeline.css
   Estilos para landing-items.php — style: timeline
   Clases: .landing-timeline, .timeline-item, .timeline-marker, .timeline-content
   ========================================================================== */

/* ── Variables locales (sobreescribibles por tema) ───────────────────────── */
:root {
  --tl-marker-size:        2.6rem;       /* tamaño base del círculo          */
  --tl-marker-size-hover:  3rem;         /* tamaño en hover                  */
  --tl-line-width:         2px;
  --tl-line-color:         var(--landing-primary, #2a6049);
  --tl-line-color-fade:    transparent;
  --tl-marker-bg:          #fff;
  --tl-marker-color:       var(--landing-primary, #2a6049);
  --tl-marker-border:      var(--landing-primary, #2a6049);
  --tl-marker-bg-hover:    var(--landing-primary, #2a6049);
  --tl-marker-color-hover: #fff;
  --tl-marker-bg-active:   var(--landing-secondary, #e8a42a);
  --tl-marker-color-active:#fff;
  --tl-item-bg-active:     color-mix(in srgb, var(--landing-secondary, #e8a42a) 8%, transparent);
  --tl-item-radius:         var(--radius-sm, 4px);
  --tl-transition:          0.28s cubic-bezier(.34,1.2,.64,1); /* spring suave */
  --tl-transition-color:    0.2s ease;
  --tl-visible-count:       4;           /* items visibles antes del "ver más" */
}

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.landing-timeline {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  padding: 0;
}

/* ── Línea vertical ──────────────────────────────────────────────────────── */
.landing-timeline::before {
  content: '';
  position: absolute;
  left: calc(var(--tl-marker-size) / 2);
  top: calc(var(--tl-marker-size) / 2);
  bottom: 0;
  width: var(--tl-line-width);
  background: var(--tl-line-color);
  z-index: 0;
}

/* ── Fade-out de la línea cuando el timeline está colapsado ─────────────── */
.landing-timeline.tl-collapsed::before {
  background: linear-gradient(
    to bottom,
    var(--tl-line-color) 0%,
    var(--tl-line-color) 60%,
    var(--tl-line-color-fade) 100%
  );
}

/* ── Último ítem: quitar la línea ────────────────────────────────────────── */
/*
   Opción A — último visible sin línea (siempre que sea el último del DOM):
   Se logra cortando la línea del ::before del wrapper al height del penúltimo.
   La solución CSS pura más limpia es usar un pseudo en el último .timeline-item.
*/
.landing-timeline .timeline-item:last-child {
  --tl-item-is-last: 1;
}

/* La línea se pinta en el ::before del wrapper; para el último ítem
   añadimos un "borrador" blanco que cubre la línea desde su marcador hacia abajo. */
.landing-timeline .timeline-item:last-child::after {
  content: '';
  position: absolute;
  left: calc(var(--tl-marker-size) / 2 - var(--tl-line-width) / 2);
  top: calc(var(--tl-marker-size) / 2);
  bottom: 0;
  width: var(--tl-line-width);
  /* Hereda el color del fondo de la sección — se puede sobreescribir con
     .style-timeline { --tl-bg: #f0f4f2 } si el bg no es blanco */
  background: var(--tl-bg, inherit);
  z-index: 1;
}

/* ── Item ────────────────────────────────────────────────────────────────── */
.timeline-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: .75rem 1rem .75rem 0;
  border-radius: var(--tl-item-radius);
  transition: background var(--tl-transition-color);
  z-index: 2;
}

.timeline-item:not(:last-child) {
  margin-bottom: .25rem;
}

/* ── Estado: oculto (para el "ver más") ──────────────────────────────────── */
.timeline-item.tl-hidden {
  display: none;
}

/* ── Estado: active ──────────────────────────────────────────────────────── */
.timeline-item.active {
  background: var(--tl-item-bg-active);
  border-radius: var(--tl-item-radius);
}

/* ── Marcador (círculo con número) ───────────────────────────────────────── */
.timeline-marker {
  flex-shrink: 0;
  position: relative;
  z-index: 3;
  width: var(--tl-marker-size);
  height: var(--tl-marker-size);
  border-radius: 50%;
  background: var(--tl-marker-bg);
  border: 2px solid var(--tl-marker-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    width   var(--tl-transition),
    height  var(--tl-transition),
    background var(--tl-transition-color),
    border-color var(--tl-transition-color),
    box-shadow var(--tl-transition-color);
  cursor: default;
}

.timeline-marker span {
  font-family: var(--lf-headline, inherit);
  font-weight: 900;
  font-size: .85rem;
  line-height: 1;
  color: var(--tl-marker-color);
  transition: color var(--tl-transition-color), font-size var(--tl-transition);
  user-select: none;
}

/* hover en el item completo → crece el marcador */
.timeline-item:hover .timeline-marker {
  width: var(--tl-marker-size-hover);
  height: var(--tl-marker-size-hover);
  background: var(--tl-marker-bg-hover);
  border-color: var(--tl-marker-bg-hover);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--landing-primary, #2a6049) 15%, transparent);
}

.timeline-item:hover .timeline-marker span {
  color: var(--tl-marker-color-hover);
  font-size: .95rem;
}

/* ── Estado: active — marcador ───────────────────────────────────────────── */
.timeline-item.active .timeline-marker {
  background: var(--tl-marker-bg-active);
  border-color: var(--tl-marker-bg-active);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--landing-secondary, #e8a42a) 20%, transparent);
}

.timeline-item.active .timeline-marker span {
  color: var(--tl-marker-color-active);
}

/* hover sobre un active */
.timeline-item.active:hover .timeline-marker {
  background: var(--tl-marker-bg-active);
  border-color: var(--tl-marker-bg-active);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--landing-secondary, #e8a42a) 25%, transparent);
}

/* ── Contenido ───────────────────────────────────────────────────────────── */
.timeline-content {
  flex: 1;
  padding-left: .85rem;
  padding-top: .35rem;
  padding-bottom: .5rem;
}

.timeline-title {
  font-family: var(--lf-headline, inherit);
  font-size: clamp(.95rem, 1.8vw, 1.1rem);
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 .45rem;
  color: var(--gray-ink, #1a1a1a);
}

.timeline-item.active .timeline-title {
  color: color-mix(in srgb, var(--landing-secondary, #e8a42a) 60%, #1a1a1a);
}

.timeline-text {
  font-size: .9rem;
  color: #555;
  line-height: 1.65;
}

/* ── Botón "ver más / ver menos" ─────────────────────────────────────────── */
.tl-toggle-wrap {
  max-width: 860px;
  margin: 1.25rem auto 0;
  padding-left: calc(var(--tl-marker-size) + 1.25rem); /* alinea con el contenido */
}

.tl-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: none;
  border: 1.5px solid var(--landing-primary, #2a6049);
  color: var(--landing-primary, #2a6049);
  font-family: var(--lf-headline, inherit);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: .45rem 1.1rem;
  border-radius: 99px;
  cursor: pointer;
  transition:
    background var(--tl-transition-color),
    color var(--tl-transition-color),
    transform .15s ease;
}

.tl-toggle-btn:hover {
  background: var(--landing-primary, #2a6049);
  color: #fff;
  transform: translateY(-1px);
}

.tl-toggle-btn:active {
  transform: translateY(0);
}

.tl-toggle-icon {
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
  transition: transform .25s ease;
}

.tl-toggle-btn[aria-expanded="true"] .tl-toggle-icon {
  transform: rotate(180deg);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 575px) {
  :root {
    --tl-marker-size:       2.2rem;
    --tl-marker-size-hover: 2.55rem;
  }

  .timeline-item {
    gap: 1rem;
  }

  .tl-toggle-wrap {
    padding-left: calc(var(--tl-marker-size) + 1rem);
  }

  .timeline-title {
    font-size: .9rem;
  }
}

/* ── Animaciones expand/collapse ─────────────────────────────────────────── */

/* Estado inicial de items ocultos — preparados para animar */
.timeline-item.tl-hidden {
  display: none; /* ya lo tienes */
}

/* Entrando: fade + slide desde arriba */
.timeline-item.tl-entering {
  animation: tl-fade-in var(--tl-anim-duration, 320ms) ease both;
}

/* Saliendo: fade + slide hacia arriba */
.timeline-item.tl-leaving {
  animation: tl-fade-out var(--tl-anim-duration, 320ms) ease both;
  pointer-events: none;
}

@keyframes tl-fade-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes tl-fade-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}