/* ── Self-hosted fonts ────────────────────────────────────────────── */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 200;
  font-display: swap;
  src: url("assets/fonts/inter-latin-200-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("assets/fonts/inter-latin-300-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/inter-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("assets/fonts/inter-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}

/* ── Design tokens ────────────────────────────────────────────────── */
:root {
  /* Font families — paid fonts first, free self-hosted fallbacks */
  --font-sans:    "ABC Diatype", Inter, ui-sans-serif, system-ui, sans-serif;
  --font-display: "PP Kyoto", Newsreader, Georgia, "Times New Roman", serif;
  --font-mono:    "IBM Plex Mono", "JetBrains Mono", ui-monospace, "Courier New", monospace;

  /* Brand palette */
  --color-forest:  #004E23;
  --color-verdant: #309D4B;
  --color-growth:  #ABD49E;
  --color-canvas:  #E4E3DB;
  --color-carbon:  #1E1E1E;

  /* Neutral scale (warm grays — never cold/blue) */
  --color-neutral-50:  #FEFEFE;
  --color-neutral-100: #F9F9F8;
  --color-neutral-200: #F3F2EF;
  --color-neutral-300: #F0EFE9;
  --color-neutral-400: #E4E3DB;
  --color-neutral-500: #C5C2BC;
  --color-neutral-600: #A7A6A2;
  --color-neutral-700: #787672;
  --color-neutral-800: #525150;
  --color-neutral-900: #1E1C1A;
  --color-neutral-950: #111010;

  /* Semantic tokens — light mode */
  --background:         #F9F9F8;
  --surface:            #F5F5F2;
  --card:               #FDFDFC;
  --muted:              #F1F0EC;
  --accent:             #F3F2EF;
  --sidebar-bg:         #F0EFE9;

  --foreground:         #141210;
  --muted-foreground:   #636260;
  --subtle-foreground:  #A7A6A2;

  --primary:            #004E23;
  --primary-foreground: #FEFEFE;

  --border:             #DFDCD7;
  --input:              #DFDCD7;
  --ring:               #A1A1A1;

  /* Radius */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius:    8px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.10);

  /* Layout — site level */
  --site-gutter:      16px;
  --site-content-max: 1280px;

  /* Layout — component level */
  --sidebar-w: 232px;
  --content-w: 660px;
}

@media (min-width: 768px) {
  :root { --site-gutter: 48px; }
}

/* ── Dark mode ────────────────────────────────────────────────────── */
.dark {
  --background:         #171715;
  --surface:            #262421;
  --card:               #171717;
  --muted:              #1E1C1A;
  --accent:             #1E1C1A;
  --sidebar-bg:         #1F1F1C;

  --foreground:         #CDC8C1;
  --muted-foreground:   #A1A1A1;
  --subtle-foreground:  #787672;

  --primary:            #ABD49E;
  --primary-foreground: #0A0A0A;

  --border:             rgba(255, 255, 255, 0.10);
  --input:              rgba(255, 255, 255, 0.15);
  --ring:               #737373;
}

/* Light/dark logo switching — placed after base .mark/.hero__mark rules; see below */

/* Brand greens shift to lighter value in dark mode */
.dark .section__num { color: var(--color-growth); }
.dark .nav__num     { color: var(--color-growth); }
.dark .nav__item.is-active { color: var(--color-growth); }
.dark .nav__item.is-active .nav__num { color: var(--color-growth); }

/* ── Reset / base ─────────────────────────────────────────────────── */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

.app { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: transparent;
  display: flex;
  flex-direction: column;
  padding: 64px 22px 22px;
  z-index: 10;
}

.brand { display: block; line-height: 0; }
.mark { width: 168px; height: auto; display: block; }

.nav-toggle {
  display: none;
  width: 40px;
  height: 34px;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.nav-toggle__lines,
.nav-toggle__lines::before,
.nav-toggle__lines::after {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background: var(--foreground);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle__lines { position: relative; }
.nav-toggle__lines::before { position: absolute; top: -7px; left: 0; }
.nav-toggle__lines::after  { position: absolute; top:  7px; left: 0; }
.sidebar.is-open .nav-toggle__lines { background: transparent; }
.sidebar.is-open .nav-toggle__lines::before { transform: translateY(7px)  rotate(45deg); }
.sidebar.is-open .nav-toggle__lines::after  { transform: translateY(-7px) rotate(-45deg); }

.nav {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav__item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 7px 10px;
  border-radius: 7px;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.1px;
  color: var(--foreground);
  transition: background 0.15s ease;
}
.nav__item:hover     { background: color-mix(in srgb, var(--foreground) 5%, transparent); }
.nav__item.is-active {
  background: color-mix(in srgb, var(--primary) 7%, transparent);
  color: var(--primary);
}
.nav__item.is-active .nav__num { color: var(--primary); }
.nav__num {
  font-family: var(--font-mono);
  color: var(--color-verdant);
  font-size: 11px;
  font-weight: 400;
  min-width: 20px;
}

.sidebar__footer { margin-top: auto; }
.mode {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--background);
  cursor: pointer;
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 300;
  color: var(--foreground);
  transition: background 0.15s ease;
}
.mode:hover { background: var(--muted); }
.mode__icon { font-size: 12px; line-height: 1; }

/* ── Main ─────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.rule {
  border: 0;
  border-top: 1px solid var(--border);
  width: var(--content-w);
  max-width: calc(100% - 44px);
  margin: 0 auto;
}
.careers + .rule,
.news-article + .rule {
  width: 720px;
  max-width: calc(100% - 44px);
}

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 16px;
}
.hero__mark { width: 80px; height: auto; display: block; }

/* Light/dark logo switching — must follow .mark and .hero__mark base rules */
.mark--dark,
.hero__mark--dark { display: none; }
.dark .mark--dark,
.dark .hero__mark--dark { display: block; }
.dark .mark--light,
.dark .hero__mark--light { display: none; }

/* Article figure light/dark image switching — !important beats inline style="display:block" */
.fig--dark,
.theme-img--dark { display: none !important; }
.dark .fig--dark,
.dark .theme-img--dark { display: block !important; }
.dark .fig--light,
.dark .theme-img--light { display: none !important; }

/* ── Sections ─────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
.section { padding: 84px 24px; scroll-margin-top: 24px; }

.section__num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-verdant);
  margin: 0 0 24px;
}
.section__num--center { text-align: center; }

.section__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: 0.1px;
  margin: 0;
  color: var(--foreground);
}
.section__title--center { text-align: center; width: var(--content-w); max-width: 100%; margin-left: auto; margin-right: auto; }
.section__title--brand  { letter-spacing: 3px; font-size: 34px; }

/* Footnote reference + note */
.footnote-ref {
  font-size: 0.34em;
  font-weight: 400;
  letter-spacing: normal;
  vertical-align: super;
  line-height: 0;
}
.footnote-ref a { text-decoration: none; color: var(--muted-foreground); }
.footnote-ref a:hover { color: var(--foreground); }

.footnotes {
  width: 100%;
  max-width: 100%;
  margin: 40px 0 0;
  padding: 0;
}
.footnotes::before {
  content: "";
  display: block;
  width: 520px;
  max-width: 100%;
  border-top: 1px solid var(--border);
  margin-bottom: 16px;
}
.prose > .footnotes + p { margin-top: 0; }
.prose > p.section__num {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  color: var(--muted-foreground);
  margin: 48px 0 14px;
}
.prose > p.section__num--center { text-align: center; }
.footnote {
  font-family: var(--font-display);
  font-style: normal;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted-foreground);
  margin: 0;
}
.footnote__num {
  font-style: normal;
  font-size: 0.72em;
  margin-right: 3px;
}

/* Intro: centered header + centered prose column */
.section--intro { padding-top: 20px; padding-bottom: 60px; }
.prose {
  width: var(--content-w);
  max-width: 100%;
  margin: 56px auto 0;
}
.prose > p {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.6;
  color: var(--foreground);
  margin: 0 0 24px;
}
.prose > p:last-of-type { margin-bottom: 0; }
.prose > p > a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.prose > p > a:hover { color: var(--color-verdant); }

/* Numbered sections (careers / contact) */
.section:not(.section--intro) { min-height: 34vh; }
.section:not(.section--intro) .section__num,
.section:not(.section--intro) .section__body {
  width: var(--content-w);
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.section:not(.section--intro) .section__num  { margin-bottom: 22px; text-align: center; }
.section:not(.section--intro) .actions { justify-content: center; }

.section__lead {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  line-height: 1.6;
  color: var(--foreground);
  margin: 0 0 26px;
}
.section__lead a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease;
}
.section__lead a:hover { color: var(--muted-foreground); }

/* ── Buttons ──────────────────────────────────────────────────────── */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  border-radius: 7px;
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 450;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.btn__icon { font-size: 13px; line-height: 1; }
.btn--solid { background: var(--primary); color: var(--primary-foreground); }
.btn--solid:hover { background: var(--color-verdant); }
.btn--fill  { background: var(--muted); color: var(--foreground); }
.btn--fill:hover  { background: color-mix(in srgb, var(--foreground) 10%, transparent); }
.btn--ghost { background: var(--background); color: var(--foreground); border-color: var(--border); }
.btn--ghost:hover { background: var(--muted); }
.btn--join  { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.btn--join:hover  { background: var(--color-verdant); border-color: var(--color-verdant); }

/* ── Careers page ─────────────────────────────────────────────────── */
.careers {
  width: 720px;
  max-width: 100%;
  margin: 0 auto;
  padding: 96px 24px 88px;
}
.careers__intro {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.6;
  color: var(--foreground);
  text-align: center;
  max-width: 520px;
  margin: 24px auto 0;
}
.back {
  display: inline-block;
  margin: 0 0 28px;
  color: var(--primary);
  text-decoration: none;
  font-size: 22px;
  line-height: 1;
  transition: color 0.15s ease, opacity 0.15s ease;
}
.back:hover { color: var(--color-verdant); }

.jobs { margin-top: 64px; }
.jobs__status {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  color: var(--muted-foreground);
  text-align: center;
  margin: 40px 0;
}
.jobs__status a { color: var(--foreground); }

.jobs__group + .jobs__group { margin-top: 48px; }
.jobs__dept {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted-foreground);
  margin: 0 0 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.jobs__count { color: var(--subtle-foreground); }

.job {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 8px 18px 4px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--foreground);
  border-radius: var(--radius-md);
  transition: background 0.15s ease, padding 0.15s ease;
}
.job:hover { background: var(--muted); padding-left: 12px; padding-right: 12px; }
.job__main  { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.job__title { font-family: var(--font-display); font-size: 19px; line-height: 1.3; }
.job__meta  { font-family: var(--font-sans); font-size: 13px; font-weight: 300; color: var(--muted-foreground); }
.job__aside {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--muted-foreground);
}
.job__comp  { white-space: nowrap; }
.job__arrow { color: var(--muted-foreground); transition: transform 0.15s ease, color 0.15s ease; }
.job:hover .job__arrow { color: var(--foreground); transform: translateX(2px); }

/* ── Role detail ──────────────────────────────────────────────────── */
.role__meta {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  color: var(--muted-foreground);
  text-align: center;
  margin: 16px 0 0;
}
.role__body {
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.65;
  color: var(--foreground);
  margin-top: 40px;
}
.role__body p                { margin: 0 0 1em; }
.role__body p:last-child     { margin-bottom: 0; }
.role__body ul, .role__body ol { margin: 0 0 1em; padding-left: 1.3em; }
.role__body li               { margin: 0.25em 0; }
.role__body strong           { color: var(--foreground); font-weight: 500; }
.role__body a                { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.careers .role__actions      { justify-content: center; margin-top: 40px; }
.role__apply-note {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 300;
  color: var(--muted-foreground);
  text-align: center;
  margin: 14px 0 0;
}

/* ── Card grid (Datasets, SLMs) ──────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 48px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-decoration: none;
  color: var(--foreground);
  min-height: 180px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  background: var(--muted);
  box-shadow: var(--shadow-sm);
}
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card__tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
}
.card__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  line-height: 1.25;
  margin: 0 0 10px;
  color: var(--foreground);
}
.card__desc {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 300;
  line-height: 1.6;
  color: var(--muted-foreground);
  margin: 0;
  flex: 1;
}
.card__footer { display: none; }
.card__meta { display: none; }
.card__arrow {
  flex-shrink: 0;
  color: var(--muted-foreground);
  transition: color 0.15s ease, transform 0.15s ease;
}
.card:hover .card__arrow {
  color: var(--primary);
  transform: translate(2px, -2px);
}

/* ── News / Research list ─────────────────────────────────────────── */
.news-row {
  display: flex;
  align-items: baseline;
  gap: 18px;
}
.news-item__num {
  flex: 0 0 2.4em;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-foreground);
  line-height: 1.3;
  padding-top: 18px;
  text-align: right;
}
.news-row .job { flex: 1; min-width: 0; }

/* ── News / Research article ──────────────────────────────────────── */
.news-article {
  width: 720px;
  max-width: 100%;
  margin: 0 auto;
  padding: 96px 24px 88px;
  box-sizing: border-box;
}
.news-article__media {
  display: block;
  width: 100%;
  height: auto;
  margin: 30px auto 0;
  background: var(--card);
  border-radius: 7px;
}
.news-article .section__num   { margin-bottom: 16px; }
.news-article .section__title { width: 100%; max-width: 100%; }
.news-article__body.prose {
  width: var(--content-w);
  max-width: 100%;
  margin: 40px auto 0;
  text-align: left;
}
.news-article__body.prose > p {
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.75;
}
.news-article__meta {
  font-family: var(--font-sans) !important;
  font-size: 13px !important;
  font-weight: 300 !important;
  color: var(--muted-foreground) !important;
  margin-bottom: 28px !important;
  text-align: center;
}
.news-article__body h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.3;
  color: var(--foreground);
  margin: 36px 0 14px;
}
.news-article__body ul,
.news-article__body ol {
  margin: 16px 0 20px;
  padding-left: 22px;
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.65;
  color: var(--foreground);
}
.news-article__body dl {
  margin: 16px 0 20px;
}
.news-article__body dt {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  padding-top: 16px;
}
.news-article__body dd {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--foreground);
  margin-left: 0;
}
.news-article__body li {
  margin-bottom: 10px;
}
.news-article__body li:last-child {
  margin-bottom: 0;
}
.news-article__body li strong {
  font-weight: 500;
  color: var(--foreground);
}
.news-article__body blockquote {
  margin: 28px 0;
  padding: 0 0 0 18px;
  border-left: 2px solid var(--border);
}
.news-article__body blockquote p {
  font-style: italic;
  color: var(--foreground);
}

