:root {
  color-scheme: light;
  --ink: #141716;
  --muted: #58635f;
  --quiet: #73807b;
  --paper: #f6f3ec;
  --paper-strong: #fffdf8;
  --line: #d8d2c4;
  --line-strong: #bbb3a3;
  --panel: #ffffff;
  --charcoal: #1e2724;
  --charcoal-2: #2f3b37;
  --cyan: #0a8fa6;
  --green: #27865f;
  --amber: #b87319;
  --code-bg: #ece7dc;
  --shadow: 0 18px 48px rgba(31, 39, 36, 0.12);
  --mono:
    "SFMono-Regular", "Cascadia Code", "Liberation Mono", Menlo, monospace;
  --sans:
    Avenir, "Avenir Next", "Gill Sans", Corbel, "Trebuchet MS", sans-serif;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(20, 23, 22, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 23, 22, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
}

a {
  color: var(--cyan);
  text-decoration-color: rgba(10, 143, 166, 0.35);
  text-underline-offset: 0.18em;
}

a:hover {
  color: #066777;
  text-decoration-color: currentColor;
}

.skipLink {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 20;
  background: var(--charcoal);
  color: #fff;
  padding: 10px 14px;
}

.skipLink:focus {
  top: 12px;
}

.siteHeader {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(20, 23, 22, 0.12);
  background: rgba(246, 243, 236, 0.92);
  backdrop-filter: blur(16px);
}

.topNav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 14px clamp(18px, 4vw, 44px);
}

.brandMark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brandGlyph {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--charcoal);
  background: var(--charcoal);
  color: #f7efe1;
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1;
}

.brandMark strong,
.brandMark small {
  display: block;
  line-height: 1.05;
}

.brandMark strong {
  font-family: var(--serif);
  font-size: 1.08rem;
}

.brandMark small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.topLinks a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid transparent;
  color: var(--charcoal-2);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0 10px;
  text-decoration: none;
}

.topLinks a:hover,
.topLinks .previewLink {
  border-color: var(--line-strong);
  background: rgba(255, 253, 248, 0.72);
}

.docFrame {
  display: grid;
  grid-template-columns: minmax(230px, 292px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  max-width: 1480px;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 46px);
}

.docSidebar {
  align-self: start;
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  box-shadow: 8px 8px 0 rgba(30, 39, 36, 0.08);
}

.sidebarKicker {
  border-bottom: 1px solid var(--line);
  color: var(--quiet);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 14px 16px;
  text-transform: uppercase;
}

.sideNav {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.sideNav section {
  display: grid;
  gap: 2px;
  padding: 6px 0 12px;
}

.sideNav h2 {
  margin: 0 0 4px;
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.sideNav a {
  display: block;
  border-left: 3px solid transparent;
  color: var(--charcoal-2);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  padding: 7px 8px 7px 10px;
  text-decoration: none;
}

.sideNav a:hover {
  border-left-color: var(--cyan);
  background: #fff;
  color: var(--ink);
}

.docMain {
  min-width: 0;
}

.docContent {
  max-width: 940px;
  min-height: 70vh;
  border: 1px solid var(--line);
  background: var(--paper-strong);
  box-shadow: var(--shadow);
  padding: clamp(28px, 5vw, 64px);
}

.docContent > :first-child {
  margin-top: 0;
}

.docContent h1,
.docContent h2,
.docContent h3,
.docContent h4 {
  color: var(--ink);
  line-height: 1.12;
}

.docContent h1 {
  max-width: 16ch;
  margin-bottom: 0.35em;
  font-family: var(--serif);
  font-size: clamp(2.35rem, 5vw, 4.4rem);
  font-weight: 700;
  letter-spacing: 0;
}

.docContent h2 {
  margin-top: 2.1em;
  border-top: 1px solid var(--line);
  padding-top: 0.82em;
  font-family: var(--serif);
  font-size: clamp(1.55rem, 3vw, 2.45rem);
}

.docContent h3 {
  margin-top: 1.7em;
  font-size: 1.22rem;
  font-weight: 900;
}

.docContent p,
.docContent li {
  color: var(--charcoal-2);
}

.docContent p {
  max-width: 76ch;
}

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

.docContent li + li {
  margin-top: 0.35em;
}

.docContent code {
  border: 1px solid rgba(30, 39, 36, 0.08);
  background: var(--code-bg);
  color: #26322e;
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 0.13em 0.32em;
}

.docContent pre {
  overflow: auto;
  border: 1px solid #26322e;
  background: #121816;
  color: #eef5ef;
  padding: 18px;
}

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

.docContent table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.4rem 0;
}

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

.docContent th {
  background: #ece7dc;
  color: var(--ink);
  text-align: left;
}

.docContent blockquote {
  border-left: 4px solid var(--green);
  margin-left: 0;
  padding-left: 18px;
}

.mermaid {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(10, 143, 166, 0.06), transparent 38%),
    linear-gradient(315deg, rgba(184, 115, 25, 0.08), transparent 42%), #fffdf8;
  margin: 1.4rem 0;
  padding: 18px;
}

.mermaid svg {
  display: block;
  width: min(920px, 100%);
  min-width: 680px;
  max-width: 100% !important;
  height: auto;
  margin: 0 auto;
}

.valueWheel {
  counter-reset: value-wheel;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  list-style: none;
  margin: 1.4rem 0;
  padding: 0;
}

.valueWheel li {
  align-items: center;
  background: #fffdf8;
  border: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr;
  min-height: 68px;
  padding: 12px;
  position: relative;
}

