/* ============================================================
   A Survey on Predictive Safety in Embodied AI
   minimalist · scientific · paper-style · pure white
   ============================================================ */

:root {
  --ink:        #0a0a0a;
  --ink-soft:   #2b2b2b;
  --ink-mute:   #6b6b6b;
  --ink-faint:  #a8a8a8;
  --ink-ghost:  #d8d8d8;
  --bg:         #ffffff;
  --bg-soft:    #ffffff;
  --rule:       #e3e3e3;
  --rule-soft:  #efefef;
  --link:       #0a0a0a;
  --link-hover: #000000;

  /* chart palette — derived ink ramp */
  --c0:  #ffffff;
  --c1:  #f3f3f3;
  --c2:  #d9d9d9;
  --c3:  #bdbdbd;
  --c4:  #8a8a8a;
  --c5:  #525252;
  --c6:  #1a1a1a;

  --serif:      'Source Serif 4', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --sans:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:       'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure:    44rem;
  --measure-fig: 60rem;
}

/* ---------- reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.62;
  font-feature-settings: 'kern', 'liga', 'onum';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; }
ul, ol { padding: 0; margin: 0; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
hr { border: 0; }
sup { font-size: 0.7em; vertical-align: super; line-height: 0; }
svg { display: block; }

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--ink-ghost);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color .15s ease, color .15s ease;
}
a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--ink);
}

/* ---------- layout ---------- */
.paper {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 5.5rem 1.75rem 6rem;
}

section { margin: 5rem 0; }

p { margin: 0 0 1.1rem; }
em { font-style: italic; }
strong { font-weight: 600; }

/* justified body prose with safe hyphenation; titles and pull-quotes opt out below */
.paper p,
.paper ol.frontiers li {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  text-align-last: start;
}
.paper .lede,
.paper .corpus .lead { text-align: left; }

.mono {
  font-family: var(--mono);
  font-size: 0.88em;
  font-feature-settings: 'tnum';
  letter-spacing: -0.01em;
}

/* ---------- header / title block ---------- */
.head { margin-bottom: 3.5rem; }

.venue {
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 2rem;
}

.title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.022em;
  margin: 0 0 2.25rem;
  text-wrap: balance;
}

.authors,
.affils {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.4rem;
  margin: 0;
  font-family: var(--sans);
}
.authors {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}
.authors li { display: inline; }
.authors a { text-decoration: none; }
.authors a:hover { text-decoration: underline; text-decoration-color: var(--ink); }
.authors sup { color: var(--ink-mute); font-weight: 400; }

.affils {
  font-size: 0.88rem;
  color: var(--ink-mute);
  margin-bottom: 1.75rem;
}

.links {
  font-family: var(--sans);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.links .dot { color: var(--ink-faint); user-select: none; }
.links a { text-decoration: none; border-bottom: 1px solid var(--ink-ghost); padding-bottom: 1px; }
.links a:hover { border-color: var(--ink); }

/* ---------- abstract ---------- */
.abstract {
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}
.abstract p {
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0;
}

.kicker {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  margin: 0 0 0.85rem;
}

/* ---------- meta strip ---------- */
.meta {
  margin: 2.25rem 0 0;
  padding: 1.1rem 0;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
}
.meta dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  font-family: var(--sans);
}
.meta div { display: flex; flex-direction: column; gap: 0.15rem; }
.meta dt {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.meta dd {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  font-feature-settings: 'tnum';
}
@media (max-width: 540px) {
  .meta dl { grid-template-columns: repeat(2, 1fr); gap: 1rem 1.5rem; }
}

.rule {
  height: 1px;
  background: var(--rule);
  margin: 4.5rem 0 0;
}

/* ---------- section heads ---------- */
h2.section {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.012em;
  margin: 0 0 1.4rem;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}
h2.section .num {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--ink-mute);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.lede {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.6;
  border-left: 1.5px solid var(--ink);
  padding: 0.1rem 0 0.1rem 1.2rem;
  margin: 1.75rem 0;
  text-wrap: balance;
}
.lede em { font-style: italic; color: var(--ink); }

.footnote {
  font-size: 0.86rem;
  color: var(--ink-mute);
  line-height: 1.6;
  font-family: var(--serif);
}
.footnote sup { color: var(--ink); }

/* ---------- taxonomy ---------- */
.taxonomy {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 2rem 0 1.2rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.ax {
  padding: 1.5rem 1.4rem 1.6rem;
  border-right: 1px solid var(--rule-soft);
}
.ax:last-child { border-right: 0; }
.ax-label {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  font-weight: 500;
  color: var(--ink-mute);
  margin-bottom: 1rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.ax-n {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  font-weight: 400;
}
.ax ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}
.ax li {
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.4;
}
.ax .ref { color: var(--ink-mute); font-size: 0.75em; margin-left: 0.2em; }

@media (max-width: 720px) {
  .taxonomy { grid-template-columns: 1fr; }
  .ax { border-right: 0; border-bottom: 1px solid var(--rule-soft); }
  .ax:last-child { border-bottom: 0; }
}

/* ---------- figures (chart + caption) ---------- */
figure {
  margin: 2.5rem 0;
}
.figure-wide {
  /* bleed wider than text column on large screens */
  margin-left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--measure-fig));
  max-width: var(--measure-fig);
}
.figure-xl {
  /* full viewport bleed — for the per-paper timeline */
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  width: 100vw;
  max-width: 100vw;
  padding: 0 max(1.75rem, calc((100vw - 90rem) / 2));
}
@media (max-width: 1024px) {
  .figure-wide { margin-left: 0; transform: none; width: 100%; max-width: 100%; }
  .figure-xl {
    left: 0; right: 0;
    margin-left: 0; margin-right: 0;
    width: 100%;
    padding: 0;
  }
}

