/* =====================================================
   SimFoundry — GEAR/NVIDIA research page styles
   ===================================================== */

@font-face {
  font-family: "NVIDIA Sans";
  src: url("../../../fonts/NVIDIASans_Rg.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "NVIDIA Sans";
  src: url("../../../fonts/NVIDIASans_Md.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "NVIDIA Sans";
  src: url("../../../fonts/NVIDIASans_Bd.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --color-text: #222222;
  --color-text-muted: #5d574d;
  --color-muted: #5d574d;
  --color-bg: #f9f7f2;
  --color-bg-alt: #f1eee7;
  --color-border: #ded8ca;
  --color-accent: #76b900;
  --color-accent-dark: #4f7f00;
  --color-stanford-red: #76b900;
  --color-stanford-red-dark: #4f7f00;
  --color-card: #ffffff;
  --color-card-shadow: rgba(25, 24, 22, 0.08);

  --font-sans: "NVIDIA Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "NVIDIA Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;

  --container-max: clamp(756px, 75.6vw, 1114px);
  --container-narrow: clamp(644px, 55vw, 853px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 21.6px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  max-width: 100%;
}

img { max-width: 100%; height: auto; }
canvas { max-width: 100%; }

a {
  color: #4d4334;
  text-decoration: underline;
  text-decoration-color: rgba(77, 67, 52, 0.28);
  text-underline-offset: 2px;
}
a:hover {
  color: #1f1f1f;
  text-decoration-color: var(--color-accent);
}

.gear-site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 40px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(222, 216, 202, 0.86);
  box-shadow: 0 2px 10px rgba(25, 24, 22, 0.04);
  backdrop-filter: blur(10px);
}

.gear-site-logo a {
  color: #202020;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
}

.gear-site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
}

.gear-site-nav a {
  color: #222222;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1;
  position: relative;
  text-decoration: none;
}

.gear-site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
}

.gear-site-nav a:hover::after,
.gear-site-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

@media (max-width: 760px) {
  .gear-site-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 24px;
  }

  .gear-site-nav {
    justify-content: flex-start;
    gap: 14px 18px;
  }
}

/* ----------- Hero ----------- */
.hero {
  padding: 58px 24px 40px;
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, var(--color-bg) 100%);
  border-bottom: 1px solid var(--color-border);
}
.hero-inner {
  max-width: var(--container-max);
  margin: 0 auto;
}
.publication-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.708rem, 2.833vw, 2.875rem);
  line-height: 1.2;
  margin: 0 0 24px;
  color: #111111;
  /* Break out wider than the hero column and cap the font so the explicit
     <br> split renders as a clean two lines across desktop widths. */
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(1251px, 94vw);
  max-width: none;
}
.publication-authors {
  font-size: 1rem;
  margin: 0 auto 8px;
  line-height: 1.7;
  max-width: 853px;
}
.publication-authors .author-block { margin: 0 4px; }
.affiliation {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin: 0 auto 4px;
  max-width: 853px;
}
.affiliation-note {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 0 auto 12px;
  max-width: 853px;
}
.publication-venue {
  display: inline-block;
  color: #2b2b2b;
  font-size: 0.88rem;
  font-weight: 600;
  margin: 12px 0 24px;
  padding: 4px 12px;
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  background: rgba(118, 185, 0, 0.08);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: #1a1a1a;
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 1.03rem;
  font-weight: 500;
  border: 1px solid #1a1a1a;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.15s ease;
}
.btn:hover {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-1px);
}

/* ----------- Sections ----------- */
.section {
  padding: 64px 24px;
  background: var(--color-bg);
}
.container {
  max-width: var(--container-max);
  margin: 0 auto;
}
.container.narrow {
  max-width: var(--container-narrow);
}
.container.wide {
  max-width: var(--container-max);
}
.section-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.292rem, 1.833vw, 1.875rem);
  text-align: center;
  margin: 0 0 16px;
  /* Allow titles to be wider than the (narrow) body container so long
     headings wrap less. Centered in the viewport via the 50%/translate trick. */
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(1137px, 92vw);
  max-width: none;
}
.section-lead {
  text-align: center;
  color: var(--color-text-muted);
  max-width: 720px;
  margin: 0 auto 32px;
}

