*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --background: 255 255 255;
  --foreground: 27 27 27;
  --muted: 243 244 246;
  --muted-foreground: 107 114 128;
  --link: 75 85 99;
  --border: 209 213 219;
  --font-serif: "EB Garamond", "Times New Roman", serif;
  --font-sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", Menlo, monospace;
  --measure: 60rem;
  --toc-width: 9rem;
  --page-pad: 1rem;
  --page-pad-md: 3rem;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --radius: 0.75rem;
  --text-chrome: 0.875rem;
  --leading-chrome: 1.25rem;
  --text-brand: 1.875rem;
  --leading-brand: 2.25rem;
  --text-title: 3rem;
  --text-h2: clamp(2.125rem, 3.4vw, 2.6rem);
  --leading-h2: 1.08;
  --text-h3: clamp(1.55rem, 2.4vw, 1.8rem);
  --leading-h3: 1.16;
  --text-body: 1rem;
  --leading-body: 1.62;
  --text-caption: 0.875rem;
  --leading-caption: 1.625;
  --meta-label-col: 120px;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: rgb(var(--background));
  color: rgb(var(--foreground));
  font-family: var(--font-mono);
  font-size: var(--text-chrome);
  line-height: var(--leading-chrome);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.page {
  padding: var(--page-pad);
  overflow-x: clip;
}

@media (min-width: 768px) {
  .page {
    padding: var(--page-pad-md);
  }
}

.layout {
  display: grid;
  grid-template-areas:
    "toc"
    "main"
    "foot";
  max-width: min(var(--measure), 100%);
  margin: 0 auto;
}

