/* dex-gem.ai — the DexGEM Lab research log.
   Design contract: tokens.json (DexGEM design language) + the computed-style
   evidence in website-research.md (pi.website / mindlab.im / thinkingmachines.ai).
   Body is serif per tokens.json font.body; Space Grotesk for headings/labels,
   Inter for chrome (nav, metadata, captions, tables). */

@font-face {
  font-family: 'Source Serif 4';
  src: url('./fonts/SourceSerif4-var.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('./fonts/SourceSerif4-italic-var.woff2') format('woff2');
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url('./fonts/Inter-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url('./fonts/Inter-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url('./fonts/Inter-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('./fonts/SpaceGrotesk-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('./fonts/SpaceGrotesk-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #F3F6FA;
  --ink: #202846;
  --muted: #687087;   /* Ink 60 per DESIGN_LANGUAGE §2 */
  --hair: #D9DDE4;    /* tokens ink12 */
  --sapphire: #1E5FC2;
  --tint: #E9EFF8;
  --serif: 'Source Serif 4', Charter, Georgia, serif;
  --sans: Inter, 'Helvetica Neue', Arial, sans-serif;
  --grot: 'Space Grotesk', var(--sans);
  /* 730px / 18px Source Serif 4 (advance 0.4436em) ≈ 91 chars/line —
     between Thinking Machines (81–86) and Physical Intelligence (95–100). */
  --measure: 730px;
  --gutter: clamp(20px, 4vw, 48px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 18px/1.6 var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--sapphire); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--sapphire); outline-offset: 4px; }
::selection { background: #D4E2F7; }
img, video { display: block; max-width: 100%; }
b, strong { font-weight: 600; }

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  padding: 8px 16px;
  background: var(--paper);
  font: 400 14px var(--sans);
  z-index: 10;
}
.skip-link:focus { top: 8px; }

/* ------------------------------------------------------------- chrome */

.site-header { border-bottom: 1px solid var(--hair); }
.site-header-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 20px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.wordmark { display: block; }
.wordmark img { display: block; height: 30px; width: auto; }
.site-nav { display: flex; gap: 26px; }
.site-nav a {
  font: 400 14px var(--sans);
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover { color: var(--sapphire); }
.site-nav a[aria-current='page'] { color: var(--sapphire); }

.site-footer { border-top: 1px solid var(--hair); }
.site-footer-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 24px var(--gutter) 30px;
  font: 400 12px/1.6 var(--sans);
  color: var(--muted);
}

.badge-draft {
  font: 600 10px/1 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--hair);
  padding: 4px 7px;
  white-space: nowrap;
}

/* ------------------------------------------------------------- index */

.index {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(48px, 7vw, 88px) var(--gutter) clamp(64px, 8vw, 110px);
}
.index-intro {
  margin: 0 0 clamp(44px, 5vw, 68px);
  font-size: 18px;
  line-height: 1.65;
  max-width: 34em;
}

.post-list { border-bottom: 1px solid var(--hair); }
.post-row {
  display: flex;
  align-items: flex-start;
  gap: 26px;
  padding: 22px 0;
  border-top: 1px solid var(--hair);
  color: inherit;
  text-decoration: none;
}
.post-row-text { flex: 1; min-width: 0; }
.post-thumb {
  flex: none;
  width: 140px;
  height: auto;
  border: 1px solid var(--hair);
}
.post-row--featured {
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 24px 26px;
  margin: 0 0 26px;
  transition: box-shadow .12s ease;
}
.post-row--featured:hover { box-shadow: 5px 5px 0 var(--ink); }
.post-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}
.post-title {
  font: 500 20px/1.35 var(--grot);
  letter-spacing: -.01em;
  color: var(--ink);
}
.post-row:hover .post-title { color: var(--sapphire); }
.post-date {
  font: 400 13px var(--sans);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}
.post-excerpt {
  display: block;
  margin-top: 7px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------------------------------------- article */

.article {
  width: min(var(--measure), calc(100% - var(--gutter) * 2));
  margin: clamp(48px, 6vw, 84px) auto clamp(72px, 8vw, 120px);
}
.article-header { margin-bottom: clamp(36px, 4vw, 52px); }

h1 {
  font: 600 clamp(30px, calc(2.4vw + 8px), 40px)/1.18 var(--serif);
  letter-spacing: -.012em;
  margin: 0;
  text-wrap: balance;
}
.article-subtitle {
  margin: 16px 0 0;
  font: italic 400 19px/1.5 var(--serif);
  color: var(--muted);
}

.article-meta {
  margin: 26px 0 0;
  padding: 14px 0 16px;
  border-block: 1px solid var(--hair);
  display: flex;
  flex-direction: column;
  gap: 7px;
  font: 400 13px/1.6 var(--sans);
  color: var(--muted);
}
.meta-row { display: flex; gap: 18px; align-items: baseline; }
.meta-row dt {
  flex: 0 0 96px;
  font: 600 10.5px/1.6 var(--grot);
  letter-spacing: .11em;
  text-transform: uppercase;
}
.meta-row dd { margin: 0; }
.meta-row dd a { color: var(--sapphire); }
.meta-team { font-size: 12px; }

.article-lead { margin: 0 0 clamp(40px, 5vw, 56px); }
.eyebrow {
  margin: 0 0 10px;
  font: 700 11px/1.5 var(--grot);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--sapphire);
}
.article-lead p { margin: 0; }

p { margin: 0 0 1.05em; }
.article li { margin-bottom: 10px; }
.article ul, .article ol { padding-left: 26px; margin: 0 0 1.4em; }
.article li::marker { color: var(--muted); }

/* Quiet headings: structure by spacing and a hairline, not by scale. */
.article h2 {
  font: 500 22px/1.3 var(--grot);
  letter-spacing: -.01em;
  margin: clamp(48px, 5vw, 68px) 0 18px;
  padding-top: clamp(26px, 2.8vw, 36px);
  border-top: 1px solid var(--hair);
  text-wrap: pretty;
}
.article-lead + h2 { margin-top: 0; }
.article h3 {
  font: 500 17px/1.4 var(--grot);
  letter-spacing: 0;
  margin: 36px 0 12px;
  text-wrap: pretty;
}
.article h4 { font: 600 18px/1.45 var(--serif); margin: 1.6em 0 .7em; }

.article a { color: var(--sapphire); }

blockquote {
  margin: 1.6em 0;
  padding: 0 0 0 20px;
  border-left: 2px solid var(--sapphire);
  color: var(--ink);
}
blockquote > :last-child { margin-bottom: 0; }

code {
  font: .85em/1.5 ui-monospace, 'SFMono-Regular', Consolas, monospace;
  background: var(--tint);
  padding: 1.5px 5px;
  overflow-wrap: anywhere;
}
pre {
  margin: 1.8em 0;
  padding: 18px 20px;
  background: var(--tint);
  border: 1px solid var(--hair);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
pre code { background: none; padding: 0; font-size: 13.5px; }

/* ------------------------------------------------------------- media */

/* Figures and videos sit at the text measure (the blog.css contract:
   .figure:not(.wide) { margin-inline: 0 }); --mw keeps narrow media at
   their natural width so nothing upscales. */
.figure {
  width: min(var(--mw, var(--measure)), 100%);
  margin: clamp(36px, 4vw, 52px) 0;
}
.figure img { width: 100%; height: auto; border: 1px solid var(--hair); }
.figure video { width: 100%; height: auto; background: var(--ink); }
.figure video + video { margin-top: 12px; }
figcaption {
  margin-top: 10px;
  font: italic 400 13px/1.55 var(--sans);
  color: var(--muted);
}
figcaption a { color: var(--muted); text-decoration: underline; }

/* ------------------------------------------------------------- tables */

.table-block { margin: 2em 0; }
.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
table {
  width: 100%;
  border-collapse: collapse;
  font: 400 14px/1.6 var(--sans);
  font-variant-numeric: tabular-nums;
}
thead th {
  text-align: left;
  vertical-align: bottom;
  font-weight: 600;
  padding: 10px 12px;
  background: var(--tint);
  border-block: 1px solid var(--hair);
  white-space: nowrap;
}
tbody td, tbody th {
  text-align: left;
  vertical-align: top;
  font-weight: 400;
  padding: 9px 12px;
  border-bottom: 1px solid var(--hair);
}
.table-note {
  margin: 10px 0 0;
  font: italic 400 13px/1.55 var(--sans);
  color: var(--muted);
}

/* ------------------------------------------------------------- mobile */

@media (max-width: 760px) {
  body { font-size: 17px; line-height: 1.65; }
  h1 { font-size: clamp(28px, 8vw, 34px); }
  .article h2 { font-size: 20px; }
  .post-title { font-size: 18px; }
  .post-thumb { width: 96px; }
  .post-row-top { flex-direction: column; gap: 4px; }
  .meta-row { flex-direction: column; gap: 1px; }
  .meta-row dt { flex-basis: auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .post-row--featured { transition: none; }
}
@media print {
  .site-header, .site-footer, .skip-link { display: none; }
  body { background: #fff; font-size: 11pt; }
  .article { width: 100%; margin: 0; }
  .figure { width: 100%; }
  h2, h3, figure, tr { break-inside: avoid; }
}
