/* Compact AI history transit map */

#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 {
  padding: 0 !important;
}

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

.ai-map {
  --ink: #101827;
  --muted: #667488;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(16, 24, 39, 0.14);
  border-radius: 22px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 24px 62px rgba(19, 35, 58, 0.11);
  box-sizing: border-box;
}

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

.ai-map-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 28px 32px 22px;
  background:
    radial-gradient(circle at 95% 0%, rgba(38, 132, 245, 0.11), transparent 34%),
    #fbfcfe;
}

.ai-map-eyebrow {
  margin: 0 0 6px;
  color: #176acb;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.ai-map-header h3 {
  margin: 0;
  color: #101827;
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.ai-map-header h3 + p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.ai-map-overview {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
  color: #6b778a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.ai-map-overview strong {
  color: #142033;
  font-size: 15px;
}

.ai-map-overview button {
  appearance: none;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid rgba(20, 32, 51, 0.14);
  border-radius: 999px;
  background: #142033;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 11px !important;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: none;
  transition: transform 160ms ease, background 160ms ease;
}

.ai-map-overview button:hover {
  background: #253853;
  transform: translateY(-1px);
}

.ai-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 12px 32px;
  border-top: 1px solid rgba(16, 24, 39, 0.08);
  border-bottom: 1px solid rgba(16, 24, 39, 0.08);
  background: #fff;
}

.ai-map-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ai-map-filter {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #59677a;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px !important;
  font-weight: 720;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.ai-map-filter > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8795a8;
}

.ai-map-filter[data-filter="machine"] > span { background: #3a98f5; }
.ai-map-filter[data-filter="genai"] > span { background: #24b785; }

.ai-map-filter:hover {
  color: #182538;
  background: #f2f5f8;
}

.ai-map-filter.is-active {
  border-color: rgba(20, 32, 51, 0.12);
  background: #edf2f7;
  color: #182538;
}

.ai-map-count {
  flex: 0 0 auto;
  color: #8793a3;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ai-map-viewport {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, #102a42, #071421 72%);
  background-size: 30px 30px, 30px 30px, auto;
}

.ai-map-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 144px;
  width: 100%;
  min-width: 0;
  height: 274px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 50px;
  scroll-padding-inline: 50px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(142, 170, 197, 0.56) rgba(255, 255, 255, 0.07);
}

.ai-map-rail:focus {
  outline: none;
}

.ai-map-rail::-webkit-scrollbar { height: 6px; }
.ai-map-rail::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.07); }
.ai-map-rail::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(142, 170, 197, 0.56);
}

.ai-map-stop {
  --stop-color: #9aa8ba;
  appearance: none;
  position: relative;
  width: 144px;
  height: 268px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  scroll-snap-align: center;
}

