:root {
  color-scheme: light;
  --ink: #24231f;
  --muted: #777066;
  --line: #e1d7c7;
  --paper: #fdf8ef;
  --soft: #f7efe2;
  --accent: #4d625c;
  --accent-2: #b6652f;
  --max: 1160px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Iowan Old Style", Charter, Georgia, serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.62;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

.hero {
  min-height: 50vh;
  padding: 72px max(24px, calc((100vw - var(--max)) / 2)) 48px;
  display: grid;
  grid-template-columns: minmax(0, 920px);
  gap: 34px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  color: #f8f0e4;
  background:
    radial-gradient(circle at 76% 18%, rgba(255, 121, 44, 0.46), transparent 34rem),
    radial-gradient(circle at 10% 90%, rgba(255, 184, 96, 0.18), transparent 28rem),
    linear-gradient(140deg, #321409, #7f3512 58%, #421808);
  position: relative;
}

.hero a {
  color: rgba(248, 240, 228, 0.86);
}

.hero nav,
.site-header {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.hero nav {
  position: absolute;
  top: 24px;
  right: max(24px, calc((100vw - var(--max)) / 2));
}

.hero h1 {
  max-width: 980px;
  margin: 0 0 16px;
  font-size: clamp(38px, 4.8vw, 64px);
  line-height: 1;
  font-family: Optima, "Optima nova", Candara, "Trebuchet MS", sans-serif;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
}

.hero p {
  max-width: 680px;
  margin: 0;
  font-size: clamp(22px, 3vw, 31px);
  color: rgba(248, 240, 228, 0.72);
  font-style: italic;
  font-weight: 400;
}

.practice-loop {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: center;
  max-width: 680px;
  margin: 12px 0 0;
  color: rgba(248, 240, 228, 0.62);
  font-size: clamp(14px, 1.45vw, 16px);
  line-height: 1.2;
  letter-spacing: 0;
  font-style: italic;
  font-weight: 400;
}

.practice-loop span {
  white-space: nowrap;
}

.practice-loop span + span::before {
  content: "\2192";
  margin: 0 9px;
  color: rgba(231, 145, 80, 0.84);
  font-style: normal;
}

.opening-question {
  position: absolute;
  top: 28px;
  left: max(24px, calc((100vw - var(--max)) / 2));
  margin: 0;
  font-size: clamp(13px, 1.4vw, 15px);
  color: rgba(248, 240, 228, 0.38);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.03em;
}

.hero-sub {
  max-width: 640px;
  margin: 10px 0 0 !important;
  font-size: clamp(15px, 1.6vw, 18px) !important;
  color: rgba(248, 240, 228, 0.58) !important;
  font-style: normal !important;
}

.practice-loop a {
  color: rgba(248, 240, 228, 0.82);
  text-decoration: none;
  border-bottom: 1px solid rgba(248, 240, 228, 0.22);
}

.practice-loop a:hover {
  color: rgba(248, 240, 228, 1);
  border-bottom-color: rgba(231, 145, 80, 0.7);
}

.atlas-context {
  margin-top: 14px !important;
  color: rgba(248, 240, 228, 0.52) !important;
  font-size: 13px !important;
  line-height: 1.2 !important;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-style: normal !important;
}

.entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 0;
}

.entry-links a,
.note-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
  border-radius: 6px;
}

.entry-links a {
  padding: 0;
  border: 0;
  background: transparent;
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 14px max(20px, calc((100vw - var(--max)) / 2));
  background: rgba(251, 252, 250, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 600; color: var(--ink); text-decoration: none; }

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 20px 72px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 760px);
  gap: 42px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 82px;
  padding-top: 10px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  color: var(--muted);
}

input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  font: inherit;
  background: white;
}

.results {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.results a {
  display: block;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.note {
  min-width: 0;
}

.note h1 {
  margin-top: 0;
  font-size: 42px;
  line-height: 1.06;
  letter-spacing: 0;
  font-weight: 640;
}

.note h2 {
  margin-top: 38px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.path,
.muted {
  color: var(--muted);
  font-size: 14px;
}

.path {
  margin-bottom: 12px;
}

.local-trace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 24px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
}

.local-trace div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.42);
}

