/* AgiBot G2 Policy Lab project page — light, minimal, technical editorial styling.
   Adapted from Reza Kakooee's ant-piano-movers-rl blog aesthetic. */

:root {
  --ink: #18181b;
  --muted: #6b7280;
  --faint: #9aa1ab;
  --paper: #fafafa;
  --surface: #ffffff;
  --line: #e6e8ec;
  --teal: #00bb7f;
  --cyan: #00b7d7;
  --violet: #8d54ff;
  --red: #ff2357;
  --amber: #f99c00;
  --shadow: 0 18px 50px rgba(24, 30, 45, 0.08);
  --max: 1040px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 64px; }  /* section links land below the sticky header */

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Geist, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.04rem;
  line-height: 1.74;
  -webkit-font-smoothing: antialiased;
}

img, video { display: block; max-width: 100%; }
a { color: var(--ink); text-decoration-color: rgba(0, 183, 215, .5); text-underline-offset: 3px; }
a:hover { color: var(--cyan); }

.mono {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  padding: 14px clamp(18px, 4vw, 36px);
  background: rgba(250, 250, 250, .88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.topbar .inner {
  display: flex; justify-content: space-between; align-items: center;
  gap: 18px; width: 100%; max-width: var(--max); margin: 0 auto;
}
.mark {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: .84rem; letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; color: var(--ink); font-weight: 600;
}
.topbar .inner { min-width: 0; }
.mark { flex: 0 0 auto; white-space: nowrap; }
/* one row of section links that scrolls sideways; the fade at the right shows there is more */
.topbar nav {
  display: flex; gap: 20px; flex-wrap: nowrap; min-width: 0;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; padding-right: 28px;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a {
  flex: 0 0 auto; white-space: nowrap;
  font-size: .86rem; color: var(--muted); text-decoration: none;
}
.topbar nav a:hover, .topbar nav a.active { color: var(--ink); }
.topbar nav a.active { font-weight: 600; }
.menu-btn { display: none; }
@media (max-width: 768px) {
  /* phones: the title and a "..." button; the button opens the section list */
  .topbar { padding: 8px 16px; }
  .mark { font-size: .72rem; }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 34px; padding: 0 0 6px; cursor: pointer;
    border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
    color: var(--ink); font-size: 22px; line-height: 1;
  }
  .topbar nav {
    display: none; position: absolute; top: calc(100% + 6px); left: 12px; right: 12px;
    flex-direction: column; gap: 0; padding: 6px 0; max-height: 70vh;
    overflow-x: hidden; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
    -webkit-mask-image: none; mask-image: none;
  }
  .topbar.open nav { display: flex; }
  .topbar nav a { padding: 10px 18px; font-size: .95rem; }
  .topbar nav a.active { background: #f2f4f7; }
  /* wide tables scroll inside their own box instead of widening the page */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ------------------------------------------------------------------ hero */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 clamp(18px, 4vw, 36px); }

.hero { padding: clamp(48px, 8vw, 96px) 0 clamp(24px, 4vw, 40px); }
.eyebrow {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: .8rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--teal); margin: 0 0 18px; font-weight: 600;
}
.hero h1 {
  margin: 0; font-size: clamp(2.2rem, 5.2vw, 3.5rem); line-height: 1.12;
  letter-spacing: -.02em; font-weight: 650;
}
.lede { margin: 22px 0 0; font-size: 1.16rem; color: var(--muted); max-width: 68ch; }
.byline {
  margin: 20px 0 0; font-family: "Geist Mono", ui-monospace, monospace;
  font-size: .84rem; color: var(--faint);
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 0; }
.button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); text-decoration: none;
  font-size: .92rem; transition: border-color .15s, transform .15s;
}
.button:hover { border-color: var(--cyan); transform: translateY(-1px); color: var(--ink); }
.button--primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.button--primary:hover { background: #000; color: #fff; }

/* --------------------------------------------------------------- section */
.section { padding: clamp(32px, 5.5vw, 60px) 0; border-top: 1px solid var(--line); }
.section > h2 {
  margin: 0 0 10px; font-size: clamp(1.45rem, 2.7vw, 1.95rem);
  line-height: 1.2; letter-spacing: -.01em; font-weight: 620;
}
.section > h2 .num {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: .75em; color: var(--cyan); margin-right: .5em;
}
.section h3 {
  margin: 36px 0 10px; font-size: 1.16rem; font-weight: 620;
}
.section p { margin: 15px 0; }
.section p strong, .section li strong { font-weight: 620; }
em { color: var(--ink); }

/* ---------------------------------------------------------------- figures */
figure { margin: 34px 0; }
figure img, figure video {
  width: 100%; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow);
}
figure video {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #09090b;
}
figcaption {
  margin-top: 12px; font-size: .92rem; color: var(--muted); line-height: 1.6;
}

