body.timeline-shell-mode {
  height: 100dvh;
  min-height: 540px;
  overflow: hidden;
  padding: 0;
}

.timeline-app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  height: 100dvh;
  min-height: 540px;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
}

.timeline-topbar {
  position: relative;
  z-index: 3;
  padding: 12px clamp(14px, 2vw, 30px) 10px;
  border-bottom: 1px solid var(--hair);
  background: var(--ink);
  min-width: 0;
  width: 100%;
}

.timeline-topbar .site-nav {
  margin: 0 0 9px;
}

.timeline-topbar header {
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  width: 100%;
}

.timeline-topbar header > div:first-child {
  min-width: 0;
  flex: 1;
}

.timeline-topbar h1 {
  max-width: none;
  font-size: clamp(16px, 1.7vw, 25px);
  line-height: 1.16;
}

.timeline-actions {
  display: flex;
  flex: none;
  gap: 8px;
  align-items: center;
}

.timeline-action,
.timeline-drawer-tab,
.timeline-popover-close,
.timeline-drawer-close {
  appearance: none;
  border: 1px solid var(--hair);
  border-radius: 0;
  background: var(--ink-2);
  color: var(--paper);
  font: 600 11px/1 var(--sans);
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
}

.timeline-action {
  padding: 10px 13px;
  color: var(--gold);
}

.timeline-action-primary {
  border-color: var(--seal);
  background: color-mix(in srgb, var(--seal) 24%, var(--ink-2));
  color: var(--paper);
}

.timeline-action:hover,
.timeline-drawer-tab:hover,
.timeline-drawer-tab[aria-selected="true"] {
  border-color: var(--gold);
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 10%, var(--ink-2));
}

.timeline-action:focus-visible,
.timeline-drawer-tab:focus-visible,
.timeline-popover-close:focus-visible,
.timeline-drawer-close:focus-visible,
.timeline-event-rail .ev:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.timeline-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 10px clamp(8px, 1.5vw, 22px);
  overflow: hidden;
}

.timeline-stage-instrumented {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.timeline-stage-instrumented > .signal-console {
  margin: 0;
}

.timeline-stage #chart-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.timeline-stage #chart {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
}

.timeline-stage .chart-fate-marker text {
  opacity: 0;
  transition: opacity .14s ease;
}

.timeline-stage .chart-fate-marker:hover text {
  opacity: 1;
}

.timeline-story-pins {
  position: absolute;
  z-index: 7;
  top: 18px;
  left: clamp(14px, 2vw, 28px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  max-height: calc(100% - 36px);
  overflow-y: auto;
  scrollbar-width: none;
}

.timeline-stage-instrumented .timeline-story-pins {
  top: 120px;
  max-height: calc(100% - 136px);
}

.timeline-story-pins::-webkit-scrollbar { display: none; }
.timeline-story-pins-label {
  margin: 0 0 2px 7px;
  color: var(--gold);
  font: 700 8px/1 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
  text-shadow: 0 1px 5px var(--ink);
}

.timeline-story-pin {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  max-width: 176px;
  padding: 5px 9px 5px 6px;
  border: 1px solid color-mix(in srgb, var(--hair) 75%, transparent);
  border-left: 2px solid var(--gold-dim);
  border-radius: 0;
  background: color-mix(in srgb, var(--ink-2) 94%, transparent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .28);
  color: var(--paper-dim);
  font: 600 9px/1.15 var(--sans);
  letter-spacing: .06em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  transition: max-width .18s ease, border-color .18s ease, color .18s ease, background .18s ease;
}

.timeline-story-pin-index { color: var(--gold); font-size: 8px; letter-spacing: .1em; }
.timeline-story-pin:hover,
.timeline-story-pin:focus-visible,
.timeline-story-pin.active {
  max-width: 210px;
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 10%, var(--ink-2));
  color: var(--paper);
  outline: none;
}
.timeline-story-pin-spotlight { border-left-color: var(--seal); }
.timeline-story-pin-dossier { border-left-color: var(--paper-dim); }

.timeline-story-panel {
  position: absolute;
  z-index: 10;
  top: 14px;
  right: clamp(14px, 2vw, 28px);
  bottom: 14px;
  width: min(590px, 54vw);
  min-width: 360px;
  border: 1px solid var(--gold-dim);
  border-left: 4px solid var(--gold);
  background: color-mix(in srgb, var(--ink) 96%, transparent);
  box-shadow: -22px 0 50px rgba(0, 0, 0, .52);
  color: var(--paper);
  overflow: hidden;
  backdrop-filter: blur(12px);
}
.timeline-stage-instrumented .timeline-story-panel { top: 116px; }
.timeline-story-panel[hidden] { display: none; }
.timeline-story-panel[data-type="spotlight"] { width: min(760px, 68vw); border-color: var(--seal); border-left-color: var(--seal); }
.timeline-story-panel[data-type="dossier"] { top: auto; width: min(470px, 44vw); min-height: 240px; max-height: 68%; border-left-color: var(--paper-dim); }