.valueWheel li:not(:last-child)::after {
  color: var(--green);
  content: "->";
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 800;
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translate(50%, -50%);
}

.valueWheel span {
  align-items: center;
  background: var(--green);
  color: #fffdf8;
  display: inline-flex;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.valueWheel strong {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.96rem;
  line-height: 1.25;
}

.mermaidError {
  border-color: #b45309;
  background: #fff7ed;
  color: #7c2d12;
  font-family: var(--mono);
  font-size: 0.82rem;
  white-space: pre-wrap;
}

.atlasHero {
  border: 1px solid var(--charcoal);
  background:
    linear-gradient(90deg, rgba(30, 39, 36, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(30, 39, 36, 0.06) 1px, transparent 1px),
    #fffdf8;
  background-size: 26px 26px;
  margin: 24px 0;
  padding: clamp(18px, 4vw, 34px);
}

.atlasHero strong {
  display: block;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  line-height: 1.16;
}

.atlasHero p {
  margin-bottom: 0;
}

.diagramIndex,
.signalGrid,
.infographicGrid {
  display: grid;
  gap: 12px;
  margin: 1.4rem 0;
}

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

.signalGrid,
.infographicGrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.diagramIndex a,
.signalCard,
.infoTile {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--charcoal-2);
  padding: 14px;
  text-decoration: none;
}

.diagramIndex a {
  display: block;
  font-weight: 900;
}

.diagramIndex a span,
.signalCard span,
.infoTile span {
  display: block;
  color: var(--quiet);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
  margin-top: 4px;
}

.signalCard strong,
.infoTile strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
}

.infoTile {
  min-height: 132px;
}

.infoTile b {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--charcoal);
  background: var(--charcoal);
  color: #fffdf8;
  font-family: var(--mono);
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.imagePlate,
.imagePlateGrid {
  margin: 1.4rem 0;
}

.imagePlate {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
}

.imagePlate img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(30, 39, 36, 0.1);
}

.imagePlate figcaption {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.45;
  margin-top: 10px;
}

.imagePlateHero {
  box-shadow: 10px 10px 0 rgba(30, 39, 36, 0.08);
}

.imagePlateGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.heroPanel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(24px, 5vw, 54px);
  align-items: start;
  margin: -12px 0 30px;
}

.heroPanel h1 {
  max-width: 13ch;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 34px;
  height: 2px;
  background: currentColor;
}

.lede {
  color: var(--charcoal-2);
  font-family: var(--serif);
  font-size: clamp(1.22rem, 2.4vw, 1.62rem);
  line-height: 1.42;
}

.actionRow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.actionRow a,
.docCard a {
  align-items: center;
  border: 1px solid var(--charcoal);
  background: var(--charcoal);
  color: #fffdf8;
  display: inline-flex;
  font-weight: 900;
  min-height: 42px;
  padding: 0 14px;
  text-decoration: none;
}

.actionRow a + a {
  background: transparent;
  color: var(--charcoal);
}

.docGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0 14px;
}

.docCard {
  border: 1px solid var(--line);
  background: #fff;
  padding: 18px;
}

.docCard h3 {
  margin: 0 0 8px;
}

.docCard p {
  margin-bottom: 16px;
}

.statusStrip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0;
  padding: 0;
  list-style: none;
}

.statusStrip li {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 7px 10px;
}

.routePath {
  counter-reset: route-path;
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 1.4rem 0 2rem;
  padding: 0;
}

.routePath li {
  align-items: start;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  gap: 4px 12px;
  grid-template-columns: auto 1fr;
  padding: 14px;
  position: relative;
}

.routePath li:not(:last-child)::after {
  background: var(--green);
  bottom: -11px;
  content: "";
  left: 27px;
  position: absolute;
  top: calc(100% - 1px);
  width: 2px;
}

.routePath span {
  align-items: center;
  background: var(--charcoal);
  color: #fffdf8;
  display: inline-flex;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 800;
  grid-row: span 2;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.routePath a {
  color: var(--ink);
  font-weight: 900;
  text-decoration-color: rgba(30, 39, 36, 0.32);
  text-underline-offset: 3px;
}

.routePath small {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.nextNav {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 2rem 0;
  padding-top: 14px;
}

.nextNav a {
  align-items: center;
  border: 1px solid var(--charcoal);
  color: var(--charcoal);
  display: inline-flex;
  font-weight: 900;
  min-height: 42px;
  padding: 0 14px;
  text-decoration: none;
}

.nextNav a:last-child {
  background: var(--charcoal);
  color: #fffdf8;
}

.siteFooter {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  max-width: 1480px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  color: var(--quiet);
  font-size: 0.9rem;
  padding: 24px clamp(18px, 4vw, 44px) 42px;
}

.siteFooter a {
  font-weight: 800;
}

@media (max-width: 980px) {
  .siteHeader {
    position: static;
  }

  .topNav {
    display: grid;
    align-items: stretch;
  }

  .topLinks {
    justify-content: flex-start;
  }

  .docFrame {
    grid-template-columns: 1fr;
  }

  .docMain {
    order: -1;
  }

  .docSidebar {
    position: static;
    max-height: none;
  }

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

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

  .docFrame {
    padding: 14px;
  }

  .docContent {
    padding: 24px 18px;
  }

  .docContent h1 {
    font-size: clamp(2.05rem, 10vw, 2.9rem);
  }

  .sideNav,
  .docGrid,
  .heroPanel,
  .diagramIndex,
  .signalGrid,
  .infographicGrid,
  .imagePlateGrid {
    grid-template-columns: 1fr;
  }

  .mermaid {
    padding: 12px;
  }
}
