/* Styling aligned with the IMoveLab webapp design system:
   Inter sans, #0A0A0A ink / #737373 muted, #E5E5E5 borders,
   #FAFAFA page / white cards, #C41230 accent (#A01020 hover),
   6–12px radii. Dark theme mirrors the app's .dark token set. */
:root {
  --cmu-red: #c41230;
  --cmu-red-dark: #a01020;
  --ink: #0a0a0a;
  --ink-soft: #404040;
  --muted: #666666;
  --line: #e5e5e5;
  --bg: #fafafa;
  --bg-soft: #f5f5f5;
  --bg-card: #ffffff;
  --pill-border: #d4d4d4;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --radius: 12px;
  --radius-sm: 6px;
  --maxw: 1120px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Red lightened for AA contrast on dark surfaces; hover goes brighter. */
    --cmu-red: #ff5670;
    --cmu-red-dark: #ff8296;
    --ink: #ededed;
    --ink-soft: #d4d4d4;
    --muted: #a3a3a3;
    --line: #2a2a2a;
    --bg: #0a0a0a;
    --bg-soft: #1c1c1c;
    --bg-card: #151515;
    --pill-border: #3a3a3a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--cmu-red); text-decoration: none; }
a:hover { color: var(--cmu-red-dark); text-decoration: underline; }
/* Links inside running text are underlined so they aren't distinguished by color alone (WCAG 1.4.1) */
p a, .citation a { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--cmu-red); outline-offset: 2px; border-radius: var(--radius-sm); }

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

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
}
.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 64px 32px 56px;
  display: grid;
  grid-template-columns: minmax(0, 210px) 1fr;
  gap: 48px;
  align-items: center;
}

/*
  The source video is 3840x2160 and almost entirely black: the skeleton is rendered
  on a narrow WHITE portrait canvas occupying source rect x:1630 y:402 w:692 h:1366.
  We show only that canvas by over-sizing the video inside an overflow-hidden portrait
  frame — no re-encoding needed. If the crop ever shifts, adjust the four numbers below.
*/
.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 692 / 1366;
  overflow: hidden;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}
.video-frame video {
  position: absolute;
  width: 554.9%;    /* 3840 / 692  */
  height: auto;     /* keeps the 16:9 aspect ratio */
  left: -235.5%;    /* -1630 / 692 */
  top: -29.4%;      /* -402 / 1366 */
  display: block;
}
.video-toggle {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(10, 10, 10, .55);
  color: #fff;
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: background .2s ease;
}
.video-toggle:hover { background: rgba(10, 10, 10, .8); }
.video-toggle svg { width: 16px; height: 16px; }
.video-toggle .icon-play,
.video-toggle .icon-pause { display: none; }
.video-toggle.is-playing .icon-pause { display: block; }
.video-toggle:not(.is-playing) .icon-play { display: block; }

h1.title {
  font-weight: 600;
  font-size: clamp(1.5rem, 2.8vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
.dataset-word {
  display: block;
  margin-top: 12px;
  font-weight: 600;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--cmu-red);
}

/* ---------- Tag pills (styled like the app's outline buttons) ---------- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--ink);
  font-weight: 500;
  font-size: .875rem;
  line-height: 1;
  border: 1px solid var(--pill-border);
  transition: border-color .2s ease, color .2s ease, background .2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.pill:hover {
  border-color: var(--cmu-red);
  color: var(--cmu-red);
  text-decoration: none;
  background: var(--bg-card);
}
.pill svg { width: 16px; height: 16px; flex: none; }
.pill--soon {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--line);
  box-shadow: none;
}
.pill--soon:hover { background: var(--bg-soft); color: var(--muted); border-color: var(--line); }
.pill--soon .soon-tag {
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: 999px;
}

/* ---------- Sections ---------- */
main.wrap { padding-top: 8px; padding-bottom: 48px; }
section { padding: 68px 0; }

.sec-head { margin-bottom: 28px; }
.sec-kicker {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cmu-red);
  margin: 0 0 8px;
}
h2 {
  font-weight: 600;
  font-size: clamp(1.5rem, 2.4vw, 1.875rem);
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
  line-height: 1.3;
}
h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--ink);
}
p { margin: 0 0 16px; font-size: 1rem; color: var(--ink-soft); }
p:last-child { margin-bottom: 0; }
section > p,
section > ul.clean,
.ack { max-width: 76ch; }
#experiment-1 > p,
#experiment-1 > ul.clean { max-width: none; }

