.cxmt-chapter,
.cxmt-chapter * {
  box-sizing: border-box;
}

.cxmt-chapter {
  --cxmt-blue: #0b6cff;
  --cxmt-blue-soft: #eef4ff;
  --cxmt-ink: #111111;
  --cxmt-muted: #5a6573;
  --cxmt-rule: #d8dce3;
  --cxmt-panel: #f8f9fb;
  --cxmt-official: #0a6b3d;
  --cxmt-reported: #6a4a00;
  --cxmt-teardown: #6b3fa0;
  --cxmt-patent: #7a3f1e;
  --cxmt-derived: #205c86;
  --cxmt-unknown: #6b7280;
  width: min(100%, 940px);
  margin: 5rem auto 4rem;
  padding: 3rem 0 0;
  border-top: 3px solid var(--cxmt-ink);
  color: var(--cxmt-ink);
  scroll-margin-top: 92px;
}

.cxmt-chapter a {
  color: #0645d8;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.cxmt-chapter__hero {
  display: grid;
  gap: 1rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--cxmt-rule);
}

.cxmt-chapter__eyebrow {
  margin: 0;
  color: var(--cxmt-blue);
  font: 700 0.78rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cxmt-chapter__hero h2 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(2.35rem, 5vw, 4.4rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.cxmt-chapter__lead {
  max-width: 840px;
  margin: 0;
  color: #2f3742;
  font-size: clamp(1.08rem, 1.8vw, 1.28rem);
  line-height: 1.65;
}

.cxmt-plain-map,
.cxmt-reader-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--cxmt-rule);
  background: var(--cxmt-rule);
}

.cxmt-plain-map article,
.cxmt-reader-map article {
  min-width: 0;
  padding: 1rem;
  background: #ffffff;
}

.cxmt-plain-map span,
.cxmt-reader-map span {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--cxmt-blue);
  font: 700 0.7rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cxmt-plain-map p,
.cxmt-reader-map p {
  margin: 0;
  color: #334155;
  font-size: 0.9rem;
  line-height: 1.55;
}

.cxmt-reader-map {
  margin: 0.35rem 0 0.5rem;
  border-color: #cbd7ec;
  background: #cbd7ec;
}

.cxmt-reader-map article {
  background: #f7faff;
}