/* ── News article figures ──────────────────────────────────────────── */
.news-article__figure {
  margin: 36px 0;
}
.news-article__figure img {
  width: 100%;
  border-radius: var(--radius-md);
  display: block;
}
.news-article__figure figcaption {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-foreground);
  margin-top: 10px;
  line-height: 1.5;
}

/* ── Related content links ────────────────────────────────────────── */
.related {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.related__label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
  margin: 0 0 14px;
}
.related__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.related__link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 300;
  color: var(--foreground);
  background: var(--muted);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.related__link:hover {
  background: color-mix(in srgb, var(--primary) 6%, var(--muted));
  border-color: var(--primary);
  color: var(--primary);
}
.related__num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-verdant);
}
.related__link:hover .related__num { color: var(--primary); }
.dark .related__link:hover .related__num { color: var(--color-growth); }

/* ── Data stats bar (horizontal metric cells) ─────────────────────── */
.data-stats {
  display: flex;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 32px 0;
}
.data-stats__cell {
  flex: 1;
  background: var(--muted);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.data-stats__value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--color-forest);
  line-height: 1;
  letter-spacing: -0.02em;
}
.dark .data-stats__value { color: var(--color-growth); }
.data-stats__label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.4;
}

/* ── Commerce-1 metrics grid ──────────────────────────────────────── */
.c1-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 36px 0;
}
.c1-metrics__cell {
  background: var(--muted);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.c1-metrics__value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  color: var(--color-forest);
  line-height: 1;
  letter-spacing: -0.02em;
}
.dark .c1-metrics__value { color: var(--color-growth); }
.c1-metrics__label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.4;
}