/* Full-width gray "takeaway" band used as a section break. */
.takeaway {
  background: #1d1d1d;
  border-top: 4px solid var(--color-accent);
  border-bottom: 0;
  padding: 52px 24px;
}
.takeaway-eyebrow {
  display: block;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-accent);
  margin: 0 0 10px;
}
.takeaway-text {
  max-width: 1137px;
  margin: 0 auto;
  text-align: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
  line-height: 1.4;
  color: #ffffff;
}
.takeaway-text .accent-red { color: var(--color-stanford-red); }
.content p {
  margin: 0 0 1em;
  text-align: justify;
}

/* ----------- Teaser ----------- */
.teaser {
  padding-top: 42px;
  padding-bottom: 48px;
}
.teaser-figure { margin: 0; }
.teaser-figure img,
.teaser-figure video {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  margin: 0 auto;
}
.teaser-figure video {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 26px rgba(25, 24, 22, 0.08);
}
.teaser-placeholder,
.video-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--color-bg-alt);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}
.figure-caption {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin: 14px auto 0;
  max-width: 758px;
}

.figure-tldr {
  color: var(--color-text);
  font-size: 1.08rem;
  font-weight: 500;
  line-height: 1.6;
  max-width: 720px;
  margin: 22px auto 0;
  padding: 18px 26px;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-left: 5px solid var(--color-accent);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 20px rgba(25, 24, 22, 0.05);
}

.tldr-label {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #111111;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* ----------- Video embed ----------- */
.video-embed {
  width: 100%;
  margin: 0 auto;
}
.pipeline-video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  background: var(--color-card);
  border: 1px solid var(--color-border);
}

/* Pipeline section: enlarge the figure and its heading ~1.3x. The figure
   extends 15% past the container on each side (centered); body overflow-x is
   clipped so this never adds a horizontal scrollbar. */
#walkthrough .video-embed {
  width: 130%;
  margin: 0 -15%;
}
#walkthrough .section-title {
  font-size: clamp(1.625rem, 2.6vw, 2.058rem);
}

