/* Components for the WAHS strategy and engine reference pages. */

.strategy-intro {
  padding: 30px 0 36px;
  border-bottom: 1px solid var(--line);
}
.strategy-intro h1 {
  margin: 0;
  max-width: 860px;
  color: var(--purple-ink);
  font: 700 clamp(34px, 4.2vw, 52px)/1.12 Georgia, serif;
  letter-spacing: -0.02em;
}
.strategy-meta {
  margin-top: 14px;
  font-size: 14px;
  color: var(--muted);
}
.strategy-meta a {
  color: var(--purple);
  font-weight: 650;
  text-decoration: none;
}
.strategy-meta a:hover {
  text-decoration: underline;
}
.strategy-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.strategy-nav a {
  display: inline-block;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
  text-decoration: none;
}
.strategy-nav a:hover {
  border-color: var(--purple);
  color: var(--purple);
}
.strategy-section {
  padding: 44px 0;
  border-bottom: 1px solid var(--line);
}
.strategy-section:last-child {
  border-bottom: none;
}
.strategy-section > h2 {
  margin: 0 0 14px;
  color: var(--purple-ink);
  font: 700 clamp(26px, 3vw, 34px)/1.2 Georgia, serif;
}
.strategy-section > p {
  max-width: 860px;
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.6;
  margin: 0;
}
.strategy-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.strategy-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.strategy-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px;
}
.strategy-card.recommended {
  border: 2px solid #4b2e83;
  background: #fcfaff;
}
.strategy-card h3 {
  margin: 0 0 8px;
  font-size: 18.5px;
  color: var(--ink);
}
.strategy-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}
.strategy-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.6;
}
.strategy-card li + li {
  margin-top: 6px;
}
.strategy-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 999px;
  background: #ede9fe;
  color: #4b2e83;
  margin-bottom: 10px;
}
.strategy-badge.secondary {
  background: #e0f2fe;
  color: #0369a1;
}
.strategy-badge.future {
  background: #fef3c7;
  color: #92400e;
}
.strategy-callout {
  margin-top: 22px;
  padding: 18px 22px;
  border-radius: 10px;
  background: #f5f3ff;
  border-left: 4px solid #4b2e83;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}
.strategy-table-wrap {
  overflow-x: auto;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.strategy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}
.strategy-table th,
.strategy-table td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.55;
}
.strategy-table td a {
  color: var(--purple);
  font-weight: 600;
}
.strategy-table th {
  background: var(--soft);
  font-weight: 700;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.strategy-table tr:last-child td {
  border-bottom: none;
}
.strategy-table tr.highlight-row td {
  background: #faf7ff;
}
.score-pill {
  display: inline-block;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: #ede9fe;
  color: #4b2e83;
  font-size: 13px;
}
.safe-pill {
  display: inline-block;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: #dcfce7;
  color: #166534;
  font-size: 12.5px;
}
.code-inline {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  color: #0f172a;
}
.flow-diagram {
  margin-top: 22px;
  padding: 20px 24px;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre;
}
.internals-details {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  padding: 16px 20px;
}
.internals-details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 15.5px;
  color: var(--purple-ink);
}
.internals-details-body {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.internals-details-body > p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  max-width: 860px;
}
@media (max-width: 720px) {
  .strategy-grid-2, .strategy-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------
   Shared layout and components for /wahs/llm-strategy/ and
   /wahs/engine-reference/. Component styles above this line were moved
   unchanged from the strategy page's former inline <style> block.
   ------------------------------------------------------------------ */

/* Two-column document layout with a contents list that stays in view. */
.doc-layout {
  width: min(calc(100% - 48px), var(--page));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}
.doc-body { min-width: 0; }
.doc-body .strategy-section { scroll-margin-top: 16px; }
.doc-body .strategy-section:focus { outline: none; }
.doc-toc {
  position: sticky;
  top: 20px;
  padding: 44px 0 24px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  scroll-target-group: auto;
}
.doc-toc-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.doc-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--line);
}
.doc-toc a {
  display: block;
  margin-left: -2px;
  padding: 7px 0 7px 14px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.35;
  text-decoration: none;
}
.doc-toc a.sub { padding-left: 28px; font-size: 13.5px; }
.doc-toc a:hover { color: var(--purple); }
/* :is() keeps the rule valid where :target-current is not recognised. */
.doc-toc a:is(:target-current, .target-current) {
  color: var(--purple-ink);
  font-weight: 700;
  border-left-color: var(--purple);
}
.doc-toc-more {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}
.doc-toc-more a { display: inline; padding: 0; margin: 0; border: 0; font-size: inherit; color: var(--purple); font-weight: 650; }
.doc-toc-mobile { display: none; }
.back-to-top, .strategy-section > .back-to-top { margin: 0; padding: 20px 0 36px; font-size: 14px; }
.back-to-top a { color: var(--purple); font-weight: 650; text-decoration: none; }