/* ── Task flow stepper ────────────────────────────────────────────── */
.task-flow {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 36px 0;
  overflow-x: auto;
}
.task-flow__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 80px;
  position: relative;
}
.task-flow__step + .task-flow__step::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  width: 0;
  height: 1px;
  border-top: 1px dashed var(--border);
  transform: translateX(-50%);
  width: calc(100% / 2);
  left: 0;
}
.task-flow__dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--muted);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-foreground);
  position: relative;
  z-index: 1;
}
.task-flow__step--active .task-flow__dot {
  background: var(--color-forest);
  border-color: var(--color-forest);
  color: #fff;
}
.dark .task-flow__step--active .task-flow__dot {
  background: var(--color-verdant);
  border-color: var(--color-verdant);
}
.task-flow__name {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-foreground);
  text-align: center;
  margin-top: 6px;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.task-flow__connector {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-top: 16px;
  border-top: 1px dashed var(--border);
}

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  padding: 28px 32px;
  margin-top: auto;
}
.footer__left, .footer__right {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--muted-foreground);
}
.footer a        { text-decoration: none; color: var(--muted-foreground); }
.footer a:hover  { color: var(--foreground); }
.footer__brand   { color: var(--muted-foreground); }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 12px 16px;
    background: var(--background);
    border-right: 0;
    border-bottom: 1px solid var(--border);
    z-index: 20;
  }
  .brand { order: 1; }
  .mark  { width: 116px; }
  .nav-toggle { display: inline-flex; order: 2; margin-left: auto; }

  .nav {
    order: 3;
    flex-basis: 100%;
    margin: 4px 0 0;
    padding: 8px 0 2px;
    border-top: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    display: none;
  }
  .sidebar.is-open .nav { display: flex; }
  .nav__item { padding: 11px 8px; }

  .sidebar__footer {
    order: 4;
    flex-basis: 100%;
    display: none;
    margin: 0;
    padding-bottom: 6px;
  }
  .sidebar.is-open .sidebar__footer { display: block; }

  .main { margin-left: 0; }

  .hero { padding: 36px 24px 12px; }
  .hero__mark { width: 48px; }
  .section { padding: 52px 22px; }
  .section--intro { padding-top: 16px; padding-bottom: 56px; }
  .prose { margin-top: 36px; }
  .section__title { font-size: 25px; }
  .section:not(.section--intro) { min-height: auto; }
  .section:not(.section--intro) .section__num { margin-bottom: 16px; }

  .careers,
  .news-article { padding: 56px 22px 64px; }
  .jobs { margin-top: 44px; }
}

