/* ==========================================================================
   TruncGradGS project page
   Light academic theme — one accent, calm neutrals, room for figures.
   ========================================================================== */

:root {
  --bg: #fafbfc;
  --bg-elevated: #ffffff;
  --bg-soft: #f3f5f8;
  --bg-inset: #e8ebf0;
  --fg: #14161a;
  --fg-muted: #5a6270;
  --fg-faint: #8a92a0;
  --border: #e4e7ec;
  --border-strong: #c8ced8;
  --accent: #1f5d99;
  --accent-dark: #17456f;
  --accent-soft: #eaf2f9;
  --radius: 8px;
  --page: 1040px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 480px at 50% -80px, rgba(31, 93, 153, 0.07), transparent 60%),
    var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img,
video {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------- typography */

h1,
h2,
h3,
h4 {
  line-height: 1.22;
  letter-spacing: -0.015em;
  font-weight: 650;
  margin: 0;
}

h2 {
  font-weight: 650;
}

p {
  margin: 0 0 1rem;
}

.muted {
  color: var(--fg-muted);
}

.small {
  font-size: 0.87rem;
}

.accent {
  color: var(--accent);
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.87em;
}

/* ------------------------------------------------------------------ layout */

.wrap {
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: 24px;
}

section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

section > .wrap > h2 {
  font-size: 1.55rem;
  margin-bottom: 0.4rem;
}

section > .wrap > .section-intro {
  color: var(--fg-muted);
  max-width: 58ch;
  margin-bottom: 1.75rem;
  font-size: 1.02rem;
}

section > .wrap > .section-intro--full {
  max-width: none;
}

.method-note {
  color: var(--fg-muted);
  max-width: 62ch;
  margin: 0 auto 0.25rem;
  font-size: 0.98rem;
  text-align: center;
}

.eyebrow {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.5rem;
}

/* ---------------------------------------------------------------- nav bar */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 251, 252, 0.86);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 54px;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  white-space: nowrap;
}

.nav-brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 22px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-muted);
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a[aria-current="true"] {
  color: var(--fg);
  text-decoration: none;
}

.nav-links a[aria-current="true"] {
  font-weight: 650;
}

/* -------------------------------------------------------------------- hero */

.hero {
  padding: 68px 0 56px;
  border-top: none;
}

.hero .wrap {
  text-align: center;
}

.hero-title {
  font-size: clamp(1.55rem, 3.4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.28;
  margin-bottom: 1rem;
  max-width: 22em;
  margin-inline: auto;
}

.hero-title .title-accent {
  color: var(--accent);
}

.authors {
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

.authors a {
  color: var(--fg);
}

.affiliations {
  color: var(--fg-muted);
  font-size: 0.94rem;
  margin-bottom: 0.7rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 17px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--bg-elevated);
  color: var(--fg);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

.btn[aria-disabled="true"] {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--fg-faint);
  cursor: default;
}

.btn[aria-disabled="true"]:hover {
  border-color: var(--border);
  color: var(--fg-faint);
}

.btn .tag {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-inset);
  color: var(--fg-muted);
}

.abstract {
  font-size: 1.02rem;
  color: #2c313a;
  max-width: 90ch;
  margin: 0 auto;
  padding: 1.15rem 1.35rem;
  text-align: justify;
  text-justify: inter-word;
  -webkit-hyphens: auto;
  hyphens: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(20, 22, 26, 0.03);
}

/* ------------------------------------------------------------------ maths */

.eq {
  margin: 1.35rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  font-size: 1.02rem;
}

.katex-display {
  margin: 0.55rem 0 !important;
}

.katex {
  font-size: 1.04em;
}

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

figure {
  margin: 1.75rem 0 0;
}

figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

figcaption {
  margin-top: 0.65rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--fg-muted);
  max-width: 70ch;
}

.figure-row {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  margin-top: 1.5rem;
}

.figure-row figure {
  margin: 0;
}

figcaption b {
  color: var(--fg);
  font-weight: 650;
}

.qual-figures {
  margin-bottom: 2.75rem;
}

.qual-figures > figure {
  margin-top: 0;
}

.scene-grid {
  margin-top: 1.75rem;
}

/* ----------------------------------------------------------------- tables */

.tables {
  display: grid;
  gap: 28px;
}

.tables.two-col {
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
}