.figure {
  margin: 0 0 30px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
.figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

/* Claude Code setup and tutorial */
.claude-setup {
  margin: 26px 0 30px;
  padding: 28px;
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
.setup-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.setup-heading h3 {
  margin: 0;
  font-size: 1.125rem;
}
.setup-heading p {
  margin: 4px 0 0;
  font-size: .9375rem;
  color: var(--muted);
}
.docs-link {
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--ink);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.docs-link:hover {
  color: var(--cmu-red);
  text-decoration: none;
}
.docs-link svg { width: 16px; height: 16px; }
.setup-steps {
  display: grid;
  grid-template-columns: 1.4fr .8fr .8fr;
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.setup-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}
.step-number {
  padding-top: 3px;
  color: var(--cmu-red);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.5;
}
.setup-step h4 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.4;
}
.setup-step p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.55;
}
.command-list {
  display: grid;
  gap: 10px;
}
.command-block { min-width: 0; }
.command-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .04em;
  line-height: 1.4;
  text-transform: uppercase;
}
.command {
  display: block;
  width: 100%;
  overflow-x: auto;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: .75rem;
  line-height: 1.5;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
.tutorial-video {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
  box-shadow: var(--shadow);
}
.tutorial-video video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}
.tutorial-video figcaption {
  padding: 14px 18px;
  background: var(--bg-card);
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.5;
}

/* Stats use typography and whitespace; only internal separators remain. */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 4px 0 28px;
}
.stat {
  min-width: 0;
  padding: 12px 24px;
  border-left: 1px solid var(--line);
  text-align: center;
}
.stat:first-child { border-left: none; }
.stat .num {
  display: block;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}
.stat .lbl {
  display: block;
  margin-top: 4px;
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.4;
}

ul.clean { margin: 6px 0 0; padding-left: 0; list-style: none; }
ul.clean li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 9px;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
ul.clean li::before {
  content: "";
  position: absolute;
  left: 2px; top: 10px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cmu-red);
}
ul.clean li b { color: var(--ink); font-weight: 600; }

.exp-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 6px;
}
.exp-card {
  padding: 24px;
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
.exp-card .stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  background: transparent;
}
.exp-card .stat {
  min-width: 0;
  padding: 0;
  border-left: none;
}
.exp-card .stat .num { font-size: 1.375rem; }
.exp-card .tag-num {
  display: inline-block;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--cmu-red);
  padding: 4px 9px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.citation {
  margin-top: 12px;
  max-width: 76ch;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: none;
  border-left: 3px solid var(--cmu-red);
  font-size: .9375rem;
  color: var(--ink-soft);
}
.citation .authors { color: var(--ink); }
.citation .ptitle { font-style: italic; }

.ack { color: var(--ink-soft); }

/* contact */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 10px;
}
.contact {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
.contact .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 22%;
  flex: none;
  background: var(--bg-soft);
  box-shadow: 0 0 0 1px var(--line);
}
.contact .who { font-weight: 600; color: var(--ink); font-size: .9375rem; }
.contact .role { font-size: .8125rem; color: var(--muted); margin-bottom: 2px; }
.contact .mail { font-size: .875rem; }

/* footer */
footer {
  background: var(--bg-card);
  padding: 28px 0 32px;
}
footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
footer .brand { font-weight: 600; color: var(--ink); font-size: .875rem; }
footer .muted { color: var(--muted); font-size: .75rem; }

/* In dark mode the accent lightens, so white-on-red badges lose contrast —
   flip their text to the dark page ink to keep them readable. */
@media (prefers-color-scheme: dark) {
  .hero { border-bottom: 1px solid var(--line); }
  footer { border-top: 1px solid var(--line); }
  .exp-card .tag-num { color: #0a0a0a; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; gap: 26px; padding: 40px 32px; justify-items: start; }
  .video-frame { order: -1; width: 200px; }
  .setup-steps { grid-template-columns: 1fr; gap: 24px; }
  .exp-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 20px; }
  .hero-inner { padding: 32px 20px; }
  section { padding: 48px 0; }
  .pill { height: 36px; padding: 0 14px; font-size: .8125rem; }
  .claude-setup { padding: 20px; }
  .setup-heading { display: block; margin-bottom: 24px; }
  .docs-link { width: 100%; margin-top: 16px; }
  .tutorial-video figcaption { padding: 12px 14px; }
  .exp-card { padding: 20px; }
  .stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 24px;
  }
  .stat,
  .stat:first-child {
    min-width: 0;
    padding: 0;
    border-left: none;
  }
  .exp-card .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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