@media (max-width: 560px) {
  .job {
    flex-direction: row;
    align-items: baseline;
    gap: 12px;
  }
  .job__main  { min-width: 0; }
  .job__aside { flex-shrink: 0; gap: 10px; }
}

@media (max-width: 520px) {
  .section__lead br  { display: none; }
  .section__title br { display: none; }
}

@media (max-width: 700px) {
  /* Data stats wrap to 2 columns */
  .data-stats { flex-wrap: wrap; }
  .data-stats__cell { flex: 1 1 calc(50% - 1px); }
  /* 3-col metrics override becomes 1 col per row on small screens */
  .c1-metrics[style*="1fr 1fr 1fr"] { grid-template-columns: 1fr !important; }
  .related__links { flex-direction: column; }
  .related__link { justify-content: flex-start; }
}

/* ── Research article template ─────────────────────────────────────── */
.research-article {
  padding: 72px 24px 88px 40px;
  max-width: 1100px;
  margin-left: 0;
  margin-right: 0;
}

.research-article .back { margin-bottom: 20px; }

.research-hero {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 7px;
  margin: 28px 0 0;
  background: var(--muted);
}

.research-meta {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 300;
  color: var(--muted-foreground);
  margin: 28px 0 40px;
  text-align: center;
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Three-column layout */
.research-layout {
  display: flex;
  align-items: flex-start;
  gap: 48px;
}

/* Left TOC */
.research-toc {
  flex: 0 0 190px;
  position: sticky;
  top: 40px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  align-self: flex-start;
}

.research-toc__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
  margin-bottom: 16px;
}