.cxmt-chapter__status-row,
.cxmt-chapter__evidence-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cxmt-evidence {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 8px;
  border: 1px solid currentColor;
  background: #ffffff;
  font: 700 0.68rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cxmt-evidence--official { color: var(--cxmt-official); }
.cxmt-evidence--reported { color: var(--cxmt-reported); }
.cxmt-evidence--teardown { color: var(--cxmt-teardown); }
.cxmt-evidence--patent { color: var(--cxmt-patent); }
.cxmt-evidence--derived { color: var(--cxmt-derived); }
.cxmt-evidence--unknown { color: var(--cxmt-unknown); }

.cxmt-chapter__orientation {
  display: grid;
  gap: 10px;
  padding: 1.15rem 1.25rem;
  border-left: 4px solid var(--cxmt-blue);
  background: var(--cxmt-blue-soft);
}

.cxmt-chapter__orientation strong {
  font-size: 1rem;
}

.cxmt-chapter__orientation p {
  margin: 0;
  color: #334155;
  font-size: 0.94rem;
  line-height: 1.6;
}

.cxmt-position {
  display: grid;
  gap: 0.55rem;
  padding: 1.25rem 1.35rem;
  border: 2px solid var(--cxmt-ink);
  background: #ffffff;
  box-shadow: 7px 7px 0 var(--cxmt-blue);
}

.cxmt-position > span {
  color: var(--cxmt-blue);
  font: 700 0.7rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cxmt-position strong {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.35;
}

.cxmt-position p {
  margin: 0;
  color: #334155;
  font-size: 0.96rem;
  line-height: 1.65;
}

.cxmt-chapter__toc {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 1.75rem 0 0;
  border: 1px solid var(--cxmt-rule);
  background: var(--cxmt-rule);
}

.cxmt-chapter__toc a {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
  padding: 11px 12px;
  background: #ffffff;
  color: var(--cxmt-ink);
  text-decoration: none;
}

.cxmt-chapter__toc a:hover,
.cxmt-chapter__toc a:focus-visible {
  background: var(--cxmt-blue-soft);
}

.cxmt-chapter__toc-number {
  color: var(--cxmt-blue);
  font: 700 0.75rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.cxmt-chapter__toc-label {
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.cxmt-step {
  position: relative;
  display: grid;
  gap: 1rem;
  padding: 3.25rem 0 0;
  scroll-margin-top: 92px;
}

.cxmt-step + .cxmt-step {
  margin-top: 3.25rem;
  border-top: 1px solid var(--cxmt-rule);
}

.cxmt-step__header {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.cxmt-step__number {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--cxmt-ink);
  font: 700 0.8rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.cxmt-step__header h3 {
  margin: 0;
  font-size: clamp(1.65rem, 3.1vw, 2.55rem);
  font-weight: 550;
  line-height: 1.08;
  letter-spacing: -0.032em;
}

.cxmt-step__summary {
  grid-column: 2;
  margin: -5px 0 0;
  color: var(--cxmt-muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.cxmt-step p,
.cxmt-step li {
  color: #313946;
  font-size: 1rem;
  line-height: 1.72;
}

.cxmt-step p {
  margin: 0;
}

.cxmt-step ul,
.cxmt-step ol {
  margin: 0;
  padding-left: 1.25rem;
}

.cxmt-step li + li {
  margin-top: 0.45rem;
}

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

.cxmt-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--cxmt-rule);
  background: #ffffff;
}

.cxmt-card h4 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  line-height: 1.3;
}

.cxmt-card p,
.cxmt-card li {
  font-size: 0.9rem;
  line-height: 1.58;
}

.cxmt-card p {
  margin: 0;
}

.cxmt-formula {
  display: grid;
  gap: 10px;
  padding: 1rem 1.1rem;
  border: 1px solid #20242b;
  background: #101318;
  color: #ffffff;
}

.cxmt-formula code,
.cxmt-path {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 500 0.88rem/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.cxmt-formula p {
  color: #dbe5f4;
  font-size: 0.85rem;
  line-height: 1.5;
}

.cxmt-path {
  margin: 0;
  padding: 1rem 1.1rem;
  border: 1px solid #20242b;
  background: #101318;
  color: #ffffff;
}

.cxmt-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--cxmt-rule);
  background: #ffffff;
}

.cxmt-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.cxmt-table th,
.cxmt-table td {
  padding: 0.78rem 0.8rem;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
  font-size: 0.86rem;
  line-height: 1.5;
}

.cxmt-table th {
  background: #f3f5f8;
  color: var(--cxmt-ink);
  font-weight: 750;
}

.cxmt-table tr:last-child td {
  border-bottom: 0;
}

.cxmt-table th:last-child,
.cxmt-table td:last-child {
  border-right: 0;
}

.cxmt-callout {
  display: grid;
  gap: 8px;
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--cxmt-blue);
  background: var(--cxmt-blue-soft);
}

.cxmt-callout strong {
  color: var(--cxmt-ink);
}

.cxmt-callout p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.58;
}

.cxmt-callout--warning {
  border-left-color: #a15c00;
  background: #fff8e8;
}

.cxmt-callout--unknown {
  border-left-color: #687181;
  background: #f5f6f8;
}

.cxmt-known-unknown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.cxmt-known-unknown > section {
  padding: 1rem;
  border: 1px solid var(--cxmt-rule);
}

.cxmt-known-unknown h4 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
}

.cxmt-source-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cxmt-source-list li {
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--cxmt-rule);
  background: #ffffff;
  font-size: 0.84rem;
  line-height: 1.5;
}

.cxmt-source-list strong {
  display: block;
  margin-bottom: 3px;
  color: var(--cxmt-ink);
}

.cxmt-source-list span {
  color: var(--cxmt-muted);
}

.cxmt-chapter-nav,
.cxmt-chapter-nav-restore {
  --cxmt-blue: #0b6cff;
  --cxmt-blue-soft: #eef4ff;
  --cxmt-ink: #111111;
}

.cxmt-chapter-nav {
  position: sticky;
  top: 74px;
  z-index: 4;
  display: grid;
  gap: 9px;
  min-width: 0;
  margin: 0 0 13px;
  padding: 11px;
  border: 1px solid #b9c9e8;
  border-left: 4px solid var(--cxmt-blue);
  background: rgba(246, 249, 255, 0.98);
  backdrop-filter: blur(10px);
}

.cxmt-chapter-nav__header {
  display: flex;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
  min-width: 0;
}

