/* "How MCP Master Tester works" (how-it-works.html). Loaded after site.css; everything is scoped to
   .hiw so the site header and footer keep their own styles. Colours build on site.css's tokens. */
.hiw {
  --h-fg: var(--text); --h-muted: var(--muted); --h-surface: var(--panel); --h-line: var(--border);
  --h-tint: #eaeff6; --h-band: #e6ecf4; --h-accent-soft: #e4eefc; --h-code-bg: #eef2f8;
  --h-display: var(--sans);
}
@media (prefers-color-scheme: dark) {
  .hiw { --h-tint: #1b2431; --h-band: #171f2b; --h-accent-soft: #13243c; --h-code-bg: #0a0e15; }
}

/* Layout: one reading column, a contents rail beside it on wide screens. */
.hiw { max-width: 1080px; margin: 0 auto; padding: 40px 16px 72px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; }
@media (min-width: 1040px) { .hiw { grid-template-columns: 216px minmax(0, 1fr); gap: 56px; } }
.hiw > main { min-width: 0; max-width: 790px; display: flex; flex-direction: column; gap: 56px; }

/* contents */
.hiw .contents { font-size: 14px; }
.hiw .contents .nav-title { font: 600 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--h-muted); margin: 0 0 10px; }
.hiw .contents ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 0 16px; }
.hiw .contents li { margin: 0; }
.hiw .contents a { display: block; padding: 4px 0; color: var(--h-fg); text-decoration: none; }
.hiw .contents a:hover, .hiw .contents a:focus-visible { color: var(--accent); }
.hiw .contents .group { margin-top: 12px; font: 600 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--h-muted); grid-column: 1 / -1; }
@media (min-width: 1040px) {
  .hiw .contents { position: sticky; top: 80px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; }
  .hiw .contents ol { grid-template-columns: 1fr; }
}

/* header */
.hiw .intro .eyebrow { font: 500 13px var(--mono); color: var(--accent); margin: 0 0 14px; }
.hiw h1 { font: 700 clamp(32px, 5vw, 46px)/1.08 var(--h-display); letter-spacing: -0.02em; margin: 0 0 18px; text-wrap: balance; }
.hiw .lede { font-size: 19px; line-height: 1.55; color: var(--h-muted); margin: 0; max-width: 62ch; }
.hiw .facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 26px 0 0; padding: 16px 0 0; border-top: 1px solid var(--h-line); font-size: 14px; color: var(--h-muted); }
.hiw .facts b { font: 600 14px var(--mono); color: var(--h-fg); font-variant-numeric: tabular-nums; margin-right: 6px; }

/* sections */
.hiw section { display: flex; flex-direction: column; gap: 16px; scroll-margin-top: 80px; }
.hiw h2 { font: 600 27px/1.2 var(--h-display); letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
.hiw h3 { font: 600 18px/1.3 var(--h-display); margin: 14px 0 0; }
.hiw .part { font: 600 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 -8px; }
.hiw p, .hiw ul, .hiw ol { margin: 0; max-width: 68ch; }
.hiw main ul, .hiw main ol { padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.hiw li { margin: 0; }
.hiw strong { font-weight: 600; }
.hiw code { font: 0.875em var(--mono); background: var(--h-code-bg); border: 0; border-radius: 4px; padding: 1px 5px; overflow-wrap: anywhere; }

/* figures: diagrams, code and terminal output */
.hiw figure { margin: 8px 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hiw figcaption { font-size: 13.5px; line-height: 1.5; color: var(--h-muted); max-width: 70ch; }
.hiw figcaption b { color: var(--h-fg); font-weight: 600; }
.hiw .scroll { overflow-x: auto; border: 1px solid var(--h-line); border-radius: 10px; background: var(--h-surface); }
.hiw .scroll.diagram { padding: 18px 14px; }
.hiw .scroll.diagram svg { display: block; width: 100%; min-width: 660px; max-width: 760px; height: auto; margin: 0 auto; color: var(--h-fg); }
.hiw pre { margin: 0; padding: 14px 16px; font: 13px/1.6 var(--mono); background: var(--h-code-bg); color: var(--h-fg); white-space: pre; tab-size: 2; border: 0; border-radius: 0; overflow: visible; }
.hiw pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.hiw .scroll.code { background: var(--h-code-bg); }
.hiw .cap-dir { font: 600 11px var(--mono); letter-spacing: .04em; color: var(--h-muted); padding: 8px 16px 0; background: var(--h-code-bg); }
.hiw .k { color: var(--accent); } .hiw .s { color: var(--ok); } .hiw .n { color: var(--warn); }
.hiw .t-err { color: var(--err); } .hiw .t-warn { color: var(--warn); } .hiw .t-ok { color: var(--ok); } .hiw .t-dim { color: var(--h-muted); }

/* diagram marks, coloured from the same tokens as the page */
.hiw .d-box { fill: var(--h-surface); stroke: var(--h-line); stroke-width: 1.2; }
.hiw .d-box.d-accent { fill: var(--h-accent-soft); stroke: var(--accent); stroke-width: 1.6; }
.hiw .d-box.d-okbox { stroke: var(--ok); } .hiw .d-box.d-warnbox { stroke: var(--warn); } .hiw .d-box.d-errbox { stroke: var(--err); }
.hiw .d-life { stroke: var(--h-line); stroke-width: 1.2; stroke-dasharray: 3 4; }
.hiw .d-band { fill: var(--h-band); }
.hiw .d-note { fill: var(--h-tint); stroke: var(--h-line); stroke-width: 1; }
.hiw .d-head { fill: currentColor; }
.hiw .d-title { font: 600 12.5px var(--sans); fill: var(--h-fg); }
.hiw .d-t { font: 12px var(--sans); fill: var(--h-fg); }
.hiw .d-sub { font: 11px var(--sans); fill: var(--h-muted); }
.hiw .d-code { font: 500 11.5px var(--mono); fill: var(--h-fg); }
.hiw .d-sep { font: 600 10px var(--sans); letter-spacing: .08em; fill: var(--h-muted); }

/* tables */
.hiw table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.5; margin: 0; }
.hiw th, .hiw td { text-align: left; vertical-align: top; padding: 9px 14px; border-bottom: 1px solid var(--h-line); }
.hiw th { font: 600 12px var(--sans); letter-spacing: .04em; color: var(--h-muted); background: var(--h-tint); white-space: nowrap; }
.hiw tr:last-child td { border-bottom: 0; }
.hiw td:first-child { white-space: nowrap; }
.hiw td.wrap { white-space: normal; }
.hiw td code { white-space: nowrap; }
.hiw .tag { display: inline-block; font: 600 11px var(--mono); border: 1px solid currentColor; border-radius: 5px; padding: 0 6px; }
.hiw .tag.ok { color: var(--ok); } .hiw .tag.warn { color: var(--warn); } .hiw .tag.err { color: var(--err); } .hiw .tag.info { color: var(--h-muted); }

.hiw .note { border-left: 3px solid var(--accent); background: var(--h-accent-soft); padding: 12px 16px; border-radius: 0 8px 8px 0; font-size: 15px; max-width: 70ch; }
.hiw .pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.hiw .pair > * { min-width: 0; }
.hiw .closing { border-top: 1px solid var(--h-line); padding-top: 18px; font-size: 13.5px; color: var(--h-muted); }
.hiw :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
