:root {
  color-scheme: light;
  --paper: #fffefa;
  --page: #f2f0e9;
  --ink: #17201c;
  --muted: #5f6d66;
  --faint: #8a958f;
  --green: #167a57;
  --green-soft: #e6f2ec;
  --blue-soft: #eaf0f7;
  --line: #d9ddd8;
  --code: #17231e;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(23, 32, 28, 0.025) 1px, transparent 1px),
    var(--page);
  background-size: 100% 28px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--green);
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(23, 32, 28, 0.11);
  background: rgba(255, 254, 250, 0.92);
  padding: 12px clamp(18px, 3vw, 56px);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.brand svg {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(145deg, #173d2f, #36aa7d);
  color: #dcfff1;
  padding: 6px;
}

.brand path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.5;
}

.brand circle {
  fill: currentColor;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.site-header nav a {
  color: #435149;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.site-header nav a:hover {
  color: var(--green);
}

main {
  width: calc(100% - clamp(24px, 4vw, 80px));
  max-width: 1800px;
  margin: 32px auto 64px;
}

.paper {
  border: 1px solid rgba(23, 32, 28, 0.12);
  background: var(--paper);
  box-shadow: 0 22px 70px rgba(36, 44, 40, 0.11);
}

.paper-header {
  border-bottom: 1px solid var(--line);
  padding:
    clamp(46px, 6vw, 110px)
    clamp(28px, 8vw, 160px)
    clamp(54px, 5vw, 74px);
}

.eyebrow,
.section-number,
.table-of-contents > p {
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.paper-header h1 {
  max-width: min(1120px, 86%);
  margin: 16px 0 22px;
  font-family: Charter, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(48px, 6vw, 96px);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.dek {
  max-width: 900px;
  margin: 0;
  color: #46534c;
  font-family: Charter, "Iowan Old Style", Georgia, serif;
  font-size: clamp(21px, 2.4vw, 29px);
  line-height: 1.35;
}

.paper-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.paper-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin-top: 30px;
}

.paper-actions a {
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.paper-actions .primary-action {
  border-radius: 6px;
  background: var(--ink);
  color: white;
  padding: 12px 16px;
}

.paper-layout {
  display: grid;
  grid-template-columns: clamp(210px, 17vw, 300px) minmax(0, 1000px);
  justify-content: center;
  gap: clamp(40px, 5vw, 90px);
  padding:
    clamp(54px, 5vw, 74px)
    clamp(28px, 7vw, 128px)
    clamp(72px, 7vw, 104px);
}

.table-of-contents {
  align-self: start;
  position: sticky;
  top: 100px;
}

.table-of-contents nav {
  display: grid;
  margin-top: 16px;
}

.table-of-contents nav a {
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
  padding: 7px 0 7px 13px;
  text-decoration: none;
}

.table-of-contents nav a:hover {
  border-color: var(--green);
  color: var(--green);
}

.implementation-note {
  display: grid;
  gap: 6px;
  margin-top: 28px;
  border: 1px solid #c9d8d0;
  border-radius: 8px;
  background: #f0f7f3;
  padding: 14px;
}

.implementation-note strong {
  color: var(--green);
  font-size: 10px;
  text-transform: uppercase;
}

.implementation-note span {
  color: #53635b;
  font-size: 10px;
  line-height: 1.5;
}

.paper-body {
  min-width: 0;
}

.paper-body section {
  scroll-margin-top: 96px;
  margin-top: 82px;
}

.paper-body section:first-child {
  margin-top: 0;
}

.paper-body h2 {
  margin: 7px 0 20px;
  font-family: Charter, "Iowan Old Style", Georgia, serif;
  font-size: clamp(32px, 4.5vw, 48px);
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.paper-body h3 {
  margin: 34px 0 12px;
  font-family: Charter, "Iowan Old Style", Georgia, serif;
  font-size: 23px;
  line-height: 1.2;
}

.paper-body p,
.paper-body li {
  color: #37443d;
  font-family: Charter, "Iowan Old Style", Georgia, serif;
  font-size: 17px;
  line-height: 1.72;
}

.paper-body p {
  margin: 0 0 20px;
}

.paper-body code {
  color: #0e6445;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.85em;
}

.abstract {
  border-left: 3px solid var(--green);
  background: #f3f7f4;
  padding: 24px 28px;
}

.abstract h2 {
  margin-top: 0;
  font-size: 27px;
}

.abstract p {
  margin-bottom: 0;
  font-size: 16px;
}

.design-grid,
.future-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 28px;
}

.design-grid article,
.future-grid article {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  background: #fbfcfa;
  padding: 17px;
}

.design-grid strong,
.future-grid strong {
  font-size: 13px;
}

.design-grid span,
.future-grid span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.system-figure {
  margin: 32px 0;
  border: 1px solid #cfd6d1;
  background: #f7f9f7;
  padding: 20px;
}

.figure-title {
  display: flex;
  gap: 5px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 10px;
}

.pipeline {
  display: grid;
  grid-template-columns: 1fr 22px 1fr 22px 1fr 22px 1fr;
  align-items: stretch;
}

.pipeline article {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 112px;
  border: 1px solid #cbd4ce;
  background: white;
  padding: 13px;
}

.pipeline article small {
  color: var(--green);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.pipeline article strong {
  font-size: 11px;
  line-height: 1.3;
}

.pipeline article span {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.pipeline > i {
  display: grid;
  place-items: center;
  color: #7d9287;
  font-style: normal;
}

.pipeline-bridge {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 0;
  color: var(--green);
}

.pipeline-bridge span {
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pipeline-bridge i {
  font-style: normal;
}

.feedback-bar {
  margin-top: 13px;
  border: 1px solid #bfd5c9;
  background: var(--green-soft);
  color: #315346;
  padding: 10px 13px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

.schema-table-wrap {
  overflow-x: auto;
  margin: 28px 0;
}

.schema-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  font-size: 11px;
  text-align: left;
}

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

.schema-table th {
  background: #f0f3f1;
  color: #45534b;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.schema-table td {
  color: var(--muted);
  line-height: 1.5;
}

.equation,
.score-card {
  display: grid;
  gap: 9px;
  margin: 22px 0;
  border: 1px solid #c8d7cf;
  background: #f2f8f5;
  padding: 20px;
  text-align: center;
}

.equation span,
.score-card span {
  color: var(--green);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.equation strong,
.score-card strong {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(14px, 2vw, 18px);
  line-height: 1.5;
}

.score-card small {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

pre {
  overflow-x: auto;
  margin: 26px 0;
  border-radius: 5px;
  background: var(--code);
  color: #dce9e2;
  padding: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

pre code {
  color: inherit !important;
  font-size: 11px !important;
  line-height: 1.72;
}

.version-example {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  align-items: stretch;
  margin: 26px 0;
}

.version-example article {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  padding: 16px;
}

.version-example small {
  color: var(--faint);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.09em;
}

.version-example strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.version-example span {
  color: var(--muted);
  font-size: 9px;
}

.version-example > i {
  display: grid;
  place-items: center;
  color: var(--green);
  font-style: normal;
}

.old-version {
  background: #f4f4f2;
}

.active-version {
  background: var(--green-soft);
}

.callout,
.safety-rules {
  margin: 26px 0;
  border-left: 3px solid #4b76a4;
  background: var(--blue-soft);
  padding: 18px 20px;
}

.callout > strong {
  font-size: 12px;
}

.callout p {
  margin: 7px 0 0;
  font-size: 14px;
}

.layer-stack {
  display: grid;
  gap: 7px;
  margin: 28px 0;
}

.layer-stack article {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 13px;
  border: 1px solid var(--line);
  background: #fafbf9;
  padding: 14px;
}

.layer-stack article > span {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 9px;
  font-weight: 900;
}

.layer-stack strong {
  font-size: 12px;
}

.layer-stack p {
  margin: 3px 0 0;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 10px;
  line-height: 1.45;
}

.scenario {
  border-left: 3px solid var(--ink);
  padding-left: 18px;
  font-size: 19px !important;
  font-style: italic;
}

.walkthrough {
  display: grid;
  gap: 0;
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.walkthrough li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 4px 13px;
  border-top: 1px solid var(--line);
  padding: 17px 0;
}

.walkthrough li::before {
  grid-row: 1 / span 2;
  content: counter(step);
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-family: Inter, sans-serif;
  font-size: 9px;
  font-weight: 900;
}

.walkthrough strong {
  font-family: Inter, sans-serif;
  font-size: 12px;
}

.walkthrough span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.boundary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 28px 0;
}

.boundary-grid article {
  border: 1px solid var(--line);
  background: #fafbf9;
  padding: 20px;
}

.boundary-grid article > p {
  margin: 0;
  color: var(--green);
  font-family: Inter, sans-serif;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.boundary-grid h3 {
  margin-top: 8px;
  font-size: 21px;
}

.boundary-grid ul,
.safety-rules ul {
  margin: 0;
  padding-left: 18px;
}

.boundary-grid li,
.safety-rules li {
  color: var(--muted);
  font-family: Inter, sans-serif;
  font-size: 10px;
  line-height: 1.65;
}

.safety-rules {
  border-color: var(--green);
  background: #edf6f1;
}

.safety-rules h3 {
  margin: 0 0 11px;
  font-family: Inter, sans-serif;
  font-size: 12px;
}

.paper-footer {
  display: grid;
  gap: 8px;
  margin-top: 88px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding-top: 24px;
  font-size: 10px;
  line-height: 1.5;
}

@media (max-width: 1080px) {
  .paper-layout {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .table-of-contents {
    position: static;
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 18px;
  }

  .table-of-contents nav {
    grid-column: 1;
  }

  .implementation-note {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .site-header {
    padding: 11px 16px;
  }

  .site-header nav a:first-child {
    display: none;
  }

  main {
    width: 100%;
    margin-top: 0;
  }

  .paper {
    border-right: 0;
    border-left: 0;
  }

  .paper-layout {
    padding-right: 22px;
    padding-left: 22px;
  }

  .pipeline {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .pipeline > i {
    transform: rotate(90deg);
  }

  .pipeline article {
    min-height: auto;
  }

  .design-grid,
  .future-grid,
  .boundary-grid {
    grid-template-columns: 1fr;
  }

  .version-example {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .version-example > i {
    height: 22px;
    font-size: 0;
    transform: none;
  }

  .version-example > i::after {
    content: "\2193";
    font-size: 14px;
  }
}

@media (max-width: 500px) {
  .brand span {
    display: none;
  }

  .site-header nav {
    gap: 15px;
  }

  .paper-header {
    padding-right: 22px;
    padding-left: 22px;
  }

  .paper-header h1 {
    font-size: 47px;
  }

  .table-of-contents {
    grid-template-columns: 1fr;
  }

  .implementation-note {
    grid-column: 1;
    grid-row: auto;
  }

  .paper-body p,
  .paper-body li {
    font-size: 16px;
  }
}

/* Top-level bullet lists in the article body */
.paper-body > section > ul {
  margin: 22px 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 13px;
}

.paper-body > section > ul > li {
  position: relative;
  padding-left: 22px;
  font-size: 15px;
  line-height: 1.62;
}

.paper-body > section > ul > li::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 2px;
  width: 9px;
  height: 3px;
  background: var(--green);
}

.paper-body > section > ul > li > strong {
  color: var(--ink);
}

.paper-body > section > ul > li > code,
.schema-table code {
  font-size: 11px;
}

.schema-table td code {
  color: var(--ink);
  background: #f1f4f1;
  padding: 1px 4px;
}

.layer-stack article > div {
  min-width: 0;
}

.paper-body q {
  font-style: italic;
}

@media (max-width: 720px) {
  .paper-body > section > ul > li {
    font-size: 14px;
  }
}

.paper-body h4 {
  margin: 30px 0 10px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
}

.paper-body > section > ol {
  margin: 0 0 22px;
  padding-left: 26px;
}

.paper-body > section > ol > li {
  margin-bottom: 11px;
  padding-left: 6px;
}

.paper-body > section > ol > li::marker {
  color: var(--green);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
}

.table-of-contents nav a.toc-sub {
  padding-left: 14px;
  font-size: 12.5px;
  color: var(--muted);
}