.local-trace h2 {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.local-trace p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.missing-link {
  color: var(--accent-2);
  border-bottom: 1px dotted currentColor;
}

pre {
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}

.page-title {
  padding: 28px 0 0;
  margin: 0;
  font-size: clamp(18px, 2vw, 24px);
  font-family: Optima, "Optima nova", Candara, "Trebuchet MS", sans-serif;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

.search-band {
  padding: 28px 0;
}

.band {
  border-bottom: 1px solid var(--line);
  padding: 28px 0;
}

.site-footer {
  padding: 28px max(24px, calc((100vw - var(--max)) / 2));
  border-top: 1px solid var(--line);
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

.order-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.order-nav a {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 13px;
  text-decoration: none;
  color: var(--muted);
  background: rgba(255,255,255,0.52);
  letter-spacing: 0.03em;
  transition: border-color 0.12s, color 0.12s;
}

.order-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.read-guide {
  border-bottom: 1px solid var(--line);
  padding: 32px 0 30px;
  max-width: 840px;
}

.trace-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
}

.trace-mode {
  display: grid;
  gap: 5px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.46);
  text-decoration: none;
}

.trace-mode span {
  color: var(--accent-2);
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.trace-mode strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.trace-mode small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.atlas-subgroup {
  margin-top: 18px;
}

.atlas-subgroup h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.note-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  text-decoration: none;
}

.note-card span { color: var(--ink); font-weight: 600; }
.note-card small { color: var(--muted); }

.graph-page {
  max-width: 900px;
}

.connection-list section {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}

.lede {
  color: var(--muted);
  font-size: 20px;
}

.theory-page {
  max-width: none;
  padding: 0 0 96px;
}

.theory-hero {
  min-height: 76vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.7fr);
  grid-template-rows: auto 1fr auto;
  column-gap: clamp(40px, 8vw, 130px);
  align-items: end;
  padding: 68px max(24px, calc((100vw - var(--max)) / 2)) 64px;
  color: #f8f0e4;
  background:
    radial-gradient(circle at 76% 18%, rgba(255, 121, 44, 0.40), transparent 34rem),
    radial-gradient(circle at 12% 92%, rgba(255, 184, 96, 0.16), transparent 28rem),
    linear-gradient(145deg, #321409, #7f3512 58%, #421808);
}

.theory-status {
  grid-column: 1 / -1;
  align-self: start;
  margin: 0;
  color: rgba(248, 240, 228, 0.58);
  font: 700 11px/1.2 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.theory-hero h1 {
  margin: 40px 0 0;
  font-family: Optima, "Optima nova", Candara, "Trebuchet MS", sans-serif;
  font-size: clamp(46px, 6vw, 84px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.theory-lede {
  max-width: 530px;
  margin: 54px 0 0;
  color: rgba(248, 240, 228, 0.82);
  font-size: clamp(20px, 2.5vw, 30px);
  line-height: 1.36;
}

.theory-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 50px;
}

.theory-actions a {
  padding: 10px 15px;
  border: 1px solid rgba(248, 240, 228, 0.28);
  border-radius: 999px;
  color: rgba(248, 240, 228, 0.9);
  font: 600 13px/1 ui-sans-serif, system-ui, sans-serif;
  text-decoration: none;
}

.theory-primitives {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: var(--max);
  margin: 0 auto;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.theory-primitives article {
  min-height: 260px;
  padding: 34px;
  border-right: 1px solid var(--line);
}

.theory-primitives article:last-child { border-right: 0; }

.theory-primitives span {
  color: var(--accent-2);
  font: 700 11px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.12em;
}

.theory-primitives h2 {
  margin: 48px 0 12px;
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 500;
}

.theory-primitives p {
  max-width: 320px;
  margin: 0;
  color: var(--muted);
}

.theory-tact {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(44px, 8vw, 96px);
  color: #f8f0e4;
  background: #9b542c;
}

.theory-tact .eyebrow { color: rgba(248, 240, 228, 0.64); }

.theory-tact h2 {
  max-width: 820px;
  margin: 18px 0 14px;
  font-size: clamp(36px, 6vw, 72px);
  line-height: 1.02;
  font-weight: 500;
}

.theory-tact > p:last-child {
  max-width: 680px;
  margin: 0;
  color: rgba(248, 240, 228, 0.8);
  font-size: 20px;
}

.theory-body {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 760px);
  gap: clamp(36px, 7vw, 96px);
  max-width: 1080px;
  margin: 0 auto;
  padding: 84px 24px;
  scroll-margin-top: 76px;
}

.theory-toc {
  position: sticky;
  top: 86px;
  align-self: start;
  display: grid;
  gap: 8px;
  padding: 4px 0 20px;
}

.theory-toc .eyebrow { margin-bottom: 8px; }

.theory-toc a {
  color: var(--muted);
  font: 500 13px/1.35 ui-sans-serif, system-ui, sans-serif;
  text-decoration: none;
}

.theory-toc a:hover { color: var(--accent); }

.theory-document {
  min-width: 0;
}

.theory-document > p:first-child {
  margin-top: 0;
  font-size: clamp(21px, 3vw, 29px);
  line-height: 1.45;
}

.theory-document h2 {
  margin: 72px 0 18px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.05;
  font-weight: 500;
  scroll-margin-top: 76px;
}

.theory-document h3 {
  margin: 42px 0 12px;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 600;
  scroll-margin-top: 76px;
}

.theory-document p,
.theory-document li {
  font-size: 17px;
}

.theory-document pre {
  overflow-x: auto;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--soft);
}

.theory-document code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.theory-experiment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
  align-items: end;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(42px, 7vw, 84px);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.theory-experiment h2 {
  margin: 10px 0 12px;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1;
  font-weight: 500;
}

.theory-experiment p:not(.eyebrow) {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  font-size: 19px;
}

.theory-experiment > a {
  white-space: nowrap;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  text-decoration: none;
}

.hero .coupled-entry {
  margin-top: 22px;
  font-size: 15px;
  font-style: normal;
  letter-spacing: 0.04em;
}

.hero .coupled-entry a {
  display: inline-flex;
  padding: 9px 14px;
  border: 1px solid rgba(248, 240, 228, 0.35);
  border-radius: 999px;
  text-decoration: none;
}

.coupled-page {
  width: min(var(--max), calc(100% - 48px));
  margin: 0 auto;
  padding: 72px 0 90px;
}

.coupled-hero {
  max-width: 820px;
  margin-bottom: 42px;
}

.coupled-hero h1 {
  margin: 4px 0 16px;
  font-family: Optima, "Optima nova", Candara, "Trebuchet MS", sans-serif;
  font-size: clamp(46px, 7vw, 88px);
  line-height: 0.96;
  font-weight: 500;
  letter-spacing: 0.025em;
}

.coupled-hero > p:last-child {
  max-width: 740px;
  color: var(--muted);
  font-size: clamp(18px, 2.4vw, 24px);
}

.eyebrow,
.panel-label {
  margin: 0;
  color: var(--accent-2);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.coupled-runner {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: 0 18px 50px rgba(66, 45, 23, 0.07);
}

.runner-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px 20px;
  border-bottom: 1px solid var(--line);
}

.runner-heading h2 {
  margin: 4px 0 0;
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 500;
}

.runner-toggle {
  min-width: 76px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: var(--paper);
  font: 600 13px/1 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
}

.coupled-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.coupled-steps button {
  min-width: 0;
  min-height: 82px;
  padding: 12px 8px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font: 600 11px/1.25 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
}

.coupled-steps button:last-child { border-right: 0; }

.coupled-steps button span {
  display: block;
  width: 20px;
  height: 20px;
  margin: 0 auto 7px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 10px;
  line-height: 18px;
}

.coupled-steps button.active {
  color: #fffaf1;
  background: var(--accent);
}

.coupled-views {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 340px;
}

.read-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 5vw, 64px);
}

