/* CogWAM project page — calm academic light-blue system.
   Background stays mostly white; blue is reserved for accents, links,
   section indices and active states — never for large blocks of text/border. */

:root {
  --bg: #f7fbfe;
  --bg-secondary: #eef7fc;
  --bg-blue: #e6f3fa;

  --surface: #ffffff;

  --text: #18232d;
  --text-secondary: #536675;
  --text-muted: #7d8e9b;

  --accent: #5f9fc4;
  --accent-soft: #d9edf7;
  --accent-dark: #3f7fa5;

  --border: #d8e7ef;

  --serif: "Source Serif 4", "Iowan Old Style", "Georgia", serif;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --max-width: 1040px;
  --content-width: 720px;
  --gap: 24px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; display: block; }

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

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

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 251, 254, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.01em;
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 28px;
  font-size: 14px;
  color: var(--text-secondary);
}

.nav-links a {
  color: var(--text-secondary);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent-dark);
  text-decoration: none;
}

.nav-actions {
  display: flex;
  gap: 10px;
}

.pill {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    transform 0.18s ease, box-shadow 0.18s ease;
}

.pill:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: #2c5d7d;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(63, 127, 165, 0.16);
}

.pill.disabled {
  color: var(--text-muted);
  border-style: dashed;
  cursor: default;
}

.pill.disabled:hover {
  background: var(--bg-blue);
  border-color: var(--border);
  color: var(--text-secondary);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(63, 127, 165, 0.1);
}

.pill.primary {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: #2c5d7d;
}

.pill.primary:hover {
  background: #cbe6f4;
  border-color: #cbe6f4;
  text-decoration: none;
}

@media (max-width: 760px) {
  .nav-links { display: none; }
}

/* ---------- Section scaffolding ---------- */

section {
  padding: 96px 0;
  border-bottom: 1px solid var(--border);
}

section:nth-of-type(even) {
  background: var(--bg-secondary);
}

.section-head {
  max-width: var(--content-width);
  margin: 0 auto 48px;
}

.section-index {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--accent-dark);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.section-title {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--text);
}

