/* ========================================================================
   REAP project page — minimal academic style
   Anonymous-safe: no external fonts, no analytics, no CDNs.
   ======================================================================== */

:root {
  --bg:           #ffffff;
  --bg-alt:       #f7f8fa;
  --text:         #1f2430;
  --text-muted:   #59626a;
  --accent:       #284b63;
  --accent-soft:  #4c6a8d;
  --accent-warm:  #c8877a;
  --accent-fail:  #8a5a72;
  --border:       #e2e6ec;
  --line:         #b7c0cd;
  --code-bg:      #f4f5f7;
  --highlight:    #ebf1ef;   /* p2pTealTint */
  --max-width:    1140px;
  --narrow-width: 760px;
}

* { 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", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: var(--narrow-width);
  margin: 0 auto;
  padding: 0 24px;
}

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

/* ===== Hero =============================================================== */
.hero {
  padding: 56px 0 24px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.paper-title {
  font-size: 2.0rem;
  line-height: 1.25;
  font-weight: 700;
  margin: 0 0 18px;
  color: var(--text);
  letter-spacing: -0.01em;
}
/* Author line, sits between the title and the venue. Not italic (the venue is),
   and a touch larger, so the two lines read as name-then-venue rather than as
   one run of metadata. */
.authors {
  font-size: 1.08rem;
  color: var(--text);
  margin: 10px 0 2px;
  font-weight: 500;
}
/* Affiliation line under the authors: same muted tone as the venue but upright,
   so the stack reads name -> institution -> venue by weight and style. */
.affiliation {
  font-size: 0.98rem;
  color: var(--text-muted);
  margin: 2px 0 0;
}
/* Author/affiliation links: underline only on hover, so the hero stays a clean
   block of type rather than a row of blue links. */
.author-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
.author-link:hover,
.author-link:focus-visible {
  border-bottom-color: currentColor;
}
.venue {
  font-size: 1.0rem;
  color: var(--text-muted);
  margin: 4px 0 22px;
  font-style: italic;
}
.link-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: var(--accent);
  color: #fff !important;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none !important;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--accent-soft); }
.btn-disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.7;
}
.btn .icon { font-family: serif; font-size: 0.95em; }

/* ===== Hero banner video ================================================= */
.hero-video {
  padding: 32px 0 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.banner-video {
  position: relative;
  margin: 0 auto;
  max-width: 960px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 24px rgba(31, 36, 48, 0.08);
}
.banner-video video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.tagline {
  margin: 24px auto 0;
  max-width: var(--narrow-width);
  text-align: center;
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--text);
}
.tagline em { color: var(--accent); font-style: italic; }

/* ===== Speed labels on videos ============================================ */
.video-wrap, .banner-video, .video-item .video-wrap {
  position: relative;
}
.video-speed {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(31, 36, 48, 0.82);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  pointer-events: none;
  z-index: 1;
}