.table-block h3 {
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

.table-block,
.scene {
  min-width: 0;
}

.table-block .table-note {
  font-size: 0.86rem;
  color: var(--fg-muted);
  margin-bottom: 0.8rem;
  max-width: 64ch;
}

.table-block .table-note--full {
  max-width: none;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  -webkit-overflow-scrolling: touch;
}

table.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

table.results th,
table.results td {
  padding: 8px 11px;
  text-align: right;
  white-space: nowrap;
}

table.results th:first-child,
table.results td.method {
  text-align: left;
  padding-left: 14px;
}

table.results thead th {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
  vertical-align: bottom;
  background: var(--bg-elevated);
}

table.results thead th.group-head {
  text-align: center;
  color: var(--fg);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

table.results thead th.group-head:first-of-type {
  border-left: none;
}

table.results th.col-method {
  text-align: left;
  padding-left: 14px;
}

table.results tbody td {
  border-bottom: 1px solid #eef0f4;
  color: #23262d;
}

table.results tbody tr:last-child td {
  border-bottom: none;
}

table.results tr.group td {
  background: var(--bg-inset);
  color: var(--fg-muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding-top: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

table.results tr.ours {
  background: var(--accent-soft);
}

table.results tr.ours td.method {
  font-weight: 650;
  box-shadow: inset 3px 0 0 var(--accent);
}

table.results tr.pair td {
  border-top: 1px solid var(--border);
}

table.results td.best {
  font-weight: 700;
  color: var(--accent);
}

/* ------------------------------------------------------------- comparisons */

.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tab {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--fg-muted);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 550;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.tab:hover {
  border-color: var(--border-strong);
  color: var(--fg);
}

.tab[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 620;
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 12px;
}

.panel-head h3 {
  font-size: 1.05rem;
}

.panel-head .baseline {
  font-size: 0.78rem;
  font-weight: 620;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.vc-slider-container {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-inset);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: ew-resize;
  touch-action: pan-y;
  --vc-pos: 50%;
  box-shadow: 0 1px 0 rgba(20, 22, 26, 0.04);
}

.vc-slider-container video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  z-index: 0;
}

.vc-slider-container .vc-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

.vc-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--vc-pos);
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 3;
}

.vc-caption {
  position: absolute;
  bottom: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  pointer-events: none;
  z-index: 4;
}

.vc-caption-left {
  left: 10px;
}

.vc-caption-right {
  right: 10px;
}

.vc-slider-container:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------- dataset */

.stats {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 1.75rem;
}

.stat {
  background: var(--bg-elevated);
  padding: 14px 16px;
}

.stat dt {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 3px;
}

.stat dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.stat dd span {
  font-weight: 400;
  color: var(--fg-muted);
  font-size: 0.88rem;
}

.scene-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr));
}

.scene {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
}

.scene-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-inset);
  line-height: 0;
}

.scene-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scene-body {
  padding: 12px 14px 14px;
}

.scene-body h3 {
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.scene-body p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--fg-muted);
}

.scene-pending {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  font-size: 0.85rem;
  color: var(--fg-muted);
  background: var(--bg-inset);
}

.scene.is-pending .scene-media video {
  visibility: hidden;
}

.scene.is-pending .scene-pending {
  display: flex;
}

/* --------------------------------------------------------------- citation */

.cite-wrap {
  position: relative;
  margin-top: 1rem;
}

pre.bibtex {
  margin: 0;
  padding: 18px 20px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.58;
  color: #24272e;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--fg-muted);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 620;
  cursor: pointer;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.copy-btn[data-copied="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

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

footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
  font-size: 0.86rem;
  color: var(--fg-muted);
}

footer p {
  margin: 0;
  max-width: 64ch;
}

footer a {
  color: var(--fg-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

footer a:hover {
  color: var(--accent);
}

/* ------------------------------------------------------------- utilities */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------- breakpoints */

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  section {
    padding: 48px 0;
  }

  .hero {
    padding: 44px 0 40px;
  }

  .wrap {
    padding-inline: 18px;
  }

  .abstract {
    padding: 1rem 1.1rem;
  }

  .hero-title {
    max-width: none;
  }

  .nav-links {
    gap: 14px;
  }

  table.results th,
  table.results td {
    padding: 7px 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn {
    transition: none;
  }
}
