/* ============================================================================
   AI history timeline — "The Great Acceleration"
   Milestones sit at their true position in time and are dragged past a fixed
   playhead. The readout above shows how long it had been since the previous
   breakthrough, which collapses from years to days as you travel right — that
   compression is the point of the whole component.
   ========================================================================== */

#history-section,
#history-section .learn-chapter-panel,
#history-section .timeline-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#history-section .timeline-wrapper {
  display: grid;
  gap: 30px;
  padding: 0 !important;
}

/* Progressive enhancement: the plain vertical list is what renders until the
   script boots, so the chapter is still readable with JS off or broken. */
#history-section .ai-map {
  display: none;
}

#history-section.timeline-live .ai-map {
  display: block;
}

#history-section.timeline-live .timeline {
  display: none !important;
}

.ai-map {
  --ink: #0d1728;
  --muted: #68758a;
  --era: #3f9dff;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(13, 23, 40, 0.13);
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 22px 54px rgba(28, 48, 76, 0.09);
  box-sizing: border-box;
}

.ai-map *,
.ai-map *::before,
.ai-map *::after {
  box-sizing: border-box;
}

/* ---------- header ---------- */
.ai-map-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 30px 34px 24px;
  border-bottom: 1px solid rgba(13, 23, 40, 0.09);
  background:
    radial-gradient(circle at 91% 12%, rgba(18, 126, 232, 0.09), transparent 31%),
    #fbfcfe;
}

.ai-map-eyebrow {
  margin: 0 0 7px;
  color: #0875df;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ai-map-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(31px, 4vw, 48px);
  font-weight: 810;
  letter-spacing: -0.05em;
  line-height: 0.98;
}

.ai-map-header h3 + p {
  margin: 10px 0 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 14px;
}

/* Right-hand side of the header: the Daily AI news link sits above the counts. */
.ai-map-headright {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 12px;
  flex: 0 0 auto;
}

.ai-map-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.history-museum-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid #172131;
  border-radius: 999px;
  background: #172131;
  color: #ffffff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 760;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.history-museum-button:hover,
.history-museum-button:focus-visible {
  background: #2d394b;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(13, 23, 40, 0.16);
}

.history-museum-button:focus-visible {
  outline: 3px solid rgba(23, 119, 230, 0.28);
  outline-offset: 3px;
}

.history-museum-button span {
  font-size: 15px;
  line-height: 1;
}

.ai-map-newsbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid rgba(217, 103, 15, 0.32);
  border-radius: 999px;
  background: rgba(217, 103, 15, 0.08);
  color: #ab4b06;
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.ai-map-newsbtn:hover,
.ai-map-newsbtn:focus-visible {
  border-color: rgba(217, 103, 15, 0.6);
  background: rgba(217, 103, 15, 0.14);
  transform: translateY(-1px);
}

.ai-map-newsbtn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d9670f;
  box-shadow: 0 0 0 3px rgba(217, 103, 15, 0.2);
}

.ai-map-overview {
  display: flex;
  align-items: center;
  gap: 22px;
  flex: 0 0 auto;
  padding-bottom: 3px;
  color: #718096;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ai-map-overview span {
  white-space: nowrap;
}

.ai-map-overview strong {
  margin-right: 3px;
  color: #12213a;
  font-size: 16px;
  letter-spacing: -0.025em;
}

/* ---------- the instrument ---------- */
.ai-map-snapshot {
  position: relative;
  color: #14243a;
  background:
    radial-gradient(900px 360px at 8% 0%, color-mix(in srgb, var(--era) 13%, transparent), transparent 68%),
    radial-gradient(780px 360px at 96% 100%, rgba(255, 122, 47, 0.1), transparent 58%),
    linear-gradient(145deg, #f8fbff 0%, #eef4f8 52%, #f7f2ee 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
  transition: background-color 240ms ease;
}

/* ---------- heads-up display ---------- */
.ai-map-hud {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 22px 26px 8px;
}

.ai-map-hud-year {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0;
}

.ai-map-hud-year strong {
  color: #14243a;
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 830;
  letter-spacing: -0.05em;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.ai-map-hud-era {
  padding: 5px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--era) 14%, rgba(255, 255, 255, 0.72));
  color: color-mix(in srgb, var(--era) 72%, #14243a);
  font-size: 10.5px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ai-map-gap {
  flex: 0 1 340px;
  min-width: 250px;
}

.ai-map-gap-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.ai-map-gap-head span {
  color: #65758a;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.ai-map-gap-head strong {
  color: #17283f;
  font-size: 19px;
  font-weight: 820;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ai-map-gap-bar {
  display: block;
  position: relative;
  height: 7px;
  border-radius: 99px;
  background: rgba(15, 32, 52, 0.1);
  overflow: hidden;
}

.ai-map-gap-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--era), color-mix(in srgb, var(--era) 45%, #fff));
  transition: width 450ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- landscape ---------- */
.ai-map-scenewrap {
  position: relative;
}

.ai-map-travel-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 11px 20px 2px;
  color: #607188;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.4;
  text-align: center;
  text-transform: uppercase;
}

.ai-map-travel-hint span {
  color: var(--era);
  font-size: 17px;
  line-height: 1;
}

.ai-map-scene {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: grab;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--era) 72%, #dceaff) rgba(15, 32, 52, 0.08);
  -webkit-overflow-scrolling: touch;
}

.ai-map-scene::-webkit-scrollbar {
  display: block;
  height: 12px;
}

.ai-map-scene::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(15, 32, 52, 0.08);
}

