:root {
  --method-input: #9d5d35;
  --method-style: #214f7b;
  --method-context: #b2822f;
  --method-memory: #8b3f55;
  --method-decision: #2c6d61;
  --method-output: #694a78;
}

body.method-page::after {
  opacity: .14;
  filter: grayscale(.4) saturate(.5) blur(1.5px);
}

body.method-page .page-shell { max-width: 1320px; }
body.method-page .page-hero { max-width: 820px; }

.method-flow-host {
  position: relative;
  min-height: 0;
  margin: 34px 0 12px;
  padding: clamp(22px, 4vw, 50px);
  overflow: hidden;
  border: 1px solid #bdb198;
  border-radius: 0;
  background: linear-gradient(135deg, #fffdf7 0%, #f5efe2 100%);
  box-shadow: 0 24px 72px rgb(22 41 63 / .12);
}

.method-flow-host::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 7px;
  height: 100%;
  background: #7b2f3c;
}

.method-static { position: relative; z-index: 1; }
.method-flow-heading { margin-bottom: 30px; }
.method-flow-heading .method-flow-kicker {
  color: #7b2f3c;
  font: 800 1rem/1.3 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.method-flow-heading h2 {
  margin: 5px 0 7px;
  color: #1f3a5f;
  font: 600 clamp(1.8rem, 4vw, 3rem)/1 var(--serif);
  letter-spacing: -.035em;
}
.method-flow-heading p { max-width: 720px; margin: 0; color: #766d5d; font: 1rem/1.65 var(--serif); }

.method-advantage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 22px 0 38px;
  border: 1px solid #c7bba4;
  background: #c7bba4;
}
.method-advantage { padding: 17px 19px; background: rgb(255 253 247 / .92); }
.method-advantage h3 { margin: 0 0 7px; color: #7b2f3c; font: 600 1rem/1.4 var(--serif); }
.method-advantage p { margin: 0; color: #4c5662; font: 1rem/1.65 var(--serif); }

.primary-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    "query guard style"
    ". . down"
    "result verify retrieve";
  gap: 36px 54px;
  align-items: stretch;
}
.flow-query { grid-area: query; }
.flow-input_guard { grid-area: guard; }
.flow-style_encoder { grid-area: style; }
.flow-retrieval { grid-area: retrieve; }
.flow-verification { grid-area: verify; }
.flow-result { grid-area: result; }

.method-card {
  --card-color: var(--method-style);
  position: relative;
  min-height: 0;
  padding: 21px 21px 19px;
  border: 1px solid color-mix(in srgb, var(--card-color) 72%, #aaa);
  border-top: 7px solid var(--card-color);
  background: color-mix(in srgb, var(--card-color) 9%, #fffdf7);
  box-shadow: 0 12px 28px rgb(22 41 63 / .075);
}
.method-card[data-category="input"] { --card-color: var(--method-input); background: #f4e5d8; }
.method-card[data-category="style"] { --card-color: var(--method-style); background: #dbe7f1; }
.method-card[data-category="context"] { --card-color: var(--method-context); background: #f3e4bd; }
.method-card[data-category="data"] { --card-color: var(--method-memory); background: #ead9df; }
.method-card[data-category="decision"] { --card-color: var(--method-decision); background: #d7e8e2; }
.method-card[data-category="output"] { --card-color: var(--method-output); background: #e6dcea; }
.method-card.is-pending { border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; }

.method-card-eyebrow { color: var(--card-color); font: 800 1rem/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.method-card h3 { margin: 8px 0 7px; color: #1d304d; font: 600 1rem/1.4 var(--serif); }
.method-card-signature { margin: 0 0 11px; color: #313c45; font: 700 .72rem/1.5 var(--mono); }
.method-card-detail { margin: 0; color: #5e5a52; font-size: 1rem; line-height: 1.65; }
.method-card-status {
  display: inline-block;
  margin-top: 9px;
  padding: 2px 6px;
  border: 1px solid var(--card-color);
  color: var(--card-color);
  font: 800 .62rem/1.25 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* The main path is a single static snake. These connectors never cross. */
.flow-query::after,
.flow-input_guard::after,
.flow-retrieval::after,
.flow-verification::after {
  content: "→";
  position: absolute;
  top: 50%;
  left: calc(100% + 17px);
  color: #6f6a5f;
  font: 2rem/1 var(--serif);
  transform: translateY(-50%);
}
.flow-retrieval::after,
.flow-verification::after {
  content: "←";
  right: calc(100% + 17px);
  left: auto;
}
.flow-style_encoder::after {
  content: "↓";
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  color: #6f6a5f;
  font: 2rem/1 var(--serif);
  transform: translateX(-50%);
}
.support-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  margin: 43px 0 18px;
  color: #696256;
  font: 800 1rem/1.3 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.support-heading::after { content: ""; height: 1px; background: #cbbfa8; }
.support-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.support-flow .method-card { min-height: 0; }
.support-role { display: block; margin-top: 8px; color: var(--card-color); font: 800 .68rem/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; }

.method-map-caption { max-width: 860px; margin: 10px auto 44px; color: #756c5e; text-align: center; font: italic 1rem/1.65 var(--serif); }

.method-brief {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  min-height: 0;
  margin: 0 0 52px;
  border-top: 1px solid #bfb39c;
  border-bottom: 1px solid #bfb39c;
}
.method-brief article { position: relative; padding: 26px 30px 24px; border-left: 1px solid #cfc4ad; }
.method-brief article:first-child { border-left: 0; }
.method-brief article > span { color: #a8997c; font: 1rem/1.4 var(--serif); }
.method-brief h2 { margin: 8px 0 6px; color: #28476c; font: 600 1rem/1.4 var(--serif); }
.method-brief p { margin: 0; color: #4e5862; font: 1rem/1.65 var(--serif); }

.method-prose { max-width: 780px; margin: 0 auto; }
.method-prose h2 { margin-top: 48px; padding-top: 12px; border-top: 1px solid #d5cbb8; color: #1f3a5f; font: 600 1.42rem/1.2 var(--serif); }
.method-prose p,
.method-prose li { color: #3c4655; }
.method-prose strong {
  color: #29496d;
  box-shadow: inset 0 -.42em #eadfbd;
}
.method-prose code { background: #eee5d3; color: #30435a; }
.method-prose .note { border-color: #c8bda6; background: #eee6d6; color: #374555; }
.method-prose .note.warn { border-color: #d3ba75; background: #f2e6bd; color: #594817; }
.method-prose table { background: #fffdf7; color: #2a3748; }
.method-prose th { background: #e5e0d5; color: #4f5965; }
.method-prose td { color: #2d3948; border-bottom-color: #cfc5b2; }
.method-prose td.num { color: #183c63; font-weight: 700; }
.method-prose .prov { color: #5c6570; }
.method-prose a { color: #315f8d; }
.model-comparison-shell {
  width: min(1120px, calc(100vw - 48px));
  margin: 24px 0 26px 50%;
  transform: translateX(-50%);
}
.method-prose .model-comparison { table-layout: fixed; font-size: 1rem; }
.method-prose .model-comparison th { background: #273e5d; color: #fffaf0; }
.method-prose .model-comparison th:first-child { width: 28%; }
.method-prose .model-comparison th:nth-child(2) { width: 47%; }
.method-prose .model-comparison td:first-child { color: #223d5f; font-family: var(--serif); font-weight: 700; }
.method-prose .model-comparison tr:nth-child(even) td { background: #f2ede2; }
.method-prose .model-comparison .metric-pending { color: #756c5e; font-family: var(--mono); font-size: .78rem; font-weight: 700; }
.performance-figure-shell {
  width: min(1120px, calc(100vw - 48px));
  margin: 24px 0 22px 50%;
  transform: translateX(-50%);
  overflow-x: auto;
}
.method-performance-figure {
  min-width: 760px;
  margin: 0;
  padding: 24px 28px 20px;
  border: 1px solid #c8bda6;
  background: #fffdf7;
  color: #2d3948;
}
.method-performance-figure figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  font: 1rem/1.65 var(--serif);
}
.method-performance-figure figcaption strong { color: #223d5f; box-shadow: none; }
.method-performance-figure figcaption span { color: #5c6570; }
.performance-plot { display: grid; gap: 8px; }
.performance-row {
  display: grid;
  grid-template-columns: minmax(250px, 1.5fr) minmax(350px, 2.7fr) 50px;
  align-items: center;
  gap: 16px;
  min-height: 29px;
  font: 1rem/1.4 var(--serif);
}
.performance-row > strong {
  color: #31455d;
  box-shadow: none;
  font: 700 1rem/1.4 var(--mono);
  text-align: right;
}
.performance-track {
  position: relative;
  display: block;
  height: 20px;
  background: linear-gradient(to right, transparent calc(25% - .5px), #ded6c7 25%, transparent calc(25% + .5px), transparent calc(50% - .5px), #ded6c7 50%, transparent calc(50% + .5px), transparent calc(75% - .5px), #ded6c7 75%, transparent calc(75% + .5px));
  border-left: 1px solid #bdb29f;
  border-right: 1px solid #bdb29f;
}
.performance-ci {
  position: absolute;
  left: var(--lo);
  top: 9px;
  width: calc(var(--hi) - var(--lo));
  height: 2px;
  background: #8090a1;
}
.performance-ci::before,
.performance-ci::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 1px;
  height: 10px;
  background: inherit;
}
.performance-ci::before { left: 0; }
.performance-ci::after { right: 0; }
.performance-point {
  position: absolute;
  left: var(--x);
  top: 5px;
  width: 10px;
  height: 10px;
  border: 2px solid #314f70;
  border-radius: 50%;
  background: #fffdf7;
  transform: translateX(-50%);
}
.performance-row.deployed > span:first-child,
.performance-row.deployed > strong { color: #7a2838; }
.performance-row.deployed .performance-ci { background: #9a3b4c; }
.performance-row.deployed .performance-point { border-color: #7a2838; background: #7a2838; }
.performance-row.numerical-best .performance-point { border-color: #28476c; background: #fffdf7; }
.performance-axis {
  display: flex;
  justify-content: space-between;
  margin: 0 66px 0 calc(37.5% + 3px);
  color: #756c5e;
  font: 1rem/1.4 var(--mono);
}
.performance-key {
  display: flex;
  justify-content: flex-end;
  gap: 22px;
  margin-top: 13px;
  color: #5c6570;
  font: 1rem/1.4 var(--serif);
}
.performance-key i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border: 2px solid #28476c;
  border-radius: 50%;
  vertical-align: 0;
}
.performance-key .key-deployed { border-color: #7a2838; background: #7a2838; }
.performance-key .key-numerical { background: #fffdf7; }
.method-prose .performance-table { min-width: 1040px; }
.method-prose .performance-table caption {
  padding: 0 0 9px;
  color: #5c6570;
  font: 1rem/1.65 var(--serif);
  text-align: left;
}
.method-prose .performance-table th:first-child { width: 26%; }
.method-prose .performance-table th:nth-child(2) { width: 19%; }
.method-prose .performance-table th:nth-child(3) { width: 8%; }
.method-prose .performance-table th:nth-child(4) { width: 19%; }
.method-prose .performance-table th:nth-child(5) { width: 8%; }
.method-prose .performance-table th:nth-child(6) { width: 20%; }
.method-prose .performance-table td.num { color: #30435a; font-weight: 600; }
.method-prose .performance-table td.num strong { color: #7a2838; box-shadow: none; }
.method-prose .performance-table .selected-method-row td { background: #eee2da; }
.model-method-guide {
  margin: 24px 0 8px;
  border-top: 1px solid #c8bda6;
}
.model-method-guide > h3 {
  margin: 0;
  padding: 14px 0 11px;
  color: #223d5f;
  font: 600 1rem/1.4 var(--serif);
}
.model-method-guide > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid #d7cdbb;
  border-left: 3px solid #7a2838;
}
.model-method-guide article {
  padding: 15px 18px 16px;
  border-right: 1px solid #d7cdbb;
  border-bottom: 1px solid #d7cdbb;
  background: #fffdf7;
}
.model-method-guide article.deployed { background: #eee2da; }
.model-method-guide h4 {
  margin: 0 0 5px;
  color: #223d5f;
  font: 700 1rem/1.4 var(--serif);
}
.model-method-guide article.deployed h4 { color: #7a2838; }
.model-method-guide p { margin: 0; font: 1rem/1.65 var(--serif); }
.method-prose .performance-record-table th:first-child { width: 25%; }
.method-prose .performance-record-table th:nth-child(2) { width: 29%; }
.method-prose .performance-record-table th:nth-child(3) { width: 46%; }
.method-prose .method-descriptions-table { min-width: 760px; table-layout: fixed; }
.method-prose .method-descriptions-table th:first-child { width: 31%; }
.method-prose .method-descriptions-table th:nth-child(2) { width: 69%; }
.method-prose .method-descriptions-table th,
.method-prose .method-descriptions-table td { padding: 13px 16px; }
.method-prose .method-descriptions-table td:first-child {
  color: #223d5f;
  font: 600 1rem/1.45 var(--serif);
}
.method-prose .method-descriptions-table td:nth-child(2) {
  font: 1rem/1.6 var(--serif);
}
.method-tag {
  display: inline-block;
  padding: 3px 7px;
  border: 1px solid currentColor;
  color: #536273;
  font: 800 1rem/1.4 var(--mono);
  letter-spacing: .055em;
  text-transform: uppercase;
}
.method-tag.selected { background: #d6e8e1; color: #205f51; }
.method-tag.baseline { background: #dce6f0; color: #31577f; }
.method-tag.compared { background: #eee5d4; color: #705a35; }
.method-tag.ablation { background: #f1dfb8; color: #71501d; }
.method-tag.diagnostic { background: #e7deea; color: #664c70; }
.method-tag.evidence { background: #e6ddd4; color: #704a42; }
.method-static-fallback { display: block; width: 100%; height: auto; }
.method-static-note { color: #756c5e; font-size: 1rem; }
.method-flow-error { padding: 30px; color: #756c5e; text-align: center; font-size: 1rem; }

@media (max-width: 900px) {
  .primary-flow { gap: 30px 38px; }
  .method-card { padding: 18px 16px; }
  .flow-query::after,
  .flow-input_guard::after { left: calc(100% + 9px); }
  .flow-retrieval::after,
  .flow-verification::after { right: calc(100% + 9px); }
}

@media (max-width: 680px) {
  .method-flow-host { padding: 25px 18px; }
  .primary-flow { display: flex; flex-direction: column; gap: 34px; }
  .primary-flow .method-card::after {
    content: "↓";
    position: absolute;
    top: calc(100% + 7px);
    right: auto;
    left: 50%;
    color: #6f6a5f;
    font: 2rem/1 var(--serif);
    transform: translateX(-50%);
  }
  .primary-flow .method-card:last-child::after { display: none; }
  .support-flow,
  .method-brief,
  .method-advantage-grid { grid-template-columns: 1fr; }
  .model-method-guide > div { grid-template-columns: 1fr; }
  .support-flow { gap: 13px; }
  .method-brief { min-height: 0; }
  .method-brief article { padding: 28px 18px; border-top: 1px solid #cfc4ad; border-left: 0; }
  .method-brief article:first-child { border-top: 0; }
}

@media print {
  .method-flow-host { box-shadow: none; }
}