.section-lede {
  color: var(--text-secondary);
  font-size: 17px;
  max-width: 720px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* ---------- Hero ---------- */

.hero {
  padding-top: 84px;
  padding-bottom: 56px;
  background:
    radial-gradient(circle, var(--accent-soft) 1.4px, transparent 1.4px) 0 0/28px 28px,
    linear-gradient(180deg, var(--bg) 0%, var(--bg-secondary) 100%);
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  max-width: 880px;
  text-align: center;
}

.hero-title {
  font-family: var(--serif);
  font-size: 42px;
  line-height: 1.22;
  font-weight: 700;
  margin: 0 0 20px;
}

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

.hero-subtitle {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 400;
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto 34px;
  line-height: 1.55;
}

.hero-authors {
  font-size: 14.5px;
  color: var(--text);
  margin-bottom: 10px;
}

.hero-authors sup { color: var(--accent-dark); }

.hero-legend {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.hero-legend sup { color: var(--accent-dark); }

.hero-affiliations {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    transform 0.18s ease, box-shadow 0.18s ease;
}

.hero-btn svg { width: 16px; height: 16px; flex: none; }

.hero-btn:hover { text-decoration: none; transform: translateY(-2px); }

/* Primary action — the one button that carries the page's main intent.
   #35688a rather than --accent-dark: white on --accent-dark is only 4.38:1,
   under the 4.5:1 AA floor for 14px text. This is 6.00:1. */
.hero-btn.primary { background: #35688a; color: #fff; }
.hero-btn.primary:hover { background: #2c5d7d; box-shadow: 0 8px 18px rgba(63, 127, 165, 0.28); }

/* Secondary actions — same hue, lighter weight. No hard border: the tint
   alone separates them from the page, which keeps the row calm. Text is
   #2c5d7d (5.86:1 on the soft tint), not --accent-dark, for the same reason. */
.hero-btn.tonal {
  background: var(--accent-soft);
  border-color: transparent;
  color: #2c5d7d;
}
.hero-btn.tonal:hover {
  background: #c9e4f2;
  border-color: transparent;
  color: #24506c;
  box-shadow: 0 8px 18px rgba(63, 127, 165, 0.18);
}

.hero-btn.disabled {
  background: var(--surface);
  border-color: var(--border);
  border-style: dashed;
  color: var(--text-muted);
  cursor: default;
}
.hero-btn.disabled:hover {
  background: var(--bg-blue);
  border-color: var(--border);
  color: var(--text-secondary);
  box-shadow: 0 6px 14px rgba(63, 127, 165, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

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

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

.btn.primary:hover { background: #cbe6f4; }

.btn.disabled {
  color: var(--text-muted);
  border-style: dashed;
  cursor: default;
  pointer-events: none;
}

.hero-figure {
  margin-top: 56px;
}

.hero-figure img {
  width: 100%;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.hero-figure figcaption {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 12px;
}

.hero-clips {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.hero-clip {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}

.hero-clip video { width: 100%; aspect-ratio: 4/3; object-fit: cover; }

.hero-clip .clip-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 6px 10px;
  font-size: 12px;
  color: #fff;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.55));
}

@media (max-width: 900px) {
  .hero-title { font-size: 28px; }
  .hero-subtitle { font-size: 15.5px; }
  .hero-clips { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Idea ---------- */

.idea-statement {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.55;
  color: var(--text);
  max-width: var(--content-width);
  margin: 0 auto;
}

.idea-statement strong { color: var(--accent-dark); }

/* ---------- Method ---------- */

.method-figure {
  max-width: var(--max-width);
  margin: 0 auto 40px;
}

.method-figure img {
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #fff;
}

.method-figure figcaption {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 14px;
  max-width: var(--content-width);
}

.mechanisms {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.mechanism {
  border-top: 2px solid var(--accent);
  padding-top: 16px;
}

.mechanism h3 {
  font-size: 16px;
  margin: 0 0 8px;
  color: var(--text);
}

.mechanism p {
  font-size: 14.5px;
  color: var(--text-secondary);
  margin: 0;
}

@media (max-width: 900px) {
  .mechanisms { grid-template-columns: 1fr; }
}

/* ---------- Real robot / RoboDojo galleries ---------- */

.context-figure {
  max-width: var(--max-width);
  margin: 0 auto 56px;
}

.context-figure img {
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #fff;
}

.context-figure figcaption {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 14px;
  max-width: var(--content-width);
}

.checkpoint-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 8px 14px;
  margin-bottom: 32px;
}

.task-tags { display: flex; gap: 8px; }

.tag {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-blue);
  color: var(--accent-dark);
  border: 1px solid var(--accent-soft);
}

.tag.fail {
  background: #fbeceb;
  color: #a34a41;
  border-color: #f3d9d6;
}

.video-frame {
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}

.video-frame video { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: #000; }

/* Real-robot source footage is 16:9 / 1280x720 (or a close 960x544 crop of
   it) -- a 4:3 box around it would letterbox top and bottom. RoboDojo's own
   render is exactly 4:3 (640x480), so it keeps the base rule. */
.video-frame.wide video { aspect-ratio: 16/9; }

/* Shared clip-library pattern: task dropdown + filter chips + one mounted
   stage <video> + a thumbnail strip. Used by both Real Robot and RoboDojo. */

.library-controls {
  max-width: var(--max-width);
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.library-controls select {
  font-family: var(--sans);
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.library-dims {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dim-btn {
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
}

.dim-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: var(--accent-dark);
}

.library-stage {
  max-width: var(--max-width);
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  align-items: start;
}

.library-stage .video-frame video { aspect-ratio: 4/3; }

.library-info dl {
  display: grid;
  grid-template-columns: 110px 1fr;
  row-gap: 8px;
  font-size: 14px;
  margin: 0;
}

.library-info dt { color: var(--text-muted); }
.library-info dd { margin: 0; color: var(--text); }

@media (max-width: 900px) {
  .library-stage { grid-template-columns: 1fr; }
}

.library-strip {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.clip-thumb {
  flex: 0 0 140px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: var(--surface);
}

.clip-thumb.active { border-color: var(--accent); }

.clip-thumb img { width: 140px; height: 105px; object-fit: cover; display: block; }

.clip-thumb .clip-thumb-label {
  font-size: 11px;
  padding: 4px 6px;
  color: var(--text-secondary);
  background: var(--surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Results ---------- */

.results-block { max-width: var(--max-width); margin: 0 auto 56px; }

.results-block h3 {
  font-family: var(--serif);
  font-size: 19px;
  margin: 0 0 6px;
}

.results-note {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
  max-width: 720px;
}

table.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface);
}

table.result-table th, table.result-table td {
  padding: 10px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

table.result-table th:first-child, table.result-table td:first-child {
  text-align: left;
}

table.result-table thead th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border);
}

table.result-table tr.highlight td {
  background: var(--bg-blue);
  font-weight: 600;
  color: var(--accent-dark);
}

table.result-table tr.group-label td {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  font-weight: 400;
}

.table-scroll { overflow-x: auto; }

.ablation-figure { margin-top: 40px; }
.ablation-figure img {
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #fff;
}
.ablation-figure figcaption {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 10px;
}

.scope-note {
  max-width: var(--content-width);
  margin: 40px auto 0;
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--bg-blue);
  font-size: 14px;
  color: var(--text-secondary);
  border-radius: 0 6px 6px 0;
}

/* ---------- Citation ---------- */

.citation-block {
  max-width: var(--content-width);
  margin: 0 auto;
}

pre.bibtex {
  background: #0f1720;
  color: #d7e6ee;
  font-family: var(--mono);
  font-size: 13px;
  padding: 22px 24px;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.55;
}

.copy-btn {
  margin-top: 14px;
}

/* ---------- Footer ---------- */

footer {
  padding: 40px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

footer .foot-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 10px;
}
