/* ==========================================================================
   Renkara Timeline — Relume-inspired vertical narrative timeline
   ========================================================================== */

.timeline {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-xl) 0;
}

/* Vertical line */
.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  width: 2px;
  height: 100%;
  background: var(--color-border);
}

/* Animated fill */
.timeline__fill {
  position: absolute;
  top: 0;
  left: 24px;
  width: 2px;
  height: 0;
  background: linear-gradient(180deg, var(--renkara-blue), var(--renkara-navy));
  transition: height 0.1s linear;
  z-index: 1;
}

/* ---- Year divider ---- */

.timeline__year {
  position: relative;
  display: flex;
  align-items: center;
  padding: var(--space-3xl) 0 var(--space-lg);
  padding-left: 64px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.timeline__year.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline__year-label {
  font-family: var(--font-mono);
  font-size: var(--text-h1);
  font-weight: var(--fw-extrabold);
  color: var(--color-text-primary, var(--color-text));
  letter-spacing: -0.02em;
  line-height: 1;
}

.timeline__year::before {
  display: none;
}

/* ---- Entry ---- */

.timeline__entry {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  padding-left: 64px;
  padding-bottom: var(--space-2xl);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.timeline__entry.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Dot */
.timeline__entry::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-border);
  border: 2px solid var(--color-bg);
  z-index: 2;
  transition: background 0.3s var(--ease);
}

.timeline__entry.visible::before {
  background: var(--renkara-blue);
}

/* ---- Content ---- */

.timeline__content {
  max-width: 720px;
}

.timeline__date {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  font-weight: var(--fw-medium);
  color: var(--renkara-blue);
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.timeline__title {
  font-size: var(--text-h3);
  font-weight: var(--fw-bold);
  color: var(--color-text-primary, var(--color-text));
  margin-bottom: var(--space-sm);
  line-height: var(--lh-h3);
}

.timeline__text {
  font-size: var(--text-body);
  color: var(--color-text-secondary);
  line-height: var(--lh-body);
  margin-bottom: var(--space-md);
}

/* ---- Tags ---- */

.timeline__tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-caption);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.03em;
}

.timeline__tag--launch {
  background: var(--accent-accelastudy-light);
  color: var(--accent-accelastudy);
}

.timeline__tag--milestone {
  background: rgba(46, 107, 158, 0.1);
  color: var(--renkara-blue);
}

.timeline__tag--innovation {
  background: var(--accent-fulcrum-light);
  color: var(--accent-fulcrum);
}

.timeline__tag--ip {
  background: var(--accent-docket-light);
  color: var(--accent-docket);
}

.timeline__tag--tool {
  background: var(--accent-herald-light);
  color: var(--accent-herald);
}

/* ---- Image placeholder ---- */

.timeline__image {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  background: var(--color-bg-subtle, var(--cloud-white));
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted, var(--steel));
  font-size: var(--text-small);
  overflow: hidden;
}

.timeline__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Desktop: centered line, alternating sides ---- */

@media (min-width: 768px) {
  .timeline::before {
    left: 50%;
    transform: translateX(-50%);
  }

  .timeline__fill {
    left: 50%;
    transform: translateX(-50%);
  }

  .timeline__year {
    padding-left: 0;
    justify-content: center;
  }

  /* year dots removed */

  .timeline__entry {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
    padding-left: 0;
    align-items: start;
  }

  .timeline__entry::before {
    left: calc(50% - 5px);
    top: 8px;
  }

  /* Left entries: text left, image right (default) */
  .timeline__entry--left .timeline__content {
    text-align: right;
    margin-left: auto;
    padding-right: var(--space-2xl);
  }

  .timeline__entry--left .timeline__image {
    order: 2;
    margin-left: var(--space-2xl);
  }

  .timeline__entry--left .timeline__tag {
    float: right;
  }

  /* Right entries: image left, text right */
  .timeline__entry--right .timeline__content {
    order: 2;
    padding-left: var(--space-2xl);
  }

  .timeline__entry--right .timeline__image {
    order: 1;
    margin-left: auto;
  }
}

/* ---- Pulsing dot on latest ---- */

.timeline__entry:last-of-type::before {
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 107, 158, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(46, 107, 158, 0); }
}

/* ---- Dark mode ---- */

[data-theme="dark"] .timeline::before {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .timeline__entry::before {
  border-color: #0F172A;
}

/* year dots removed */

[data-theme="dark"] .timeline__image {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .timeline__tag--milestone {
  background: rgba(46, 107, 158, 0.2);
}

/* ---- Lightbox ---- */

.timeline__image img {
  cursor: zoom-in;
}

.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox.active {
  display: flex;
}

.lightbox img,
.lightbox video {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox video {
  display: none;
}

.lightbox__close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: #FFFFFF;
  font-size: 2rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
  line-height: 1;
  z-index: 10;
}

.lightbox__close:hover {
  opacity: 1;
}

/* Carousel navigation */
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #FFFFFF;
  font-size: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.15s, background 0.15s;
  z-index: 10;
}

.lightbox__nav:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.25);
}

.lightbox__nav--prev { left: 20px; }
.lightbox__nav--next { right: 20px; }

.lightbox__counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  font-family: var(--font-mono, monospace);
  z-index: 10;
}

.lightbox__nav.hidden { display: none; }
.lightbox__counter.hidden { display: none; }

.lightbox__caption {
  position: absolute;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50);
  padding-top: var(--space-md, 16px);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8125rem;
  font-style: italic;
  text-align: center;
  max-width: 80vw;
  z-index: 10;
}

.lightbox__caption:empty { display: none; }

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  .timeline__entry,
  .timeline__year {
    opacity: 1;
    transform: none;
  }
  .timeline__entry:last-of-type::before {
    animation: none;
  }
}

/* Footnote — trademark attributions, legal disclaimers */
.timeline__footnote {
  font-size: var(--text-xs, 0.75rem);
  color: var(--color-text-muted, #94A3B8);
  line-height: 1.6;
  margin-top: var(--space-2xl, 3rem);
  padding-top: var(--space-lg, 1.5rem);
  border-top: none;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  position: relative;
  z-index: 1;
}
.timeline__footnote + .timeline__footnote {
  margin-top: var(--space-sm, 0.5rem);
  padding-top: 0;
}