.timeline-story-panel-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--hair);
  background: var(--ink-2);
}
.timeline-story-panel-kicker { color: var(--gold); font: 700 9px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; }
.timeline-story-panel h2 { margin-top: 7px; max-width: 680px; color: var(--paper); font-size: clamp(17px, 1.7vw, 25px); line-height: 1.12; }
.timeline-story-panel-close {
  appearance: none;
  flex: none;
  width: 31px;
  height: 31px;
  border: 1px solid var(--hair);
  border-radius: 0;
  background: var(--ink-3);
  color: var(--paper);
  font: 20px/1 var(--sans);
  cursor: pointer;
}
.timeline-story-panel-close:hover,
.timeline-story-panel-close:focus-visible { border-color: var(--gold); color: var(--gold); outline: none; }
.timeline-story-content { height: calc(100% - 73px); padding: 18px; overflow: auto; scrollbar-color: var(--gold-dim) var(--ink-2); }
.timeline-story-content > .legend-box,
.timeline-story-content > .sub { width: 100%; max-width: none; }
.timeline-story-content #sankey-wrap,
.timeline-story-content #regents-wrap,
.timeline-story-content .table-scroll { min-width: 720px; }
.timeline-story-content #sankey,
.timeline-story-content #regents { min-width: 720px; }
.timeline-story-content footer { margin: 0; }

.timeline-bottom {
  position: relative;
  z-index: 4;
  border-top: 1px solid var(--hair);
  background: var(--ink-2);
  box-shadow: 0 -12px 30px rgba(0, 0, 0, .2);
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.timeline-rail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  padding: 8px clamp(14px, 2vw, 30px) 5px;
  color: var(--gold);
  font: 600 10px/1 var(--sans);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.timeline-rail-head span:last-child {
  color: var(--paper-dim);
  font-weight: 400;
  letter-spacing: .08em;
}

.timeline-event-rail {
  display: flex !important;
  grid-template-columns: none !important;
  gap: 7px !important;
  width: 100%;
  min-width: 0;
  padding: 0 clamp(14px, 2vw, 30px) 10px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.timeline-event-rail .ev {
  flex: 0 0 auto;
  width: auto;
  min-width: 142px;
  max-width: 240px;
  min-height: 52px;
  margin: 0;
  padding: 7px 10px;
  border-top-width: 1px;
  text-align: left;
  scroll-snap-align: start;
  transform: none !important;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, color .14s ease;
}

.timeline-event-rail .ev::after {
  content: "Pin year →";
  display: block;
  margin-top: 6px;
  color: var(--gold-dim);
  font: 600 8px/1 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.timeline-event-rail .ev:hover {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 7%, var(--ink-3));
}

.timeline-event-rail .ev:hover::after,
.timeline-event-rail .ev[aria-pressed="true"]::after {
  color: var(--gold);
}

.timeline-event-rail .ev .yr {
  font-size: 11px;
  line-height: 1.1;
}

.timeline-event-rail .ev .nm {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.18;
}

.timeline-event-rail .ev.active {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 9%, var(--ink-3));
}

.timeline-event-rail .timeline-featured-event {
  min-width: 190px;
  border-color: var(--seal);
  border-top-width: 3px;
  background: color-mix(in srgb, var(--seal) 20%, var(--ink-3));
}

.timeline-event-rail .timeline-featured-event .nm::before {
  content: "The breakup · ";
  color: var(--paper);
}

.timeline-event-popover {
  position: absolute;
  right: clamp(14px, 2vw, 30px);
  bottom: calc(100% + 10px);
  width: min(560px, calc(100vw - 28px));
  padding: 16px 44px 16px 18px;
  border: 1px solid var(--gold-dim);
  background: var(--ink-2);
  color: var(--paper-dim);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  font-size: 13px;
  line-height: 1.55;
}

.timeline-event-popover[hidden] {
  display: none;
}

.timeline-event-popover .timeline-event-date {
  color: var(--gold);
  font: 500 10px/1 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.timeline-event-popover h2 {
  margin: 5px 0 7px;
  color: var(--paper);
  font-size: 19px;
  line-height: 1.15;
}

.timeline-popover-close,
.timeline-drawer-close {
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--paper-dim);
  font-size: 18px;
}

.timeline-popover-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.timeline-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(620px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--gold-dim);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  box-shadow: -24px 0 70px rgba(0, 0, 0, .55);
}

.timeline-drawer::backdrop {
  background: rgba(0, 0, 0, .66);
  backdrop-filter: blur(2px);
}

.timeline-drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 18px;
  border-bottom: 1px solid var(--hair);
  background: var(--ink);
}