figcaption {
  margin-top: 1rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--ink-mute);
  font-family: var(--serif);
  font-style: italic;
  max-width: 60ch;
}
.fig-id {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--ink);
  letter-spacing: 0.01em;
  margin-right: 0.4em;
}

/* ---------- charts (shared) ---------- */
.chart {
  width: 100%;
  font-family: var(--sans);
  position: relative;
}
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .axis-line { stroke: var(--rule); stroke-width: 1; }
.chart .grid-line { stroke: var(--rule-soft); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .tick-label {
  font-family: var(--sans);
  font-size: 11px;
  fill: var(--ink-mute);
  font-feature-settings: 'tnum';
}
.chart .axis-title {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  fill: var(--ink-mute);
  font-weight: 500;
}
.chart .value-label {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--ink);
  font-feature-settings: 'tnum';
}
.chart .row-label {
  font-family: var(--sans);
  font-size: 12px;
  fill: var(--ink);
}
.chart .bar { transition: opacity .15s ease; }
.chart .bar:hover { opacity: 0.75; }

/* legend */
.chart .legend {
  display: flex; flex-wrap: wrap; gap: 1.2rem 1.8rem;
  margin-top: 0.6rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-mute);
}
.chart .legend-item { display: inline-flex; align-items: center; gap: 0.5rem; }
.chart .legend-swatch {
  width: 12px; height: 12px;
  display: inline-block;
}

/* heatmap-specific cell number contrast */
.chart .cell-text {
  font-family: var(--mono);
  font-size: 11px;
  font-feature-settings: 'tnum';
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

/* ---------- priorities table ---------- */
table.priorities {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.92rem;
  margin: 2rem 0 2.25rem;
}
table.priorities th,
table.priorities td {
  padding: 0.85rem 0.85rem 0.85rem 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule-soft);
}
table.priorities thead th {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  border-bottom: 1px solid var(--rule);
}
table.priorities tbody tr:last-child td { border-bottom: 1px solid var(--rule); }
table.priorities td:first-child {
  width: 1.5rem;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}
table.priorities td:nth-child(2) { font-weight: 500; color: var(--ink); width: 38%; }
table.priorities td:nth-child(3) { width: 3rem; color: var(--ink); }
table.priorities td:nth-child(4) { color: var(--ink-soft); }
@media (max-width: 600px) {
  table.priorities { font-size: 0.86rem; }
  table.priorities td:nth-child(2) { width: auto; }
}