.ai-map-scene::-webkit-scrollbar-thumb {
  border: 3px solid #eef4f7;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--era), color-mix(in srgb, var(--era) 55%, #fff));
}

.ai-map-scene.is-dragging {
  cursor: grabbing;
}

.ai-map-scene:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--era) 45%, transparent);
  outline-offset: -3px;
}

.ai-map-world {
  position: relative;
  height: 330px;
}

.ai-map-band {
  position: absolute;
  top: 0;
  bottom: 0;
  opacity: 0.12;
}

.ai-map-band-name {
  position: absolute;
  top: 14px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.65;
}

.ai-map-axis-line {
  position: absolute;
  right: 0;
  left: 0;
  top: 165px;
  height: 2px;
  opacity: 0.42;
  background: linear-gradient(90deg, #22c58a, #3f9dff 46%, #ff7a2f);
}

.ai-map-tick {
  position: absolute;
  top: 158px;
  width: 1px;
  background: #5f7085;
}

.ai-map-tick-year {
  position: absolute;
  top: 174px;
  color: #718096;
  font-size: 9.5px;
  font-weight: 750;
  transform: translateX(-50%);
}

.ai-map-mark {
  position: absolute;
  top: 165px;
  z-index: 3;
  width: 13px;
  height: 13px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.94);
  border-radius: 50%;
  background: var(--era);
  cursor: pointer;
  appearance: none;
  box-shadow: 0 0 0 1px rgba(15, 32, 52, 0.16), 0 3px 9px rgba(30, 48, 70, 0.12);
  transform: translate(-50%, -50%);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.ai-map-mark:hover {
  transform: translate(-50%, -50%) scale(1.45);
}

.ai-map-mark.is-active {
  transform: translate(-50%, -50%) scale(1.75);
  box-shadow:
    0 0 0 1px rgba(15, 32, 52, 0.14),
    0 0 0 7px color-mix(in srgb, var(--era) 22%, transparent),
    0 8px 25px color-mix(in srgb, var(--era) 32%, transparent);
}

.ai-map-mark:focus-visible {
  outline: 3px solid rgba(20, 36, 58, 0.72);
  outline-offset: 4px;
}

.ai-map-stem {
  position: absolute;
  z-index: 2;
  width: 1px;
  opacity: 0.4;
  background: linear-gradient(var(--era), transparent);
}

.ai-map-mark-label {
  position: absolute;
  z-index: 2;
  color: #52657b;
  font-size: 11px;
  font-weight: 640;
  white-space: nowrap;
  opacity: 0.72;
  pointer-events: none;
  transform: translateX(-50%);
  transition: color 200ms ease, opacity 200ms ease;
}

.ai-map-mark-label u {
  display: block;
  color: #718198;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.ai-map-mark-label.is-active {
  color: #14243a;
  opacity: 1;
}

.ai-map-mark-label.is-active u {
  color: var(--era);
}

/* playhead + edge fades */
.ai-map-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 4;
  width: 2px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(28, 47, 70, 0.48) 22%, rgba(28, 47, 70, 0.48) 78%, transparent);
}

.ai-map-playhead::before {
  content: "";
  position: absolute;
  top: 150px;
  left: 50%;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(28, 47, 70, 0.38);
  background: rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.ai-map-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 4;
  width: 90px;
  pointer-events: none;
}

.ai-map-fade-start {
  left: 0;
  background: linear-gradient(90deg, rgba(244, 248, 250, 0.96), transparent);
}

.ai-map-fade-end {
  right: 0;
  background: linear-gradient(270deg, rgba(244, 246, 248, 0.96), transparent);
}

/* ---------- readout ---------- */
.ai-map-readout {
  position: relative;
  z-index: 5;
  min-height: 132px;
  padding: 16px 26px 20px;
  border-top: 1px solid rgba(15, 32, 52, 0.1);
  background: rgba(255, 255, 255, 0.42);
}

