/* ===== AI2 / MolmoMotion blog post ===== */
:root {
  --ai2-dark: #0a2c27;          /* hero deep green */
  --ai2-dark-2: #0e3a33;        /* slightly lighter green */
  --ai2-cream: #f7f0e7;         /* body background (AI2 cream) */
  --ai2-cream-2: #f7f0e7;       /* figure/clip backdrop */
  --ai2-text: #102f2a;          /* body text on cream */
  --ai2-text-soft: #3f5b54;     /* muted body text */
  --ai2-light: #f3efe6;         /* hero title text */
  --ai2-light-soft: #b9cac4;    /* hero muted text */
  --ai2-accent: #f0529c;        /* AI2 pink accent */
  --ai2-green: #1aa06b;         /* positive / "ours" green */
  --maxw: 760px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--ai2-cream);
  color: var(--ai2-text);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ===== Hero (project page: light/cream with pink accents) ===== */
.hero {
  background: var(--ai2-cream);
  color: var(--ai2-text);
  padding: 76px 24px 44px;
  text-align: center;
}
.hero-inner { max-width: 960px; margin: 0 auto; }

.eyebrow {
  font-size: 14px;
  letter-spacing: 0.32em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ai2-accent);
  margin: 0 0 26px;
}

.hero h1 {
  font-size: clamp(44px, 7vw, 76px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.02;
  margin: 0 0 18px;
  color: var(--ai2-dark);
}

.hero .subtitle {
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 400;
  color: var(--ai2-text-soft);
  margin: 0 auto 36px;
}

.hero .lede {
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 400;
  line-height: 1.6;
  color: var(--ai2-text-soft);
  max-width: 660px;
  margin: 0 auto;
}

/* ===== Project-page hero extras (authors, affiliations) ===== */
.authors {
  margin: 32px auto 10px;
  max-width: 960px;
  font-size: clamp(17px, 1.9vw, 20px);   /* match edit-by-track is-size-5 (~1.25rem) */
  font-weight: 500;
  line-height: 1.5;
  color: var(--ai2-text);
}
.author-line { margin-bottom: 7px; }
.author-line:last-child { margin-bottom: 0; }
.author-line a { white-space: nowrap; }   /* keep multi-word names on one line */
.authors a { color: var(--ai2-text); text-decoration: none; border-bottom: 1px solid rgba(16,47,42,0.25); }
.authors a:hover { border-bottom-color: var(--ai2-accent); color: var(--ai2-accent); }
.authors sup { color: var(--ai2-text-soft); font-size: 0.8em; }   /* normal paper superscript */
/* equal-contribution asterisk: keep it clearly visible */
.authors sup.eq { font-size: 0.95em; }

/* core-contributor heart icon (raised to upper-right, superscript position) */
.core-icon {
  display: inline-block;
  height: 0.62em;
  width: auto;
  vertical-align: 0.4em;
  margin-left: 0.06em;
}

.affiliations {
  margin: 8px auto 0;
  max-width: 760px;
  font-size: clamp(16px, 1.9vw, 20px);   /* match edit-by-track (same tier as authors) */
  color: var(--ai2-text-soft);
}
.affiliations sup { font-size: 0.8em; }

.author-note {
  margin: 12px auto 0;
  font-size: 15px;
  color: var(--ai2-text-soft);
}
.author-note .core-icon { height: 0.8em; margin: 0 0.15em 0 0; vertical-align: -0.04em; }

.hero .actions {
  margin-top: 40px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero .actions a {
  display: inline-block;
  padding: 11px 22px;
  border: 1.5px solid var(--ai2-accent);
  border-radius: 999px;
  color: var(--ai2-accent);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.hero .actions a:hover {
  background: var(--ai2-accent);
  color: #fff;
  border-color: var(--ai2-accent);
}

/* ===== Article ===== */
.article {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 80px 24px 120px;
}

.article p {
  margin: 0 0 22px;
}

.article h2 {
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 64px 0 18px;
  line-height: 1.15;
}

.article h3 {
  font-size: clamp(20px, 2.6vw, 23px);
  font-weight: 700;
  margin: 44px 0 14px;
}

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

/* pink section numbers in headings */
.sec-num { color: var(--ai2-accent); }

.article strong { font-weight: 700; }
.article em { font-style: italic; }

.article ul {
  margin: 0 0 22px;
  padding-left: 22px;
}
.article li { margin-bottom: 14px; }
.article li::marker { color: var(--ai2-accent); }

/* ===== Figures ===== */
figure {
  margin: 40px 0;
}
figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
}
figure.full {
  /* let large diagrams/graphs run a bit wider than the text column */
  width: min(960px, 92vw);
  margin-left: 50%;
  transform: translateX(-50%);
}
figcaption {
  margin-top: 14px;
  font-size: 15px;
  font-style: italic;
  line-height: 1.55;
  color: var(--ai2-text-soft);
  text-align: center;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

/* demo rows: side-by-side gifs */
.demo-label {
  font-size: 16px;
  font-weight: 600;
  margin: 36px 0 12px;
  color: var(--ai2-text);
  text-align: center;
}
.gif-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.gif-row img {
  flex: 1 1 0;
  min-width: 220px;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  background: var(--ai2-cream-2);
}

/* video-generation comparison grid (3 methods on one horizontal level) */
.vid-section {
  width: min(980px, 94vw);
  margin: 40px 0;
  margin-left: 50%;
  transform: translateX(-50%);
}
.vid-section .demo-label { text-align: center; }
.vid-compare {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: start;
}
.vid-compare.two { grid-template-columns: repeat(2, 1fr); }
.vid-col {
  margin: 0;
  display: flex;
  flex-direction: column;
}
.vid-method {
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 10px;
  color: var(--ai2-text);
}
.vid-col img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: var(--ai2-cream-2);
}
/* highlight the "ours" column */
.vid-col.best img {
  box-shadow: 0 0 0 3px var(--ai2-accent);
}
/* crop-zoom into a clip that has too much empty space */
.zoom-wrap {
  overflow: hidden;
  border-radius: 8px;
  line-height: 0;
}
.zoom-wrap img {
  transform: scale(1.85);
  transform-origin: center 55%;
}
.vid-id {
  display: inline-block;
  align-self: center;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 47, 42, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--ai2-text-soft);
}
@media (max-width: 640px) {
  .vid-compare { grid-template-columns: 1fr; }
}

/* Placeholder slot for graphs to be inserted later */
.graph-slot {
  border: 2px dashed rgba(16, 47, 42, 0.3);
  border-radius: 10px;
  padding: 36px 24px;
  text-align: center;
  color: var(--ai2-text-soft);
  font-size: 15px;
  background: rgba(244, 234, 217, 0.5);
}

/* ===== Footer ===== */
.footer {
  background: var(--ai2-dark);
  color: var(--ai2-light-soft);
  text-align: center;
  padding: 48px 24px;
  font-size: 14px;
}

@media (max-width: 640px) {
  body { font-size: 17px; }
  .hero { padding: 64px 20px 80px; }
  .article { padding: 56px 20px 80px; }
  .gif-row { flex-direction: column; }
  .gif-row img { width: 100%; }
}

/* ===================== Project-page additions ===================== */

/* make <video> behave like the <img> figures/clips */
figure video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
}
.gif-row video,
.vid-col video {
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: var(--ai2-cream-2);
}
.vid-col.best video { box-shadow: 0 0 0 3px var(--ai2-accent); }

