@import url("https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;1,6..72,400&family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg: #f9f6ef;
  --paper: #fffdf8;
  --ink: #161513;
  --muted: #6d6860;
  --line: #d8d0c4;
  --code-bg: #f0ebe2;
  --code-ink: #24211d;
  --accent: #176b64;
  --accent-strong: #a33e2d;
  --shadow: 0 22px 60px rgba(32, 28, 20, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.article-page {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.82), rgba(251, 248, 242, 0.98)),
    var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  transform: translateY(-160%);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 8px 12px;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  /* solid bar: full-bleed background, content aligned to the 1120px shell */
  padding: 20px max(20px, calc((100vw - 1120px) / 2)) 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* anchors land below the sticky bar */
.article-content h2,
.article-content h3,
figure.nvfp4-viz {
  scroll-margin-top: 92px;
}

.site-brand,
.site-footer a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.site-logo {
  display: block;
  width: auto;
  height: 42px;
  object-fit: contain;
  opacity: 0.78;
}

.site-logo-footer {
  height: 34px;
  opacity: 0.55;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.site-nav a:hover,
.article-content a:hover {
  color: var(--accent-strong);
}

.article-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto 80px;
}

.article-hero {
  padding: 64px 0 42px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.article-kicker {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.article-hero h1 {
  max-width: 980px;
  margin: 0 auto;
  color: var(--ink);
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(2.3rem, 4.6vw, 4.1rem);
  font-weight: 400;
  line-height: 1.02;
}

.article-hero h1 .title-accent {
  color: var(--accent);
}

.article-subtitle {
  max-width: 920px;
  margin: 20px auto 0;
  color: var(--ink);
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  font-weight: 400;
  line-height: 1.35;
}

.article-meta {
  margin: 26px 0 0;
  color: var(--ink);
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.05rem;
}

.article-content {
  max-width: 860px;
  margin: 56px auto 0;
  font-size: 1.02rem;
}

.article-content h2,
.article-content h3 {
  color: var(--ink);
  font-family: "Newsreader", Georgia, serif;
  font-weight: 400;
  line-height: 1.08;
}

.article-content h2 {
  margin: 72px 0 20px;
  padding-top: 6px;
  font-size: clamp(1.9rem, 3.6vw, 2.9rem);
}

/* collapsed-by-default PR-link subsections; the summary stands in for the h3 */
.article-content details.impl-fold {
  margin: 46px 0 26px;
}

.article-content details.impl-fold summary {
  cursor: pointer;
  color: var(--ink);
  font-family: "Newsreader", Georgia, serif;
  font-weight: 400;
  line-height: 1.08;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
}

.article-content details.impl-fold summary:hover {
  color: var(--accent);
}

.article-content details.impl-fold[open] summary {
  margin-bottom: 14px;
}

/* animate expand/collapse where ::details-content is supported; elsewhere the
   toggle stays instant */
html {
  interpolate-size: allow-keywords;
}

.article-content details.impl-fold::details-content {
  block-size: 0;
  overflow-y: clip;
  transition: block-size 0.32s ease, content-visibility 0.32s allow-discrete;
}

.article-content details.impl-fold[open]::details-content {
  block-size: auto;
}

.article-content h3 {
  margin: 46px 0 16px;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
}

.article-content p,
.article-content ul,
.article-content ol {
  margin: 0 0 20px;
}

.article-content li + li {
  margin-top: 8px;
}

.article-content a {
  color: var(--accent);
  font-weight: 600;
  text-decoration-color: rgba(23, 107, 100, 0.35);
  text-underline-offset: 3px;
}

.article-content hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 48px 0;
}

.article-content p[align="center"] {
  margin: 34px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2%;
  flex-wrap: wrap;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border: 1px solid rgba(216, 208, 196, 0.8);
  box-shadow: var(--shadow);
}

.article-content pre {
  overflow-x: auto;
  margin: 24px 0;
  padding: 18px 20px;
  border: 1px solid rgba(216, 208, 196, 0.95);
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 0.88rem;
  line-height: 1.55;
}

.article-content code {
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
}

.article-content :not(pre) > code {
  padding: 0.16em 0.34em;
  border-radius: 5px;
  background: rgba(23, 107, 100, 0.09);
  color: #174f4b;
  font-size: 0.92em;
}

.table-scroll {
  width: min(100vw - 40px, 1040px);
  margin: 28px 50% 34px;
  transform: translateX(-50%);
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.article-content table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.88rem;
  line-height: 1.45;
}

.article-content th,
.article-content td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.article-content th {
  color: var(--ink);
  background: #eee8de;
  font-weight: 700;
}

.article-content tr:last-child td {
  border-bottom: 0;
}

.site-footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 42px;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .article-shell,
  .site-footer {
    width: min(100% - 28px, 1120px);
  }

  .article-hero {
    padding: 42px 0 32px;
  }

  .article-content {
    margin-top: 36px;
    font-size: 0.98rem;
  }

  .article-content h2 {
    margin-top: 54px;
  }

.article-content p[align="center"] img[width="48%"],
.article-content p[align="center"] img[width="49%"],
.article-content p[align="center"] img[width="32%"] {
  width: 100% !important;
}
}

/* collapsed ToC under the hero wherever the fixed rail does not fit */
.toc-mobile {
  max-width: 860px;
  margin: 30px auto 0;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.toc-mobile summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc-mobile ol {
  margin: 12px 0 4px;
  padding-left: 24px;
}

.toc-mobile li {
  margin: 7px 0;
}

.toc-mobile a {
  color: var(--ink);
  text-decoration: none;
}

.toc-mobile a:hover {
  color: var(--accent);
}

@media (min-width: 1460px) {
  .toc-mobile {
    display: none;
  }
}

/* left-rail table of contents: only on viewports wide enough to sit clear of the column
   (1460px covers a full-screen 14" laptop at 100% zoom) */
.article-toc {
  display: none;
}

@media (min-width: 1460px) {
  /* the rail + 28px gap span 224px of left margin; shift the column half of
     that so the rail-and-column composition is centered, not the column alone */
  .article-shell {
    margin-left: calc((100vw - 1120px) / 2 + 112px);
  }

  .site-header {
    padding-left: calc((100vw - 1120px) / 2 + 112px);
    padding-right: calc((100vw - 1120px) / 2 - 112px);
  }

  .article-toc {
    display: block;
    position: fixed;
    top: 140px;
    /* the shell is min(1120px, 100% - 40px) with the hero title on its left
       edge - the rail sits fully clear of that box */
    left: calc((100vw - 1120px) / 2 - 112px);
    width: 196px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    padding-right: 10px;
  }
}

.toc-label {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8a847a;
  margin-bottom: 10px;
}

.article-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.article-toc a {
  display: block;
  padding: 3px 0 3px 11px;
  border-left: 2px solid #e4ded2;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #6d6860;
  text-decoration: none;
}

.article-toc li.toc-h3 a {
  padding-left: 24px;
  font-size: 0.75rem;
}

.article-toc a:hover {
  color: #161513;
}

.article-toc a.active {
  color: #176b64;
  border-left-color: #176b64;
  font-weight: 600;
}
