/* --- Premium Global Timeline Stylesheet --- */

/* Radial background spot glow layout */
body.timeline-page {
  background: radial-gradient(circle at 50% 0%, rgba(255, 42, 95, 0.08) 0%, rgba(6, 8, 20, 1) 50%),
              radial-gradient(circle at 10% 50%, rgba(212, 175, 55, 0.03) 0%, rgba(3, 5, 12, 1) 100%);
  background-attachment: fixed;
}

.timeline-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 24px 100px 24px;
}

.timeline-header-intro {
  text-align: center;
  margin-bottom: 60px;
  animation: fadeInDown 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-title {
  font-size: 2.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #ffffff 20%, var(--accent-gold) 60%, var(--accent-crimson) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px rgba(255, 42, 95, 0.1));
}

.timeline-subtitle {
  color: var(--text-secondary);
  font-size: 1.15rem;
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.7;
}

/* --- Workspace Grid --- */
.timeline-workspace {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 48px;
  align-items: start;
}

/* --- Premium Sidebar Panel --- */
.timeline-sidebar {
  position: sticky;
  top: 80px;
  background: rgba(10, 13, 28, 0.65);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: fadeInLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.block-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 800;
  letter-spacing: 0.12em;
  background: linear-gradient(to right, var(--text-primary), var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Search Box Glow */
.timeline-sidebar .search-box {
  background: rgba(6, 8, 20, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.timeline-sidebar .search-box:focus-within {
  border-color: rgba(255, 42, 95, 0.4);
  box-shadow: 0 0 15px rgba(255, 42, 95, 0.2);
}

.timeline-sidebar .search-box input {
  font-size: 0.9rem;
}

/* Sort Toggles */
.sort-toggles {
  display: flex;
  gap: 8px;
  background: rgba(6, 8, 20, 0.6);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.btn-sort {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 10px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-sort:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
}

.btn-sort.active {
  background: var(--accent-crimson);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-crimson-glow);
}

/* Era Pills Stack */
.timeline-era-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-era-pills .btn-era {
  text-align: left;
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.8rem;
}


/* --- Timeline Stream --- */
.timeline-stream-wrapper {
  position: relative;
  padding-left: 28px;
}

/* Glowing Neon Vertical Axis */
.timeline-line {
  position: absolute;
  left: 20px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: linear-gradient(to bottom, 
    var(--accent-crimson) 0%, 
    var(--accent-gold) 25%, 
    var(--accent-crimson) 50%, 
    var(--accent-gold) 75%, 
    var(--accent-crimson) 100%
  );
  box-shadow: 0 0 12px rgba(255, 42, 95, 0.3), 
              0 0 24px rgba(212, 175, 55, 0.15);
  border-radius: 4px;
  z-index: 1;
}

.timeline-items {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* Century Header Badge */
.timeline-year-header {
  position: relative;
  z-index: 2;
  margin-left: 12px;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-gold);
  text-shadow: 0 0 15px var(--accent-gold-glow);
  background: #060814;
  display: inline-block;
  padding: 6px 16px;
  border-radius: 30px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  margin-top: 16px;
  animation: zoomIn 0.5s ease;
}

/* Timeline Item Container & Scroll Entrance Animation */
.timeline-item {
  display: flex;
  position: relative;
  padding-left: 40px;
  z-index: 2;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pointer Arrow to timeline node */
.timeline-item::before {
  content: "";
  position: absolute;
  left: 32px; /* Align with the card left edge at 40px */
  top: 26px; /* Vertically center with the 20px node at top: 24px */
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  z-index: 10;
}

.timeline-item.conflict::before {
  border-right: 8px solid var(--accent-crimson);
}

.timeline-item.empire::before {
  border-right: 8px solid var(--accent-gold);
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-node {
  position: absolute;
  left: -17px; /* Center 20px node wrapper on the 3px line */
  top: 24px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  z-index: 5;
  background-color: #03050c;
  border: 3px solid var(--border-color);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-item:hover .timeline-node {
  transform: scale(1.2);
}

/* Conflict Pulsing Node */
.timeline-item.conflict .timeline-node {
  border-color: var(--accent-crimson);
}

.timeline-item.conflict:hover .timeline-node {
  background-color: var(--accent-crimson);
  box-shadow: 0 0 15px var(--accent-crimson);
  animation: nodePulse 1.5s infinite alternate;
}

/* Empire Pulsing Node */
.timeline-item.empire .timeline-node {
  border-color: var(--accent-gold);
}

.timeline-item.empire:hover .timeline-node {
  background-color: var(--accent-gold);
  box-shadow: 0 0 15px var(--accent-gold);
  animation: goldNodePulse 1.5s infinite alternate;
}

@keyframes nodePulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 42, 95, 0.6); }
  100% { box-shadow: 0 0 0 8px rgba(255, 42, 95, 0); }
}

@keyframes goldNodePulse {
  0% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.6); }
  100% { box-shadow: 0 0 0 8px rgba(212, 175, 55, 0); }
}

/* --- Premium Glassmorphic Cards --- */
.timeline-card {
  width: 100%;
  background: rgba(13, 17, 34, 0.65);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Diagonal Shine Overlay on Hover */
.timeline-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 20%;
  height: 200%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(30deg);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.timeline-card:hover::after {
  left: 140%;
}

.timeline-card:hover {
  transform: translateX(5px) translateY(-2px);
  background: rgba(16, 21, 42, 0.8);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

/* Conflict Card Border Glow */
.timeline-item.conflict .timeline-card {
  border-left: 4px solid var(--accent-crimson);
}

.timeline-item.conflict:hover .timeline-card {
  border-color: rgba(255, 42, 95, 0.4);
  border-left-color: var(--accent-crimson);
  box-shadow: 0 15px 40px rgba(255, 42, 95, 0.08), 
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Empire Card Border Glow */
.timeline-item.empire .timeline-card {
  border-left: 4px solid var(--accent-gold);
}

.timeline-item.empire:hover .timeline-card {
  border-color: rgba(212, 175, 55, 0.4);
  border-left-color: var(--accent-gold);
  box-shadow: 0 15px 40px rgba(212, 175, 55, 0.08), 
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Card typography & metadata */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 16px;
}

.card-title-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-type-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  border-radius: 4px;
  display: inline-block;
  align-self: flex-start;
}

.conflict .card-type-tag {
  background: rgba(255, 42, 95, 0.15);
  color: var(--accent-crimson);
  border: 1px solid rgba(255, 42, 95, 0.25);
  text-shadow: 0 0 10px rgba(255, 42, 95, 0.2);
}

.empire .card-type-tag {
  background: rgba(212, 175, 55, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(212, 175, 55, 0.25);
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.card-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
}

.card-dates {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(6, 8, 20, 0.8);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  white-space: nowrap;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.conflict .card-dates {
  border-color: rgba(255, 42, 95, 0.2);
}

.empire .card-dates {
  border-color: rgba(212, 175, 55, 0.2);
}

.card-desc {
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Card details panel grid */
.card-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 20px;
}

.detail-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.detail-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.detail-stat {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
}

.conflict .detail-stat {
  color: var(--accent-crimson);
  text-shadow: 0 0 10px var(--accent-crimson-glow);
}

.empire .detail-stat {
  color: var(--accent-gold);
  text-shadow: 0 0 10px var(--accent-gold-glow);
}

.detail-belligerents-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-side {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.detail-side span {
  font-weight: 800;
}

.detail-side.side-a span {
  color: #60a5fa;
}

.detail-side.side-b span {
  color: #f43f5e;
}

/* Inspect Map link button */
.btn-inspect-map {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.conflict .btn-inspect-map {
  background: rgba(255, 42, 95, 0.05);
  border: 1px solid var(--accent-crimson);
  color: var(--accent-crimson);
}

.conflict .btn-inspect-map:hover {
  background: var(--accent-crimson);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-crimson-glow);
  transform: translateY(-1px);
}

.empire .btn-inspect-map {
  background: rgba(212, 175, 55, 0.05);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
}

.empire .btn-inspect-map:hover {
  background: var(--accent-gold);
  color: #03050c;
  box-shadow: 0 0 20px var(--accent-gold-glow);
  transform: translateY(-1px);
}

.quick-jump-block {
  margin-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 24px;
}

/* Empty State styling */
.timeline-empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
  font-style: italic;
  font-size: 1.15rem;
  background: rgba(13, 17, 34, 0.35);
  border-radius: 12px;
  border: 1px dashed var(--border-color);
}

/* Keyframes for entrance fade animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* --- Responsive Media Layouts --- */
.mobile-only {
  display: none;
}

@media (max-width: 992px) {
  .timeline-workspace {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .timeline-sidebar {
    position: static;
    width: 100%;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: block;
  }
}

@media (max-width: 600px) {
  .timeline-container {
    padding: 32px 16px 80px 16px;
  }

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

  .timeline-stream-wrapper {
    padding-left: 16px;
  }

  .timeline-line {
    left: 10px;
  }

  .timeline-item {
    padding-left: 20px;
  }

  .timeline-node {
    left: -9px;
    top: 20px;
    width: 16px;
    height: 16px;
  }

  .timeline-card {
    padding: 20px;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .card-dates {
    align-self: flex-start;
  }

  .card-title {
    font-size: 1.15rem;
  }

  .card-desc {
    font-size: 0.9rem;
  }

  .card-details {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* --- Timeline Era Select Dropdown --- */
.timeline-era-select-container {
  width: 100%;
}

.timeline-era-select-container select.era-dropdown {
  width: 100%;
  height: 44px;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 8px;
  background-position: right 16px center;
}
