/**
 * Timeline Page Styles
 * Vertical timeline with year markers
 */

/* ==================== Timeline Page Container ==================== */
.timeline-page {
  max-width: var(--nav-width);
  margin: 0 auto;
  padding: calc(var(--gap) * 2) var(--gap);
}

/* ==================== Timeline Structure ==================== */
.timeline-section {
  margin-top: calc(var(--gap) * 4);
}

.timeline {
  position: relative;
  padding-left: 0;
}

/* Timeline vertical line */
.timeline::before {
  content: '';
  position: absolute;
  left: 80px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg,
    transparent 0%,
    var(--accent) 10%,
    var(--accent) 90%,
    transparent 100%
  );
  opacity: 0.3;
}

/* ==================== Year Marker ==================== */
.timeline-year {
  position: relative;
  margin-bottom: calc(var(--gap) * 3);
}

.year-marker {
  position: sticky;
  top: calc(var(--header-height, 60px) + var(--gap));
  z-index: 10;
  margin-bottom: calc(var(--gap) * 2);
  padding: var(--gap) 0;
  background: var(--theme);
}

.year-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 160px;
  padding: 16px;
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  position: relative;
}

.year-badge::after {
  content: '';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid var(--accent-2);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
}

.year-number {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  line-height: 1;
}

.year-count {
  font-size: var(--text-xs);
  opacity: 0.9;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ==================== Timeline Items ==================== */
.timeline-items {
  display: flex;
  flex-direction: column;
  gap: calc(var(--gap) * 1.5);
  padding-left: 140px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: calc(var(--gap) * 1.5);
  padding: calc(var(--gap) * 1.5);
  opacity: 0;
  animation-fill-mode: forwards;
}

/* Timeline dot connector */
.timeline-dot {
  position: absolute;
  left: -60px;
  top: calc(var(--gap) * 1.5 + 8px);
  width: 16px;
  height: 16px;
  background: var(--accent);
  border: 3px solid var(--theme);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
  z-index: 2;
}

.timeline-item:hover .timeline-dot {
  background: var(--accent-2);
  box-shadow: 0 0 0 6px rgba(14, 165, 233, 0.3);
  transform: scale(1.2);
  transition: all 0.3s ease;
}

/* Horizontal line from dot to card */
.timeline-dot::after {
  content: '';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 2px;
  background: var(--border);
}

/* ==================== Timeline Content ==================== */
.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.timeline-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--tertiary);
  font-weight: var(--font-medium);
}

.timeline-date svg {
  color: var(--accent);
}

.timeline-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.timeline-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  line-height: 1.3;
  margin: 0 0 8px;
}

.timeline-title a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.timeline-title a:hover {
  color: var(--accent);
}

.timeline-excerpt {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--secondary);
  margin: 0 0 var(--gap);
}

.timeline-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  margin-top: auto;
}

.timeline-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--accent);
  text-decoration: none;
  transition: all 0.2s ease;
}

.timeline-link:hover {
  color: var(--accent-2);
  transform: translateX(4px);
}

.timeline-reading-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--tertiary);
}

/* ==================== Timeline Image ==================== */
.timeline-image {
  width: 180px;
  height: 120px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.timeline-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.timeline-item:hover .timeline-image img {
  transform: scale(1.1);
}

/* ==================== Timeline Top Button ==================== */
.timeline-top-btn {
  position: fixed;
  bottom: calc(var(--gap) * 2);
  right: calc(var(--gap) * 2);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 999;
}

.timeline-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.timeline-top-btn:hover {
  background: var(--accent-2);
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.timeline-top-btn svg {
  width: 24px;
  height: 24px;
}

/* ==================== Empty State ==================== */
.empty-state {
  text-align: center;
  padding: calc(var(--gap) * 4);
  margin: calc(var(--gap) * 4) auto;
  max-width: 500px;
}

.empty-state svg {
  color: var(--tertiary);
  margin-bottom: var(--gap);
}

.empty-state h3 {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  color: var(--primary);
  margin: var(--gap) 0;
}

.empty-state p {
  font-size: var(--text-base);
  color: var(--secondary);
  margin: 0;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 1024px) {
  .timeline::before {
    left: 60px;
  }

  .timeline-items {
    padding-left: 100px;
  }

  .timeline-dot {
    left: -40px;
  }

  .timeline-dot::after {
    width: 24px;
  }

  .timeline-image {
    width: 150px;
    height: 100px;
  }
}

@media (max-width: 768px) {
  .timeline-page {
    padding: var(--gap) 16px;
  }

  .timeline::before {
    left: 8px;
  }

  .timeline-items {
    padding-left: 40px;
  }

  .timeline-dot {
    left: -32px;
    width: 12px;
    height: 12px;
  }

  .timeline-dot::after {
    width: 20px;
  }

  .year-marker {
    top: calc(var(--header-height, 60px) + 8px);
  }

  .year-badge {
    width: 120px;
    padding: 12px;
  }

  .year-number {
    font-size: var(--text-2xl);
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: var(--gap);
    padding: var(--gap);
  }

  .timeline-image {
    width: 100%;
    height: 160px;
    order: -1;
  }

  .timeline-title {
    font-size: var(--text-lg);
  }

  .timeline-excerpt {
    font-size: var(--text-sm);
  }

  .timeline-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .timeline-top-btn {
    bottom: var(--gap);
    right: var(--gap);
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 480px) {
  .year-badge {
    width: 100px;
    padding: 10px;
  }

  .year-number {
    font-size: var(--text-xl);
  }

  .year-count {
    font-size: 10px;
  }

  .timeline-items {
    padding-left: 32px;
  }

  .timeline-dot {
    left: -24px;
    width: 10px;
    height: 10px;
    border-width: 2px;
  }

  .timeline-dot::after {
    width: 16px;
  }
}

/* ==================== Print Styles ==================== */
@media print {
  .timeline::before {
    display: none;
  }

  .timeline-dot,
  .timeline-top-btn {
    display: none;
  }

  .timeline-item {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .year-marker {
    position: relative;
    top: 0;
  }
}