/* ----------- 3D Viewers ----------- */
#scene-viewer,
#object-viewer {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.viewer-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.viewer-label {
  font-weight: 600;
  color: var(--color-text);
}
.viewer-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 36px 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-card) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231a1a1a' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 12px center;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-text);
  cursor: pointer;
}
.viewer-select:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.viewer-grid {
  display: grid;
  gap: 20px;
}
.viewer-grid--single { grid-template-columns: 1fr; }
.viewer-grid--dual { grid-template-columns: 1fr 1fr; }
.viewer-grid--triple { grid-template-columns: 1fr 1fr 1fr; }
.viewer-grid--triple .viewer-container { aspect-ratio: 4 / 3; }
@media (max-width: 960px) {
  .viewer-grid--triple { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .viewer-grid--dual { grid-template-columns: 1fr; }
  .viewer-grid--triple { grid-template-columns: 1fr; }
}

.viewer-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 28px var(--color-card-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.viewer-card-title {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--color-border);
  background: #f7f4ed;
}
.viewer-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background:
    linear-gradient(135deg, #ece7db 0%, #d8d1c2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.viewer-container--image {
  background: var(--color-bg-alt);
}
.viewer-container--image .viewer-loading {
  color: var(--color-text-muted);
}
.viewer-container--image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.viewer-container--video {
  background: var(--color-bg-alt);
}
.viewer-container--video video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ----------- Interactive object picker ----------- */
.io-scene.io-hovering { cursor: pointer; }
.io-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}
.io-tooltip {
  position: absolute;
  z-index: 3;
  transform: translate(12px, -50%);
  padding: 3px 9px;
  background: rgba(15, 18, 25, 0.9);
  color: #fff;
  font-size: 0.82rem;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
}
.io-hint-inline,
.io-selected-label {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.viewer-preview-video {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 42%;
  height: 38%;
  object-fit: cover;
  z-index: 5;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  background: #000;
  pointer-events: none;
  transition: top 0.55s cubic-bezier(0.4, 0, 0.2, 1),
              left 0.55s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.55s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.55s cubic-bezier(0.4, 0, 0.2, 1),
              border-radius 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}
/* While the heavy interactive viewer loads, the preview fills the viewer. */
.viewer-preview-video.is-cover {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: contain;
}
.viewer-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  border: 4px solid rgba(130, 130, 130, 0.3);
  border-top-color: var(--color-accent);
  animation: viewer-spin 0.85s linear infinite;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
@keyframes viewer-spin {
  to { transform: rotate(360deg); }
}
.viewer-spinner-label {
  position: absolute;
  top: calc(50% + 42px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  color: #fff;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}
.viewer-loading {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.viewer-hint {
  padding: 8px 16px 12px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
}
.viewer-note {
  margin-top: 20px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.sam3d-summary {
  max-width: 777px;
  margin: 0 auto 28px;
}
.sam3d-summary p {
  text-align: left;
  margin: 0;
}

/* ----------- Qualitative results ----------- */
.qualitative-results {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.qualitative-group[hidden] {
  display: none;
}
.qualitative-video-toggle {
  display: inline-flex;
  align-self: center;
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-card);
  box-shadow: 0 4px 12px rgba(25, 24, 22, 0.04);
}
.qualitative-toggle-button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-right: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1;
  min-width: 96px;
  padding: 9px 14px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.qualitative-toggle-button:last-child {
  border-right: 0;
}
.qualitative-toggle-button:hover,
.qualitative-toggle-button:focus-visible {
  color: var(--color-accent-dark);
}
.qualitative-toggle-button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}
.qualitative-toggle-button.is-active {
  background: var(--color-text);
  color: #ffffff;
  box-shadow: inset 0 -3px 0 var(--color-accent);
}
.qualitative-pair {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.qualitative-pair--dual {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 720px) {
  .qualitative-pair,
  .qualitative-pair--dual { grid-template-columns: 1fr; }
}
.qualitative-panel {
  margin: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 20px rgba(25, 24, 22, 0.05);
}
.qualitative-media {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-alt);
  overflow: hidden;
}
.qualitative-media img,
.qualitative-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.qualitative-media--image img {
  object-fit: contain;
}
.qualitative-panel figcaption {
  order: -1;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text);
  background: #f7f4ed;
  border-bottom: 1px solid var(--color-border);
}
.qualitative-panel figcaption .success-rate {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--color-muted);
}
.real2sim-policy {
  text-align: center;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-text);
  margin: 0 0 16px 0;
}
.qualitative-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}
#sam3d-scene-tabs {
  margin-top: 0;
}
.qualitative-tab {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-card);
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  padding: 9px 13px;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.qualitative-tab:hover,
.qualitative-tab:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
}
.qualitative-tab:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.qualitative-tab.is-active {
  background: var(--color-text);
  border-color: var(--color-text);
  color: #ffffff;
  box-shadow: inset 0 -3px 0 var(--color-accent);
}

/* ----------- Sim-to-Real Policy Training ----------- */
.accent-red { color: var(--color-stanford-red); }
.subsection-title {
  font-family: var(--font-serif);
  font-size: clamp(0.917rem, 1.417vw, 1.167rem);
  font-weight: 600;
  text-align: center;
  margin: 0 0 26px;
  color: var(--color-text);
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(1137px, 92vw);
  max-width: none;
}
.policy-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
@media (max-width: 720px) {
  .policy-row { grid-template-columns: 1fr; }
}
.policy-col { margin: 0; }
.policy-col-header {
  text-align: center;
  font-weight: 600;
  font-size: 1.02rem;
  margin-bottom: 10px;
  color: var(--color-text);
  line-height: 1.25;
  /* Reserve two lines so a wrapping header (e.g. "Real World Eval (Unseen
     Objects)") on narrow screens doesn't push its video out of line with the
     others. */
  min-height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
}
.policy-media {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--color-border);
  box-shadow: 0 8px 20px rgba(25, 24, 22, 0.06);
}
.policy-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.policy-success {
  text-align: center;
  margin-top: 12px;
  color: var(--color-text-muted);
  font-size: 0.98rem;
}
.policy-success strong {
  color: var(--color-text);
  font-size: 1.15rem;
}
.policy-success--highlight {
  color: var(--color-accent-dark);
  font-weight: 600;
}
.policy-success--highlight strong {
  color: var(--color-accent-dark);
}

