@font-face {
  font-family: "Poppins";
  src: url("../fonts/poppins-latin-400-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("../fonts/poppins-latin-500-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("../fonts/poppins-latin-600-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("../fonts/poppins-latin-700-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #17231f;
  --muted: #68736d;
  --paper: #f4f0e7;
  --surface: #fffdf8;
  --pine: #123f33;
  --pine-deep: #082e25;
  --mint: #c5e2d4;
  --mint-soft: #e4f0e9;
  --line: #cbc6ba;
  --amber: #b76c16;
  --amber-soft: #f7e7cd;
  --code: #102b24;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --measure: 70ch;
  --wide: 1120px;
  --rail-width: 12rem;
  --rail-gap: clamp(2rem, 6vw, 6rem);
  --shadow: 0 18px 55px rgba(18, 37, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(18, 63, 51, 0.035) 1px, transparent 1px) 0 0 / 100% 32px,
    var(--paper);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
}

img,
svg {
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--pine);
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--pine-deep);
  text-decoration-thickness: 0.14em;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  transform: translateY(-170%);
  padding: 0.55rem 0.8rem;
  border: 2px solid var(--pine);
  background: var(--surface);
  color: var(--pine);
}

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

.reading-progress {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 90;
  width: 100%;
  height: 3px;
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  background: var(--pine);
}

.article-topbar {
  width: min(100% - 2rem, var(--wide));
  margin: 0 auto;
  padding: 1rem 0;
  border-bottom: 1px solid var(--ink);
}

.article-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.075em;
  text-decoration: none;
  text-transform: uppercase;
}

.article-brand__mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  background: var(--pine);
  color: var(--surface);
  font-size: 0.62rem;
}

.article-shell {
  width: min(100% - 2rem, var(--wide));
  margin: 0 auto;
  padding-bottom: 5rem;
}

.article-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.34fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: end;
  padding: clamp(3rem, 8vw, 7.5rem) 0 clamp(2.5rem, 6vw, 5rem);
  border-bottom: 1px solid var(--ink);
}

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

.article-kicker {
  margin: 0 0 1rem;
  color: var(--pine);
  font-size: 0.72rem;
  font-weight: 820;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.article-title {
  max-width: 18ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.75rem, 7vw, 6.4rem);
  font-weight: 620;
  line-height: 0.96;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

.article-dek {
  max-width: 58ch;
  margin: 1.5rem 0 0;
  color: #35453f;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2.2vw, 1.62rem);
  line-height: 1.42;
}

.article-meta {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.045em;
  list-style: none;
  text-transform: uppercase;
}

.article-meta li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.article-meta strong {
  color: var(--ink);
  font-weight: 750;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--rail-width)) minmax(0, 1fr);
  gap: var(--rail-gap);
  align-items: start;
  padding-top: 3rem;
}

.token-rail {
  position: sticky;
  top: 2rem;
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.token-rail a {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.45rem 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 690;
  line-height: 1.3;
  text-decoration: none;
}

.token-rail a::before {
  content: "";
  width: 100%;
  height: 2px;
  background: var(--line);
}

.token-rail a[aria-current="true"] {
  color: var(--pine);
}

.token-rail a[aria-current="true"]::before {
  background: var(--pine);
}

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

.article-section {
  scroll-margin-top: 2rem;
  padding: 1rem 0 4.25rem;
}

.article-section + .article-section {
  border-top: 1px solid var(--line);
}

.article-section > :not(.wide):not(.full-bleed) {
  max-width: var(--measure);
}

.section-label {
  display: block;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 780;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 650;
  letter-spacing: -0.025em;
}

h2 {
  max-width: 21ch;
  margin: 0 0 1.35rem;
  font-size: clamp(2rem, 4.8vw, 3.7rem);
  line-height: 1.03;
}

h3 {
  margin: 2.25rem 0 0.75rem;
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  line-height: 1.2;
}

h4 {
  margin: 1.8rem 0 0.55rem;
  font-size: 1.1rem;
  line-height: 1.3;
}

p,
ul,
ol,
blockquote {
  margin-top: 0;
  margin-bottom: 1.15rem;
}

ul,
ol {
  padding-left: 1.35rem;
}

li + li {
  margin-top: 0.45rem;
}

.lede {
  max-width: 56ch;
  font-family: var(--serif);
  font-size: clamp(1.28rem, 2.4vw, 1.7rem);
  line-height: 1.48;
}

.prose-note {
  color: var(--muted);
  font-size: 0.92rem;
}

code,
pre {
  font-family: var(--mono);
}

code {
  padding: 0.1em 0.28em;
  background: var(--mint-soft);
  font-size: 0.88em;
}

pre {
  max-width: 100%;
  margin: 1.5rem 0;
  padding: 1.2rem;
  overflow: auto;
  border-radius: 0.2rem;
  background: var(--code);
  color: #eef8f2;
  font-size: 0.82rem;
  line-height: 1.6;
}

pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.math {
  display: block;
  margin: 1.25rem 0;
  padding: 1rem;
  overflow-x: auto;
  border-left: 3px solid var(--pine);
  background: var(--surface);
  font-family: var(--serif);
  font-size: 1.08rem;
}

.article-footer {
  margin-top: 1rem;
  padding: 2rem 0;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font-size: 0.82rem;
}

.article-footer a {
  font-weight: 720;
}

@media (max-width: 840px) {
  body {
    font-size: 16px;
  }

  .article-header {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .article-title {
    font-size: clamp(2.6rem, 12vw, 4.7rem);
  }

  .article-meta {
    max-width: 28rem;
  }

  .article-layout {
    grid-template-columns: 1fr;
    padding-top: 1.5rem;
  }

  .token-rail {
    position: static;
    display: flex;
    gap: 0.5rem;
    padding: 0 0 1rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
  }

  .token-rail li {
    flex: 0 0 auto;
  }

  .token-rail li + li {
    margin-top: 0;
  }

  .token-rail a {
    display: block;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--line);
    white-space: nowrap;
  }

  .token-rail a::before {
    display: none;
  }

  .token-rail a[aria-current="true"] {
    border-color: var(--pine);
    background: var(--mint-soft);
  }

  .article-section {
    padding-bottom: 3.3rem;
  }
}

@media (max-width: 520px) {
  .article-topbar,
  .article-shell {
    width: min(100% - 1.25rem, var(--wide));
  }

  .article-header {
    padding-top: 2.6rem;
  }

  .article-title {
    font-size: clamp(2.35rem, 13vw, 3.7rem);
  }

  h2 {
    font-size: clamp(1.9rem, 10vw, 2.8rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
