@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
}

/* Design tokens shared with the blog (blog/styles.css). */
:root {
  color-scheme: light;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #ffffff;
  --bg-soft: #f7f5f9;
  --surface: #ffffff;
  --ink: #16141a;
  --ink-2: #4a4652;
  --muted: #7a7583;
  --line: #e7e3ec;
  --line-strong: #d3cdda;
  --accent: #7446a0;
  --accent-ink: #5d3585;
  --accent-soft: #f2ebf9;
  --retained: #215f9a;
  --superseded: #e17f00;
  --abandoned: #c2235d;
  --on-mark: #ffffff;
  --shadow: 0 1px 2px rgba(22, 20, 26, .04), 0 10px 30px rgba(22, 20, 26, .06);
  --radius: 16px;
  --header-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121016;
    --bg-soft: #19161e;
    --surface: #1c1922;
    --ink: #f3f1f6;
    --ink-2: #c9c4d0;
    --muted: #958f9e;
    --line: #2c2833;
    --line-strong: #3d3846;
    --accent: #b48ae0;
    --accent-ink: #cfb0ef;
    --accent-soft: #2a2234;
    --retained: #4a8ad6;
    --superseded: #cf7a12;
    --abandoned: #d9528a;
    --on-mark: #16141a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121016;
  --bg-soft: #19161e;
  --surface: #1c1922;
  --ink: #f3f1f6;
  --ink-2: #c9c4d0;
  --muted: #958f9e;
  --line: #2c2833;
  --line-strong: #3d3846;
  --accent: #b48ae0;
  --accent-ink: #cfb0ef;
  --accent-soft: #2a2234;
  --retained: #4a8ad6;
  --superseded: #cf7a12;
  --abandoned: #d9528a;
  --on-mark: #16141a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p { margin-top: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

main, .site-footer { width: min(1280px, 100% - 48px); margin-inline: auto; }

/* Header (same as the blog) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--header-h);
  padding: 0 max(24px, calc((100vw - 1280px) / 2));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -.02em;
  text-decoration: none;
}
.brand-mark { width: 32px; height: 32px; }
.site-nav { display: flex; gap: 22px; margin-left: auto; }
.site-nav a { color: var(--ink-2); font-size: 14px; font-weight: 550; text-decoration: none; }
.site-nav a:hover { color: var(--ink); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: inline; }
}

/* Explorer heading and controls */
.explorer { padding: 48px 0 64px; }
.explorer-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
  margin-bottom: 24px;
}
h1 { margin-bottom: 8px; font-size: clamp(30px, 3.6vw, 40px); font-weight: 750; line-height: 1.1; letter-spacing: -.03em; }
.explorer-lede { max-width: 680px; margin: 0; color: var(--ink-2); }
.explorer-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search-control, .sort-control {
  display: flex;
  align-items: center;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
}
.search-control { width: min(340px, 34vw); padding: 0 12px; }
.search-control:focus-within, .sort-control:focus-within { border-color: var(--accent); }
.search-control svg { flex: none; width: 17px; margin-right: 8px; fill: none; stroke: var(--muted); stroke-linecap: round; stroke-width: 1.8; }
.search-control input { width: 100%; border: 0; outline: 0; background: none; font-size: 14px; }
.search-control input::placeholder { color: var(--muted); }
.sort-control { padding-left: 12px; color: var(--muted); font-size: 13px; font-weight: 600; }
.sort-control select { height: 100%; padding: 0 8px; border: 0; outline: 0; background: transparent; font-size: 14px; font-weight: 550; cursor: pointer; }
.sort-control select option { color: var(--ink); background: var(--surface); }

/* Two-pane explorer */
.explorer-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 780px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: clip;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.paper-browser { min-width: 0; border-right: 1px solid var(--line); background: var(--surface); }
.paper-browser-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.paper-list { max-height: calc(100vh - var(--header-h)); min-height: 730px; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.paper-option {
  display: block;
  width: 100%;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: background .14s ease;
}
.paper-option:hover { background: var(--bg-soft); }
.paper-option.active { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.paper-option-index { color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.paper-option h3 { margin: 5px 0 6px; font-size: 15.5px; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; }
.paper-option-repo { display: block; overflow: hidden; color: var(--muted); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.paper-option-stats { display: flex; gap: 12px; margin-top: 6px; color: var(--muted); font-size: 12px; }
.empty-list { padding: 28px 18px; color: var(--muted); font-size: 14px; }

/* Paper detail */
.paper-detail { min-width: 0; padding: 36px clamp(22px, 4vw, 48px) 56px; }
.detail-kicker { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--accent-ink); font-size: 13px; font-weight: 700; }
.detail-title { max-width: 1000px; margin: 8px 0 16px; font-size: clamp(26px, 3vw, 34px); font-weight: 700; line-height: 1.15; letter-spacing: -.03em; text-wrap: balance; }
.link-row { display: flex; flex-wrap: wrap; gap: 8px; }
.external-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.external-link:hover { border-color: var(--accent); }
.external-link svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.detail-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 28px 0 10px; }
.detail-stat { padding: 14px 16px; border-radius: 12px; background: var(--bg-soft); }
.detail-stat strong { display: block; font-size: 24px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.detail-stat span { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.history-line { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.abstract-details { margin: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.abstract-details summary { padding: 13px 0; color: var(--ink); font-size: 14px; font-weight: 650; cursor: pointer; }
.abstract-details p { max-width: 900px; padding-bottom: 16px; color: var(--ink-2); font-size: 15px; }
.keyword-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 28px; }
.keyword-chip {
  padding: 3px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink-2);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 550;
}

.trajectory-summary { margin: 0 0 36px; padding: 16px 20px; border-radius: 12px; background: var(--bg-soft); }
.trajectory-summary h3 { margin: 0 0 4px; color: var(--muted); font-size: 13px; font-weight: 700; }
.trajectory-summary p { margin: 0; color: var(--ink-2); font-size: 15px; white-space: pre-line; }

.trajectory-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; align-items: flex-end; margin-bottom: 14px; }
.trajectory-head h3 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.trajectory-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.trajectory-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-2); font-size: 13px; }
.trajectory-legend span { display: inline-flex; align-items: center; }
.trajectory-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 7px; border-radius: 50%; }
.legend-retained::before { background: var(--retained); }
.legend-superseded::before { background: var(--superseded); }
.legend-abandoned::before { background: var(--abandoned); }