.cxmt-chapter-nav__heading {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cxmt-chapter-nav__controls {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
}

.cxmt-chapter-nav__control,
.cxmt-chapter-nav-restore {
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid #b9c9e8;
  border-radius: 0;
  background: #ffffff;
  color: #263244;
  font: 700 10px/1.25 Arial, sans-serif;
  cursor: pointer;
}

.cxmt-chapter-nav__control:hover,
.cxmt-chapter-nav__control:focus-visible,
.cxmt-chapter-nav-restore:hover,
.cxmt-chapter-nav-restore:focus-visible {
  border-color: var(--cxmt-blue);
  background: var(--cxmt-blue-soft);
  color: #0b4eb9;
  outline: 2px solid transparent;
}

.cxmt-chapter-nav__control--remove {
  color: #5b6472;
}

.cxmt-chapter-nav__content {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.cxmt-chapter-nav__content[hidden] {
  display: none;
}

.cxmt-chapter-nav-restore {
  position: sticky;
  top: 74px;
  z-index: 4;
  display: block;
  width: 100%;
  margin: 0 0 13px;
  border-left: 4px solid #0b6cff;
  text-align: left;
}

.cxmt-chapter-nav__date,
.cxmt-chapter-nav__title,
.cxmt-chapter-nav__status {
  margin: 0;
}

.cxmt-chapter-nav__date {
  color: var(--cxmt-blue);
  font: 700 10px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cxmt-chapter-nav__title {
  color: var(--cxmt-ink);
  font: 750 13px/1.35 Arial, sans-serif;
}

.cxmt-chapter-nav__status {
  color: #55657a;
  font-size: 11px;
  line-height: 1.4;
}

.cxmt-chapter-nav__jump {
  display: block;
  padding: 8px 9px;
  border: 1px solid #b9c9e8;
  background: #ffffff;
  color: var(--cxmt-ink);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
  text-decoration: none;
}

.cxmt-chapter-nav__jump:hover,
.cxmt-chapter-nav__jump:focus-visible {
  border-color: var(--cxmt-blue);
  background: var(--cxmt-blue-soft);
}

.cxmt-chapter-nav__steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.cxmt-chapter-nav__steps a {
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid #d8e1f2;
  background: #ffffff;
  color: #263244;
  font: 700 10px/1.35 Arial, sans-serif;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.cxmt-chapter-nav__steps a:hover,
.cxmt-chapter-nav__steps a:focus-visible,
.cxmt-chapter-nav__steps a[aria-current="true"] {
  border-color: var(--cxmt-blue);
  background: var(--cxmt-blue-soft);
  color: #0b4eb9;
}

.cxmt-main-index-link[data-cxmt-featured="true"] {
  color: #0b6cff;
}

.cxmt-main-index-link[data-cxmt-featured="true"]::before {
  width: 11px;
  height: 11px;
  border: 3px solid var(--paper, #ffffff);
  outline: 1px solid #0b6cff;
  background: #0b6cff;
}

.cxmt-top-jump {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 18px;
  align-items: center;
  margin: 1.25rem 0 0;
  padding: 15px 16px;
  border: 1px solid #b9c9e8;
  border-left: 4px solid var(--cxmt-blue);
  background: var(--cxmt-blue-soft);
  color: var(--cxmt-ink);
  text-decoration: none;
}

.cxmt-top-jump:hover,
.cxmt-top-jump:focus-visible {
  border-color: var(--cxmt-blue);
  background: #e7f0ff;
}

.cxmt-top-jump__date {
  grid-column: 1;
  color: var(--cxmt-blue);
  font: 700 0.72rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cxmt-top-jump__title {
  grid-column: 1;
  font-size: 1rem;
  line-height: 1.35;
}

.cxmt-top-jump__copy {
  grid-column: 1;
  color: #4f5f73;
  font-size: 0.86rem;
  line-height: 1.45;
}

.cxmt-top-jump__action {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  color: var(--cxmt-blue);
  font-size: 0.82rem;
  font-weight: 750;
  white-space: nowrap;
}

.cxmt-chapter__footer {
  display: grid;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--cxmt-ink);
}

.cxmt-chapter__footer p {
  margin: 0;
  color: var(--cxmt-muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

@media (max-width: 980px) {
  .cxmt-chapter-nav,
  .cxmt-chapter-nav-restore {
    position: relative;
    top: auto;
  }
}

@media (max-width: 760px) {
  .cxmt-chapter {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .cxmt-chapter__toc,
  .cxmt-plain-map,
  .cxmt-reader-map,
  .cxmt-card-grid,
  .cxmt-known-unknown {
    grid-template-columns: 1fr;
  }

  .cxmt-step__header {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .cxmt-step__number {
    width: 40px;
    height: 40px;
  }

  .cxmt-top-jump {
    grid-template-columns: 1fr;
  }

  .cxmt-top-jump__action {
    grid-column: 1;
    grid-row: auto;
  }

  .cxmt-chapter-nav__header {
    align-items: stretch;
    flex-direction: column;
  }

  .cxmt-chapter-nav__controls {
    width: 100%;
  }

  .cxmt-chapter-nav__control {
    flex: 1 1 0;
  }

  .cxmt-chapter-nav__steps {
    grid-template-columns: 1fr;
  }
}
