:root {
  --paper: #f7f8f2;
  --panel: #fffefa;
  --ink: #10231d;
  --body: #2f463c;
  --muted: #5a7066;
  --line: #d8e2d7;
  --green: #063f31;
  --green-soft: #e8f1e8;
  --accent: #b98845;
  --accent-soft: #f3eadb;
  --radius: 16px;
  --shadow: 0 18px 48px rgba(15, 52, 39, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  max-width: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(232, 241, 232, 0.78), rgba(247, 248, 242, 0) 28rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.68;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--green);
  text-underline-offset: 3px;
}

button {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(216, 226, 215, 0.88);
  background: rgba(247, 248, 242, 0.92);
  backdrop-filter: blur(16px);
}

.topbar-inner,
.article-head,
.lede-grid,
.article-grid,
.footer-inner {
  width: min(calc(100% - 2rem), 1280px);
  margin: 0 auto;
}

.topbar-inner {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--green);
  font-weight: 900;
  text-decoration: none;
}

.mark {
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-size: 13px;
}

.nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a,
.toc a {
  border-radius: 999px;
  color: var(--muted);
  padding: 7px 10px;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.nav a:hover,
.nav a:focus,
.toc a:hover,
.toc a:focus {
  background: var(--green-soft);
  color: var(--green);
  outline: none;
}

.article-head {
  padding: 68px 0 34px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.kicker::before {
  content: "";
  width: 28px;
  height: 2px;
  background: currentColor;
}

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

h1 {
  max-width: 980px;
  margin-bottom: 20px;
  color: var(--green);
  font-size: clamp(42px, 7vw, 78px);
  line-height: .98;
  letter-spacing: -0.035em;
}

.dek {
  max-width: 860px;
  margin-bottom: 24px;
  color: var(--body);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(20px, 2.6vw, 27px);
  line-height: 1.42;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.lede-grid {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(340px, 1.05fr);
  gap: 26px;
  align-items: stretch;
  padding-bottom: 48px;
}

.abstract,
.language-figure,
.wide-figure,
.callout,
.aside-note,
.example-card,
.table-wrap,
.rank-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.abstract {
  border-left: 5px solid var(--green);
  padding: 22px;
}

.abstract h2 {
  margin-bottom: 10px;
  font-size: 18px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.abstract p,
.prose p,
.prose li {
  color: var(--body);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.78;
}

.language-figure {
  display: grid;
  place-items: center;
  min-height: 420px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.72) 42%, rgba(232, 241, 232, 0.95)),
    var(--green-soft);
  overflow: hidden;
}

.language-figure svg {
  width: 100%;
  min-height: 360px;
  display: block;
}

.article-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 38px;
  align-items: start;
  padding-bottom: 80px;
}

.toc {
  position: sticky;
  top: 86px;
  border-right: 1px solid var(--line);
  padding-right: 18px;
  color: var(--muted);
  font-size: 13px;
}

.toc strong {
  display: block;
  margin-bottom: 10px;
  color: var(--green);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.toc a {
  display: block;
  margin: 7px 0;
}

.prose {
  min-width: 0;
}

.prose section {
  padding: 24px 0 46px;
  border-top: 1px solid var(--line);
}

.prose section:first-child {
  border-top: 0;
  padding-top: 0;
}

.prose section > h2,
.prose section > h3,
.prose section > p,
.prose section > ul,
.prose section > ol,
.prose section > .aside-note {
  max-width: 780px;
}

.prose h2 {
  margin-bottom: 16px;
  color: var(--green);
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.026em;
}

.prose h3 {
  margin: 28px 0 10px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
}

.prose p {
  margin-bottom: 18px;
}

.prose code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  padding: 1px 5px;
  color: var(--green);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: .88em;
}

.aside-note {
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 22px 0;
  padding: 14px 16px;
  background: var(--accent-soft);
  color: #5c3b16;
  box-shadow: none;
}

.wide-figure {
  width: 100%;
  max-width: none;
  margin: 28px 0 34px;
  overflow: hidden;
}

.figure-inner {
  padding: 1.4rem;
}

.figure-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.figure-title h3 {
  margin: 0;
  font-size: 20px;
}

.figure-title p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

figcaption {
  border-top: 1px solid var(--line);
  background: #f4f7f2;
  padding: 14px 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.badge {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(6, 63, 49, 0.14);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--green);
  padding: 7px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
}

.pill.active,
.pill:hover,
.pill:focus {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.matrix-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 18px;
}

.table-wrap {
  overflow-x: auto;
  box-shadow: none;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.bar-track {
  height: 7px;
  border-radius: 999px;
  background: #e4ece4;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: var(--score);
  border-radius: inherit;
  background: var(--green);
}

.rank-panel,
.callout {
  padding: 16px;
}

.ranking {
  display: grid;
  gap: 10px;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(120px, .8fr) minmax(110px, 1fr) 44px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.side-column {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.callout {
  box-shadow: 0 10px 24px rgba(15, 52, 39, 0.06);
}

.callout h3 {
  margin-top: 0;
  font-size: 17px;
}

.callout p,
.callout li {
  color: var(--body);
  font-size: 15px;
  line-height: 1.56;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 44px;
  color: var(--muted);
  font-size: 14px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

@media (max-width: 1080px) {
  .lede-grid,
  .article-grid,
  .matrix-layout {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 14px;
  }

  .side-column {
    grid-column: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar-inner,
  .article-head,
  .lede-grid,
  .article-grid,
  .footer-inner,
  .prose,
  .toc,
  .side-column,
  .abstract,
  .language-figure,
  .wide-figure {
    width: calc(100vw - 4.5rem);
    max-width: calc(100vw - 4.5rem);
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }

  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: .65rem;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .nav {
    max-width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .nav a {
    flex: 0 0 auto;
  }

  h1 {
    max-width: 16ch;
    font-size: 25px;
    line-height: 1.04;
    letter-spacing: -0.02em;
  }

  .dek,
  .abstract p,
  .prose p,
  .prose li {
    max-width: 31ch;
    font-size: 16px;
  }

  .meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: .35rem;
  }

  .abstract,
  .callout,
  .wide-figure,
  .rank-panel {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .figure-title,
  .rank-row {
    display: block;
  }

  .side-column {
    grid-template-columns: 1fr;
  }
}