/* Benchmark clips: head camera + wrist camera side by side (1124x400). Keep their own shape, no crop. */
figure video.wide { aspect-ratio: auto; object-fit: contain; }

/* A clip that is not recorded yet. Replace the div with <video class="wide" ...> when the file exists. */
.video-placeholder {
  display: flex; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 1124 / 400;
  border: 2px dashed var(--line); border-radius: 14px; background: var(--surface);
  color: var(--faint); text-align: center; padding: 0 20px;
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .84rem; letter-spacing: .06em; text-transform: uppercase;
}

/* Large video showcases */
.figure-featured {
  margin: 38px 0;
}
.figure-featured video {
  aspect-ratio: 16 / 9;
  min-height: 420px;
  box-shadow: 0 20px 60px rgba(24, 30, 45, 0.12);
}

.figure-grid-2 {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 34px 0;
}
.figure-grid-2 figure { margin: 0; }
.figure-grid-2 figure video { min-height: 250px; }
.figure-grid-2 figcaption { font-size: .88rem; margin-top: 10px; }

.figure-row {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 30px 0;
}
.figure-row figure { margin: 0; }
.figure-row figcaption { font-size: .84rem; margin-top: 10px; }

.figure-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 32px 0; }
.figure-pair figure { margin: 0; }
@media (max-width: 768px) {
  .figure-grid-2, .figure-pair, .figure-row { grid-template-columns: 1fr; }
  .figure-featured video { min-height: 240px; }
}

/* ----------------------------------------------------------------- tables */
table {
  width: 100%; border-collapse: collapse; margin: 24px 0;
  font-size: .94rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
thead th {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: .76rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); background: #f6f7f9; font-weight: 500;
}
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { font-family: "Geist Mono", ui-monospace, monospace; }
.fail { color: var(--red); font-family: "Geist Mono", ui-monospace, monospace; font-weight: 600; }
.pass { color: var(--teal); font-family: "Geist Mono", ui-monospace, monospace; font-weight: 600; }
.warn { color: var(--amber); font-family: "Geist Mono", ui-monospace, monospace; font-weight: 600; }

/* ------------------------------------------------------------------- code */
pre {
  margin: 22px 0; padding: 16px 18px; overflow-x: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  font-family: "Geist Mono", ui-monospace, monospace; font-size: .87rem; line-height: 1.6;
}
code {
  font-family: "Geist Mono", ui-monospace, monospace; font-size: .9em;
  background: #f2f4f7; padding: .12em .4em; border-radius: 5px;
}
pre code { background: none; padding: 0; }

/* ---------------------------------------------------------------- callout */
.callout {
  margin: 26px 0; padding: 18px 20px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--violet);
}
.callout p { margin: 0; }
.callout--result { border-left-color: var(--teal); }
.callout--fail { border-left-color: var(--red); }
.callout--info { border-left-color: var(--cyan); }

.result-number {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: clamp(1.5rem, 3.6vw, 2.2rem); font-weight: 600; color: var(--teal);
  display: block; line-height: 1.2; margin-bottom: 6px;
}
.fail-number {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: clamp(1.5rem, 3.6vw, 2.2rem); font-weight: 600; color: var(--red);
  display: block; line-height: 1.2; margin-bottom: 6px;
}

/* ----------------------------------------------------------------- stat grid */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 24px 0;
}
.stat-card {
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
}
.stat-card .val {
  font-family: "Geist Mono", ui-monospace, monospace; font-size: 1.7rem;
  font-weight: 700; color: var(--ink); line-height: 1.1; margin-bottom: 4px;
}
.stat-card .label { font-size: .84rem; color: var(--muted); }

/* ----------------------------------------------------------------- footer */
.footer {
  border-top: 1px solid var(--line); margin-top: 40px;
  padding: 30px clamp(18px, 4vw, 32px) 60px;
  color: var(--muted); font-size: .9rem;
}
.footer .inner {
  max-width: var(--max); margin: 0 auto;
  display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.footer a { color: var(--muted); text-decoration: none; margin-left: 16px; }
.footer a:hover { color: var(--ink); }
