:root {
  --ink: #151811;
  --ink-muted: #4e584a;
  --paper: #f4f7f0;
  --paper-strong: #fbfcf7;
  --line: #d8dfce;
  --line-strong: #a9b5a0;
  --canopy: #0f261c;
  --moss: #2d6b4f;
  --oxide: #bb3d2a;
  --amber: #d8a925;
  --sky: #5e87a6;
  --shadow: 0 24px 70px rgb(24 30 18 / 12%);
  --body-font: "Source Sans 3", "Segoe UI", sans-serif;
  --display-font: "Fraunces", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgb(21 24 17 / 3%) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--paper);
  color: var(--ink);
  font-family: var(--body-font);
  font-size: 18px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--oxide);
}

img {
  max-width: 100%;
}

::selection {
  background: #f2d972;
  color: var(--ink);
}

.skip-link,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  z-index: 10;
  top: 1rem;
  left: 1rem;
  width: auto;
  height: auto;
  padding: 0.75rem 1rem;
  clip: auto;
  color: var(--paper-strong);
  background: var(--ink);
  border-radius: 6px;
}

.masthead {
  color: var(--paper-strong);
  background: var(--canopy);
}

.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1220px;
  min-height: 72px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.brand,
.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.brand {
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 0.9rem;
  height: 0.9rem;
  background: conic-gradient(from 30deg, var(--amber), var(--oxide), var(--sky), var(--moss), var(--amber));
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgb(255 255 255 / 7%);
}

.topbar-actions a {
  min-height: 2.25rem;
  padding: 0.35rem 0.7rem;
  color: rgb(251 252 247 / 82%);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgb(251 252 247 / 18%);
  border-radius: 999px;
}

.topbar-actions a:hover {
  color: var(--paper-strong);
  border-color: rgb(251 252 247 / 42%);
}

.hero {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 78vh;
  overflow: hidden;
  border-top: 1px solid rgb(251 252 247 / 10%);
  isolation: isolate;
}

#latent-map,
.latent-diagram,
.hero-shade {
  position: absolute;
  inset: 0;
}

#latent-map {
  z-index: -4;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 74% 22%, rgb(216 169 37 / 24%), transparent 22rem),
    radial-gradient(circle at 84% 75%, rgb(94 135 166 / 22%), transparent 26rem),
    #10140f;
}

.latent-diagram {
  z-index: -3;
  right: 0;
  left: auto;
  width: min(42vw, 620px);
  height: calc(100% - 72px);
  margin-top: 72px;
  color: var(--paper-strong);
  opacity: 0.68;
}

.latent-diagram::before,
.latent-diagram::after {
  position: absolute;
  top: 50%;
  left: 58%;
  width: 34rem;
  max-width: 82%;
  aspect-ratio: 1;
  border: 1px solid rgb(251 252 247 / 13%);
  border-radius: 50%;
  content: "";
  transform: translate(-50%, -50%);
}

.latent-diagram::after {
  width: 22rem;
  border-color: rgb(216 169 37 / 18%);
}

.latent-node {
  position: absolute;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  width: 12.8rem;
  padding: 0.65rem 0.75rem;
  color: rgb(251 252 247 / 82%);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.1;
  background: rgb(251 252 247 / 7%);
  border: 1px solid rgb(251 252 247 / 14%);
  border-radius: 8px;
}

.latent-node::before {
  position: absolute;
  top: 50%;
  left: -0.52rem;
  width: 0.68rem;
  height: 0.68rem;
  background: var(--amber);
  border-radius: 50%;
  content: "";
  transform: translateY(-50%);
  box-shadow: 0 0 0 5px rgb(216 169 37 / 13%);
}

.latent-node b {
  display: inline-grid;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0 0.3rem;
  place-items: center;
  color: var(--paper-strong);
  font-family: var(--display-font);
  font-size: 1.05rem;
  background: rgb(16 20 15 / 46%);
  border: 1px solid rgb(251 252 247 / 13%);
  border-radius: 999px;
}

