/*
 * Sparks Type: Timeline
 * Vertical timeline with chapter headings, event cards, expand/collapse.
 * Used by: modern-middle-east, hunger-games-timeline, the-martian-timeline
 *
 * Structure:
 *   .tl (timeline container)
 *     .ch (chapter heading) → .chd (dot) + h2 + .ch-dates + .ch-overview
 *     .ev (event) → .ed (dot) + .cd (card)
 *       .cd → .cdy (date) + .ctt (title) + .cds (description)
 *             + .cex (expandable) → .exc (content) + .ctg (toggle)
 *             + .faction-tags → .faction-tag
 */

/* ══════════════════════════════════════
   Timeline Container
   ══════════════════════════════════════ */

.tl {
  position: relative;
  padding-left: 36px;
}

/* Vertical line — monochrome accent fade. Used to be a cyan→purple
   rainbow that fought the active theme on Editorial; now a
   single-accent gradient that respects whatever --accent-primary
   resolves to. */
.tl::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom,
    rgba(var(--accent-primary-rgb), 0.45) 0%,
    rgba(var(--accent-primary-rgb), 0.25) 50%,
    rgba(var(--accent-primary-rgb), 0.15) 100%
  );
}

/* RTL mirroring */
body.lang-ar .tl,
body.lang-fa .tl { padding-left: 0; padding-right: 36px; }
body.lang-ar .tl::before,
body.lang-fa .tl::before { left: auto; right: 7px; }


/* ══════════════════════════════════════
   Chapter Heading
   ══════════════════════════════════════ */

/* .ph is a legacy alias used by hunger-games-timeline */
.ch, .ph {
  position: relative;
  margin: 48px 0 32px;
  scroll-margin-top: 80px;
}

.ch:first-child, .ph:first-child { margin-top: 0; }

/* Chapter dot on the timeline */
.chd, .phd {
  position: absolute;
  left: -36px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary) 30%, var(--accent-secondary) 100%);
  box-shadow: 0 0 12px rgba(var(--accent-primary-rgb), 0.5);
}

body.lang-ar .chd, body.lang-ar .phd,
body.lang-fa .chd, body.lang-fa .phd { left: auto; right: -36px; }

.ch h2, .ph h2 {
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-semibold);
  color: var(--white);
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.ch-dates {
  font-size: var(--font-size-badge);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-primary);
  opacity: 0.7;
  margin-bottom: 8px;
}

.ch-overview {
  font-size: var(--font-size-small);
  color: var(--text-primary);
  margin-bottom: 20px;
  line-height: 1.6;
}


/* ══════════════════════════════════════
   Event Card
   ══════════════════════════════════════ */

/* Event card — rendered immediately, no scroll-triggered reveal.
   Earlier versions used a staggered fade-in (0-0.8s delay × 0.5s
   animation) gated by an IntersectionObserver. Removed 2026-05-04:
   on long timelines the cascade produced a visible blank-black-area
   while the observer caught up, jarring on fast scrolls. The
   information-density of an event card is the value; the animation
   was decoration that cost more than it gave. */
.ev {
  position: relative;
  margin-bottom: 16px;
}

/* Event dot */
.ed {
  position: absolute;
  left: -33px;
  top: 20px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  /* Dot outline used to be a hardcoded white tint (rgba(255,255,255,0.2))
     which became invisible on Editorial's parchment and Mono's white page.
     --border-strong resolves per-theme: white-on-dark for Nebula/Mono
     Dark, dark-on-light for Editorial/Mono Light. */
  border: 2px solid var(--border-strong);
  transition: transform 0.3s, box-shadow 0.3s;
}

body.lang-ar .ed,
body.lang-fa .ed { left: auto; right: -33px; }

.ev:hover .ed {
  transform: scale(1.4);
}

/* Event card body —
   Theme-tokenised: bg, border, blur all flow from the active theme's
   --card-* and --glass-* slots. Nebula resolves to dark translucent
   navy with glass blur; Editorial resolves to light parchment card
   (lighter than page, per its book-metaphor); Mono Light resolves to
   flat white hairline; Mono Dark resolves to flat #0a0e14. */
