/* ══════════════════════════════════════════════════════════════════
   History Timeline View
   Vertical timeline of Pokemon TCG milestones & collection history
   ══════════════════════════════════════════════════════════════════ */

/* ── Era Color Tokens ────────────────────────────────────────────── */
:root {
  --era-jp: #e74c3c;
  --era-wotc: #2980b9;
  --era-ex: #8e44ad;
  --era-dp: #27ae60;
  --era-bw: #2c3e50;
  --era-xy: #d35400;
  --era-sm: #f39c12;
  --era-swsh: #1abc9c;
  --era-sv: #9b59b6;
  --era-mep: #e91e63;
  --timeline-line: rgba(102, 126, 234, 0.25);
  --timeline-dot: #667eea;
  --milestone-color: #f59e0b;
}

/* ══════════════════════════════════════════════════════════════════
   MAIN CONTAINER
   ══════════════════════════════════════════════════════════════════ */
.history-view {
  position: relative;
  max-width: var(--grid-max-width, 1400px);
  margin: 0 auto;
  padding: 0 var(--space-xl, 20px);
}

/* ══════════════════════════════════════════════════════════════════
   YEAR NAVIGATOR — sticky bar with scrollable year buttons
   ══════════════════════════════════════════════════════════════════ */
.history-year-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  height: 40px;
  padding: 4px 8px;
  margin: 0 calc(-1 * var(--space-xl, 20px));
  padding-left: var(--space-xl, 20px);
  padding-right: var(--space-xl, 20px);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.history-year-nav-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  width: 100%;
}

.history-year-nav-inner::-webkit-scrollbar {
  display: none;
}

.history-year-btn {
  flex: 0 0 auto;
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1;
}