.timeline-drawer-kicker {
  color: var(--gold);
  font: 500 10px/1 var(--sans);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.timeline-drawer-title {
  margin: 6px 0 0;
  color: var(--paper);
  font-size: 22px;
  line-height: 1.18;
}

.timeline-drawer-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--hair);
  background: var(--ink-2);
}

.timeline-drawer-tab {
  flex: none;
  padding: 8px 10px;
  color: var(--paper-dim);
  white-space: nowrap;
}

.timeline-drawer-content {
  height: calc(100dvh - 126px);
  padding: 20px 20px 48px;
  overflow: auto;
  overscroll-behavior: contain;
}

.timeline-drawer-content > .legend-box,
.timeline-drawer-content > .sub {
  max-width: none;
  margin-bottom: 16px;
}

.timeline-chapter-map {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--hair);
}

.timeline-chapter-map-title {
  color: var(--paper);
  font-size: 18px;
  line-height: 1.2;
}

.timeline-chapter-map > p {
  margin: 5px 0 14px;
  color: var(--paper-dim);
  font-size: 12px;
  line-height: 1.45;
}

.timeline-chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.timeline-chapter {
  position: relative;
  min-height: 112px;
  padding: 13px 13px 27px 42px;
  border: 1px solid var(--hair);
  background: var(--ink-2);
  color: var(--paper);
  text-align: left;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}

.timeline-chapter:hover,
.timeline-chapter:focus-visible {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, var(--ink-2));
  outline: none;
}

.timeline-chapter-number {
  position: absolute;
  top: 13px;
  left: 12px;
  color: var(--seal);
  font: 700 11px/1 var(--sans);
}

.timeline-chapter strong {
  display: block;
  font: 600 13px/1.28 var(--serif);
}

.timeline-chapter-open {
  position: absolute;
  left: 42px;
  bottom: 12px;
  color: var(--gold-dim);
  font: 600 8px/1 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.timeline-chapter:hover .timeline-chapter-open,
.timeline-chapter:focus-visible .timeline-chapter-open {
  color: var(--gold);
}

.timeline-drawer-content #sankey-wrap,
.timeline-drawer-content #regents-wrap,
.timeline-drawer-content .table-scroll {
  overflow-x: auto;
}

.timeline-drawer-content #sankey,
.timeline-drawer-content #regents {
  min-width: 860px;
}

.timeline-drawer-content footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--hair);
}

@media (max-width: 760px) {
  body.timeline-shell-mode,
  .timeline-app {
    min-height: 500px;
  }

  .timeline-topbar {
    padding: 9px 10px 8px;
  }

  .timeline-topbar .site-nav {
    margin-bottom: 6px;
  }

  .timeline-topbar h1 {
    font-size: 14px;
    letter-spacing: .02em;
  }

  .timeline-topbar header {
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
  }

  .timeline-actions {
    width: 100%;
  }

  .timeline-actions .timeline-action {
    flex: 1;
  }

  .timeline-action {
    padding: 8px 9px;
    font-size: 9px;
  }

  .timeline-stage {
    padding: 6px;
    overflow-x: auto;
  }

  .timeline-stage #chart-wrap {
    width: 900px;
    overflow: visible;
  }

  .timeline-stage #chart {
    width: 900px !important;
    max-width: none;
  }

  .timeline-rail-head {
    padding: 7px 10px 4px;
  }

  .timeline-rail-head span:last-child {
    display: none;
  }

  .timeline-event-rail {
    padding: 0 10px 8px;
  }

  .timeline-event-rail .ev {
    min-width: 130px;
    max-width: 190px;
    min-height: 48px;
  }

  .timeline-chapter-grid {
    grid-template-columns: 1fr;
  }

  .timeline-event-popover {
    right: 10px;
    bottom: calc(100% + 7px);
    width: calc(100vw - 20px);
    max-height: 38vh;
    overflow: auto;
  }

  .timeline-drawer-head {
    padding: 14px;
  }

  .timeline-drawer-tabs {
    padding: 8px 14px;
  }

  .timeline-drawer-content {
    padding: 16px 14px 36px;
  }

  .timeline-story-pins,
  .timeline-stage-instrumented .timeline-story-pins {
    position: fixed;
    top: 92px;
    left: 8px;
    right: 8px;
    max-height: none;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .timeline-story-pins-label {
    display: none;
  }

  .timeline-story-pin {
    flex: none;
    white-space: nowrap;
  }

  .timeline-story-panel,
  .timeline-stage-instrumented .timeline-story-panel,
  .timeline-story-panel[data-type="spotlight"],
  .timeline-story-panel[data-type="dossier"] {
    position: fixed;
    inset: 86px 8px 106px;
    width: auto;
    min-width: 0;
    max-height: none;
  }

  .timeline-story-content {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .timeline-stage .chart-fate-marker text {
    transition: none;
  }
}