.latent-node-1 {
  top: 16%;
  left: 20%;
}

.latent-node-2 {
  top: 28%;
  left: 54%;
}

.latent-node-3 {
  top: 44%;
  left: 32%;
}

.latent-node-4 {
  top: 58%;
  left: 58%;
}

.latent-node-5 {
  top: 70%;
  left: 16%;
}

.latent-node-6 {
  top: 80%;
  left: 48%;
}

.latent-node-7 {
  top: 34%;
  left: 12%;
}

.hero-shade {
  z-index: -2;
  background:
    linear-gradient(90deg, rgb(16 20 15 / 95%) 0%, rgb(16 20 15 / 82%) 38%, rgb(16 20 15 / 34%) 100%),
    linear-gradient(180deg, transparent 74%, var(--paper) 100%);
}

.hero-inner {
  width: min(1120px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 4.5rem 0 5.5rem;
}

.eyebrow,
.toc-title {
  margin: 0;
  color: var(--amber);
  font-size: 0.83rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 11ch;
  margin: 0.35rem 0 1rem;
  font-family: var(--display-font);
  font-size: 5rem;
  line-height: 0.94;
}

.lede {
  max-width: 780px;
  margin: 0 0 1rem;
  color: rgb(251 252 247 / 88%);
  font-size: 1.35rem;
  line-height: 1.35;
}

.intro-copy {
  max-width: 820px;
  color: rgb(251 252 247 / 74%);
}

.intro-copy p {
  margin: 0.6rem 0 0;
}

.hero-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin-top: 2rem;
}

.search-box {
  position: relative;
  display: block;
  width: min(100%, 440px);
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 1rem;
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid rgb(21 24 17 / 62%);
  border-radius: 50%;
  transform: translateY(-50%);
}

.search-icon::after {
  position: absolute;
  right: -0.45rem;
  bottom: -0.35rem;
  width: 0.48rem;
  height: 2px;
  background: rgb(21 24 17 / 62%);
  content: "";
  transform: rotate(45deg);
}

.search-box input {
  width: 100%;
  min-height: 3.2rem;
  padding: 0.8rem 1rem 0.8rem 2.75rem;
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  background: rgb(251 252 247 / 94%);
  border: 1px solid rgb(251 252 247 / 50%);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-box input:focus {
  outline: 3px solid rgb(216 169 37 / 42%);
  outline-offset: 3px;
}

.hero-link {
  display: inline-grid;
  min-height: 3.2rem;
  padding: 0 1.15rem;
  place-items: center;
  color: var(--paper-strong);
  font-weight: 800;
  text-decoration: none;
  background: var(--oxide);
  border-radius: 8px;
}

.hero-link:hover {
  color: var(--paper-strong);
  background: #d14c36;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  max-width: 780px;
  margin: 2.2rem 0 0;
  padding: 1.15rem 0 0;
  border-top: 1px solid rgb(251 252 247 / 20%);
}

.stats div {
  min-width: 10rem;
  padding: 0 1.5rem 0.3rem 0;
}

.stats dt {
  font-family: var(--display-font);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
}

.stats dd {
  margin: 0.2rem 0 0;
  color: rgb(251 252 247 / 68%);
  font-size: 0.95rem;
  font-weight: 700;
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(190px, 250px) minmax(0, 1fr);
  gap: 4rem;
  width: min(1220px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 4.5rem 0 5rem;
}

.toc-panel {
  position: relative;
}

.toc-sticky {
  position: sticky;
  top: 1.5rem;
  padding-top: 0.45rem;
  border-top: 3px solid var(--ink);
}

.toc-title {
  color: var(--oxide);
}

.toc-panel nav {
  display: grid;
  gap: 0.1rem;
  margin-top: 0.9rem;
}

.toc-link {
  padding: 0.25rem 0;
  color: var(--ink-muted);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
}

.toc-link:hover,
.toc-link.is-active {
  color: var(--oxide);
}

.toc-level-3 {
  padding-left: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.content-prose {
  min-width: 0;
}

.content-prose h2,
.content-prose h3 {
  scroll-margin-top: 2rem;
}

.content-prose h2 {
  margin: 0 0 1.2rem;
  padding-top: 1.4rem;
  font-family: var(--display-font);
  font-size: 2.65rem;
  line-height: 1.02;
}

.content-prose h2:not(:first-child) {
  margin-top: 4.4rem;
  border-top: 1px solid var(--line);
}

.content-prose h3 {
  margin: 2.2rem 0 0.9rem;
  color: var(--moss);
  font-family: var(--display-font);
  font-size: 1.65rem;
  line-height: 1.12;
}

.content-prose p {
  max-width: 780px;
  margin: 0.8rem 0 1.05rem;
  color: var(--ink-muted);
}

.content-prose blockquote {
  max-width: 820px;
  margin: 1.4rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  color: var(--ink);
  border-left: 4px solid var(--amber);
}

.content-prose code {
  padding: 0.05rem 0.28rem;
  color: #274c66;
  background: #e4ecea;
  border-radius: 4px;
  font-size: 0.95em;
}

.resource-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 0.9rem;
  padding: 0;
  margin: 1rem 0 1.4rem;
  list-style: none;
}

.resource-item {
  position: relative;
  min-height: 9.25rem;
  padding: 1rem 1rem 1.05rem;
  overflow-wrap: anywhere;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgb(24 30 18 / 6%);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.resource-item::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--moss), var(--amber), var(--oxide));
  content: "";
  opacity: 0.82;
}