.cd {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 18px 22px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: border-color var(--transition-base),
              background var(--transition-base);
  position: relative;
  overflow: hidden;
}

/* No translateX / scale on hover — moving cards during hover shifts
   the timeline's visual rhythm (dots, spine, date labels all stay put
   while the card slides) which reads as jittery. Feedback is border +
   bg tint only, matching the global card-hover rule. */
.cd:hover {
  border-color: var(--card-border-hover);
  background: color-mix(in srgb, var(--card-bg) 92%, var(--accent-primary) 8%);
}

/* Event card content */
.cdy {
  font-size: var(--font-size-badge);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-primary);
  opacity: 0.7;
  margin-bottom: 4px;
}

.ctt {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-semibold);
  color: var(--white);
  margin-bottom: 6px;
  line-height: 1.4;
}

.cds {
  font-size: var(--font-size-small);
  color: var(--text-primary);
  line-height: 1.7;
  opacity: 0.88;
  margin-bottom: 8px;
}


/* ══════════════════════════════════════
   Expand/Collapse
   ══════════════════════════════════════ */

.cex {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s;
  opacity: 0;
}

.cex.open { opacity: 1; }

.exc {
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.exl {
  font-size: var(--font-size-badge);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-primary);
  opacity: 0.6;
  margin-bottom: 6px;
}

.ext {
  font-size: var(--font-size-small);
  color: var(--text-secondary);
  line-height: 1.8;
}

/* Toggle button */
.ctg {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-badge);
  font-weight: var(--font-weight-medium);
  color: var(--accent-primary);
  opacity: 0.5;
  margin-top: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
  user-select: none;
}

.ctg:hover { opacity: 0.9; }
.ctg svg { width: 12px; height: 12px; transition: transform 0.3s; }
.ctg.open svg { transform: rotate(180deg); }

/* Toggle label — i18n text span inside .ctg.
   Used as <span class="tl2" data-lang="XX">Read more</span>.
   No additional visual styling needed; inherits color, size, weight
   from the parent .ctg. Registered here so the lint can verify it. */
.tl2 { /* inherits from .ctg */ }


/* ══════════════════════════════════════
   Faction Tags
   ══════════════════════════════════════ */

.faction-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.faction-tag {
  font-size: var(--font-size-badge);
  font-weight: var(--font-weight-semibold);
  padding: 4px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}


/* ══════════════════════════════════════
   Quote (in-timeline)
   ══════════════════════════════════════ */

.quote {
  border-left: 2px solid rgba(var(--accent-primary-rgb), 0.3);
  padding-left: 16px;
  margin: 12px 0;
  font-style: italic;
  font-size: var(--font-size-small);
  color: var(--text-secondary);
  line-height: 1.7;
}

body.lang-ar .quote,
body.lang-fa .quote {
  border-left: none;
  border-right: 2px solid rgba(var(--accent-primary-rgb), 0.3);
  padding-left: 0;
  padding-right: 16px;
}


/* ══════════════════════════════════════
   Timeline Divider
   ══════════════════════════════════════ */

.fl {
  width: 60px;
  height: 3px;
  background: linear-gradient(135deg, var(--accent-primary) 30%, var(--accent-secondary) 100%);
  border-radius: 2px;
  margin: 0 auto 16px;
}


/* ══════════════════════════════════════
   Mobile
   ══════════════════════════════════════ */

@media (max-width: 600px) {
  .tl { padding-left: 30px; }
  body.lang-ar .tl,
  body.lang-fa .tl { padding-left: 0; padding-right: 30px; }

  .ed { left: -27px; }
  body.lang-ar .ed,
  body.lang-fa .ed { left: auto; right: -27px; }

  .chd, .phd { left: -30px; }
  body.lang-ar .chd, body.lang-ar .phd,
  body.lang-fa .chd, body.lang-fa .phd { left: auto; right: -30px; }

  .cd { padding: 14px 16px; }
  .ctt { font-size: var(--font-size-small); }
}
