:root {
  /* Typography source (Google Fonts). Interaction:** Intersection Observer reveals. Each panel starts with `opacity: 0 for the fade-reveal system. */
  --interaction-token: Interaction*;
  --interaction-regex: Interaction::::*;
  --primary-bg: #0B0C1E;
  --secondary-bg: #141836;
  --accent-primary: #FF3860;
  --accent-secondary: #FFD700;
  --accent-tertiary: #00D4FF;
  --text-primary: #FFFFFF;
  --text-secondary: #B8C4E0;
  --border-divider: #2A2F52;
  --ink: #0B0C1E;
  --title-font: "Barlow Condensed", sans-serif;
  --body-font: "IBM Plex Sans Condensed", sans-serif;
  --mono-font: "Share Tech Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--primary-bg);
  color: var(--text-primary);
  font-family: var(--body-font);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255, 215, 0, 0.16) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.18;
  z-index: -1;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  display: grid;
  grid-template-columns: 280px 1fr;
  align-items: stretch;
  background: var(--primary-bg);
  border-bottom: 3px solid var(--border-divider);
  z-index: 30;
}

.site-title {
  display: flex;
  align-items: center;
  padding: 0 18px;
  font-family: var(--title-font);
  font-size: 1.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  border-right: 3px solid var(--border-divider);
  text-shadow: 3px 3px 0 var(--accent-primary);
}

.epoch-scrubber {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 100%;
}

.epoch-segment {
  position: relative;
  border: 0;
  border-right: 3px solid var(--ink);
  color: var(--ink);
  font-family: var(--mono-font);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 200ms ease, filter 200ms ease;
}

.epoch-segment:hover,
.epoch-segment.active {
  filter: saturate(1.25) contrast(1.12);
}

.epoch-segment.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: currentColor;
}

.epoch-segment.pulse {
  animation: pulseSegment 200ms ease;
}

