/* =========================================================
   NVIDIA Cosmos Lab — Blog Styles
   Brand layer (header/footer, NALA, #76b900) comes from style.css.
   Reading layer: 720px column, quiet type scale, small uppercase labels.
   Note: html font-size is 18px, so 1rem = 18px.
   ========================================================= */

:root {
  --blog-canvas:   #f1f3ee;
  --blog-ink:      #161616;
  --blog-ink-2:    rgba(22, 22, 22, 0.72);
  --blog-ink-3:    rgba(22, 22, 22, 0.52);
  --blog-line:     rgba(22, 22, 22, 0.12);
  --blog-fill:     rgba(22, 22, 22, 0.035);
  --blog-green:    #76b900;
  --blog-green-ink:#4f7a00;
  --blog-surface:  #ffffff;
  --blog-pill-line:#cccccc;
  --blog-pill-ink: #666666;
  --blog-read:     850px;
  --blog-wide:     1000px;
  --blog-mono:     'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --blog-ease:     cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Dark reading theme for post pages, set on <html> by the inline script in each post's <head>. */
:root[data-theme="dark"] {
  --blog-canvas:   #1e1f1c;
  --blog-ink:      #e6e8e3;
  --blog-ink-2:    rgba(230, 232, 227, 0.74);
  --blog-ink-3:    rgba(230, 232, 227, 0.52);
  --blog-line:     rgba(230, 232, 227, 0.14);
  --blog-fill:     rgba(230, 232, 227, 0.05);
  --blog-green-ink:#9cc45a;
  --blog-surface:  #262824;
  --blog-pill-line:rgba(230, 232, 227, 0.28);
  --blog-pill-ink: rgba(230, 232, 227, 0.74);
}

/* In-page jumps (contents, citations, contributors, back to top) land instantly on blog pages. */
html { scroll-behavior: auto; }

body.blog {
  background: var(--blog-canvas);
  color: var(--blog-ink);
}

.blog-page {
  min-height: calc(100svh - 60px);
  padding: 56px clamp(16px, 4vw, 40px) 120px;
}

/* ---- Shared: uppercase labels (structural labels only) ---- */
.blog-label {
  font-family: inherit;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blog-ink-3);
  line-height: 1.4;
}
.blog-meta {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--blog-ink-3);
}

/* =========================================================
   Index — reuses the Publications list components from style.css
   ========================================================= */
.blog-list-section { border-top: none; min-height: calc(100svh - 50px); }
.blog-entry .pub-title { display: block; color: var(--text-1); }
.blog-entry .pub-title:hover { color: #fff; }
.blog-entry-summary {
  font-size: var(--text-md);
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 8px;
}
.blog-entry-date {
  font-size: var(--text-md);
  color: var(--text-3);
  flex: 1;
}

/* =========================================================
   Post
   ========================================================= */
.post { margin: 0 auto; }
.post > * {
  max-width: var(--blog-read);
  margin-left: auto;
  margin-right: auto;
}

.post > .post-body { max-width: none; }

/* Pill buttons: same shape as the project pages' .page-nav-btn. */
.blog-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 100px;
  border: 1.5px solid var(--blog-pill-line);
  background: transparent;
  color: var(--blog-pill-ink);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.blog-pill:hover { border-color: var(--blog-green); color: var(--blog-green-ink); }
.blog-pill svg { width: 14px; height: 14px; flex: none; }
.post-topbar .blog-pill { padding: 7px 16px; font-size: 0.8rem; }

/* Back link and theme toggle share the top row. */
.post .post-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.post-topbar .theme-toggle { width: 34px; height: 34px; padding: 0; }
.theme-toggle svg { width: 16px; height: 16px; }

/* Cover: light and dark line-art variants. */
.post-cover .cover-dark { display: none; }
:root[data-theme="dark"] .post-cover .cover-light { display: none; }
:root[data-theme="dark"] .post-cover .cover-dark { display: block; }

/* Figure files have explicit light/dark palettes selected by the reading theme.
   Keep their canvas transparent; sample photographs are never color-filtered. */
.post-body .figure-expand img { background: transparent; }

.post-hero { margin-top: 40px; }
.post-title .nowrap { white-space: nowrap; }
.post-title {
  font-size: clamp(1.6rem, 3.6vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.22;
  text-wrap: balance;
}
.post-lede {
  margin-top: 20px;
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--blog-ink-2);
  text-wrap: pretty;
}
.post-byline {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--blog-line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  align-items: baseline;
}
.post-authors { font-size: 0.85rem; color: var(--blog-ink); }
.post-affiliation { color: var(--blog-ink-2); }
.post-affiliation a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--blog-line);
  transition: color 0.2s var(--blog-ease), text-decoration-color 0.2s var(--blog-ease);
}
.post-affiliation a:hover { color: var(--blog-ink); text-decoration-color: var(--blog-green); }
#contributions { scroll-margin-top: 100px; }
/* Following a link to a reference or the contributions card briefly flashes the target, then fades out completely. */
@keyframes blog-target-flash {
  0%, 35% { background-color: rgba(118, 185, 0, 0.16); box-shadow: 0 0 0 4px rgba(118, 185, 0, 0.22); border-color: var(--blog-green); }
  100%    { box-shadow: 0 0 0 0 rgba(118, 185, 0, 0); }
}
.is-flashing { animation: blog-target-flash 2.2s var(--blog-ease); }