@media (max-width: 960px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .doc-toc { display: none; }
  .doc-toc-mobile {
    display: block;
    margin-top: 20px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--soft);
    padding: 12px 16px;
  }
  .doc-toc-mobile summary { cursor: pointer; font-weight: 700; font-size: 15px; color: var(--purple-ink); }
  .doc-toc-mobile ol { margin: 10px 0 2px; padding-left: 20px; font-size: 15px; line-height: 1.9; }
  .doc-toc-mobile a { color: var(--purple); text-decoration: none; }
}

/* Intro and section headings inside the two-column layout. */
.doc-body .strategy-intro { padding-top: 30px; }
.strategy-section > h2 + p { margin-top: 0; }
.sub-h { margin: 34px 0 10px; font-size: 21px; color: var(--purple-ink); }
.strategy-note, .strategy-section > .strategy-note { margin: 16px 0 0; max-width: 860px; font-size: 14.5px; line-height: 1.6; color: var(--muted); }
.strategy-note a, .qa-links a, .faq a, .status-col a, .facts a { color: var(--purple); font-weight: 600; }
.cite-pill {
  display: inline-block;
  padding: 0 6px;
  border-radius: 6px;
  background: #ede9fe;
  color: var(--purple);
  font: 600 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Decision box and headline numbers. */
.decision {
  margin-top: 26px;
  max-width: 860px;
  border: 2px solid var(--purple);
  border-radius: 14px;
  background: #fcfaff;
  padding: 22px 26px;
}
.decision h2 { margin: 0 0 12px; color: var(--purple-ink); font: 700 21px/1.3 Georgia, serif; }
.decision ol { margin: 0; padding-left: 22px; font-size: 16.5px; line-height: 1.55; }
.decision li + li { margin-top: 9px; }
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
  max-width: 860px;
}
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--paper); }
.stat-value { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.15; color: var(--purple-ink); }
.stat-label { margin: 6px 0 0; font-size: 14.5px; line-height: 1.45; color: var(--muted); }
@media (max-width: 720px) { .stat-row { grid-template-columns: minmax(0, 1fr); } }