/* sticky quick-links nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 44, 39, 0.96);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid rgba(243, 239, 230, 0.12);
}
.nav-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  gap: 22px;
  justify-content: center;
  flex-wrap: wrap;
}
.nav-inner a {
  color: var(--ai2-light-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.15s ease;
}
.nav-inner a:hover { color: var(--ai2-light); }

/* anchor offset so sticky nav doesn't cover headings */
.article h2[id], .article h3[id], section[id] { scroll-margin-top: 70px; }

/* BibTeX block */
.bibtex {
  background: var(--ai2-dark);
  color: #cdddd7;
  border-radius: 10px;
  padding: 20px 22px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
}

/* tighten captioned method labels reused from blog already (.vid-method, .demo-label) */

/* ===================== Gallery selector ===================== */

/* left-crop wrapper: hides the jittering line on the left border of the clips */
.crop {
  overflow: hidden;
  border-radius: 8px;
  line-height: 0;
}
.crop video {
  display: block;
  width: 103%;
  max-width: none;
  margin-left: -3%;   /* push the left edge (with the jitter) out of the clip */
  height: auto;
  border-radius: 0;
  box-shadow: none;
  background: var(--ai2-cream-2);
}

/* gallery: break out of the text column and center on the page */
.gallery {
  width: min(980px, 94vw);
  margin: 26px 0 0;
  margin-left: 50%;
  transform: translateX(-50%);
}
/* thumbnail selector strip (edit-by-track style) */
.gallery-tabs {
  max-width: 100%;
  overflow-x: auto;         /* scroll to the other examples on narrow screens */
  margin-bottom: 26px;
}
/* inner row: width = content, auto-margins center it when it fits,
   and collapse to the left (1st pinned) when it overflows -> scrollable */
.gallery-tabs-row {
  display: flex;
  flex-wrap: nowrap;        /* always one line */
  gap: 5px;
  align-items: center;
  width: max-content;
  margin: 0 auto;
}
.gallery-tab {
  flex: 0 0 auto;
  cursor: pointer;
  padding: 4px;
  border: none;
  border-radius: 8px;
  background: transparent;
  line-height: 0;
  transition: transform 0.15s ease, background 0.15s ease;
}
.gallery-tab img {
  display: block;
  width: 80px;
  height: 50px;            /* fixed box -> uniform size & ratio for every thumbnail */
  object-fit: cover;        /* crop to fill the box instead of keeping native ratio */
  border-radius: 5px;
  background: var(--ai2-cream-2);
}
.gallery-tab:hover { transform: scale(1.1); }
.gallery-tab.active { background: rgba(240, 82, 156, 0.20); }

.stage-prompt {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--ai2-text);
  margin: 0 auto 14px;
}
.gallery-stage .stage-single {
  width: min(640px, 100%);
  margin: 0 auto;
}
/* video-gen "ours" highlight now sits on the crop wrapper */
.vid-col.best .crop { box-shadow: 0 0 0 3px var(--ai2-accent); }

/* ===== Training-data pair: equal-size, centered cells ===== */
#gallery-trainingdata .vid-compare.two { align-items: start; }
#gallery-trainingdata .crop {
  overflow: hidden;
  border-radius: 8px;
  line-height: 0;
  background: var(--ai2-cream-2);
}
#gallery-trainingdata .crop video {
  width: 100%;
  margin-left: 0;            /* drop the left-crop for this gallery */
  height: 300px;
  object-fit: contain;       /* show full frame, centered horizontally & vertically */
  background: var(--ai2-cream-2);
  border-radius: 0;
}
#gallery-trainingdata .vid-method { margin-bottom: 14px; }
#gallery-trainingdata .gallery-stage { margin-bottom: 8px; }
@media (max-width: 640px) {
  #gallery-trainingdata .crop video { height: 220px; }
}