.research-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.research-toc li + li { margin-top: 2px; }

.research-toc__link {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted-foreground);
  text-decoration: none;
  padding: 4px 0 4px 14px;
  transition: color 0.15s ease;
  position: relative;
}

.research-toc__link:hover { color: var(--foreground); }

.research-toc__link.is-active {
  color: var(--foreground);
}

.research-toc__link.is-active::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--primary);
}

.research-toc ul ul .research-toc__link {
  font-size: 11px;
  padding-left: 22px;
  color: var(--subtle-foreground);
}

.research-toc ul ul .research-toc__link:hover  { color: var(--muted-foreground); }
.research-toc ul ul .research-toc__link.is-active {
  color: var(--foreground);
}
.research-toc ul ul .research-toc__link.is-active::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-size: 10px;
}

/* Center prose */
.research-prose {
  flex: 1;
  max-width: 65ch;
  min-width: 0;
  position: relative;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.75;
  color: var(--foreground);
}

.research-prose .research-abstract {
  font-size: 17px;
  line-height: 1.65;
  font-weight: 400;
  margin-bottom: 36px;
  color: var(--foreground);
}

.research-prose p { margin-bottom: 1.2em; }

.research-prose h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--foreground);
  margin: 48px 0 16px;
  scroll-margin-top: 40px;
}