.ancient { background: #FF3860; color: #FF3860; text-shadow: 0 1px 0 #0B0C1E; }
.medieval { background: #FFD700; color: #FFD700; }
.early { background: #00D4FF; color: #00D4FF; }
.industrial { background: #B8C4E0; color: #B8C4E0; }
.contemporary { background: #FFFFFF; color: #FFFFFF; }

.epoch-segment.ancient,
.epoch-segment.medieval,
.epoch-segment.early,
.epoch-segment.industrial,
.epoch-segment.contemporary {
  color: var(--ink);
}

.layout-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  padding-top: 48px;
  min-height: 100vh;
}

.history-grid {
  display: block;
  min-width: 0;
  border-right: 3px solid var(--border-divider);
}

.epoch-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 3px solid var(--ink);
  background: var(--border-divider);
}

.history-panel {
  position: relative;
  min-height: 280px;
  padding: 44px 28px 24px;
  overflow: hidden;
  background: var(--secondary-bg);
  border-right: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  clip-path: polygon(0 12px, 12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
  opacity: 0;
  filter: blur(4px);
  transform: translateY(16px);
  transition: opacity 500ms ease-out, filter 500ms ease-out, transform 500ms ease-out;
  isolation: isolate;
}

.history-panel:nth-child(even) {
  background: #1A1F3D;
}

.history-panel.revealed {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

.history-panel[data-column="1"] { transition-delay: 0ms; }
.history-panel[data-column="2"] { transition-delay: 120ms; }
.history-panel[data-column="3"] { transition-delay: 240ms; }
.history-panel[data-column="4"] { transition-delay: 360ms; }

.history-panel.landscape { min-height: 300px; }
.history-panel.portrait { min-height: 380px; }
.history-panel.square { min-height: 330px; }

.history-panel.bleed {
  grid-column: 1 / -1;
  min-height: 360px;
  padding: 58px 52px 42px;
  background: linear-gradient(135deg, #141836 0%, #0B0C1E 48%, #1A1F3D 100%);
}

.history-panel.bleed h2 {
  max-width: 900px;
  font-size: clamp(2.4rem, 7vw, 6.8rem);
  line-height: 0.82;
}

.history-panel.bleed p {
  max-width: 760px;
  font-size: clamp(1rem, 1.5vw, 1.22rem);
}

.benday::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, #FF3860 1px, transparent 1px);
  background-size: 6px 6px;
  opacity: 0.15;
  transition: background-size 400ms ease;
  z-index: -1;
}

.benday:hover::after,
.benday.dot-expanded::after {
  background-size: 10px 10px;
}

.blob {
  position: absolute;
  width: 260px;
  height: 220px;
  top: 26px;
  right: -64px;
  background: radial-gradient(circle at 35% 35%, #FF3860, rgba(255, 56, 96, 0.08) 70%);
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  opacity: 0.3;
  animation: blobMorph 6s ease-in-out infinite;
  z-index: -2;
}

.blob.cyan {
  background: radial-gradient(circle at 35% 35%, #00D4FF, rgba(0, 212, 255, 0.08) 70%);
}

.blob.yellow {
  background: radial-gradient(circle at 35% 35%, #FFD700, rgba(255, 215, 0, 0.08) 70%);
}

.blob.big {
  width: 520px;
  height: 380px;
  right: 7%;
  top: -20px;
  opacity: 0.24;
}

.annotation {
  position: absolute;
  top: 14px;
  left: 16px;
  padding: 4px 7px;
  color: #FF3860;
  background: rgba(11, 12, 30, 0.82);
  border: 2px solid #2A2F52;
  font-family: var(--mono-font);
  font-size: 0.75rem;
  line-height: 1;
  letter-spacing: 0.04em;
  z-index: 4;
}

h1,
h2 {
  position: relative;
  margin: 0 0 18px;
  color: #FFFFFF;
  font-family: var(--title-font);
  font-size: clamp(1.6rem, 4vw, 3.2rem);
  font-weight: 800;
  line-height: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-shadow: 4px 4px 0 #0B0C1E, 7px 7px 0 #FF3860;
  z-index: 2;
}

p {
  position: relative;
  max-width: 34rem;
  margin: 0;
  color: #B8C4E0;
  font-family: var(--body-font);
  font-size: clamp(0.85rem, 1.2vw, 1.05rem);
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: 0.01em;
  z-index: 2;
}

.speech {
  position: relative;
  display: inline-block;
  margin-top: 20px;
  max-width: 280px;
  padding: 12px 16px;
  background: #FFD700;
  color: #0B0C1E;
  border: 3px solid #0B0C1E;
  border-radius: 18px;
  font-family: var(--title-font);
  font-size: 1.35rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 6px 6px 0 #FF3860;
  z-index: 3;
}

.speech::after {
  content: "";
  position: absolute;
  left: 22px;
  bottom: -20px;
  width: 28px;
  height: 22px;
  background: #FFD700;
  border-left: 3px solid #0B0C1E;
  border-bottom: 3px solid #0B0C1E;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.epoch-chevron {
  height: 70px;
  background: #0B0C1E;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  margin-bottom: -2px;
  border-top: 3px solid #2A2F52;
}

.compass-mark::before,
.compass-rose {
  content: "";
  position: absolute;
  right: 20px;
  bottom: 18px;
  width: 130px;
  height: 130px;
  opacity: 0.05;
  background:
    linear-gradient(45deg, transparent 45%, #00D4FF 46%, #00D4FF 54%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, #00D4FF 46%, #00D4FF 54%, transparent 55%),
    linear-gradient(90deg, transparent 45%, #00D4FF 46%, #00D4FF 54%, transparent 55%),
    linear-gradient(0deg, transparent 45%, #00D4FF 46%, #00D4FF 54%, transparent 55%);
  clip-path: polygon(50% 0, 58% 36%, 100% 50%, 58% 64%, 50% 100%, 42% 64%, 0 50%, 42% 36%);
  z-index: -1;
}

.compass-rose.large {
  position: absolute;
  width: 340px;
  height: 340px;
  right: 9%;
  top: 22px;
  bottom: auto;
  opacity: 0.4;
  animation: compassSpin 2s linear infinite;
}

.timeline {
  position: relative;
  min-height: 100vh;
  background: #0B0C1E;
}

.timeline-track {
  position: sticky;
  top: 82px;
  width: 2px;
  height: calc(100vh - 122px);
  margin: 34px auto;
  background: #2A2F52;
}

.timeline-dot {
  position: absolute;
  left: 50%;
  top: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00D4FF;
  box-shadow: 0 0 12px #00D4FF;
  transform: translate(-50%, -50%);
}

.tick {
  position: absolute;
  left: 0;
  width: 0;
  height: 0;
}

.tick::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -7px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 16px solid #2A2F52;
}

.tick span {
  position: absolute;
  left: 26px;
  top: -9px;
  color: #B8C4E0;
  font-family: var(--mono-font);
  font-size: 0.78rem;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

@keyframes blobMorph {
  0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; transform: rotate(0deg) scale(1); }
  50% { border-radius: 66% 34% 55% 45% / 48% 62% 38% 52%; transform: rotate(8deg) scale(1.06); }
}

@keyframes pulseSegment {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes compassSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 230px 1fr;
  }

  .layout-shell {
    grid-template-columns: minmax(0, 1fr) 120px;
  }

  .epoch-section {
    grid-template-columns: repeat(2, 1fr);
  }

  .history-panel[data-column="3"] { transition-delay: 0ms; }
  .history-panel[data-column="4"] { transition-delay: 120ms; }
}

@media (max-width: 720px) {
  .topbar {
    height: 92px;
    grid-template-columns: 1fr;
  }

  .site-title {
    height: 44px;
    border-right: 0;
    border-bottom: 3px solid #2A2F52;
    justify-content: center;
  }

  .epoch-scrubber {
    height: 48px;
  }

  .epoch-segment {
    font-size: 0.58rem;
    padding: 0 2px;
  }

  .layout-shell {
    display: block;
    padding-top: 92px;
  }

  .history-grid {
    border-right: 0;
  }

  .epoch-section {
    grid-template-columns: 1fr;
  }

  .history-panel,
  .history-panel.bleed {
    grid-column: 1;
    min-height: 310px;
    padding: 48px 22px 26px;
    transition-delay: 0ms !important;
  }

  .timeline {
    display: none;
  }
}