/* Decision cards */
.trajectory-scroll {
  max-height: min(300vh, 900px);
  padding: 16px 10px 16px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  overscroll-behavior: contain;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}
.trajectory-wrap { position: relative; padding-right: 28px; }
.trajectory-grid { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.trajectory-links { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.trajectory-link { fill: none; stroke: var(--superseded); stroke-width: 2; stroke-opacity: .76; }
.trajectory-arrow-head { fill: var(--superseded); }
.decision-card {
  --decision-color: var(--retained);
  position: relative;
  min-width: 0;
  min-height: 150px;
  padding: 0 14px 34px;
  border: 1.5px solid var(--decision-color);
  border-radius: 12px;
  background: color-mix(in srgb, var(--decision-color) 5%, var(--surface));
  text-align: left;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease;
}
.decision-card:hover, .decision-card:focus-visible { z-index: 15; transform: translateY(-2px); box-shadow: var(--shadow); outline: none; }
.decision-card.superseded { --decision-color: var(--superseded); }
.decision-card.abandoned { --decision-color: var(--abandoned); border-style: dashed; }
.decision-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 -14px 10px;
  padding: 6px 12px;
  border-radius: 10px 10px 0 0;
  color: var(--on-mark);
  background: var(--decision-color);
  font-size: 12px;
  font-weight: 700;
}
.decision-top span:last-child { opacity: .85; font-weight: 600; }
.decision-preview { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.4; }
.decision-foot { position: absolute; left: 14px; right: 14px; bottom: 10px; display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 12px; }
.decision-successor {
  position: relative;
  z-index: 4;
  padding: 0;
  border: 0;
  color: color-mix(in srgb, var(--superseded) 78%, var(--ink));
  background: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.decision-tooltip {
  position: absolute;
  z-index: 30;
  left: 8px;
  right: 8px;
  top: calc(100% + 8px);
  visibility: hidden;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(22, 20, 26, .16);
  font-size: 14px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
  pointer-events: none;
}
.decision-card:hover .decision-tooltip,
.decision-card:focus-visible .decision-tooltip,
.decision-card.expanded .decision-tooltip { visibility: visible; opacity: 1; transform: translateY(0); }
.decision-card.expanded { z-index: 16; }
.decision-tooltip-text { display: block; }
.decision-tooltip-meta { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.decision-card.flash { animation: flash-card 1.2s ease; }
@keyframes flash-card { 0%, 100% { box-shadow: none; } 40% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--superseded) 30%, transparent); } }

/* Footer, loading, errors */
.site-footer { padding: 24px 0 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.site-footer p { max-width: 760px; margin: 0; }
.loading {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--muted);
  background: var(--bg);
}
.loading-mark { width: 56px; height: 56px; animation: pulse 1.3s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: translateY(-5px); } }
.loading p { margin: 12px 0 0; font-size: 14px; }
.fatal-error {
  position: fixed;
  inset: 20px;
  z-index: 1100;
  padding: 28px;
  border: 1.5px solid var(--abandoned);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1120px) {
  .explorer-shell { grid-template-columns: 280px minmax(0, 1fr); }
  .detail-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trajectory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  main, .site-footer { width: min(1280px, 100% - 32px); }
  .site-header { gap: 12px; padding: 0 16px; }
  .explorer { padding-top: 32px; }
  .explorer-controls { align-items: stretch; flex-direction: column; width: 100%; }
  .search-control { width: 100%; }
  .explorer-shell { display: block; overflow: visible; }
  .paper-browser { border-right: 0; border-bottom: 1px solid var(--line); }
  .paper-list { display: flex; min-height: 0; max-height: none; overflow-x: auto; }
  .paper-option { flex: 0 0 260px; border-right: 1px solid var(--line); border-bottom: 0; }
  .paper-detail { padding-inline: 18px; }
  .trajectory-grid { grid-template-columns: 1fr; }
  .trajectory-links { display: none; }
}

@media (max-width: 570px) {
  .detail-stats { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