.research-prose h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--foreground);
  margin: 32px 0 12px;
  scroll-margin-top: 40px;
}

.research-prose a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  transition: border-color 0.15s ease;
}

.research-prose a:hover { border-bottom-color: var(--primary); }

.research-prose blockquote {
  margin: 28px 0;
  padding: 0 0 0 18px;
  border-left: 2px solid var(--border);
}

.research-prose blockquote p {
  font-style: italic;
  color: var(--muted-foreground);
  margin-bottom: 0;
}

.research-prose ul,
.research-prose ol {
  padding-left: 1.5em;
  margin-bottom: 1.2em;
}

.research-prose li { margin-bottom: 0.4em; }

.research-prose code {
  font-family: var(--font-mono);
  font-size: 0.83em;
  padding: 0.15em 0.4em;
  background: var(--muted);
  border-radius: var(--radius-sm);
  color: var(--foreground);
}

.research-prose pre {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow-x: auto;
  margin: 20px 0;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
}

.research-prose pre code {
  padding: 0;
  background: none;
  border-radius: 0;
}

.research-prose strong { font-weight: 500; }

.research-prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* Figures */
.research-figure {
  margin: 32px 0;
}

.research-figure__media {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--muted);
  border: 1px solid var(--border);
}

.research-figure__media img,
.research-figure__media video {
  display: block;
  width: 100%;
  height: auto;
}

.research-figure__caption {
  margin-top: 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-foreground);
}

.research-figure__num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--foreground);
}

/* Sidenotes */
.sidenote-wrapper { display: inline; }

.sidenote-ref {
  font-family: var(--font-mono);
  font-size: 0.68em;
  vertical-align: super;
  color: var(--primary);
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s ease;
}

.sidenote-wrapper:hover .sidenote-ref {
  color: var(--color-verdant);
}

.sidenote {
  position: absolute;
  left: calc(100% + 32px);
  width: 155px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted-foreground);
  padding: 2px 0;
}

.sidenote-wrapper:hover .sidenote {
  color: var(--foreground);
}

.sidenote a {
  color: var(--color-verdant);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--color-verdant) 40%, transparent);
}
.sidenote a:hover { border-bottom-color: var(--color-verdant); }

/* Mobile-extracted block footnotes — engram-style numbered references */
.block-footnotes {
  margin: 10px 0 22px;
  padding: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted-foreground);
}

.block-footnotes p { margin: 6px 0 0; }
.block-footnotes p:first-child { margin-top: 0; }
.block-footnotes p::after {
  content: " ↩";
  color: var(--color-verdant);
  font-family: var(--font-mono);
  font-size: 15px;
}

/* Narrow: hide absolute sidenotes, show block-footnotes */
@media (max-width: 1400px) {
  .sidenote { display: none; }
}

/* Wide screens: center the content column without changing sidebar behavior.
   Body is capped and centered; fixed sidebar shifts its left edge to match. */
@media (min-width: 1600px) {
  body {
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
  }
  /* Sidebar stays position:fixed but its left edge follows the centered body */
  .sidebar {
    left: max(0px, calc((100vw - 1600px) / 2));
  }
  /* Research article centers within the now-finite main column */
  .research-article {
    margin-left: auto;
    margin-right: auto;
  }
}