.ai-map-readout h4 {
  margin: 0 0 7px;
  color: #14243a;
  font-size: clamp(19px, 2.4vw, 26px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.ai-map-readout p {
  margin: 0;
  max-width: 88ch;
  color: #5d6e84;
  font-size: 13.5px;
  line-height: 1.65;
}

.ai-map-readout a {
  display: inline-flex;
  gap: 6px;
  margin-top: 10px;
  color: var(--era);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
}

.ai-map-readout a::after {
  content: "↗";
}

.ai-map-readout a:hover,
.ai-map-readout a:focus-visible {
  text-decoration: underline;
}

.ai-map-readout a[hidden] {
  display: none;
}

/* ---------- minimap ---------- */
.ai-map-mini {
  position: relative;
  height: 40px;
  margin: 0 26px 16px;
  border-radius: 9px;
  border: 1px solid rgba(15, 32, 52, 0.07);
  background: rgba(15, 32, 52, 0.065);
  cursor: pointer;
  overflow: hidden;
}

.ai-map-mini i {
  position: absolute;
  bottom: 7px;
  width: 2px;
  border-radius: 2px;
  opacity: 0.85;
}

.ai-map-mini-window {
  position: absolute;
  top: 0;
  bottom: 0;
  border: 1.5px solid rgba(45, 65, 88, 0.48);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.46);
  pointer-events: none;
}

.ai-map-axis-label {
  position: absolute;
  top: 5px;
  z-index: 2;
  color: #66778d;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.ai-map-axis-start {
  left: 9px;
}

.ai-map-axis-end {
  right: 9px;
}

/* ---------- controls ---------- */
.ai-map-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 26px 18px;
}

.ai-map-step,
.ai-map-era {
  appearance: none;
  padding: 8px 13px;
  border: 1px solid rgba(15, 32, 52, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  color: #24364d;
  font: inherit;
  font-size: 12.5px;
  font-weight: 680;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.ai-map-step:hover,
.ai-map-era:hover {
  border-color: rgba(15, 32, 52, 0.24);
  background: rgba(255, 255, 255, 0.86);
}

.ai-map-step:focus-visible,
.ai-map-era:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--era) 34%, transparent);
  outline-offset: 2px;
}

.ai-map-eras {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-map-era {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ai-map-era i {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--era);
}

.ai-map-era.is-on {
  border-color: color-mix(in srgb, var(--era) 50%, rgba(15, 32, 52, 0.12));
  background: color-mix(in srgb, var(--era) 14%, rgba(255, 255, 255, 0.72));
}

.ai-map-pos {
  margin-left: auto;
  color: #65768c;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- footer hint ---------- */
.ai-map-hint {
  margin: 0;
  padding: 13px 34px 18px;
  border-top: 1px solid rgba(13, 23, 40, 0.08);
  color: #93a0b2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: center;
}

.ai-map-hint kbd {
  padding: 2px 6px;
  border: 1px solid rgba(13, 23, 40, 0.16);
  border-radius: 5px;
  background: #fff;
  font: inherit;
  font-size: 10.5px;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .ai-map-header {
    align-items: start;
    flex-direction: column;
    gap: 18px;
    padding: 24px 22px 20px;
  }

  .ai-map-overview {
    width: 100%;
    gap: 18px;
  }

  .ai-map-headright {
    align-items: flex-start;
    width: 100%;
  }
}

@media (max-width: 760px) {
  #history-section .timeline-wrapper {
    gap: 20px;
  }

  .ai-map {
    border-radius: 18px;
  }

  .ai-map-header {
    padding: 22px 18px 18px;
  }

  .ai-map-header h3 {
    font-size: 33px;
  }

  .ai-map-overview {
    justify-content: space-between;
  }

  .ai-map-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .ai-map-hud {
    gap: 14px;
    padding: 18px 16px 6px;
  }

  .ai-map-travel-hint {
    justify-content: flex-start;
    padding: 10px 16px 0;
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  .ai-map-gap {
    flex: 1 1 100%;
    min-width: 0;
  }

  .ai-map-world {
    height: 290px;
  }

  .ai-map-readout {
    min-height: 0;
    padding: 14px 16px 18px;
  }

  .ai-map-mini {
    margin: 0 16px 14px;
  }

  .ai-map-controls {
    padding: 0 16px 16px;
  }

  .ai-map-fade {
    width: 44px;
  }

  .ai-map-pos {
    width: 100%;
    margin-left: 0;
  }

  .ai-map-hint {
    padding: 12px 16px 16px;
    font-size: 10px;
    letter-spacing: 0.06em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .history-museum-button {
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-map-mark,
  .ai-map-mark-label,
  .ai-map-gap-bar i,
  .ai-map-step,
  .ai-map-era {
    transition: none !important;
  }
}
