:root {
  color-scheme: light;
  --bg: #ffffff;
  --paper: #ffffff;
  --ink: #1f2328;
  --copy: #20262d;
  --muted: #5f6872;
  --line: #d8dee4;
  --soft: #f6f8fa;
  --tint: #eef7fb;
  --blue: #1d91c0;
  --orange: #e89522;
  --violet: #8162b7;
  --heading-font: "IBM Plex Sans", "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --body-font: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --role-user: #0b78a8;
  --role-user-bg: #e8f6fc;
  --role-tool: #6a50b8;
  --role-tool-bg: #f1ecfb;
  --role-assistant: #0f8a78;
  --role-assistant-bg: #e6f7f3;
  --role-system: #52525b;
  --role-system-bg: #f0f1f3;
  --role-think: #b45309;
  --role-think-bg: #fff3df;
  --code-ink: #35424b;
  --code-bg: #f4f7f9;
  --code-line: #dfe7ee;
  --max: 920px;
  --page-gutter: clamp(24px, 7vw, 96px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

:target {
  scroll-margin-top: 24px;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f7fbff 0, #ffffff 260px);
  color: var(--ink);
  font-family: var(--body-font);
  font-size: 16px;
  line-height: 1.55;
  word-spacing: -0.2px;
}

a {
  color: #1b6ea8;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

img {
  display: block;
  max-width: 100%;
}

.top-nav {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 8px;
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.top-nav a {
  color: inherit;
  text-decoration: none;
}

.top-nav a:hover {
  color: var(--ink);
}

.page {
  width: min(var(--max), calc(100% - (var(--page-gutter) * 2)));
  margin-left: auto;
  margin-right: auto;
}

.public-page {
  padding-bottom: 56px;
}

.draft-page {
  --main-column: 740px;
  --sidenote-column: 260px;
  --sidenote-gap: 48px;
  position: relative;
  width: min(var(--main-column), calc(100% - (var(--page-gutter) * 2)));
}

.draft-page > .paper-header,
.draft-page > .section {
  max-width: var(--main-column);
}

.paper-header {
  padding: 28px 0 0;
  text-align: left;
  border-bottom: 0;
}

.public-header {
  padding-top: 56px;
}

.public-header::after {
  display: block;
  width: 100%;
  height: 2px;
  margin-top: 24px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(11, 120, 168, 0.2) 0%,
    var(--role-user) 18%,
    var(--role-assistant) 45%,
    var(--role-think) 72%,
    var(--role-tool) 92%,
    rgba(106, 80, 184, 0.18) 100%
  );
  content: "";
}

.paper-header h1 {
  max-width: 650px;
  font-size: clamp(1.7rem, 2.45vw, 2rem);
  font-weight: 600;
  line-height: 1.12;
}

.venue {
  margin: 7px 0 3px;
  color: #2d718c;
  font-size: 0.98rem;
  font-style: italic;
  font-weight: 600;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--heading-font);
  letter-spacing: 0;
}

h1 {
  max-width: 740px;
  margin: 0;
  font-size: clamp(2.05rem, 4.1vw, 3.25rem);
  font-weight: 600;
  line-height: 1.07;
}

.section h1 {
  margin-bottom: 10px;
  font-size: 1.48rem;
  font-weight: 600;
  line-height: 1.22;
}

.article-intro {
  margin: 32px 0 2px;
  padding: 12px 0 4px;
}

.article-intro h1 {
  max-width: 710px;
  margin-bottom: 9px;
  font-size: clamp(1.46rem, 2.35vw, 2rem);
  font-weight: 600;
  line-height: 1.16;
}

.article-intro + .section {
  padding-top: 20px;
}

.article-kicker {
  margin-bottom: 7px;
  color: #2b7798;
  font-family: var(--heading-font);
  font-size: 0.86rem;
  font-weight: 700;
}

.article-deck {
  max-width: 44rem;
  margin-bottom: 0;
  color: #40505a;
  font-size: 1.02rem;
  font-style: italic;
  line-height: 1.52;
}

.authors {
  margin-bottom: 15px;
  color: #3f4f59;
  font-size: 0.98rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 12px;
}

.links a,
.copy-button,
.case-tab {
  --button-border: #abcddd;
  --button-bg: #fbfdff;
  --button-hover-bg: #edf8fc;
  --button-ink: #13516a;
  --button-hover-border: #74abc5;
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid var(--button-border);
  border-radius: 5px;
  background: var(--button-bg);
  color: var(--button-ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: inset 0 -1px 0 rgba(31, 35, 40, 0.08);
  cursor: pointer;
}

.links .link-arxiv {
  --button-border: #d7a3a3;
  --button-bg: #fff7f6;
  --button-hover-bg: #ffeceb;
  --button-ink: #8f3434;
  --button-hover-border: #c86f6f;
}

.links .link-code {
  --button-border: #b8c6dd;
  --button-bg: #f6f9ff;
  --button-hover-bg: #edf4ff;
  --button-ink: #315d91;
  --button-hover-border: #86a3ce;
}

.links .link-project {
  --button-border: #adcfc1;
  --button-bg: #f4fbf8;
  --button-hover-bg: #e8f7f1;
  --button-ink: #176b58;
  --button-hover-border: #76b79d;
}

.links .link-cite {
  --button-border: #c8b7de;
  --button-bg: #faf7ff;
  --button-hover-bg: #f2ebff;
  --button-ink: #634190;
  --button-hover-border: #a487ca;
}

.button-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.links a:hover,
.copy-button:hover,
.case-tab:hover {
  border-color: var(--button-hover-border);
  background: var(--button-hover-bg);
  color: var(--button-ink);
}

.section {
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}

.article-with-sidenotes {
  position: relative;
}

.article-copy {
  min-width: 0;
}

.inline-footnote {
  display: none;
}

.footnote-ref {
  display: inline-block;
  margin-left: 1px;
  color: #24863f;
  font-size: 0.74em;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  vertical-align: super;
}

.footnote-ref:hover {
  color: #166329;
}

.footnote-ref.is-highlighted {
  color: #135d25;
  background: #e6f4ea;
  border-radius: 3px;
}

.page-sidenote-rail {
  position: absolute;
  top: 0;
  left: calc(100% + var(--sidenote-gap));
  width: var(--sidenote-column);
  min-height: 1px;
}

.sidenote-rail {
  display: none;
}

.sidenote {
  position: absolute;
  left: 0;
  width: 100%;
  padding-left: 14px;
  border-left: 2px solid #cdd8df;
  color: #4b5660;
  font-size: 0.82rem;
  line-height: 1.36;
}

.sidenote.is-highlighted {
  border-left-color: #24863f;
  background: #f4faf6;
}

.sidenote-number {
  margin-right: 5px;
  color: #1f2328;
  font-weight: 700;
}

.footnotes {
  display: none;
  margin: 22px 0 0;
  padding-left: 22px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.role-user,
.role-tool,
.role-assistant,
.role-system,
.role-think {
  font-weight: 600;
}

.role-user {
  color: var(--role-user);
}

.role-tool {
  color: var(--role-tool);
}

.role-assistant {
  color: var(--role-assistant);
}

.role-system {
  color: var(--role-system);
}

.role-think {
  color: var(--role-think);
}

.role-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.94em;
  font-weight: 600;
  word-spacing: normal;
}

.role-tag::before {
  content: "<";
}

.role-tag::after {
  content: ">";
}

.role-tag-close::before {
  content: "</";
}

.role-chip {
  display: inline-block;
  padding: 0.05em 0.38em;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 0.92em;
  font-weight: 700;
  line-height: 1.3;
  vertical-align: baseline;
}

.role-chip.role-user {
  background: var(--role-user-bg);
}

.role-chip.role-tool {
  background: var(--role-tool-bg);
}

.role-chip.role-assistant {
  background: var(--role-assistant-bg);
}

.role-chip.role-system {
  background: var(--role-system-bg);
}

.role-chip.role-think {
  background: var(--role-think-bg);
}

h2 {
  margin-bottom: 10px;
  font-size: 1.32rem;
  font-weight: 600;
  line-height: 1.25;
}

h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.section p {
  color: var(--copy);
  margin-bottom: 0.78rem;
}

.section p:last-child {
  margin-bottom: 0;
}

.placeholder-section {
  padding: 34px 0 38px;
  text-align: left;
}

.placeholder-section p {
  max-width: 38rem;
}

figure {
  margin: 0;
}

figure img {
  width: 100%;
  background: #fff;
}

figcaption {
  margin: 8px auto 0;
  padding: 0 2px;
  color: #424a54;
  font-size: 0.84rem;
  font-style: italic;
  line-height: 1.42;
  text-align: center;
}

.caption-label {
  color: var(--copy);
  font-style: normal;
  font-weight: 700;
}

.evidence-row {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(280px, 0.88fr);
  gap: 30px;
  align-items: start;
}

.evidence-copy p {
  max-width: 42rem;
}

.inline-figure {
  justify-self: center;
  width: 100%;
  margin: 18px auto 14px;
  border: 0;
  background: transparent;
}

.figure-framed img {
  box-shadow: 0 0 0 1px rgba(31, 35, 40, 0.09);
}

.stacked-figures {
  display: grid;
  justify-self: center;
  width: 100%;
  margin: 0 auto;
  gap: 14px;
}

.evidence-row > .inline-figure,
.stacked-figures .inline-figure {
  margin: 0 auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 0.97rem;
}

.results-table th,
.results-table td {
  padding: 13px 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.results-table th {
  width: 170px;
  padding-right: 22px;
  text-align: left;
  white-space: nowrap;
}

.mechanism {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.mechanism div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
}

.mechanism span,
.demo-meta span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mechanism strong,
.demo-meta strong {
  display: block;
  margin-top: 3px;
}

.section-head {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 24px;
  align-items: start;
}

.section-head p {
  margin-top: 3px;
}

.demo {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
}

.case-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.case-tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.demo-readout {
  padding: 16px;
}

.demo-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 14px;
}

.demo-meta p {
  margin-bottom: 0;
}

.demo-summary {
  margin-bottom: 16px;
  color: var(--ink) !important;
}

.meters {
  display: grid;
  gap: 8px;
}

.meter {
  display: grid;
  grid-template-columns: 112px 1fr 42px;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.meter-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e4dc;
}

.meter-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--orange));
  transition: width 180ms ease;
}

