:root {
  --bg0: #f8fbfd;
  --bg1: #eef4f9;
  --paper: rgba(255, 255, 255, 0.96);
  --paper-soft: rgba(255, 255, 255, 0.9);
  --paper-line: rgba(43, 74, 104, 0.14);
  --stroke: rgba(43, 74, 104, 0.15);
  --stroke2: rgba(43, 74, 104, 0.08);
  --text: rgba(16, 35, 54, 0.96);
  --muted: rgba(41, 63, 84, 0.76);
  --faint: rgba(74, 99, 123, 0.68);
  --accent: #1d5f8b;
  --accent2: #557892;
  --shadow: 0 18px 40px rgba(31, 57, 83, 0.08);
  --shadow2: 0 10px 22px rgba(31, 57, 83, 0.06);
  --radius: 14px;
  --maxw: 1120px;
  --navw: 280px;
  --ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--ui);
  color: var(--text);
  background:
    radial-gradient(780px 260px at 10% 0%, rgba(143, 196, 233, 0.12), transparent 70%),
    radial-gradient(760px 240px at 90% 0%, rgba(215, 232, 244, 0.24), transparent 72%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid rgba(29, 95, 139, 0.42);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  z-index: 50;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 18px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow2);
  position: sticky;
  top: 10px;
  z-index: 20;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  line-height: 1.1;
}

.crumbs a {
  color: var(--text);
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid var(--stroke2);
  border-radius: 999px;
  background: rgba(247, 250, 253, 0.96);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.crumbs a:hover,
.crumbs a:focus-visible {
  background: rgba(239, 246, 251, 0.98);
  border-color: var(--stroke);
  text-decoration: none;
}

.crumb-sep,
.crumb-current {
  color: var(--muted);
  font-size: 12.5px;
}

.crumb-sep {
  color: var(--faint);
  font-size: 11px;
  line-height: 1;
}

.crumb-current {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid rgba(29, 95, 139, 0.16);
  border-radius: 999px;
  background: rgba(236, 244, 250, 0.98);
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
}

.brand span {
  display: none;
}

.top-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1;
}

.pill.primary {
  border-color: rgba(29, 95, 139, 0.22);
  background: rgba(248, 251, 253, 0.98);
}

.hero,
.stack,
.article {
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero {
  margin-top: 10px;
  padding: 18px 22px 16px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.kicker b {
  color: var(--accent2);
}

h1 {
  margin: 10px 0 8px;
  font-family: var(--serif);
  font-size: clamp(30px, 3.5vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  font-weight: 600;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.58;
  max-width: 92ch;
  text-align: justify;
}

.hero > p:not(.subtitle):not(.lede) {
  margin: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.58;
  max-width: 92ch;
  text-align: justify;
}

.lede {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  max-width: 96ch;
  text-align: justify;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--paper-line);
}

.meta-pill {
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.layout {
  display: grid;
  grid-template-columns: var(--navw) 1fr;
  gap: 18px;
  align-items: start;
  margin-top: 10px;
}

.toc {
  position: sticky;
  top: 88px;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  background: var(--paper-soft);
  box-shadow: var(--shadow2);
}

.toc header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--stroke2);
  color: var(--faint);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.navlist {
  list-style: none;
  margin: 0;
  padding: 12px;
}

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

.navlist a {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 12px;
  color: var(--muted);
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.navlist a:hover,
.navlist a[aria-current="true"] {
  background: rgba(29, 95, 139, 0.08);
  color: var(--text);
  transform: translateX(2px);
  text-decoration: none;
}

.toc-badge {
  min-width: 28px;
  padding-top: 1px;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.article,
.stack {
  padding: 26px 30px 32px;
}

.stack {
  margin-top: 14px;
}

.article section + section {
  margin-top: 26px;
}

.article h2,
.stack h2 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.18;
}

.article h3,
.stack h3 {
  margin: 24px 0 10px;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.article p,
.article li,
.stack p,
.stack li {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.78;
  text-align: justify;
}

.article ul,
.article ol,
.stack ul,
.stack ol {
  margin: 0;
  padding-left: 22px;
}

.article p:last-child,
.stack p:last-child {
  margin-bottom: 0;
}

.section-lede {
  margin: 0 0 14px;
  color: var(--muted);
}

.entry-list,
.article-list,
.resource-list,
.experiment-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  border-top: 1px solid var(--paper-line);
}

.entry-list li,
.article-list li,
.resource-list li,
.experiment-list li {
  margin: 0;
  padding: 18px 0;
  border-bottom: 1px solid var(--paper-line);
}

.entry-list a,
.article-list a,
.resource-list a,
.experiment-list a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.entry-list a:hover,
.article-list a:hover,
.resource-list a:hover,
.experiment-list a:hover {
  text-decoration: none;
}

.entry-label,
.article-label {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.entry-list h3,
.article-list h3,
.resource-list h3,
.experiment-list h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
}

.entry-list p,
.article-list p,
.resource-list p,
.experiment-list p {
  margin: 0;
  color: var(--muted);
}

.entry-note,
.article-note {
  margin-top: 10px;
  color: var(--faint);
  font-family: var(--ui);
  font-size: 12.5px;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

.callout {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--paper-line);
  border-radius: 12px;
  background: rgba(244, 249, 253, 0.92);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.72;
  text-align: justify;
}

.callout b,
.callout strong {
  color: var(--text);
}

.chip-list,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke2);
  background: rgba(247, 250, 253, 0.96);
  color: var(--muted);
  font-size: 13px;
}

.chip i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(29, 95, 139, 0.72);
}

.program-table,
table {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.94);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

.table-wrap table {
  margin-top: 0;
  min-width: 540px;
}

caption {
  caption-side: top;
  text-align: left;
  padding: 14px 16px 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

.program-table th,
.program-table td,
th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--paper-line);
  text-align: left;
  vertical-align: top;
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.62;
}

.program-table th,
th {
  background: rgba(29, 95, 139, 0.06);
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.program-table tr:last-child td,
tbody tr:last-child td {
  border-bottom: none;
}

.refs {
  list-style: none;
  padding: 0;
}

.refs li {
  margin-bottom: 12px;
}

footer {
  margin-top: 14px;
  padding: 12px 6px 0;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.7;
}

footer p {
  margin: 0 0 8px;
}

footer p:last-child {
  margin-bottom: 0;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px 12px 36px;
  }

  .topbar {
    flex-wrap: wrap;
    top: 8px;
  }

  .hero,
  .article,
  .stack {
    padding: 18px 16px;
  }

  .article p,
  .article li,
  .stack p,
  .stack li {
    font-size: 17px;
  }

  .program-table,
  .program-table tbody,
  .program-table tr,
  .program-table th,
  .program-table td {
    display: block;
    width: 100%;
  }

  .program-table thead {
    display: none;
  }

  .program-table tr + tr {
    border-top: 1px solid var(--paper-line);
  }
}