/* ---------- frontiers list ---------- */
ol.frontiers {
  list-style: none;
  counter-reset: f;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
ol.frontiers li {
  counter-increment: f;
  position: relative;
  padding-left: 2.4rem;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
ol.frontiers li::before {
  content: counter(f, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0.15em;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
ol.frontiers strong { color: var(--ink); font-weight: 600; }

/* ---------- bibtex ---------- */
.bib {
  border: 1px solid var(--rule);
  background: var(--bg);
}
.bib-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.bib-copy {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 0.2rem 0;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.bib-copy:hover { color: var(--ink); border-bottom-color: var(--ink); }
.bib-copy.copied { color: var(--ink); }
.bib pre {
  margin: 0;
  padding: 1.1rem 1.2rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--ink);
  overflow-x: auto;
  white-space: pre;
  background: transparent;
}

/* ---------- footer ---------- */
.foot {
  margin-top: 5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink-mute);
}
.foot a { color: var(--ink-mute); text-decoration: none; border-bottom: 1px solid var(--ink-ghost); }
.foot a:hover { color: var(--ink); border-color: var(--ink); }
@media (max-width: 540px) {
  .foot { flex-direction: column; gap: 0.4rem; }
}

/* ============================================================
   Interactive paper timeline (corpus opener)
   ============================================================ */

.corpus {
  margin: 4rem 0 5rem;
}
.kicker-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.4rem;
}
.kicker-row .kicker { margin: 0; }
.kicker-meta {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.corpus .lead {
  font-size: 1rem;
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0.2rem 0 1.75rem;
}

/* SVG */
.timeline-svg { width: 100%; height: auto; overflow: visible; }
.tl-dot {
  cursor: pointer;
  transition: transform .12s ease, opacity .15s ease;
  transform-origin: center;
  transform-box: fill-box;
}
.tl-dot:hover { opacity: 1; }
.tl-group.is-hidden .tl-dot {
  fill: #f3f3f3 !important;
  opacity: 0.35;
  pointer-events: none;
}
.tl-ring {
  pointer-events: none;
  transition: opacity .15s ease;
}
.tl-year {
  font-family: var(--sans);
  font-size: 11px;
  fill: var(--ink);
  font-weight: 500;
  font-feature-settings: 'tnum';
}
.tl-count {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--ink-mute);
  font-feature-settings: 'tnum';
}

/* details panel — sits above the chart, sticky while scrolling through it */
.timeline-details {
  margin: 0 0 1rem;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--rule);
  background: var(--bg);
  min-height: 72px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0.5rem;
  z-index: 2;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: border-color .15s ease;
}
.timeline-details.is-pinned { border-color: var(--ink); }
.timeline-details.is-pinned::after {
  content: 'pinned · click again to release';
  position: absolute;
  top: -0.55rem; right: 0.85rem;
  font-family: var(--sans);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--bg);
  padding: 0 0.4rem;
}
.td-empty {
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--ink-mute);
  font-style: italic;
}
.td-content {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: var(--sans);
  width: 100%;
}
.td-meta {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.td-meta .td-year { font-weight: 600; color: var(--ink); }
.td-meta .td-model { font-weight: 600; }
.td-meta .td-sep { color: var(--ink-faint); }
.td-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.4;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  align-self: flex-start;
  text-wrap: balance;
}
.td-title[href]:hover {
  border-bottom-color: var(--ink);
}

/* legend / filter chips — grouped */
.tl-legend {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 1rem 1.6rem;
  align-items: start;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.tl-legend-group { display: flex; flex-direction: column; gap: 0.55rem; min-width: 0; }
.tl-legend-head {
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.tl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tl-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--rule);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-mute);
  border-radius: 999px;
  transition: color .12s ease, border-color .12s ease, background .12s ease, opacity .12s ease;
  cursor: pointer;
  white-space: nowrap;
}
.tl-chip.is-active { color: var(--ink); border-color: var(--ink-ghost); }
.tl-chip:not(.is-active) { opacity: 0.4; }
.tl-chip:hover { border-color: var(--ink); }
.tl-chip-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.tl-chip-n {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-mute);
  font-feature-settings: 'tnum';
  margin-left: 0.05rem;
}
.tl-chip-reset {
  align-self: end;
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 0.4rem 0;
  border: 0;
  border-bottom: 1px solid var(--ink-ghost);
  background: transparent;
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease;
}
.tl-chip-reset:hover { color: var(--ink); border-bottom-color: var(--ink); }

@media (max-width: 900px) {
  .tl-legend { grid-template-columns: 1fr 1fr; }
  .tl-chip-reset { grid-column: 1 / -1; align-self: start; }
}
@media (max-width: 540px) {
  .tl-legend { grid-template-columns: 1fr; gap: 1.1rem; }
  .tl-chip { font-size: 0.74rem; padding: 0.28rem 0.55rem; }
}

/* ============================================================
   Decorative maze beside the title — black agent traces a
   serpentine path, with a red "imagined trajectory" drawn
   in ahead of it. Sits inline with the title block.
   ============================================================ */

.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.25rem;
}
.head-main {
  flex: 1 1 auto;
  min-width: 0;
}

aside.maze {
  flex: 0 0 auto;
  width: 184px;
  user-select: none;
  font-family: var(--sans);
}

.maze-svg {
  width: 100%; height: auto;
  display: block;
  overflow: visible;
}
.maze-walls {
  stroke: var(--ink);
  stroke-width: 1;
  fill: none;
}

/* on narrow screens shrink the maze, then drop it below the title */
@media (max-width: 760px) { aside.maze { width: 140px; } }
@media (max-width: 640px) {
  .head-row { flex-direction: column; gap: 1.5rem; }
  aside.maze { width: 132px; align-self: flex-start; }
}

/* ---------- selection & motion ---------- */
::selection { background: var(--ink); color: var(--bg); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