.meter b {
  text-align: right;
}

.paper-links {
  margin: 0;
  padding-left: 20px;
}

.paper-links li + li {
  margin-top: 6px;
}

.citation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.citation-head h2 {
  margin-bottom: 0;
}

.citation-stack {
  display: grid;
  gap: 18px;
}

.citation-entry {
  display: grid;
  gap: 9px;
}

.citation-entry-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.citation-entry h3 {
  margin-bottom: 1px;
  font-size: 0.98rem;
  font-weight: 700;
}

.citation-entry p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--soft);
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.5;
  word-spacing: normal;
}

code {
  padding: 0.03em 0.22em;
  border: 1px solid var(--code-line);
  border-radius: 3px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.91em;
  font-weight: 500;
  line-height: 1.35;
  word-spacing: normal;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

pre code {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.footer {
  width: min(var(--max), calc(100% - (var(--page-gutter) * 2)));
  margin-left: auto;
  margin-right: auto;
  padding: 18px 0 40px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 1160px) {
  .page-sidenote-rail {
    display: none;
  }

  .footnotes {
    display: block;
  }
}

@media (max-width: 680px) {
  .top-nav {
    justify-content: flex-start;
    overflow-x: auto;
    gap: 14px;
  }

  .paper-header {
    padding-top: 24px;
  }

  h1 {
    font-size: clamp(2rem, 9.2vw, 2.45rem);
  }

  .results-table th,
  .results-table td {
    display: block;
    width: auto;
    padding-right: 0;
  }

  .results-table th {
    padding-bottom: 2px;
    border-top: 1px solid var(--line);
  }

  .results-table td {
    padding-top: 0;
    border-top: 0;
  }

  .mechanism,
  .evidence-row,
  .section-head,
  .demo-meta,
  .stacked-figures {
    grid-template-columns: 1fr;
  }

  .page-sidenote-rail {
    display: none;
  }

  .footnotes {
    display: block;
  }

  .meter {
    grid-template-columns: 96px 1fr 40px;
    font-size: 0.84rem;
  }

  .citation-head,
  .citation-entry-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .copy-button {
    width: 100%;
  }
}