.post .post-cover {
  margin-top: 48px;
  margin-bottom: 56px;
}
.post-cover img,
.post-cover video { width: 100%; border-radius: 4px;  height: auto; }

/* ---- Body typography ---- */
.post-body { font-size: 1rem; line-height: 1.75; color: var(--blog-ink); }
.post-body > * {
  max-width: var(--blog-read);
  margin-left: auto;
  margin-right: auto;
}
.post-body p { text-wrap: pretty; }
.post-body h2,
.post-body h3 { scroll-margin-top: 80px; }

/* ---- Table of contents ---- */
.post-body .post-toc {
  margin-top: 2.4rem;
  margin-bottom: 1rem;
  padding: 18px 0 20px;
  border-top: 1px solid var(--blog-line);
  border-bottom: 1px solid var(--blog-line);
}
.post-toc:empty { display: none; }
.post-body .post-toc > ol {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  columns: 2;
  column-gap: 40px;
}
.post-body .post-toc > ol > li {
  break-inside: avoid;
  display: grid;
  grid-template-columns: 28px 1fr;
  margin-bottom: 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  font-weight: 500;
}
.post-toc .toc-num {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--blog-green-ink);
  padding-top: 0.2em;
}
.post-body .post-toc ol ol {
  grid-column: 2;
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
}
.post-body .post-toc ol ol li {
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--blog-ink-2);
}
.post-body .post-toc ol ol li + li { margin-top: 3px; }
.post-body .post-toc a {
  text-decoration: none;
  transition: color 0.2s var(--blog-ease);
}
.post-body .post-toc a:hover {
  color: var(--blog-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--blog-green);
}
.post-body p + p { margin-top: 1.25em; }
.post-body h2 {
  color: var(--blog-green-ink);
  margin-top: 3.2rem;
  margin-bottom: 1rem;
  font-size: clamp(1.4rem, 2.6vw, 1.75rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-wrap: balance;
}
/* Section headings in NVIDIA green: the darker shade keeps contrast on the light page. */
:root[data-theme="dark"] .post-body h2 { color: var(--blog-green); }
.post-body h3 {
  margin-top: 2.2rem;
  margin-bottom: 0.6rem;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.post-body a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--blog-green);
  transition: text-decoration-color 0.25s var(--blog-ease);
}
.post-body a:hover { text-decoration-color: var(--blog-ink); }
.post-body strong { font-weight: 600; }

.post-body ul,
.post-body ol { margin-top: 1.25em; margin-bottom: 1.25em; padding-left: 1.4em; }
.post-body li + li { margin-top: 0.5em; }
.post-body ul li::marker { color: var(--blog-green); }
.post-body ol li::marker { font-size: 0.8em; color: var(--blog-ink-3); }

.post-body blockquote {
  margin-top: 2rem;
  margin-bottom: 2rem;
  padding-left: 22px;
  border-left: 2px solid var(--blog-green);
  font-size: 1.2rem;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--blog-line);
  margin-top: 3rem;
  margin-bottom: 3rem;
}

.post-body code {
  font-family: var(--blog-mono);
  font-size: 0.85em;
  background: var(--blog-fill);
  border: 0.5px solid var(--blog-line);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}
.post-code {
  position: relative;
  margin-top: 1.75rem;
  margin-bottom: 1.75rem;
}
.post-code pre {
  overflow-x: auto;
  padding: 22px 20px;
  background: var(--blog-fill);
  border: 0.5px solid var(--blog-line);
  border-radius: 4px;
  font-family: var(--blog-mono);
  font-size: 0.72rem;
  line-height: 1.65;
  tab-size: 2;
}
.post-code pre code { background: none; border: none; padding: 0; font-size: inherit; }
.post-code:has(.copy-btn) pre { padding-right: 88px; }
.post-code-label { display: block; margin-bottom: 8px; }
.post-code-group { margin-top: 1.75rem; margin-bottom: 1.75rem; }
.post-code-group .post-code { margin: 0; }
.post-code-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 1.75rem;
  margin-bottom: 1.75rem;
}
.post-code-pair .post-code { margin: 0; }
.post-code-note {
  margin-top: -0.75rem;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--blog-ink-3);
}
.post-body .post-code-note + p { margin-top: 1.75rem; }
.post-code .copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 13px;
  border-radius: 4px;
  border: 1.5px solid var(--blog-green);
  background: rgba(118, 185, 0, 0.07);
  color: var(--blog-green-ink);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.post-code .copy-btn:hover { background: var(--blog-green); color: #fff; }

/* ---- Figures ---- */
.post-body figure { margin-top: 2.4rem; margin-bottom: 2.4rem; }
.post-body figure.wide { max-width: var(--blog-wide); }
.post-body figure img,
.post-body figure video { width: 100%; height: auto; border-radius: 4px; }
.post-body figure .fig-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  gap: 8px;
}
.post-body figcaption {
  margin-top: 12px;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--blog-ink-3);
  max-width: var(--blog-read);
  margin-left: auto;
  margin-right: auto;
}
.post-body figcaption .fig-num {
  font-size: 0.9em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blog-ink-2);
  margin-right: 6px;
}