.language-panel {
  border-right: 1px solid var(--line);
  background: rgba(253, 248, 239, 0.7);
}

.language-panel h3 {
  margin: 20px 0 8px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  font-weight: 500;
}

.language-line {
  max-width: 520px;
  margin: 12px 0 28px;
  font-size: clamp(21px, 2.7vw, 31px);
  line-height: 1.35;
}

.term-link {
  align-self: flex-start;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  text-decoration: none;
}

.formula-panel {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 18%, rgba(77, 98, 92, 0.14), transparent 55%),
    linear-gradient(145deg, rgba(237, 230, 217, 0.52), rgba(247, 239, 226, 0.86));
}

.formula-panel::after {
  content: "cross";
  position: absolute;
  right: -8px;
  bottom: -28px;
  color: rgba(77, 98, 92, 0.055);
  font: 700 clamp(70px, 12vw, 150px)/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.06em;
  pointer-events: none;
}

.formula-line {
  position: relative;
  z-index: 1;
  margin: 30px 0 18px;
  color: rgba(36, 35, 31, 0.74);
  font-family: "Iowan Old Style", Charter, Georgia, serif;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.08;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.formula-shade {
  position: relative;
  z-index: 1;
  max-width: 440px;
  color: var(--muted);
  font-size: 17px;
  font-style: italic;
}

.index-relations {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.index-relations > div {
  padding: 20px 26px;
  background: rgba(255, 255, 255, 0.62);
}

.index-relations p:last-child {
  margin-bottom: 0;
}

.coupled-note {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 48px;
  align-items: start;
  padding: 42px 12px 0;
  color: var(--muted);
}

.coupled-note p { margin: 0; }

.coupled-whole {
  color: var(--ink);
  font-size: clamp(24px, 3.6vw, 42px);
  line-height: 1.28;
}

@media (max-width: 780px) {
  .layout {
    display: block;
  }

  .sidebar {
    position: static;
    margin-bottom: 28px;
  }

  .hero {
    min-height: 56vh;
    padding-top: 82px;
    grid-template-columns: 1fr;
  }

  .hero nav {
    left: 20px;
    right: 20px;
    justify-content: flex-start;
  }

  .hero h1 {
    font-size: clamp(38px, 12vw, 54px);
    white-space: normal;
  }

  .hero p {
    font-size: 19px;
  }

  .trace-modes {
    grid-template-columns: 1fr;
  }

  .local-trace {
    grid-template-columns: 1fr;
  }

  .theory-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 48px 22px 42px;
  }

  .theory-hero h1 {
    margin-top: 46px;
    font-size: clamp(54px, 18vw, 82px);
    line-height: 0.82;
  }

  .theory-lede { margin-top: 38px; }

  .theory-actions { margin-top: 34px; }

  .theory-primitives {
    grid-template-columns: 1fr;
    border: 0;
  }

  .theory-primitives article {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .theory-primitives h2 { margin-top: 24px; }

  .theory-tact { padding: 50px 24px; }

  .theory-body {
    display: block;
    padding: 54px 22px;
  }

  .theory-toc {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 54px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.46);
  }

  .theory-toc .eyebrow { grid-column: 1 / -1; }

  .theory-document h2 { margin-top: 58px; }

  .theory-experiment {
    grid-template-columns: 1fr;
    margin: 0 14px;
    padding: 40px 24px;
  }

  .coupled-page {
    width: min(100% - 28px, var(--max));
    padding-top: 44px;
  }

  .runner-heading { align-items: center; }

  .coupled-steps {
    display: flex;
    overflow-x: auto;
  }

  .coupled-steps button {
    flex: 0 0 108px;
    border-bottom: 0;
  }

  .coupled-views,
  .index-relations,
  .coupled-note {
    grid-template-columns: 1fr;
  }

  .language-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .coupled-note { gap: 22px; }

  .formula-line {
    font-size: clamp(25px, 7.4vw, 42px);
    white-space: normal;
    overflow-wrap: anywhere;
  }

}