/* Who-does-what flow: three boxes in a row, stacked when narrow. */
.flow-wrap { container-type: inline-size; margin-top: 24px; }
.flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.15fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  list-style: none;
  margin: 0;
  padding: 0;
}
.flow-box { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 18px 20px; }
.flow-box.is-focus { border: 2px solid var(--purple); background: #fcfaff; }
.flow-owner { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.flow-box h3 { margin: 4px 0 8px; font-size: 18.5px; color: var(--ink); }
.flow-box ul { margin: 0; padding-left: 18px; font-size: 15px; line-height: 1.55; }
.flow-box li + li { margin-top: 5px; }
.flow-side {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px dashed #b9a6dc;
  border-radius: 10px;
  background: var(--paper);
  font-size: 14.5px;
  line-height: 1.5;
}
.flow-arrow { align-self: center; width: 92px; text-align: center; font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.flow-arrow .arrow { display: block; font-size: 22px; line-height: 1; color: var(--purple); }
.flow-arrow .arrow-v { display: none; }
@container (width < 760px) {
  .flow { grid-template-columns: minmax(0, 1fr); }
  .flow-arrow { width: auto; padding: 2px 0; }
  .flow-arrow .arrow-h { display: none; }
  .flow-arrow .arrow-v { display: block; }
}

/* Numbered walk-through. */
.steps { list-style: none; counter-reset: step; margin: 24px 0 0; padding: 0; max-width: 860px; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 20px 52px; }
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.steps > li::after { content: ""; position: absolute; left: 16px; top: 40px; bottom: 4px; width: 2px; background: var(--line); }
.steps > li:last-child { padding-bottom: 0; }
.steps > li:last-child::after { display: none; }
.steps h3 { margin: 0; padding-top: 5px; font-size: 17.5px; line-height: 1.4; color: var(--ink); }
.steps p { margin: 4px 0 0; font-size: 15.5px; line-height: 1.6; }
.step-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 2px;
  white-space: nowrap;
}

/* What the model receives. */
.prompt-fig { margin: 26px 0 0; max-width: 860px; }
.prompt-part { border: 1px solid var(--line); border-radius: 10px; background: var(--paper); padding: 12px 16px; }
.prompt-part + .prompt-part { margin-top: 8px; }
.prompt-part.is-same { background: #fcfaff; border-color: #cdbfe6; }
.prompt-part.is-changing { background: #fffaf0; border-color: #ecd9a8; }
.prompt-label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.prompt-part pre {
  margin: 6px 0 0;
  white-space: pre-wrap;
  color: var(--ink);
  font: 13.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.prompt-fig figcaption { margin-top: 10px; font-size: 14px; line-height: 1.55; color: var(--muted); }

/* Parallel facts inside approach cards. */
.facts { margin: 0; }
.facts dt { margin-top: 12px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 3px 0 0; font-size: 15px; line-height: 1.55; }

/* Question and answer lists. */
.qa-list { margin: 22px 0 0; max-width: 860px; border-bottom: 1px solid var(--line); }
.qa { padding: 18px 0; border-top: 1px solid var(--line); }
.qa h3 { margin: 0 0 6px; font-size: 17.5px; line-height: 1.4; color: var(--ink); }
.qa p { margin: 0; font-size: 15.5px; line-height: 1.6; }
.qa-links { margin-top: 6px !important; font-size: 14px !important; }
.faq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 24px; }
.faq { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 18px 20px; }
.faq h3 { margin: 0 0 6px; font-size: 16.5px; line-height: 1.4; color: var(--ink); }
.faq p { margin: 0; font-size: 15px; line-height: 1.6; }
.faq p + p { margin-top: 8px; }

/* Before and after chart: one row per model. */
.dumbbell { margin: 24px 0 0; max-width: 860px; container-type: inline-size; }
.db-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.db-key { display: inline-flex; align-items: center; gap: 7px; }
.db-swatch { width: 12px; height: 12px; border-radius: 50%; }
.db-swatch.is-before { background: #fff; border: 2px solid #6b7280; }
.db-swatch.is-after { background: var(--purple); }
.db-rows { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.db-row, .db-axis {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr) 176px;
  gap: 16px;
  align-items: center;
  padding: 9px 10px;
}
.db-row { border-top: 1px solid var(--line); }
.db-row.is-pick { background: #faf7ff; }
.db-name { font-size: 15px; font-weight: 650; line-height: 1.3; }
.db-name small { display: block; font-size: 12.5px; font-weight: 400; color: var(--muted); }
.db-pick { display: inline-block; margin-top: 3px; padding: 1px 7px; border-radius: 999px; background: #ede9fe; color: var(--purple); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.db-track {
  position: relative;
  height: 24px;
  margin: 0 7px;
  background:
    linear-gradient(to right, var(--line) 1px, transparent 1px) 0 0 / 25% 100%,
    linear-gradient(to left, var(--line) 1px, transparent 1px) 100% 0 / 1px 100% no-repeat;
}
.db-link { position: absolute; top: 11px; height: 2px; background: #a892d6; }
.db-link.is-down { background: #b6bac1; }
.db-pt { position: absolute; top: 6px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; box-shadow: 0 0 0 2px #fff; }
.db-row.is-pick .db-pt { box-shadow: 0 0 0 2px #faf7ff; }
.db-pt.is-before { background: #fff; border: 2px solid #6b7280; }
.db-pt.is-after { background: var(--purple); }
.db-val { font-size: 14px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.db-val small { display: block; font-size: 12.5px; color: var(--muted); }
.db-axis { padding-top: 4px; padding-bottom: 0; font-size: 12px; color: var(--muted); }
.db-axis-scale { position: relative; height: 16px; margin: 0 7px; font-variant-numeric: tabular-nums; }
.db-axis-scale span { position: absolute; top: 0; transform: translateX(-50%); }
@container (width < 600px) {
  .db-row, .db-axis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; }
  .db-track, .db-axis-scale { grid-column: 1 / -1; grid-row: 2; }
  .db-val { text-align: right; }
  .db-axis > span:not(.db-axis-scale) { display: none; }
  .db-axis-scale { grid-row: 1; }
}

/* Status columns and glossary. */
.status-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 24px; }
.status-col { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 18px 20px; }
.status-col h3 { margin: 0 0 8px; font-size: 16.5px; color: var(--ink); }
.status-col ul { margin: 0; padding-left: 18px; font-size: 15px; line-height: 1.55; }
.status-col li + li { margin-top: 6px; }
.glossary {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 10px 24px;
  margin: 22px 0 0;
  max-width: 860px;
  font-size: 15px;
  line-height: 1.55;
}
.glossary dt { font-weight: 700; }
.glossary dd { margin: 0; }
@media (max-width: 720px) {
  .glossary { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .glossary dd { margin-bottom: 12px; }
}
.strategy-card h3 a { color: inherit; text-decoration: none; }
.strategy-card h3 a:hover { color: var(--purple); text-decoration: underline; }
.strategy-table-wrap:focus-visible, .flow-diagram:focus-visible, .audit-arch-scroll:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

/* Engine audit report layout helpers, severity pills, and SVG diagram frame. */
.stat-row.four-up {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 100%;
}
@media (max-width: 960px) {
  .stat-row.four-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .stat-row.four-up { grid-template-columns: minmax(0, 1fr); }
}

.sev-pill {
  display: inline-block;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.sev-pill.p0 { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.sev-pill.p1 { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.sev-pill.p2 { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.sev-pill.pr { background: #ede9fe; color: #4b2e83; border: 1px solid #ddd6fe; }

.audit-arch-figure {
  margin: 24px 0 12px;
}
.audit-arch-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  padding: 18px;
  box-shadow: 0 2px 10px rgba(36, 19, 63, 0.05);
}
.audit-arch-svg {
  display: block;
  width: 100%;
  min-width: 860px;
  height: auto;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
.audit-arch-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}
.audit-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.audit-legend-swatch {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  display: inline-block;
}
.audit-arch-figure figcaption {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}
.pillar-link-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}
.pillar-link-list li {
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.5;
}
.pillar-link-list li a {
  color: var(--purple);
  font-weight: 650;
  text-decoration: none;
}
.pillar-link-list li a:hover {
  text-decoration: underline;
}