/* Cousins generalization: image (left) + eval video (right) */
.policy-row + .subsection-title {
  margin-top: 48px;
}
/* Video spans the section width (16:9). The image floats as a picture-in-
   picture window over the LEFT of the video, matching (almost) its height. */
.cousin-row {
  position: relative;
}
.cousin-row .policy-media {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}
.cousin-row .policy-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cousin-fig {
  position: absolute;
  top: 28px;
  bottom: 28px;
  left: 12px;
  margin: 0;
  z-index: 2;
}
.cousin-fig img {
  display: block;
  height: 100%;
  width: auto;
  /* transparent cutout floats over the video; shadow follows the object shapes */
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55));
}
@media (max-width: 720px) {
  .cousin-fig { top: 16px; bottom: 16px; left: 8px; }
}

/* ----------- Stat cards (task-cousins section) ----------- */
.stat-lead {
  text-align: center;
  font-size: clamp(1rem, 1.9vw, 1.45rem);
  font-weight: 600;
  margin: 0 0 18px;
}
.stat-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  max-width: 891px;
  margin: 0 auto;
}
.stat-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 20px var(--color-card-shadow);
  padding: 18px 24px 22px;
  text-align: center;
}
.stat-card-title {
  font-weight: 600;
  /* Keep titles like "On 7 held-out tasks (unseen even in sim)" on one line:
     no wrapping, font scales down with the viewport instead. */
  white-space: nowrap;
  font-size: clamp(0.72rem, 1.15vw, 1rem);
}
.stat-card-note { font-size: 0.8em; color: var(--color-text-muted); font-weight: 500; }
.stat-card-footnote {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}
.stat-compare {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  margin: 6px 0 14px;
}
.stat-from {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
}
.stat-arrow { font-size: 1.5rem; color: var(--color-text-muted); }
.stat-to {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--color-accent-dark);
}
.stat-bar-row {
  display: grid;
  grid-template-columns: 8.2em 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.stat-bar-label {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  text-align: right;
  white-space: nowrap;
}
.stat-bar-track {
  height: 12px;
  background: #eef0f3;
  border-radius: 999px;
  overflow: hidden;
}
.stat-bar {
  height: 100%;
  width: calc(var(--v) * 1%);
  min-width: 4px; /* keep the 0% baseline visible as a sliver */
  border-radius: inherit;
  transition: width 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.stat-bar--base { background: #b9bec7; }
.stat-bar--boost { background: var(--color-accent); }
@media (max-width: 720px) {
  .stat-cards { grid-template-columns: 1fr; }
}

/* Keep the Task Cousins heading on one line (override base wrap/width). */
#task-cousins .section-title {
  white-space: nowrap;
  width: max-content;
  max-width: 96vw;
  font-size: clamp(0.75rem, 1.833vw, 1.583rem);
}
@media (max-width: 720px) {
  #task-cousins .section-title { white-space: normal; width: min(1137px, 92vw); }
}

/* ----------- Two videos side by side (task cousins) ----------- */
.video-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 1042px;
  margin: 0 auto;
}
@media (max-width: 720px) {
  .video-duo { grid-template-columns: 1fr; }
}
.duo-col { margin: 0; }
.duo-caption {
  text-align: center;
  font-weight: 600;
  font-size: 1.02rem;
  margin-top: 10px;
  color: var(--color-text);
}
.stat-block {
  margin: 0 0 28px;
}

/* ----------- Highlighted stat sentences ----------- */
.stat-line {
  text-align: center;
  font-size: clamp(0.8rem, 1.7vw, 1.4rem);
  font-weight: 600;
  line-height: 1.5;
  margin: 0 0 16px;
  color: var(--color-text);
  /* Keep each sentence on a single line, breaking out wider than the body
     container (centered in the viewport). */
  white-space: nowrap;
  width: max-content;
  max-width: 96vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
.stat-line:last-child { margin-bottom: 0; }
.stat-line .accent-red { font-weight: 700; }
@media (max-width: 720px) {
  .stat-line {
    white-space: normal;
    width: auto;
    left: auto;
    transform: none;
  }
}

/* ----------- Co-training bar chart (generated, not an image) ----------- */
.barchart { margin: 0 auto; max-width: 891px; }
.barchart-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 20px;
  font-weight: 600;
}
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend-swatch { width: 16px; height: 16px; border-radius: 3px; }
.swatch-sim { background: #3b9aff; }
.swatch-real { background: #5cd65c; }
.swatch-cotrain { background: #ff6f61; }

.barchart-body {
  display: grid;
  grid-template-columns: auto auto 1fr;
  column-gap: 10px;
  align-items: start;
}
.barchart-ylabel {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.barchart-yaxis {
  height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: right;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}
.barchart-col3 { min-width: 0; }
.barchart-plot {
  position: relative;
  height: 260px;
  border-left: 2px solid var(--color-border);
  border-bottom: 2px solid var(--color-border);
}
.barchart-gridlines {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.barchart-gridlines span { border-top: 1px solid #eef0f3; }
.barchart-cols { position: absolute; inset: 0; display: flex; }
.bar-group { flex: 1; height: 100%; }
.bar-cluster {
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
}
.bar {
  position: relative;
  width: 28px;
  max-width: 28%;
  height: calc(var(--v) * 1%);
  border-radius: 3px 3px 0 0;
  transition: height 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.bar-sim { background: #3b9aff; }
.bar-real { background: #5cd65c; transition-delay: 0.15s; }
.bar-cotrain { background: #ff6f61; transition-delay: 0.3s; }
.bar-val {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.82rem;
  line-height: 1.1;
  font-weight: 600;
  color: var(--color-text);
  transition: opacity 0.35s ease 0.9s;
}

/* First-view grow animation: JS marks `[data-chart-grow]` charts as pending
   on load and releases them when they scroll into view, so bars rise from
   zero to their real values. Without JS the static rules above apply. */
.chart-grow-pending .bar { height: 0; }
.chart-grow-pending .bar-val { opacity: 0; transition: none; }
.chart-grow-pending .stat-bar { width: 0; min-width: 0; }
.chart-grow-pending .mbar { height: 0; }
.chart-grow-pending .mbar span { opacity: 0; transition: none; }
.barchart-xlabels { display: flex; margin-top: 8px; }
.barchart-xlabels span {
  flex: 1;
  text-align: center;
  font-size: 1rem;
  color: var(--color-text);
}
@media (max-width: 720px) {
  .bar { width: 16px; }
  .bar-val { font-size: 0.78rem; top: -18px; }
  .barchart-xlabels span { font-size: 0.82rem; }
}

/* ----------- SAM3D metric charts (3 panels, generated) ----------- */
.metric-charts { max-width: 1145px; margin: 36px auto 0; }
.metric-panels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
@media (max-width: 820px) {
  .metric-panels { grid-template-columns: 1fr; max-width: 540px; margin: 0 auto; }
}
.metric-panel-title {
  text-align: center;
  font-weight: 600;
  font-size: 0.98rem;
  margin-bottom: 12px;
  color: var(--color-text);
}
.metric-plot {
  display: flex;
  gap: 16px;
  height: 230px;
  align-items: flex-end;
  border-bottom: 2px solid var(--color-border);
}
.metric-cluster {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
}
.mbar {
  position: relative;
  flex: 1;
  max-width: 34px;
  height: calc(var(--v) * 1%);
  border-radius: 3px 3px 0 0;
  transition: height 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.mbar span {
  position: absolute;
  top: -17px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.52rem;
  line-height: 1.1;
  white-space: nowrap;
  color: var(--color-text);
  transition: opacity 0.35s ease 0.9s;
}
.mbar-sam { background: #3b9aff; }
.mbar-zs { background: #5cd65c; }
.mbar-tuned { background: #ff6f61; }
.metric-xrow { display: flex; gap: 16px; margin-top: 10px; }
.metric-xrow span {
  flex: 1;
  text-align: center;
  font-size: 0.74rem;
  line-height: 1.3;
  color: var(--color-text-muted);
}
.metric-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 24px;
  font-weight: 600;
  font-size: 0.92rem;
}
.swatch-sam { background: #3b9aff; }
.swatch-zs { background: #5cd65c; }
.swatch-tuned { background: #ff6f61; }

/* ----------- BibTeX ----------- */
.bibtex-block {
  background: #1d1d1d;
  color: #e2e8f0;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ----------- Real2Sim Scatter Chart ----------- */
.real2sim-chart-wrapper {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}
.chart-title {
  text-align: center;
  font-size: 1.167rem;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: var(--color-text);
}
.chart-subtitle {
  text-align: center;
  font-size: 1rem;
  color: var(--color-muted);
  margin: 0 0 20px 0;
}
.chart-hint {
  text-align: center;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--color-muted);
  margin: -12px 0 20px 0;
}
.chart-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}
.chart-toggle {
  padding: 8px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.98rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.chart-toggle:hover {
  background: #ffffff;
  border-color: var(--color-accent);
}
.chart-toggle.is-active {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
  box-shadow: inset 0 -3px 0 var(--color-accent);
}
.chart-container {
  position: relative;
  max-width: 617px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(25, 24, 22, 0.04);
}
#scatter-svg {
  display: block;
  width: 100%;
  height: auto;
}
.scatter-point {
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.scatter-point:hover {
  transform: scale(1.3);
  filter: brightness(1.1);
}
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(30, 30, 30, 0.95);
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.5;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
  max-width: 200px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.chart-tooltip .tooltip-method {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
}
.chart-tooltip .tooltip-method.simfoundry {
  background: #3182bd;
}
.chart-tooltip .tooltip-method.polaris {
  background: #e6550d;
}
.chart-tooltip .tooltip-metrics {
  display: block;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.2);
  font-size: 0.8rem;
  color: #adf;
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
}

/* Metrics Comparison Bar Charts */
.metrics-comparison {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}
.sam3d-heading {
  margin-top: 56px;
}
.metrics-title {
  text-align: center;
  font-size: 1.167rem;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: var(--color-text);
}
.metrics-subtitle {
  text-align: center;
  font-size: 1rem;
  color: var(--color-muted);
  margin: 0 0 24px 0;
}
.metrics-bars {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}
.metric-chart {
  flex: 1;
  max-width: 303px;
  min-width: 260px;
}
.metric-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
  margin-bottom: 12px;
  text-align: center;
}
.metric-arrow {
  font-weight: 700;
  margin-left: 4px;
}
.metric-arrow--up {
  color: #2e7d32;
}
.metric-arrow--down {
  color: #2e7d32;
}
.metric-bar-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.metric-bar-row {
  display: grid;
  grid-template-columns: 118px minmax(120px, 1fr) 58px;
  align-items: center;
  gap: 14px;
}
.metric-bar-name {
  font-size: 0.85rem;
  color: var(--color-muted);
  text-align: right;
  white-space: nowrap;
}
.metric-bar-track {
  height: 28px;
  background: var(--color-bg-alt);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.metric-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  width: 0;
}
.metric-bar--sf {
  background: linear-gradient(90deg, #6baed6, #3182bd);
}
.metric-bar--pol {
  background: linear-gradient(90deg, #fdae6b, #e6550d);
}
.metric-bar-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
}
@media (max-width: 600px) {
  .metrics-bars {
    flex-direction: column;
    align-items: center;
  }
  .metric-chart {
    width: 100%;
  }
}
.chart-legends {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.legend-group {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  min-width: 140px;
}
.legend-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 6px;
}
.legend-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--color-muted);
}
.legend-item svg {
  flex-shrink: 0;
}
@media (max-width: 720px) {
  .chart-legends {
    flex-direction: column;
    align-items: center;
  }
  .legend-group {
    width: 100%;
    max-width: 280px;
  }
  .legend-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ----------- Footer ----------- */
.site-footer {
  padding: 32px 24px 48px;
  text-align: center;
  color: #b8b8b8;
  font-size: 0.9rem;
  border-top: 4px solid var(--color-accent);
  background: #1d1d1d;
}

.site-footer a {
  color: #ffffff;
  text-decoration-color: rgba(118, 185, 0, 0.75);
}

.site-footer a:hover {
  color: var(--color-accent);
}