.ai-map-stop[data-era="foundations"] { --stop-color: #e0bd72; }
.ai-map-stop[data-era="machine"] { --stop-color: #55aaff; }
.ai-map-stop[data-era="genai"] { --stop-color: #47d9a5; }

.ai-map-stop::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 134px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--stop-color);
  opacity: 0.58;
}

.ai-map-stop-card {
  position: absolute;
  z-index: 2;
  top: 18px;
  left: 7px;
  right: 7px;
  min-height: 82px;
  padding: 12px 13px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: rgba(8, 25, 41, 0.92);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.ai-map-stop.is-lower .ai-map-stop-card {
  top: 168px;
}

.ai-map-stop-card::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: 35px;
  background: var(--stop-color);
  opacity: 0.65;
}

.ai-map-stop.is-lower .ai-map-stop-card::after {
  top: auto;
  bottom: 100%;
  height: 34px;
}

.ai-map-stop-date {
  display: block;
  overflow: hidden;
  color: var(--stop-color);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.ai-map-stop-title {
  display: -webkit-box;
  margin-top: 7px;
  overflow: hidden;
  color: #f2f6fa;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.32;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.ai-map-stop-node {
  position: absolute;
  z-index: 3;
  top: 126px;
  left: 50%;
  width: 19px;
  height: 19px;
  border: 4px solid #0b1d2d;
  border-radius: 50%;
  background: var(--stop-color);
  box-shadow: 0 0 0 1px var(--stop-color), 0 0 18px rgba(116, 184, 235, 0.3);
  transform: translateX(-50%);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.ai-map-stop:hover .ai-map-stop-card,
.ai-map-stop:focus-visible .ai-map-stop-card,
.ai-map-stop.is-active .ai-map-stop-card {
  border-color: var(--stop-color);
  background: #102a40;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3), inset 0 0 0 1px color-mix(in srgb, var(--stop-color) 46%, transparent);
  transform: translateY(-3px);
}

.ai-map-stop.is-lower:hover .ai-map-stop-card,
.ai-map-stop.is-lower:focus-visible .ai-map-stop-card,
.ai-map-stop.is-lower.is-active .ai-map-stop-card {
  transform: translateY(3px);
}

.ai-map-stop:hover .ai-map-stop-node,
.ai-map-stop:focus-visible .ai-map-stop-node,
.ai-map-stop.is-active .ai-map-stop-node {
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.09), 0 0 0 7px var(--stop-color), 0 0 26px var(--stop-color);
  transform: translateX(-50%) scale(1.06);
}

.ai-map-stop:focus-visible {
  outline: none;
}

.ai-map-stop:focus-visible .ai-map-stop-card {
  outline: 3px solid rgba(105, 179, 255, 0.45);
  outline-offset: 3px;
}

.ai-map-hint {
  margin: 0;
  padding: 7px 16px;
  border-bottom: 1px solid rgba(16, 24, 39, 0.09);
  background: #f7f9fb;
  color: #8894a3;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: center;
  text-transform: uppercase;
}

.ai-map-detail {
  --detail-color: #48d9a6;
  display: grid;
  grid-template-columns: minmax(130px, 0.24fr) minmax(0, 1fr) auto;
  gap: 26px;
  align-items: center;
  min-height: 148px;
  padding: 22px 30px;
  background: #fff;
}

.ai-map-detail[data-era="foundations"] { --detail-color: #ae7e1b; }
.ai-map-detail[data-era="machine"] { --detail-color: #1676d2; }
.ai-map-detail[data-era="genai"] { --detail-color: #15845f; }

.ai-map-detail-stamp {
  display: grid;
  gap: 10px;
  padding-right: 24px;
  border-right: 1px solid rgba(16, 24, 39, 0.11);
}

.ai-map-era {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  color: var(--detail-color);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ai-map-era::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: currentColor;
}

.ai-map-detail time {
  color: #172438;
  font-size: clamp(17px, 2.2vw, 24px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.ai-map-detail-copy > span {
  color: #95a0af;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-map-detail-copy h4 {
  margin: 4px 0 0;
  color: #101827;
  font-size: clamp(19px, 2.4vw, 27px);
  font-weight: 790;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.ai-map-detail-copy p {
  max-width: 700px;
  margin: 7px 0 0;
  color: #647184;
  font-size: 12px;
  line-height: 1.5;
}

.ai-map-detail-actions {
  display: grid;
  justify-items: end;
  gap: 14px;
}

.ai-map-detail-actions > a {
  color: #176acb;
  font-size: 11px;
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
}

.ai-map-detail-actions > a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ai-map-detail-actions > a[hidden] {
  display: none;
}

.ai-map-detail-actions > div {
  display: flex;
  gap: 7px;
}

.ai-map-detail-actions button {
  appearance: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(16, 24, 39, 0.13);
  border-radius: 50%;
  background: #f3f6f9;
  color: #182538;
  cursor: pointer;
  font-size: 16px !important;
  transition: background 160ms ease, transform 160ms ease;
}

.ai-map-detail-actions button:hover:not(:disabled) {
  background: #e6eef6;
  transform: translateY(-1px);
}

.ai-map-detail-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.ai-map-overview button:focus-visible,
.ai-map-filter:focus-visible,
.ai-map-detail-actions button:focus-visible,
.ai-map-detail-actions a:focus-visible {
  outline: 3px solid rgba(45, 143, 244, 0.36);
  outline-offset: 3px;
}

@media (max-width: 780px) {
  .ai-map-header {
    align-items: start;
    flex-direction: column;
    gap: 18px;
  }

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

  .ai-map-detail {
    grid-template-columns: minmax(110px, 0.3fr) minmax(0, 1fr);
    gap: 18px;
  }

  .ai-map-detail-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    justify-items: initial;
    padding-top: 13px;
    border-top: 1px solid rgba(16, 24, 39, 0.09);
  }
}

@media (max-width: 700px) {
  .ai-map {
    border-radius: 17px;
  }

  .ai-map-header {
    padding: 23px 20px 19px;
  }

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

  .ai-map-header h3 + p {
    font-size: 13px;
  }

  .ai-map-overview {
    gap: 10px;
  }

  .ai-map-overview span {
    font-size: 9px;
  }

  .ai-map-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    padding: 10px 0 8px;
  }

  .ai-map-filters {
    width: 100%;
    overflow-x: auto;
    padding: 2px 20px 5px;
    scrollbar-width: none;
  }

  .ai-map-filters::-webkit-scrollbar { display: none; }

  .ai-map-count {
    padding: 0 20px;
  }

  .ai-map-rail {
    grid-auto-columns: 132px;
    height: 258px;
    padding-inline: 22px;
    scroll-padding-inline: 22px;
  }

  .ai-map-stop {
    width: 132px;
    height: 252px;
  }

  .ai-map-stop::before { top: 126px; }
  .ai-map-stop-node { top: 118px; }
  .ai-map-stop-card { top: 14px; min-height: 78px; }
  .ai-map-stop-card::after { height: 32px; }
  .ai-map-stop.is-lower .ai-map-stop-card { top: 158px; }
  .ai-map-stop.is-lower .ai-map-stop-card::after { height: 31px; }

  .ai-map-detail {
    grid-template-columns: 1fr;
    gap: 13px;
    min-height: 0;
    padding: 19px 20px 21px;
  }

  .ai-map-detail-stamp {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 0 0 11px;
    border-right: 0;
    border-bottom: 1px solid rgba(16, 24, 39, 0.1);
  }

  .ai-map-detail time {
    font-size: 17px;
  }

  .ai-map-detail-copy h4 {
    font-size: 22px;
  }

  .ai-map-detail-actions {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-map *,
  .ai-map *::before,
  .ai-map *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