.history-year-btn:hover {
  background: rgba(102, 126, 234, 0.08);
  color: var(--color-primary, #667eea);
}

.history-year-btn.active {
  background: var(--color-primary, #667eea);
  color: #fff;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
}

/* ══════════════════════════════════════════════════════════════════
   FILTER BAR — significance + era toggles
   ══════════════════════════════════════════════════════════════════ */
.history-filter-bar {
  position: sticky;
  top: 40px;
  z-index: 49;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px var(--space-xl, 20px);
  margin: 0 calc(-1 * var(--space-xl, 20px));
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Filter group (wraps label + buttons) */
.history-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.history-filter-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-right: 2px;
}

/* Significance filter buttons */
.history-filter-btn {
  padding: 5px 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.history-filter-btn:hover {
  background: rgba(102, 126, 234, 0.06);
}

.history-filter-btn.active {
  background: var(--color-primary, #667eea);
  color: #fff;
  border-color: var(--color-primary, #667eea);
}

/* Era filter pills container */
.history-era-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

/* Era pill buttons */
.history-era-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: transparent;
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.history-era-pill::before {
  content: '';
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--era-color, #999);
  flex-shrink: 0;
}

.history-era-pill:hover {
  border-color: var(--era-color, #999);
}

.history-era-pill.active {
  background: var(--era-color, #999);
  color: #fff;
  border-color: var(--era-color, #999);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

.history-era-pill.active::before {
  background: rgba(255, 255, 255, 0.9);
}

/* ══════════════════════════════════════════════════════════════════
   TIMELINE WRAPPER — flex row: series lane (left) + timeline (right)
   ══════════════════════════════════════════════════════════════════ */
.history-timeline-wrapper {
  display: flex;
  flex-direction: row;
  max-width: 1200px;
  margin: 24px auto 0;
  padding: 20px 0 60px;
}

/* ══════════════════════════════════════════════════════════════════
   SERIES LANE — vertical column on the left for series bars
   ══════════════════════════════════════════════════════════════════ */
.history-series-lane {
  position: relative;
  flex-shrink: 0;
}

.history-series-bar {
  position: absolute;
  width: 12px;
  border-radius: 3px;
  opacity: 0.6;
  z-index: 2;
  transition: opacity 0.2s ease;
  cursor: default;
  overflow: hidden;
}

.history-series-bar:hover {
  opacity: 1;
}

.history-series-bar-label {
  position: absolute;
  top: 4px;
  left: 2px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 8px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  pointer-events: none;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════
   TIMELINE — main column (right side of wrapper, flex:1)
   ══════════════════════════════════════════════════════════════════ */
.history-timeline {
  position: relative;
  flex: 1;
  min-width: 0;
}

/* Central vertical line */
.history-timeline-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: var(--timeline-line);
  z-index: 1;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════
   ERA BANDS — full-height colored tint behind the timeline
   ══════════════════════════════════════════════════════════════════ */
.history-era-bands {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
}

.history-era-band {
  position: absolute;
  left: 0;
  right: 0;
  opacity: 0.06;
  pointer-events: none;
}

.history-era-band-label {
  position: absolute;
  top: 12px;
  right: 100%;
  margin-right: 16px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.55;
  white-space: nowrap;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════
   YEAR SECTIONS — groups of events per year
   ══════════════════════════════════════════════════════════════════ */
.history-year-section {
  position: relative;
  z-index: 2;
}

.history-year-content {
  position: relative;
}

.history-year-empty {
  height: 20px;
}

/* ══════════════════════════════════════════════════════════════════
   YEAR MARKERS — large year dividers on the timeline
   ══════════════════════════════════════════════════════════════════ */
.history-year-marker {
  position: relative;
  text-align: center;
  padding: 32px 0 24px;
  z-index: 5;
}

.history-year-marker-text {
  display: inline-block;
  padding: 6px 24px;
  font-size: 22px;
  font-weight: 800;
  color: #374151;
  letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  position: relative;
  z-index: 5;
}

/* Year card count badge */
.history-year-card-count {
  font-size: 13px;
  font-weight: 500;
  color: #9ca3af;
  letter-spacing: 0;
}

/* Dot on the center line for year marker */
.history-year-marker::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-primary, #667eea);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--timeline-line);
  z-index: 4;
}

/* ══════════════════════════════════════════════════════════════════
   EVENT CARDS — flexbox row: [left-col] [center-col] [right-col]
   ══════════════════════════════════════════════════════════════════ */
.history-event {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0;
  z-index: 5;
  margin-bottom: 48px;
  opacity: 1;
  transform: translateY(0);
}

/* Fade-in animation for newly rendered events */
@keyframes history-event-enter {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.history-year-content .history-event {
  animation: history-event-enter 0.5s ease both;
}

/* Stagger the entrance animations */
.history-year-content .history-event:nth-child(1) { animation-delay: 0s; }
.history-year-content .history-event:nth-child(2) { animation-delay: 0.05s; }
.history-year-content .history-event:nth-child(3) { animation-delay: 0.1s; }
.history-year-content .history-event:nth-child(4) { animation-delay: 0.15s; }
.history-year-content .history-event:nth-child(5) { animation-delay: 0.2s; }
.history-year-content .history-event:nth-child(n+6) { animation-delay: 0.25s; }

/* ── Flexbox columns ──────────────────────────────────────── */
.history-event-col--left,
.history-event-col--right {
  flex: 1;
  min-width: 0;
}

.history-event-col--center {
  flex-shrink: 0;
  width: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  align-self: stretch;
}

/* Left column aligns content to the right (toward center) */
.history-event-col--left {
  display: flex;
  justify-content: flex-end;
}

/* Right column aligns content to the left (toward center) */
.history-event-col--right {
  display: flex;
  justify-content: flex-start;
}

/* Connector line — horizontal bar inside the center column */
.history-event-connector {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 3;
  transform: translateY(-50%);
}

/* Dot on the center line */
.history-event-dot {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--timeline-dot);
  border: 2px solid;
  box-shadow: 0 0 0 2px var(--timeline-line);
  z-index: 6;
  flex-shrink: 0;
}

/* Event card body */
.history-event-card {
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.06),
    0 4px 12px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  overflow: hidden;
  border-left: 3px solid var(--timeline-dot);
  max-width: 100%;
}

/* Left events: card border on the right (toward center) */
.history-event--left .history-event-card {
  border-left: none;
  border-right: 3px solid var(--timeline-dot);
}

/* Right events: card border on the left (toward center) */
.history-event--right .history-event-card {
  border-right: none;
  border-left: 3px solid var(--timeline-dot);
}

.history-event-card:hover {
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

/* Event header row */
.history-event-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

/* Significance indicator dots */
.history-event-sig {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}

.history-event-sig--high {
  background: #ef4444;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}

.history-event-sig--medium {
  background: #f59e0b;
  box-shadow: 0 0 4px rgba(245, 158, 11, 0.4);
}

/* Event date */
.history-event-date {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
}

/* Event title */
.history-event-title {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.35;
  flex: 1;
}

/* Card count badge */
.history-event-card-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(102, 126, 234, 0.08);
  font-size: 10px;
  font-weight: 700;
  color: var(--color-primary, #667eea);
  white-space: nowrap;
}

/* Tags */
.history-event-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.history-event-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: rgba(0, 0, 0, 0.04);
  color: #6b7280;
}

/* Source type badge */
.history-event-source-badge {
  display: inline-block;
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.05);
  color: #6b7280;
  white-space: nowrap;
}

/* Description — hidden by default, toggled via JS style.display */
.history-event-desc {
  font-size: 12px;
  line-height: 1.55;
  color: #6b7280;
  margin-top: 10px;
}

/* ── Card Showcase — in the opposite column via flexbox ──── */
.history-event-showcase {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 4;
  pointer-events: none;
  min-height: 0;
  padding: 4px 8px;
}

.history-event-showcase:empty {
  display: none;
}

/* Left event → showcase sits in right col, align to start (toward center) */
.history-event--left .history-event-showcase {
  justify-content: flex-start;
}

/* Right event → showcase sits in left col, align to end (toward center) */
.history-event--right .history-event-showcase {
  justify-content: flex-end;
}

.history-showcase-card {
  /* Width is fixed to a 5:7-ish jumbo box (140×195) so the browser
     reserves layout space before the bitmap arrives — otherwise width
     starts at 0 and snaps wide on load, jolting the column. */
  width: 140px;
  height: 195px;
  object-fit: contain;
  border-radius: 6px;
  cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
  transition: transform 0.2s ease, filter 0.2s ease;
  flex-shrink: 0;
}

.history-showcase-card:hover {
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.3));
  z-index: 10;
}

.history-showcase-more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 50px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-tertiary, #888);
  font-size: 12px;
  font-weight: 600;
  pointer-events: auto;
  flex-shrink: 0;
}

/* ── Showcase cycle controls (when total > 4) ─────────────────── */
.history-showcase-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.history-showcase-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-showcase-arrow {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 50px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
  color: #555;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  user-select: none;
}

.history-showcase-arrow:hover {
  background: var(--color-primary, #667eea);
  color: #fff;
  border-color: var(--color-primary, #667eea);
}

.history-showcase-arrow:active {
  transform: scale(0.94);
}

.history-showcase-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-tertiary, #888);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
  flex-shrink: 0;
  align-self: center;
}

/* ── Significance Variants ─────────────────────────────────────── */

/* HIGH — larger, bolder */
.history-event--high .history-event-card {
  padding: 18px 20px;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.08),
    0 8px 20px rgba(0, 0, 0, 0.06);
}

.history-event--high.history-event--left .history-event-card {
  border-right-width: 4px;
}

.history-event--high.history-event--right .history-event-card {
  border-left-width: 4px;
}

.history-event--high .history-event-title {
  font-size: 15px;
  font-weight: 700;
}

.history-event--high .history-event-dot {
  width: 13px;
  height: 13px;
  box-shadow: 0 0 0 3px var(--timeline-line),
              0 0 12px rgba(102, 126, 234, 0.2);
}

/* MEDIUM — standard (base styles) */

/* LOW — compact, collapsed by default */
.history-event--low .history-event-card {
  padding: 8px 12px;
}

.history-event--low .history-event-header {
  margin-bottom: 0;
}

.history-event--low .history-event-title {
  font-size: 12px;
  font-weight: 500;
}


/* ══════════════════════════════════════════════════════════════════
   MILESTONE MARKERS — diamond on the center line
   ══════════════════════════════════════════════════════════════════ */
.history-milestone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 20px 0;
  margin: 12px 0;
  z-index: 8;
  cursor: pointer;
}

/* Fade-in for milestones */
.history-year-content .history-milestone {
  animation: history-milestone-enter 0.5s ease both;
}

@keyframes history-milestone-enter {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Diamond marker (SVG container) */
.history-milestone-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 6px rgba(245, 158, 11, 0.35));
}

.history-milestone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.2);
  position: relative;
  z-index: 10;
}

/* Star accent glow */
.history-milestone-content::after {
  content: '\2605';
  position: absolute;
  top: -8px;
  right: -6px;
  font-size: 14px;
  color: var(--milestone-color);
  filter: drop-shadow(0 1px 3px rgba(245, 158, 11, 0.4));
}

.history-milestone-date {
  font-size: 11px;
  color: #b45309;
}

.history-milestone-title {
  font-size: 14px;
  font-weight: 700;
  color: #92400e;
  letter-spacing: 0.3px;
}

.history-milestone-desc {
  font-size: 11px;
  color: #b45309;
  line-height: 1.4;
  max-width: 320px;
  margin-top: 4px;
}

/* Subtle pulse on milestone diamond */
@keyframes milestone-pulse {
  0%, 100% { filter: drop-shadow(0 2px 6px rgba(245, 158, 11, 0.35)); }
  50%      { filter: drop-shadow(0 2px 12px rgba(245, 158, 11, 0.6)); }
}

.history-milestone-marker {
  animation: milestone-pulse 3s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════════════
   DARK MODE
   ══════════════════════════════════════════════════════════════════ */

/* Year navigator */
body.dark-mode .history-year-nav {
  background: rgba(19, 23, 31, 0.85);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .history-year-btn {
  color: #9ca3af;
}

body.dark-mode .history-year-btn:hover {
  background: rgba(102, 126, 234, 0.12);
  color: #a5b4fc;
}

body.dark-mode .history-year-btn.active {
  background: var(--color-primary, #667eea);
  color: #fff;
}

/* Filter bar */
body.dark-mode .history-filter-bar {
  background: rgba(19, 23, 31, 0.82);
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .history-filter-label {
  color: #9ca3af;
}

body.dark-mode .history-filter-btn {
  border-color: rgba(255, 255, 255, 0.1);
  color: #9ca3af;
}

body.dark-mode .history-filter-btn:hover {
  background: rgba(102, 126, 234, 0.1);
}

body.dark-mode .history-era-pill {
  border-color: rgba(255, 255, 255, 0.08);
  color: #9ca3af;
}

/* Active pill text needs to override the dark-mode inactive grey above —
   without this it reads grey-on-saturated, illegible. */
body.dark-mode .history-era-pill.active {
  color: #fff;
}

/* Timeline line */
body.dark-mode .history-timeline-line {
  background: rgba(102, 126, 234, 0.35);
}

/* Era bands — slightly higher opacity in dark mode */
body.dark-mode .history-era-band {
  opacity: 0.1;
}

/* Year markers */
body.dark-mode .history-year-marker-text {
  background: rgba(19, 23, 31, 0.95);
  color: #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.dark-mode .history-year-marker::after {
  border-color: var(--surface);
}

/* Event cards */
body.dark-mode .history-event-card {
  background: var(--surface);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.15);
}

body.dark-mode .history-event-card:hover {
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.25),
    0 8px 24px rgba(0, 0, 0, 0.2);
}

body.dark-mode .history-event-title {
  color: #e5e7eb;
}

body.dark-mode .history-event-date {
  color: #9ca3af;
}

body.dark-mode .history-event-card-count {
  background: rgba(102, 126, 234, 0.15);
  color: #a5b4fc;
}

body.dark-mode .history-event-tag {
  background: rgba(255, 255, 255, 0.06);
  color: #9ca3af;
}

body.dark-mode .history-event-desc {
  color: #b0b5c0;
}

/* Source badge dark */
body.dark-mode .history-event-source-badge {
  background: rgba(255, 255, 255, 0.08);
  color: #9ca3af;
}


/* Year card count dark */
body.dark-mode .history-year-card-count {
  color: #6b7280;
}



body.dark-mode .history-event-dot {
  border-color: var(--surface);
}

/* Milestones in dark */
body.dark-mode .history-milestone-content {
  background: rgba(19, 23, 31, 0.95);
  border-color: rgba(245, 158, 11, 0.25);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .history-milestone-title {
  color: #fbbf24;
}

body.dark-mode .history-milestone-desc {
  color: #f59e0b;
}

body.dark-mode .history-milestone-date {
  color: #f59e0b;
}

/* Series bar label dark */
body.dark-mode .history-series-bar-label {
  color: rgba(255, 255, 255, 0.7);
}

/* Showcase dark */
body.dark-mode .history-showcase-card {
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

body.dark-mode .history-showcase-card:hover {
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.6));
}

body.dark-mode .history-showcase-more {
  background: rgba(255, 255, 255, 0.08);
  color: #6b7280;
}

body.dark-mode .history-showcase-arrow {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
  color: #d4d4e0;
}

body.dark-mode .history-showcase-arrow:hover {
  background: #818cf8;
  color: #fff;
  border-color: #818cf8;
}

body.dark-mode .history-showcase-counter {
  background: rgba(255, 255, 255, 0.08);
  color: #9aa0c0;
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (<1000px)
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 1000px) {
  .history-showcase-card {
    width: 107px;
    height: 150px;
  }
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (<768px)
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  .history-view {
    padding: 0 var(--space-md, 12px);
  }

  /* Year nav — more compact */
  .history-year-nav {
    height: 36px;
    padding: 3px 6px;
    margin: 0 calc(-1 * var(--space-md, 12px));
    padding-left: var(--space-md, 12px);
    padding-right: var(--space-md, 12px);
  }

  .history-year-btn {
    padding: 3px 8px;
    font-size: 11px;
  }

  /* Filter bar wrapping */
  .history-filter-bar {
    top: 36px;
    padding: 6px var(--space-md, 12px);
    margin: 0 calc(-1 * var(--space-md, 12px));
    gap: 6px;
  }

  .history-era-pill {
    padding: 2px 8px;
    font-size: 10px;
  }

  /* Timeline wrapper — full width, column on small screens */
  .history-timeline-wrapper {
    padding: 16px 12px 40px;
    max-width: 100%;
  }

  /* Move center line to the left */
  .history-timeline-line {
    left: 20px;
    transform: none;
  }

  /* Flatten flexbox: hide the 3-column layout, stack single column */
  .history-event,
  .history-event--left,
  .history-event--right {
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
  }

  /* Hide the left/right columns, show only the card side */
  .history-event-col--left,
  .history-event-col--right {
    display: none;
  }

  /* Show only the column that has the info card */
  .history-event--left .history-event-col--left,
  .history-event--right .history-event-col--right {
    display: block;
    flex: 1;
  }

  /* Center column becomes the left-side dot/connector */
  .history-event-col--center {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    align-items: center;
    justify-content: flex-start;
    padding-top: 16px;
  }

  /* Offset event content to the right of the line */
  .history-event {
    padding-left: 44px;
  }

  .history-event-connector {
    left: 50%;
    right: auto;
    width: 50%;
    top: 16px;
    transform: none;
  }

  .history-event-dot {
    position: relative;
  }

  /* Era accent border always on left on mobile */
  .history-event-card,
  .history-event--left .history-event-card,
  .history-event--right .history-event-card {
    border-left: 3px solid var(--timeline-dot);
    border-right: none;
  }

  .history-event--high .history-event-card,
  .history-event--high.history-event--left .history-event-card,
  .history-event--high.history-event--right .history-event-card {
    border-left-width: 4px;
    border-right: none;
  }

  /* Year marker — left aligned */
  .history-year-marker {
    text-align: left;
    padding-left: 44px;
  }

  .history-year-marker::after {
    left: 20px;
    transform: translate(-50%, -50%);
  }

  .history-year-marker-text {
    font-size: 18px;
    padding: 4px 16px;
  }

  /* Milestone — left aligned */
  .history-milestone {
    justify-content: flex-start;
    padding-left: 44px;
  }

  .history-milestone-marker {
    left: 20px;
    transform: translate(-50%, -50%) scale(0.8);
  }

  .history-milestone-content {
    text-align: left;
    align-items: flex-start;
  }

  /* Series lane — hide on mobile */
  .history-series-lane {
    display: none;
  }

  /* Showcase — hide on mobile, use inline thumbnails instead */
  .history-event-showcase {
    display: none;
  }

  /* Era band label — hide on mobile (not enough space) */
  .history-era-band-label {
    display: none;
  }
}

/* ══════════════════════════════════════════════════════════════════
   ANIMATIONS & INTERACTIONS
   ══════════════════════════════════════════════════════════════════ */

/* Hover lift for high significance */
.history-event--high .history-event-card:hover {
  transform: translateY(-2px);
}

/* Low significance click feedback */
.history-event--low .history-event-card:active {
  transform: scale(0.99);
}

/* Loading state */
.history-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .history-year-content .history-event,
  .history-year-content .history-milestone {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .history-milestone-marker {
    animation: none;
  }

  .history-event-card {
    transition: none;
  }

  .history-event-desc {
    transition: none;
  }
}
