:root {
  --bg: #ffffff;
  --panel: #fbfbfa;
  --text: #1b1b1b;
  --muted: #6e6e6e;
  --faint: #9a9a9a;
  --rule: #e5e4e1;
  --rule-strong: #cfcecb;
  --accent: #2c4a63;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 72px 32px 96px;
}

h1, h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* ---------- header ---------- */

.paper-header {
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
  padding-bottom: 44px;
  border-bottom: 1px solid var(--rule);
}

.eyebrow {
  margin: 0 0 18px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

h1 {
  margin: 0 0 26px;
  font-size: 38px;
  line-height: 1.25;
}

.authors {
  margin: 0 0 8px;
  font-size: 16.5px;
}

.authors sup, .affiliations sup { color: var(--faint); font-size: 11px; }

.affiliations {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.affiliations span { display: inline-block; margin: 0 10px; }

/* ---------- prose sections ---------- */

section {
  max-width: 820px;
  margin: 0;
  padding-top: 52px;
}

section.examples { max-width: none; }

h2 {
  margin: 0 0 18px;
  font-size: 21px;
}

.abstract p {
  margin: 0;
  text-align: justify;
  hyphens: auto;
  color: #2a2a2a;
}

.lead {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 15px;
  max-width: 820px;
}

/* ---------- baselines ---------- */

.baseline-list { margin: 0; }

.baseline-list > div {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 16px;
  padding: 9px 0;
  border-top: 1px solid var(--rule);
  font-size: 15px;
}

.baseline-list > div:last-child { border-bottom: 1px solid var(--rule); }

.baseline-list dt { font-weight: 600; letter-spacing: -0.005em; }
.baseline-list dt.ours { color: var(--accent); }
.baseline-list dd { margin: 0; color: var(--muted); }

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}

.tabs button {
  appearance: none;
  border: none;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  padding: 8px 14px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .15s ease;
}

.tabs button:hover { color: var(--text); }

.tabs button[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ---------- grid ---------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--bg);
}

table.grid {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 1080px;
}

table.grid th, table.grid td {
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

table.grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--panel);
  border-bottom: 1px solid var(--rule-strong);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  color: #333;
  padding: 11px 6px;
  white-space: nowrap;
}

table.grid thead th.ours { color: var(--accent); }

table.grid thead th.idx, table.grid tbody td.idx {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 52px;
  min-width: 52px;
  background: var(--panel);
  border-right: 1px solid var(--rule);
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

table.grid thead th.idx { z-index: 4; }

table.grid tbody td {
  border-bottom: 1px solid var(--rule);
  padding: 9px 8px;
  min-width: 122px;
}

table.grid tbody tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover td { background: #fcfcfb; }
table.grid tbody tr:hover td.idx { background: #f6f6f4; }
table.grid td.ours { background: rgba(44, 74, 99, 0.028); }
table.grid tbody tr:hover td.ours { background: rgba(44, 74, 99, 0.05); }

/* ---------- player ---------- */

.player {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: center;
}

.player button {
  appearance: none;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: #fff;
  color: #3a3a3a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.player button:hover { border-color: #8e8e8e; color: #000; }
.player button svg { display: block; }

.player.is-playing button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.bar {
  position: relative;
  flex: 1 1 auto;
  height: 3px;
  min-width: 46px;
  max-width: 74px;
  background: #e8e7e4;
  border-radius: 2px;
  cursor: pointer;
}

.bar .fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: #9c9b98;
  border-radius: 2px;
}

.player.is-playing .bar .fill { background: var(--accent); }

/* ---------- footer ---------- */

footer {
  max-width: 820px;
  margin: 0;
  padding-top: 56px;
  font-size: 14px;
  color: var(--faint);
}

footer p { margin: 0; }

/* ---------- small screens ---------- */

@media (max-width: 720px) {
  main { padding: 48px 20px 64px; }
  h1 { font-size: 28px; }
  .affiliations span { display: block; margin: 2px 0; }
  .baseline-list > div { grid-template-columns: 1fr; gap: 2px; }
  .abstract p { text-align: left; }
}

/* ---------- figures ---------- */

section.wide { max-width: none; }

.figure-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.figure-stack {
  display: flex;
  flex-direction: column;
  gap: 34px;
}

figure {
  margin: 0;
}

figure a {
  display: block;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: #fff;
  padding: 18px;
  transition: border-color .15s ease;
}

figure a:hover { border-color: var(--rule-strong); }

figure img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

figure img.narrow { max-width: 520px; }

figcaption {
  margin-top: 10px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- multi-line column headers ---------- */

table.grid thead th .sub {
  display: block;
  font-weight: 400;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0;
}

table.grid thead th.ours .sub { color: var(--accent); opacity: 0.8; }

@media (max-width: 860px) {
  .figure-row { grid-template-columns: 1fr; }
  figure a { padding: 10px; }
}