/* ---- Tables ---- */
.post-table { margin-top: 2rem; margin-bottom: 2rem; overflow-x: auto; }
.post-table table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.post-table th {
  font-weight: 400;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blog-ink-3);
  text-align: left;
  padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--blog-ink);
}
.post-table td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--blog-line);
  font-variant-numeric: tabular-nums;
}
.post-table td.num, .post-table th.num { text-align: right; }
.post-table tr.ours td { font-weight: 600; }

/* ---- Footnotes / citation / prev-next ---- */
.post-notes {
  margin-top: 3.5rem;
  padding-top: 20px;
  border-top: 1px solid var(--blog-line);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--blog-ink-2);
}
.post-notes ol { padding-left: 1.4em; }
.post-notes li + li { margin-top: 0.4em; }

.post-nav {
  margin-top: 4rem;
  padding-top: 24px;
  border-top: 1px solid var(--blog-line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
/* ---- In-text citations ---- */
.post-body sup.cite {
  font-size: 0.6em;
  line-height: 0;
  margin-left: 0.15em;
}
.post-body sup.cite a {
  color: var(--blog-green-ink);
  text-decoration: none;
  padding: 0 0.1em;
}
.post-body sup.cite a:hover,
.post-body sup.cite a:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--blog-green);
}
.cite-card {
  position: absolute;
  z-index: 900;
  width: min(380px, calc(100vw - 24px));
  padding: 12px 14px 12px 36px;
  background: var(--blog-surface);
  border: 0.5px solid var(--blog-line);
  border-radius: 4px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--blog-ink-2);
}
.cite-card[hidden] { display: none; }
.cite-card--plain { padding-left: 14px; }
.cite-card p + p { margin-top: 8px; }
.cite-card-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blog-green-ink);
}
.cite-card-num {
  position: absolute;
  left: 14px;
  top: 13px;
  font-size: 0.85em;
  color: var(--blog-green-ink);
}
.cite-card a {
  color: var(--blog-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--blog-green);
}
.post-refs li { scroll-margin-top: 100px; transition: background-color 0.6s var(--blog-ease); }
.post-refs li { border-radius: 4px; }

.post-refs ol {
  margin-top: 0;
  padding-left: 2em;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--blog-ink-2);
}
.post-refs li + li { margin-top: 0.6em; }
.post-refs li::marker {
  font-size: 0.85em;
  color: var(--blog-ink-3);
}
.post-refs a { color: var(--blog-ink); }

/* Back-matter cards: acknowledgments, citation */
.post-body .post-card {
  margin-top: 3.5rem;
  padding: 24px 24px 20px;
  background: var(--blog-surface);
  border: 0.5px solid var(--blog-line);
  border-radius: 6px;
}
.post-body .post-card + .post-card { margin-top: 1.25rem; }
.post-body .post-card .post-card-text {
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 0 0 16px;
}
.post-body .post-card .post-card-text:last-child { margin-bottom: 4px; }
.post-card .post-code { margin: 0; }
.post-card .post-code pre {
  background: var(--blog-canvas);
  padding-right: 20px;
  font-size: 0.66rem;
}

.post .post-topics {
  margin-top: 3rem;
  font-size: 0.8rem;
  color: var(--blog-ink-3);
}

.post-nav:empty { display: none; }

.post .page-nav { display: flex; justify-content: center; margin-top: 3rem; }
.post-nav a { display: block; }
.post-nav a:last-child:not(:first-child) { text-align: right; }
.post-nav .next-only { grid-column: 2; text-align: right; }
.post-nav-title {
  margin-top: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.post-nav a:hover .post-nav-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--blog-green);
}

/* ---- Responsive ---- */
@media (max-width: 760px) {
  .blog-page { padding-top: 32px; padding-bottom: 80px; }
  .post-hero { margin-top: 28px; }
  .post .post-cover { margin-top: 32px; margin-bottom: 40px; }
  .post-body figure .fig-row { grid-template-columns: 1fr; }
  .post-code-pair { grid-template-columns: 1fr; }
  .post-body .post-toc > ol { columns: 1; }
}

/* Scalable research figures, with stacked panels on narrow screens. */
.post-body .figure-expand,
.post-body .figure-expand picture { display: block; }
.post-body .figure-expand { cursor: zoom-in; text-decoration: none; border: 0; }
.post-body .figure-expand img { display: block; width: 100%; height: auto; }
.post-body .figure-expand:focus-visible { outline: 2px solid #527f09; outline-offset: 6px; }