.layout > article {
  grid-area: main;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.layout > .toc {
  grid-area: toc;
}

.layout > .site-footer {
  grid-area: foot;
}

/* ── Table of contents ──────────────────────────────────────────── */
.toc {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 0 var(--space-4);
  padding: 0.45rem 0 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: var(--leading-chrome);
  background: rgb(var(--background) / 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgb(var(--border) / 0.35);
}

.toc-label {
  display: none;
}

.toc-list {
  display: flex;
  gap: 0.35rem;
  margin: 0;
  padding: 0 0 0.1rem;
  list-style: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.toc-list::-webkit-scrollbar {
  display: none;
}

.toc-list a {
  flex: 0 0 auto;
  display: inline-block;
  padding: 0.22rem 0.55rem;
  border: 1px solid rgb(var(--border) / 0.7);
  border-radius: 999px;
  color: rgb(var(--muted-foreground));
  text-decoration: none;
  white-space: nowrap;
}

.toc-list a:hover {
  color: rgb(var(--foreground));
  border-color: rgb(var(--foreground) / 0.35);
}

.toc-list a.is-active {
  color: rgb(var(--foreground));
  background: rgb(var(--foreground) / 0.07);
  border-color: transparent;
  font-weight: 700;
}

@media (min-width: 1100px) {
  .layout {
    max-width: min(calc(var(--measure) + var(--toc-width) + var(--space-8)), 100%);
    grid-template-columns: minmax(0, var(--measure)) var(--toc-width);
    grid-template-areas:
      "main toc"
      "foot toc";
    column-gap: var(--space-8);
    align-items: start;
  }

  .layout > article {
    width: 100%;
  }

  .layout > .site-footer {
    margin-top: 0;
  }

  .toc {
    position: sticky;
    top: var(--space-12);
    width: var(--toc-width);
    margin: 0;
    padding: var(--space-2) 0 0;
    background: transparent;
    backdrop-filter: none;
    border-bottom: 0;
  }

  .toc-label {
    display: block;
    margin: 0 0 var(--space-2);
    font-weight: 700;
  }

  .toc-list {
    display: grid;
    gap: var(--space-2);
    overflow: visible;
    padding: 0;
  }

  .toc-list a {
    flex: none;
    width: fit-content;
    max-width: 100%;
    padding: 0.125rem 0.3rem;
    margin-inline: -0.3rem;
    border: 0;
    border-radius: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .toc-list a.is-active {
    background: rgb(var(--foreground) / 0.07);
  }
}

.article-title {
  margin: 0 0 var(--space-6);
  font-family: Menlo, var(--font-mono);
  font-size: clamp(2rem, 5.5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.article-title .t-blue {
  color: #3078f0;
}

.article-title .t-black {
  color: rgb(var(--foreground));
}

.article-subtitle {
  margin: 0 0 var(--space-6);
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  line-height: 1.25;
  font-weight: 500;
  color: rgb(var(--foreground) / 0.78);
  text-wrap: pretty;
}

.meta-bar {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 var(--space-12);
  font-family: var(--font-mono);
  font-size: var(--text-chrome);
  line-height: var(--leading-chrome);
}

.meta-row {
  display: grid;
  gap: var(--space-2);
}

@media (min-width: 768px) {
  .meta-row {
    grid-template-columns: var(--meta-label-col) 1fr;
    gap: 0.125rem;
  }
}

.meta-label {
  color: rgb(var(--foreground));
}

.meta-value {
  color: rgb(var(--muted-foreground));
  overflow-wrap: anywhere;
}

.meta-value a {
  color: rgb(var(--foreground));
  text-decoration: underline;
  text-underline-offset: 2px;
}

.meta-value a[href^="mailto:"] {
  text-decoration: underline dotted;
  text-decoration-color: rgb(var(--foreground) / 0.5);
  text-underline-offset: 4px;
}

.meta-value a:hover {
  text-decoration-thickness: 2px;
}

.meta-icon {
  height: 1em;
  width: 1em;
  vertical-align: -0.12em;
  margin-right: 0.35em;
}

.lead {
  margin: 0 0 var(--space-6);
  font-family: var(--font-serif);
  font-size: clamp(0.8rem, 2vw, 1.1rem);
  font-style: italic;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.04em;
  font-variant-numeric: oldstyle-nums;
  text-align: center;
  text-wrap: pretty;
  color: rgb(var(--foreground) / 0.82);
}

@media (min-width: 800px) {
  .lead {
    white-space: nowrap;
  }
}

.award-callout {
  display: grid;
  grid-template-columns: minmax(0, 11.5rem) minmax(0, 1fr);
  gap: 0.9rem 1.15rem;
  align-items: center;
  margin: 0 0 var(--space-8);
  padding: 0.7rem 0.85rem;
  border: 1px solid rgb(176 137 62 / 0.5);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fffaf2 0%, #fff 72%);
  text-decoration: none;
  color: inherit;
}

.award-callout:hover {
  border-color: rgb(138 100 36 / 0.85);
}

.award-callout img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.35rem;
  box-shadow: 0 0 0 1px rgb(176 137 62 / 0.4);
}

.award-callout-kicker {
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(1.45rem, 2.6vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #8a6424;
}

.award-callout-title {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: rgb(var(--foreground));
}

.award-callout-detail {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.35;
  color: rgb(var(--muted-foreground));
}

@media (max-width: 640px) {
  .award-callout {
    grid-template-columns: 1fr;
  }

  .award-callout img {
    width: 100%;
    max-width: none;
  }
}

.figure {
  margin: var(--space-8) auto;
  max-width: 52rem;
}

.figure--70 {
  width: 70%;
  max-width: 70%;
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
}

.figure figcaption {
  margin-top: var(--space-2);
  font-family: var(--font-serif);
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
  text-align: center;
  color: rgb(var(--foreground) / 0.65);
}

.prose {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
}

.prose :where(p, ul, ol) {
  margin: 0 0 var(--space-4);
}

.prose :where(ul, ol) {
  padding-left: var(--space-8);
}

.prose :where(li + li) {
  margin-top: 0.35rem;
}

.prose :where(strong) {
  font-weight: 700;
}

.prose :where(a) {
  color: rgb(var(--link));
  text-decoration: underline;
}

.prose :where(a):hover {
  text-decoration-thickness: 2px;
}

.prose :where(h2) {
  margin: var(--space-8) 0 var(--space-4);
  font-family: var(--font-serif);
  font-size: var(--text-h2);
  line-height: var(--leading-h2);
  letter-spacing: -0.025em;
  scroll-margin-top: var(--space-8);
  font-weight: 600;
}

.prose :where(h2:first-child) {
  margin-top: 0;
}

.prose :where(h3) {
  margin: var(--space-6) 0 var(--space-4);
  font-family: var(--font-serif);
  font-size: var(--text-h3);
  line-height: var(--leading-h3);
  letter-spacing: -0.025em;
  font-weight: 600;
}

.prose :where(hr) {
  margin: var(--space-8) 0;
  border: 0;
  border-top: 1px solid rgb(var(--border) / 0.25);
}

.prose :where(pre) {
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-chrome);
  line-height: var(--leading-chrome);
  background: rgb(var(--muted));
  border-radius: var(--radius);
  overflow-x: auto;
}

.prose :where(code) {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.prose :where(pre code) {
  font-size: inherit;
}

.stat-strip {
  margin: 0 0 var(--space-4);
  padding: 0.7rem 0;
  border-top: 1px solid rgb(var(--border) / 0.45);
  border-bottom: 1px solid rgb(var(--border) / 0.45);
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.75rem;
}

.stat-strip li {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  white-space: nowrap;
  margin: 0;
}

.stat-strip strong {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.25;
}

.stat-strip span {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  color: rgb(var(--foreground) / 0.55);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* ── Policy table ───────────────────────────────────────────────── */
.policy-table-wrap {
  margin: 0 0 var(--space-4);
  overflow-x: auto;
}

.policy-table {
  width: 100%;
  min-width: 42rem;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.policy-table td {
  width: 16.666%;
  padding: 0.55rem 0.45rem;
  border: 1px solid rgb(var(--border));
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
  background: rgb(var(--background));
}

.policy-table a {
  color: rgb(var(--foreground));
  text-decoration: none;
}

.policy-table a:hover {
  color: #3078f0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Policy marquee ─────────────────────────────────────────────── */
.policy-marquee {
  position: relative;
  margin: var(--space-6) 0 var(--space-8);
  padding: var(--space-4) 0;
  border-top: 1px solid rgb(var(--border) / 0.25);
  border-bottom: 1px solid rgb(var(--border) / 0.25);
  overflow: hidden;
  background: rgb(var(--background));
}

.marquee-stage {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.marquee-row {
  overflow: hidden;
  white-space: nowrap;
}

.marquee-track {
  display: inline-flex;
  align-items: center;
  will-change: transform;
  animation: marquee-scroll var(--dur, 60s) linear infinite;
}

.marquee-row:nth-child(even) .marquee-track {
  animation-direction: reverse;
}

@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-1 * var(--shift, 1000px))); }
}

.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(var(--foreground) / 0.72);
  text-decoration: none;
  white-space: nowrap;
}

.marquee-item img {
  height: 1.5em;
  width: auto;
  max-width: 2.6em;
  object-fit: contain;
}

.marquee-item:hover {
  color: rgb(var(--foreground));
  text-decoration: underline;
  text-underline-offset: 3px;
}

.marquee-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 80px;
  pointer-events: none;
  z-index: 2;
}

.marquee-fade-left {
  left: 0;
  background: linear-gradient(to right, rgb(var(--background)) 0%, rgb(var(--background) / 0) 100%);
}

.marquee-fade-right {
  right: 0;
  background: linear-gradient(to left, rgb(var(--background)) 0%, rgb(var(--background) / 0) 100%);
}

.bench-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  width: 70%;
  margin: 0 auto var(--space-6);
}

.bench-logos a {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.bench-logos img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 4.5rem;
  object-fit: contain;
}

.bench-logos a:hover img {
  opacity: 0.75;
}

.update-badge {
  display: inline-block;
  margin: 0 0 var(--space-4);
  padding: 0.35rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: #3078f0;
  background: rgb(48 120 240 / 0.08);
  border: 1px solid rgb(48 120 240 / 0.22);
  border-radius: 0.35rem;
}

.text-btn {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: rgb(var(--foreground));
  font: inherit;
  font-family: var(--font-mono);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.text-btn:hover {
  text-decoration-thickness: 2px;
}

.text-btn.copied {
  color: rgb(var(--muted-foreground));
}

.site-footer {
  max-width: min(var(--measure), 100%);
  margin: var(--space-16) auto 0;
  padding-top: var(--space-8);
  border-top: 1px solid rgb(var(--border) / 0.25);
  color: rgb(var(--muted-foreground));
  font-family: var(--font-mono);
  font-size: var(--text-chrome);
}

.footer-logos {
  margin-bottom: var(--space-8);
  text-align: center;
}

.footer-logos-label {
  display: block;
  margin-bottom: var(--space-4);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgb(var(--foreground) / 0.55);
}

.footer-logos-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
}

.footer-logo-img {
  height: 2.5rem;
  width: auto;
  object-fit: contain;
  opacity: 0.85;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .article-title {
    font-size: clamp(1.6rem, 8vw, 2rem);
  }

  .article-subtitle {
    font-size: clamp(1.1rem, 4.6vw, 1.3rem);
  }

  .lead {
    white-space: normal;
    letter-spacing: 0.02em;
  }

  .meta-bar {
    margin-bottom: var(--space-8);
  }

  .prose {
    font-size: 0.95rem;
  }

  .prose :where(ul, ol) {
    padding-left: var(--space-6);
  }

  .prose :where(pre) {
    padding: var(--space-3, 0.75rem);
    font-size: 0.75rem;
  }

  .figure {
    margin: var(--space-6) auto;
    max-width: 100%;
  }

  .bench-logos {
    width: 70%;
    gap: var(--space-4);
  }

  .bench-logos img {
    max-height: 3rem;
  }

  .marquee-fade {
    width: 40px;
  }

  .policy-table {
    font-size: 0.7rem;
  }

  .policy-table td {
    padding: 0.4rem 0.3rem;
  }

  .footer-logos-row {
    gap: var(--space-4);
  }

  .footer-logo-img {
    height: 2rem;
  }

  .stat-strip {
    justify-content: flex-start;
  }
}