.resource-item:hover {
  border-color: var(--line-strong);
  box-shadow: 0 16px 38px rgb(24 30 18 / 10%);
  transform: translateY(-2px);
}

.resource-item strong {
  color: var(--ink);
  font-weight: 800;
}

.resource-item a {
  font-weight: 750;
}

.resource-item[hidden] {
  display: none;
}

.content-prose > p:last-child {
  margin-bottom: 0;
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 1.5rem 3rem;
  color: var(--ink-muted);
  font-size: 0.95rem;
  font-weight: 700;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .hero {
    min-height: auto;
  }

  .latent-diagram {
    display: none;
  }

  .hero h1 {
    font-size: 3.5rem;
  }

  .lede {
    font-size: 1.15rem;
  }

  .page-shell {
    display: block;
    width: min(100% - 2rem, 760px);
    padding-top: 3rem;
  }

  .toc-panel {
    display: none;
  }

  .content-prose h2 {
    font-size: 2.15rem;
  }
}

@media (max-width: 1500px) and (min-width: 901px) {
  .latent-diagram {
    opacity: 0.48;
  }

  .latent-node {
    width: auto;
    min-width: 2.4rem;
    padding: 0;
    background: transparent;
    border: 0;
  }

  .latent-node::before,
  .latent-node span {
    display: none;
  }

  .latent-node b {
    min-width: 2.45rem;
    min-height: 2.45rem;
    background: rgb(251 252 247 / 9%);
  }

  .latent-node-1 {
    left: 40%;
  }

  .latent-node-2 {
    left: 72%;
  }

  .latent-node-3 {
    left: 58%;
  }

  .latent-node-4 {
    left: 78%;
  }

  .latent-node-5 {
    left: 36%;
  }

  .latent-node-6 {
    left: 64%;
  }

  .latent-node-7 {
    left: 46%;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 17px;
  }

  .topbar {
    align-items: flex-start;
    min-height: 0;
    padding: 1rem;
  }

  .topbar-actions {
    gap: 0.4rem;
  }

  .topbar-actions a {
    padding-inline: 0.55rem;
    font-size: 0.85rem;
  }

  .hero-inner {
    width: min(100% - 2rem, 720px);
    padding: 3rem 0 4rem;
  }

  .hero h1 {
    font-size: 2.9rem;
  }

  .hero-tools {
    align-items: stretch;
  }

  .hero-link {
    width: 100%;
  }

  .stats div {
    min-width: 8.6rem;
  }

  .resource-item {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