/* Medium: hide TOC, prose goes full-width */
@media (max-width: 1049px) {
  .research-toc { display: none; }
  .research-prose { max-width: 100%; }
}


/* Mobile */
@media (max-width: 860px) {
  .research-article {
    padding: 56px 20px 64px;
  }
  .research-layout { display: block; }
  .research-prose  { font-size: 17px; }
}

/* ── Right-margin sidenote — arrow accent ─────────────────────────── */
.sidenote::after {
  content: " ↩";
  color: var(--color-verdant);
  font-family: var(--font-mono);
  font-size: 15px;
}

/* ── Video player component (pi.website style) ────────────────────── */
.video-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 0;
  cursor: pointer;
}

.video-player video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-player__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.28);
  transition: background 0.2s ease, opacity 0.2s ease;
}

.video-player.is-playing .video-player__overlay {
  opacity: 0;
  pointer-events: none;
}

.video-player__btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform 0.2s ease, background 0.2s ease;
}

.video-player:hover .video-player__btn {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.2);
}

.video-player__label {
  position: absolute;
  bottom: 14px;
  left: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
}

/* ── Video slider (pi.website style) ─────────────────────────────── */
.video-slider {
  margin: 32px 0;
}

.video-slider__track-wrapper {
  overflow: hidden;
}

.video-slider__track {
  display: flex;
  gap: 10px;
  transition: transform 0.35s ease;
  will-change: transform;
}

.video-slider__item {
  flex: 0 0 calc(40% - 8px);
  min-width: 0;
}

.video-slider__video-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
}

.video-slider__video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-slider__controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 20px 10px 9px;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 100%);
}

.vs-play-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease;
}

.vs-play-btn:hover { background: rgba(255,255,255,0.22); }

.vs-progress-bar {
  flex: 1;
  height: 2px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.vs-progress-fill {
  height: 100%;
  background: #e5e5e5;
  border-radius: 2px;
  width: 0%;
}

.vs-time {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: rgba(255,255,255,0.75);
  flex-shrink: 0;
  white-space: nowrap;
}

.video-slider__caption {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--muted-foreground);
  margin: 8px 0 0;
  line-height: 1.4;
  text-align: center;
}

.video-slider__nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.vs-nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--foreground);
  color: var(--background);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  transition: opacity 0.15s ease;
}

.vs-nav-btn:hover   { opacity: 0.75; }
.vs-nav-btn:disabled { opacity: 0.25; cursor: default; }

@media (max-width: 860px) {
  .video-slider__item { flex: 0 0 calc(50% - 5px); }
}

/* ── Video expand modal ───────────────────────────────────────────── */
.video-expand-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.88);
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.video-expand-modal.is-open { display: flex; }
.video-expand-modal__inner {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.video-expand-modal__inner video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.video-expand-modal__caption {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}
.video-expand-modal__close {
  position: absolute;
  top: -44px;
  right: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.video-expand-modal__close:hover { color: #fff; }
.video-slider__video-wrap { cursor: zoom-in; }

/* ── Interactive bar chart tooltip ───────────────────────────────── */
.bar-row { position: relative; overflow: visible; }
.bar-row:hover .bar-fill { opacity: 0.85; }
.bar-tooltip {
  display: none;
  position: absolute;
  left: 130px;
  bottom: calc(100% + 4px);
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  padding: 8px 11px;
  border-radius: 6px;
  max-width: 260px;
  white-space: normal;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.bar-row:hover .bar-tooltip { display: block; }

/* ── Metrics grid (native component) ─────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.metrics-grid__cell {
  background: var(--muted);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.metrics-grid__value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 500;
  color: var(--color-forest);
  line-height: 1;
  letter-spacing: -0.02em;
}
.dark .metrics-grid__value { color: var(--color-growth); }
.metrics-grid__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
}
.metrics-grid__desc {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--muted-foreground);
  line-height: 1.4;
  margin-top: 2px;
}

/* ── Figure grid — 2-column image layout ─────────────────────────── */
.figure-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 32px 0;
}

.figure-grid .research-figure { margin: 0; }

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