/* ===== Key results — stat cards ========================================== */
.key-results { padding: 40px 0; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat-card {
  background: var(--highlight);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 18px;
  text-align: center;
}
.stat-value {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-unit {
  font-size: 1.4rem;
  font-weight: 600;
  margin-left: 1px;
}
.stat-label {
  margin-top: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}
.stat-sub {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ===== Section blocks ==================================================== */
.section {
  padding: 60px 0;
}
.section + .section { border-top: 1px solid var(--border); }
.section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
  color: var(--text);
  text-align: center;
}
.section-intro {
  text-align: center;
  max-width: var(--narrow-width);
  margin: 0 auto 28px;
  color: var(--text);
}

/* ===== Subsection titles ================================================= */
.subsection-title {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  margin: 40px 0 16px;
  color: var(--text);
  letter-spacing: -0.005em;
}
.subsection-title:first-of-type { margin-top: 0; }

/* ===== Per-env video grid ================================================ */
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.video-item {
  margin: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.video-item .video-wrap {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #000;
}
.video-item video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top;
}
.video-item figcaption {
  padding: 12px 14px;
  font-size: 0.9rem;
  color: var(--text);
  background: #fff;
}
.video-item figcaption strong { color: var(--accent); }
.video-item .env-source {
  padding: 0 14px 12px;
  margin: -4px 0 0;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-muted);
  background: #fff;
}
.video-item .env-source a {
  color: var(--accent-soft);
}

/* ===== Full-width inline video =========================================== */
.full-video {
  margin: 0 auto;
  max-width: 880px;
}
.full-video .video-wrap {
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.full-video video {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}
.full-video figcaption {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

/* ===== Abstract =========================================================== */
.abstract { background: var(--bg-alt); }
.abstract p {
  text-align: justify;
  margin: 0;
}

/* ===== Method numbered steps ============================================= */
.method-figure {
  margin: 0 0 36px;
  text-align: center;
}
.method-figure img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.method-figure figcaption {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 12px;
  text-align: center;
  max-width: var(--narrow-width);
  margin-left: auto;
  margin-right: auto;
}
.method-steps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  max-width: 980px;
  margin: 8px auto 0;
}
.method-step {
  display: flex;
  gap: 14px;
  padding: 18px 18px 18px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.step-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-body h3 {
  font-size: 1.0rem;
  font-weight: 600;
  margin: 4px 0 6px;
  color: var(--text);
}
.step-body p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
}
.step-callout {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent-warm);
  background: #fff;
  border-radius: 0 4px 4px 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
}
.step-callout .callout-label {
  font-weight: 600;
  color: var(--accent-warm);
  margin-right: 4px;
}
.step-callout strong { color: var(--accent); }

.method-callout {
  max-width: 980px;
  margin: 18px auto 0;
  padding: 14px 18px;
  border-left: 3px solid var(--accent-warm);
  background: #fff;
  border-radius: 0 4px 4px 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
}
.method-callout .callout-label {
  font-weight: 600;
  color: var(--accent-warm);
  margin-right: 4px;
}
.method-callout strong { color: var(--accent); }

/* ===== Comparison section ================================================ */
.comparison { background: var(--bg-alt); }
.bar-chart {
  margin: 0 auto 36px;
  max-width: 760px;
  text-align: center;
}
.bar-chart object,
.bar-chart img {
  width: 100%;
  height: auto;
  display: block;
}
.bar-chart figcaption {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.baselines-table-wrap { margin: 0 auto 36px; }

/* ===== Per-environment / baselines tables ================================ */
.env-table-wrap { margin: 0; }
.env-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.env-table th,
.env-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.env-table th {
  background: var(--bg-alt);
  font-weight: 600;
  color: var(--text);
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  border-bottom: 2px solid var(--line);
}
.env-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  white-space: nowrap;
}
/* Numeric column headers — right-align so they line up with the .num cells
   underneath. Applied to all but the first two columns of the per-env table
   (Environment / Setting) and just the first column of the baselines table
   (Method). */
.env-table th.num-head {
  text-align: right;
}
.env-table tr.env-group td {
  border-top: 2px solid var(--line);
}
.env-table tr.our-method td {
  background: var(--highlight);
}
.env-table tbody tr:hover {
  background: #fafbfc;
}
.env-table tr.our-method:hover td {
  background: var(--highlight);
}
.env-table td.tbd {
  color: var(--text-muted);
  font-style: italic;
}
.env-table-wrap figcaption,
.baselines-table-wrap figcaption {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 12px;
  text-align: center;
  max-width: var(--narrow-width);
  margin-left: auto;
  margin-right: auto;
}

/* (Baseline-table-specific overrides removed: .num and .num-head classes
   now handle numeric alignment uniformly across both tables.) */

/* ===== OOD figure ======================================================== */
.results { background: var(--bg-alt); }
.ood-figure {
  margin: 0 auto;
  max-width: 880px;
  text-align: center;
}
.ood-figure img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #fff;
}
.ood-figure figcaption {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 12px;
}

/* ===== Failure case ====================================================== */
.failure { background: #fff; }
.failure h2::before {
  content: "⚠ ";
  color: var(--accent-fail);
}

/* ===== Behaviors ========================================================= */
.behaviors { background: var(--bg-alt); }

/* ===== Utility =========================================================== */
.sc { font-variant: small-caps; letter-spacing: 0.02em; }

/* ===== Footer ============================================================ */
.footer {
  padding: 30px 0 60px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}
.footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}

/* ===== Responsive ======================================================== */
@media (max-width: 980px) {
  .stat-grid    { grid-template-columns: repeat(2, 1fr); }
  .method-steps { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .video-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .paper-title { font-size: 1.45rem; }
  .video-grid  { grid-template-columns: 1fr; }
  .stat-grid   { grid-template-columns: 1fr; }
  .stat-value  { font-size: 2.0rem; }
  .section { padding: 40px 0; }
  .hero    { padding: 40px 0 20px; }
  .hero-video { padding: 24px 0 12px; }
  .env-table { font-size: 0.84rem; }
  .env-table th, .env-table td { padding: 8px 10px; }
}

/* Inline author-year attribution inside a table cell (baselines table).
   Muted and smaller so the method name still reads as the row label. */
.env-table .cite {
  font-size: 0.82em;
  color: var(--text-muted);
  white-space: nowrap;
}
