/* ═══════════════════════════════════════════════════════════════════════════
   Public Interactive Timeline — victim detail page
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Viewport ─────────────────────────────────────────────────────────────── */

.victim-timeline-wrap {
  position: relative;
  height: 280px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.victim-timeline-wrap:active {
  cursor: grabbing;
}

/* ── Rail (the scrollable horizontal strip) ───────────────────────────────── */

.tl-rail {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  will-change: transform;
  /* width set by JS */
}

/* ── Horizontal line ──────────────────────────────────────────────────────── */

.tl-line {
  position: absolute;
  top: 80%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent-gold);
  opacity: 0.25;
  pointer-events: none;
}

/* ── Nodes (circles / pills on the line) ──────────────────────────────────── */

.tl-node {
  position: absolute;
  top: 80%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 2;
}

html[dir="rtl"] .tl-node {
  /* Nodes use `right:` in RTL, so centering shifts right instead of left */
  transform: translate(50%, -50%);
}

.tl-node-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  background: transparent;
  box-sizing: border-box;
  transition: background 0.3s var(--ease-smooth), border-color 0.3s var(--ease-smooth),
              box-shadow 0.3s var(--ease-smooth);
}

/* Date-range events: pill shape */
.tl-node-range .tl-node-dot {
  border-radius: 6px;
  width: 24px;  /* overridden by JS for proportional width */
  height: 12px;
}

/* Birth / death: filled */
.tl-node-life .tl-node-dot {
  background: var(--accent-gold);
  box-shadow: 0 0 8px rgba(197, 168, 128, 0.3);
}

/* Active node (under head) */
.tl-node.tl-active .tl-node-dot {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  box-shadow: 0 0 12px rgba(197, 168, 128, 0.5);
}

/* ── Labels (above the line) ──────────────────────────────────────────────── */

.tl-label {
  position: absolute;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  z-index: 3;
}

html[dir="rtl"] .tl-label {
  transform: translateX(50%);
}

.tl-label-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s var(--ease-smooth);
}

.tl-label.tl-active .tl-label-text {
  color: var(--accent-gold);
}

.tl-label-stem {
  width: 1px;
  background: var(--glass-border);
  margin: 0 auto;
  transition: background 0.3s var(--ease-smooth);
}

.tl-label.tl-active .tl-label-stem {
  background: var(--accent-gold);
  opacity: 0.5;
}

/* ── Head (the fixed pointer at center) ───────────────────────────────────── */

.tl-head {
  position: absolute;
  left: 50%;
  top: 80%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tl-head-arrow {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 9px solid var(--accent-gold);
  margin-top: 10px;
  opacity: 0.8;
  filter: drop-shadow(0 0 4px rgba(197, 168, 128, 0.3));
}

.tl-head-date {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

html[lang="fa"] .tl-head-date {
  font-family: var(--font-fa);
}

/* ── Expanded card (below timeline on active node) ────────────────────────── */

.tl-card {
  position: absolute;
  top: auto;
  bottom: calc(20% + 20px); /* above the line; 20% = distance from wrap bottom to line */
  z-index: 8;
  transform: translateX(-50%);
  width: 260px;
  max-width: 80vw;
  background: var(--bg-tl-card);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.35s var(--ease-smooth), max-height 0.4s var(--ease-smooth),
              padding 0.35s var(--ease-smooth);
  pointer-events: none;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

html[dir="rtl"] .tl-card {
  transform: translateX(50%);
}

.tl-card.tl-card-visible {
  opacity: 1;
  max-height: 200px;
  padding: 14px;
  pointer-events: auto;
}

.tl-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.tl-card-img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 4px;
}

.tl-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Full overlay ─────────────────────────────────────────────────────────── */

.tl-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0.25s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.tl-overlay.tl-overlay-visible {
  opacity: 1;
  visibility: visible;
}

.tl-overlay-card {
  position: relative;
  width: 420px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 28px;
  transform: scale(0.95);
  transition: transform 0.25s var(--ease-smooth);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.tl-overlay.tl-overlay-visible .tl-overlay-card {
  transform: scale(1);
}

html[data-theme="light"] .tl-overlay-card {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(90, 75, 75, 0.15);
}

html[data-theme="light"] .tl-overlay-close {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--text-primary);
}

html[data-theme="light"] .tl-overlay-close:hover {
  background: rgba(0, 0, 0, 0.14);
  border-color: rgba(0, 0, 0, 0.32);
}

.tl-overlay-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--text-primary);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
  z-index: 2;
  line-height: 1;
}

html[dir="rtl"] .tl-overlay-close {
  right: auto;
  left: 14px;
}

.tl-overlay-close:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
  transform: scale(1.1);
}

.tl-overlay-img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 16px;
}

.tl-overlay-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.4;
}

.tl-overlay-date {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}

.tl-overlay-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
}

.tl-overlay-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  background: transparent;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.tl-overlay-link:hover {
  background: var(--accent-gold);
  color: var(--bg-dark);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .victim-timeline-wrap {
    height: 300px;
    border-radius: 12px;
  }

  .tl-card {
    width: 220px;
  }

  .tl-card-img {
    height: 80px;
  }

  .tl-overlay-card {
    padding: 20px;
  }

  .tl-overlay-title {
    font-size: 17px;
  }
}

/* ── Print ────────────────────────────────────────────────────────────────── */

.tl-print-section { display: none; }

@media print {
  .victim-timeline-wrap,
  .tl-divider,
  .tl-overlay {
    display: none !important;
  }

  .tl-print-section {
    display: block;
    margin-top: 24pt;
  }

  .tl-print-section h3 {
    font-size: 11pt;
    font-weight: 700;
    margin-bottom: 8pt;
  }

  .tl-print-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .tl-print-list li {
    display: flex;
    gap: 8pt;
    align-items: flex-start;
    padding: 4pt 0;
    border-bottom: 0.5pt solid #ddd;
    font-size: 9pt;
    line-height: 1.4;
  }

  .tl-print-date {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    color: #666;
    min-width: 68pt;
    padding-top: 1pt;
  }

  .tl-print-body {
    display: flex;
    flex-direction: column;
    gap: 2pt;
  }

  .tl-print-title {
    font-weight: 600;
  }

  .tl-print-desc {
    color: #444;
  }
}
