:root {
  color-scheme: light;
  --bg: #fff;
  --card: #fff;
  --card-2: #f7f8f9;
  --text: #17191c;
  --muted: #5d636b;
  --line: #dfe2e5;
  --blue: #075ea8;
  --mint: #167a65;
  --yellow: #8a6200;
  --coral: #b43c32;
  --max: 780px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 98px; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
a { color: var(--blue); text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.shell { width: min(calc(100% - 40px), var(--max)); margin-inline: auto; }
.skip {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10;
  padding: 7px 10px;
  color: #fff;
  background: var(--blue);
  transform: translateY(-150%);
}
.skip:focus { transform: none; }

.site-header { border: 0; }
.nav { min-height: 79px; display: flex; align-items: center; justify-content: space-between; gap: 30px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 750; text-decoration: none; }
.brand b {
  display: none;
}
.text-button { min-height: 44px; padding: 0; border: 0; color: var(--muted); background: none; cursor: pointer; font-weight: 700; }
.text-button:hover { color: var(--text); }

.chapter-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(12px);
}
.chapter-nav ol {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  margin-block: 0;
  padding: 0;
  list-style: none;
}
.chapter-nav li + li { border-left: 0; }
.chapter-nav a { display: grid; gap: 1px; min-width: 0; padding: 11px 8px; color: var(--muted); text-decoration: none; }
.chapter-nav b { color: var(--muted); font: 700 9px/1.5 ui-monospace, monospace; }
.chapter-nav span { overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 750; text-overflow: ellipsis; }
.chapter-nav a:hover span, .chapter-nav a[aria-current="true"] span, .chapter-nav a[aria-current="true"] b { color: var(--blue); }

.hero { padding-block: 82px 72px; }
.eyebrow {
  margin: 0 0 14px;
  color: var(--muted);
  font: 700 12px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: .07em;
  text-transform: uppercase;
}
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.025em; }
h1 { max-width: 760px; margin-top: 13px; font-size: clamp(42px, 8vw, 66px); font-weight: 720; }
h1 span { color: var(--text); }
h2 { font-size: clamp(34px, 5vw, 44px); font-weight: 720; }
h3 { font-size: 26px; }
.lede { max-width: 720px; margin: 24px 0 30px; color: #373c42; font-size: clamp(20px, 3vw, 25px); line-height: 1.5; }
.hero-meta { display: inline-block; margin: 0 0 0 18px; color: var(--muted); font-size: 12px; }
.button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 2px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.button { padding: 10px 16px; border: 1px solid var(--blue); color: #fff; background: var(--blue); }
.secondary-button { padding: 8px 12px; border: 1px solid #aeb4ba; color: var(--text); background: #fff; font-size: 12px; }
.secondary-button:hover { border-color: var(--blue); }
.secondary-button:disabled { opacity: .45; cursor: not-allowed; }

.section { padding-block: 58px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.copy { max-width: 760px; color: var(--muted); font-size: 19px; }
.copy strong { color: var(--text); }

.workflow { display: grid; grid-template-columns: repeat(3, 1fr); margin: 34px 0 0; padding: 0; border-block: 1px solid var(--line); list-style: none; background: var(--card); }
.workflow li { min-width: 0; padding: 20px; border-bottom: 1px solid var(--line); }
.workflow li:not(:nth-child(3n + 1)) { border-left: 1px solid var(--line); }
.workflow li:nth-last-child(-n + 3) { border-bottom: 0; }
.workflow i, .workflow b, .workflow span { display: block; }
.workflow i { margin-bottom: 14px; color: var(--blue); font: normal 700 10px ui-monospace, monospace; }
.workflow b { font-size: 14px; }
.workflow span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.workflow .dns-stage { position: relative; background: #f6f9fc; }
.workflow .dns-stage::after { content: "DNS happens here"; display: inline-block; margin-top: 12px; padding: 2px 0; border-bottom: 1px solid var(--blue); color: var(--blue); font: 700 8px ui-monospace, monospace; letter-spacing: .05em; text-transform: uppercase; }
.sequence-note { margin: 20px 0 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--text); color: var(--muted); font-size: 13px; }
.sequence-note strong { color: var(--text); }
.route-heading { margin-top: 42px; }
.route-heading .eyebrow { margin-bottom: 7px; }
.route-card { position: relative; margin-top: 34px; padding: 8px 0 0 22px; overflow: hidden; border-left: 3px solid var(--text); background: var(--card); }
.overview-controls { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.overview-dns { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-bottom: 22px; }
.overview-dns-wire { position: relative; height: 38px; overflow: hidden; border-block: 1px solid var(--line); }
.overview-dns-wire i { position: absolute; top: 50%; left: 0; z-index: 1; min-width: 82px; padding: 3px 6px; color: #fff; background: var(--blue); font: normal 800 8px ui-monospace, monospace; text-align: center; opacity: 0; transform: translateY(-50%); }
.overview-dns-wire .overview-dns-answer { background: var(--mint); }
.route { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin: 0; padding: 0; list-style: none; }
.route li { min-width: 0; }
.route li:not(:first-child) { padding-left: 16px; border-left: 1px solid var(--line); }
.route i { display: block; margin-bottom: 24px; color: var(--blue); font: normal 700 10px ui-monospace, monospace; }
.route b, .route span { display: block; }
.route span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.route-line { position: relative; width: calc(75% - 16px); height: 2px; margin: 22px auto 10px; background: var(--line); }
.traveller {
  position: absolute;
  top: 50%;
  left: 0;
  min-width: 48px;
  padding: 3px 5px;
  border-radius: 2px;
  color: #fff;
  background: var(--blue);
  font: 800 9px ui-monospace, monospace;
  text-align: center;
  transform: translate(-50%, -50%);
  opacity: 0;
}
.response-token { background: var(--mint); }
.route-note { margin: 20px 0 0; color: var(--muted); font-size: 12px; }
.route-note strong { color: var(--text); }

.lesson-heading { max-width: 760px; }
.lesson-grid { display: grid; grid-template-columns: 1fr; gap: 30px; margin-top: 38px; align-items: start; }
.lead { max-width: 690px; margin: 0; color: #373c42; font-size: 20px; }
.performance-intro { max-width: 760px; margin-top: 24px; }
.takeaway { margin-top: 28px; padding-left: 16px; border-left: 3px solid var(--text); color: var(--muted); }
.takeaway b { display: block; color: var(--blue); font: 700 10px/1.8 ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
details { margin-top: 26px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
summary { min-height: 48px; padding: 12px 0; color: var(--blue); cursor: pointer; font-weight: 800; }
details p { margin-top: 0; color: var(--muted); }

.demo { min-width: 0; padding: 8px 0 0 22px; border-left: 3px solid var(--text); background: var(--card); }
.demo-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.demo-head > span, .step-count { color: var(--blue); font: 700 10px/1.5 ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.status { margin: 22px 0 0; padding: 15px 0 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.mini-route { position: relative; display: flex; align-items: center; min-height: 100px; }
.mini-route b { flex: 0 0 auto; padding: 12px; border: 1px solid var(--line); border-radius: 2px; background: var(--card-2); font-size: 12px; }
.mini-route i { flex: 1 1 20px; height: 2px; background: var(--line); }
.mini-route .local-medium { position: relative; height: 34px; background: none; }
.local-medium::before { content: ""; position: absolute; top: 50%; right: 0; left: 0; transform: translateY(-50%); }
.local-medium span { position: absolute; right: 0; bottom: 24px; left: 0; color: var(--muted); font: normal 700 8px ui-monospace, monospace; text-align: center; white-space: nowrap; }
.local-route[data-link="wifi"] .local-medium::before { height: 12px; border-block: 2px dashed var(--blue); border-radius: 50%; }
.local-route[data-link="wifi"] .local-packet { background: var(--blue); }
.local-route[data-link="ethernet"] .local-medium::before { height: 4px; border-radius: 3px; background: var(--mint); box-shadow: 0 -4px 0 rgb(120 216 189 / 22%), 0 4px 0 rgb(120 216 189 / 22%); }
.local-route[data-link="ethernet"] .local-medium span { color: var(--mint); }
.mini-route .message { position: absolute; top: 50%; left: 0; z-index: 1; padding: 4px 8px; border-radius: 2px; color: #fff; background: var(--blue); font: 800 9px ui-monospace, monospace; opacity: 0; pointer-events: none; }
.local-packet { position: absolute; top: 50%; left: 0; z-index: 1; padding: 4px 7px; border-radius: 2px; color: #fff; background: var(--mint); font: 800 8px ui-monospace, monospace; opacity: 0; pointer-events: none; }
.motion-action { margin-top: 12px; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 12px; color: var(--text); font-weight: 800; }
.choice-row { display: flex; flex-wrap: wrap; gap: 10px; }
.choice-row legend { width: 100%; }
.choice-row label, .controls fieldset > label { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--muted); }
input { accent-color: var(--blue); }
.button-group { display: flex; flex-wrap: wrap; gap: 8px; }

.prediction { max-width: 690px; margin-top: 28px; padding-block: 22px; border-block: 1px solid var(--line); }
.prediction fieldset { display: grid; gap: 7px; }
.prediction legend { font-size: 15px; }
.prediction label { display: flex; align-items: flex-start; gap: 9px; padding: 7px 10px; border-left: 2px solid transparent; color: var(--muted); cursor: pointer; font-size: 14px; }
.prediction label:has(input:checked) { border-left-color: var(--blue); color: var(--text); background: #f6f9fc; }
.prediction label.correct:has(input:checked) { border-left-color: var(--mint); color: var(--mint); background: #eef8f5; }
.prediction label.incorrect:has(input:checked) { border-left-color: var(--coral); color: var(--coral); background: #fff0ee; }
.prediction label.correct input { accent-color: var(--mint); }
.prediction label.incorrect input { accent-color: var(--coral); }
.prediction .secondary-button { margin-top: 16px; }
.prediction-feedback { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.prediction-feedback.correct { color: var(--mint); }
.prediction-feedback.incorrect { color: var(--coral); }

.packets { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.packet-path, .dns-motion { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-bottom: 18px; }
.motion-endpoint { padding: 7px; border: 1px solid var(--line); border-radius: 2px; background: var(--card-2); font-size: 9px; font-weight: 800; }
.packet-wire, .dns-wire { position: relative; height: 38px; overflow: hidden; border-block: 1px solid var(--line); }
.packet-wire i, .dns-wire i { position: absolute; top: 50%; left: 0; min-width: 25px; padding: 3px 5px; border-radius: 2px; background: var(--blue); color: #fff; font: normal 900 8px ui-monospace, monospace; text-align: center; opacity: 0; transform: translateY(-50%); }
.packets span { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 2px; background: var(--card-2); font-weight: 800; transition: opacity .2s, transform .2s, border-color .2s; }
.packets i { color: var(--blue); font: normal 700 8px ui-monospace, monospace; }
.packets span.lost { border-color: var(--coral); opacity: .22; transform: translateY(6px); }

.dns-demo { text-align: center; }
.lookup-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-bottom: 24px; }
.lookup-row code, .lookup-row output { min-width: 0; padding: 18px 10px; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 2px; background: var(--card-2); color: var(--text); }
.lookup-row output { color: var(--mint); font: 800 13px ui-monospace, monospace; }
.dns-wire i { min-width: 54px; }
.dns-wire .dns-response { background: var(--mint); }

.route-choice svg { display: block; width: 100%; height: auto; }
.route-base, .route-flow { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.route-base { stroke: var(--line); stroke-width: 4; }
.primary-path { stroke: var(--blue); }
.alternate-path { stroke-dasharray: 7 8; }
.route-flow { stroke: var(--blue); stroke-width: 9; stroke-dasharray: 3 97; }
.route-choice.playing .route-flow { animation: route-flow 3s linear 1 both; }
.alternate-flow { display: none; stroke: var(--mint); }
.route-node rect { fill: var(--card-2); stroke: var(--line); stroke-width: 2; rx: 2; }
.route-node text { fill: var(--text); font: 800 13px system-ui, sans-serif; text-anchor: middle; }
.route-node .node-role { fill: var(--muted); font: 700 9px ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.route-path-label text { fill: var(--text); font: 800 13px system-ui, sans-serif; text-anchor: middle; }
.route-path-label .node-role { fill: var(--muted); font: 700 9px ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.route-hop { fill: #fff; stroke: var(--blue); stroke-width: 4; }
.route-choice.failed .primary-path { stroke: var(--coral); stroke-dasharray: 7 8; }
.route-choice.failed .primary-node .route-hop { stroke: var(--coral); }
.route-choice.failed .primary-node text { fill: var(--coral); }
.route-choice.failed .alternate-path { stroke: var(--mint); stroke-dasharray: none; }
.route-choice.failed .alternate-node .route-hop { stroke: var(--mint); }
.route-choice.failed .primary-flow { display: none; }
.route-choice.failed .alternate-flow { display: block; }
.route-choice.converging .primary-path { stroke: var(--coral); stroke-dasharray: 7 8; }
.route-choice.converging .primary-node .route-hop { stroke: var(--coral); }
.route-choice.converging .primary-node text { fill: var(--coral); }
.route-choice.converging .route-flow { display: none; }
@keyframes route-flow { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
.switch { display: flex; align-items: center; gap: 9px; min-height: 44px; color: var(--muted); }
.model-note { margin: 4px 0 0; color: var(--muted); font-size: 11px; }

.transport-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.transport-cards legend { grid-column: 1 / -1; }
.transport-cards label { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; padding: 16px; border: 1px solid var(--line); border-radius: 2px; cursor: pointer; }
.transport-cards input { grid-row: 1 / 3; }
.transport-cards b { font-size: 13px; }
.transport-cards span { color: var(--muted); font-size: 11px; }
.transport-cards label:has(input:checked) { border-color: var(--blue); background: #f6f9fc; }
.transport-output { border-top: 1px solid var(--line); }
.transport-result-head { display: grid; gap: 5px; padding: 22px 24px; }
.transport-result-head .eyebrow { margin: 0; }
.transport-result-head strong { font-size: 16px; }
.transport-result-head > span:last-child { color: var(--muted); font-size: 12px; }
.transport-journey { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 4px 24px 22px; }
.transport-endpoint { padding: 8px; border: 1px solid var(--line); border-radius: 2px; background: var(--card-2); font-size: 9px; font-weight: 800; }
.transport-lanes { display: grid; gap: 7px; min-width: 0; }
.transport-lane { position: relative; height: 26px; border-block: 1px solid var(--line); overflow: hidden; }
.transport-lane > span { position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; color: var(--muted); font: 700 8px ui-monospace, monospace; letter-spacing: .04em; text-transform: uppercase; }
.transport-lane i { position: absolute; z-index: 2; top: 4px; left: 0; min-width: 42px; padding: 3px 5px; border-radius: 2px; background: var(--blue); color: #fff; font: 900 8px ui-monospace, monospace; text-align: center; opacity: 0; }
.transport-output[data-mode="quic"] .transport-lane i { background: var(--mint); }
.transport-events { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding: 0 24px 24px; list-style: none; }
.transport-events li { display: grid; grid-template-columns: 22px 1fr; gap: 7px; padding: 10px; border: 1px solid var(--line); }
.transport-events li + li { border-left: 0; }
.transport-events li:first-child { border-radius: 2px 0 0 2px; }
.transport-events li:last-child { border-radius: 0 2px 2px 0; }
.transport-events li > b { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 9px; }
.transport-output[data-mode="quic"] .transport-events li > b { background: var(--mint); }
.transport-events strong, .transport-events span { display: block; }
.transport-events strong { margin-bottom: 3px; font-size: 10px; }
.transport-events span { color: var(--muted); font-size: 9px; }

.stepper { min-height: 250px; }
.stepper h3 { margin: 10px 0 14px; }
.stepper > p:not(.step-count) { color: var(--muted); }
.stepper-heading { align-items: start; margin-bottom: 24px; }
.stepper-heading h3 { max-width: 540px; }
.journey-stages { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; border-block: 1px solid var(--line); }
.journey-stages li { min-width: 0; }
.journey-stages button { width: 100%; min-height: 54px; padding: 7px 3px; overflow: hidden; border: 0; border-left: 1px solid var(--line); color: var(--muted); background: #fff; cursor: pointer; font: 700 9px/1.3 ui-monospace, monospace; text-overflow: ellipsis; }
.journey-stages i, .journey-stages span { display: block; }
.journey-stages i { margin-bottom: 3px; font-style: normal; }
.journey-stages li:first-child button { border-left: 0; }
.journey-stages button:hover { color: var(--blue); }
.journey-stages button[aria-current="step"] { color: #fff; background: var(--blue); }
progress { display: block; width: 100%; height: 4px; border: 0; background: var(--line); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--blue); }
progress::-moz-progress-bar { background: var(--blue); }
.journey-detail { min-height: 240px; padding-block: 28px 12px; }
.journey-detail > p:not(.step-count) { max-width: 650px; color: var(--muted); }
.journey-detail dl { display: grid; grid-template-columns: 1fr 1fr; margin: 24px 0 0; border-top: 1px solid var(--line); }
.journey-detail dl div { padding: 13px 14px 0 0; }
.journey-detail dl div + div { padding-left: 14px; border-left: 1px solid var(--line); }
.journey-detail dt { color: var(--muted); font: 700 10px/1.5 ui-monospace, monospace; letter-spacing: .07em; text-transform: uppercase; }
.journey-detail dd { margin: 5px 0 0; color: #373c42; font-size: 13px; }
.stepper-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.experiment-guide { margin-top: 34px; padding: 4px 0 4px 22px; border-left: 3px solid var(--text); }
.experiment-guide h3 { margin: 4px 0 8px; font-size: 24px; }
.experiment-guide > p:not(.eyebrow) { max-width: 660px; margin: 0; color: var(--muted); }
.experiment-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

.playground { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); margin-top: 38px; border-block: 1px solid var(--line); background: var(--card); }
.controls { padding: 28px 28px 28px 0; border-right: 1px solid var(--line); }
.controls fieldset + fieldset { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.controls legend { font-size: 13px; }
.controls label { font-size: 13px; }
.sliders label { display: block !important; margin-bottom: 18px; }
.sliders label span { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.sliders label small { display: block; margin-top: -3px; color: var(--muted); font-size: 10px; }
.sliders output { color: var(--blue); font: 700 11px ui-monospace, monospace; }
input[type="range"] { width: 100%; min-height: 30px; }
.run-actions { display: flex; gap: 10px; margin-top: 10px; }
.run-button { flex: 1; width: 100%; }
.result-panel { min-width: 0; padding: 34px; }
.result-empty { display: grid; place-items: center; min-height: 100%; color: var(--muted); text-align: center; }
.result-empty b, .result-empty span { display: block; }
.result-empty b { color: var(--text); }
.result-total { display: block; color: var(--blue); font-size: clamp(42px, 6vw, 64px); line-height: 1; letter-spacing: -.05em; }
.result > p:not(.eyebrow) { color: var(--muted); }
.result dl { display: grid; grid-template-columns: 1fr 1fr; margin-block: 28px; border-top: 1px solid var(--line); }
.result dl div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.result dl div:nth-child(odd) { padding-right: 16px; }
.result dl div:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
.result dd { margin: 0; color: var(--text); font: 700 11px ui-monospace, monospace; }
.result h3 { font-size: 18px; }
.event-log { margin: 18px 0 0; padding: 0; list-style: none; }
.event-log li { display: grid; grid-template-columns: 72px 1fr; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.event-log time { color: var(--blue); font: 700 10px/1.6 ui-monospace, monospace; }
.event-log strong, .event-log span { display: block; }
.event-log strong { font-size: 12px; }
.event-log span { color: var(--muted); font-size: 11px; }
.assumption { margin: 18px 0 0; color: var(--muted); font-size: 12px; }
.assumption strong { color: var(--text); }
.finish h2 { max-width: 760px; margin-bottom: 30px; }
footer { color: var(--muted); font-size: 12px; }
footer .shell { padding-block: 30px; }
footer a { color: var(--blue); font-weight: 700; }

@media (max-width: 760px) {
  html { scroll-padding-top: 108px; }
  .shell { width: min(calc(100% - 28px), var(--max)); }
  .nav { min-height: 62px; }
  .chapter-nav ol { display: flex; overflow-x: auto; scrollbar-width: thin; }
  .chapter-nav li { flex: 0 0 auto; }
  .chapter-nav a { min-width: 76px; padding: 10px; }
  .hero { padding-block: 62px; }
  .hero-meta { display: block; margin: 16px 0 0; }
  .section-heading { align-items: start; flex-direction: column; }
  .workflow { grid-template-columns: 1fr 1fr; }
  .workflow li, .workflow li:nth-last-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .workflow li:not(:nth-child(3n + 1)) { border-left: 0; }
  .workflow li:nth-child(even) { border-left: 1px solid var(--line); }
  .workflow li:nth-last-child(-n + 2) { border-bottom: 0; }
  .route-card, .demo { padding: 8px 0 0 16px; }
  .route { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .route li, .route li:not(:first-child) { min-height: 0; padding: 0 0 0 6px; border: 0; border-left: 1px solid var(--line); }
  .route li:first-child { padding-left: 0; border-left: 0; }
  .route i { margin-bottom: 8px; }
  .route b { font-size: 12px; }
  .route span { font-size: 10px; }
  .route-line { width: calc(75% - 8px); }
  .route-note { margin-top: 20px; }
  .playground { grid-template-columns: 1fr; }
  .lesson-grid { gap: 28px; }
  .controls { padding: 26px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .transport-cards { grid-template-columns: 1fr; }
  .result-panel { padding: 26px 22px; }
  .result-empty { min-height: 180px; }
  .result dl { grid-template-columns: 1fr; }
  .result dl div:nth-child(odd), .result dl div:nth-child(even) { padding-inline: 0; border-left: 0; }
}

@media (max-width: 620px) {
  .nav { align-items: flex-start; padding-block: 18px; }
  .section { padding-block: 48px; }
  .overview-controls { align-items: flex-start; flex-direction: column; }
  .journey-stages { display: flex; overflow-x: auto; }
  .journey-stages li { flex: 0 0 74px; }
  .journey-detail dl { grid-template-columns: 1fr; }
  .journey-detail dl div + div { padding-left: 0; border-left: 0; }
}

@media (max-width: 430px) {
  .brand { font-size: 14px; }
  .text-button { font-size: 12px; }
  .demo-head { align-items: start; flex-direction: column; }
  .packets { gap: 3px; }
  .packets span { font-size: 12px; }
  .transport-journey { gap: 6px; padding-inline: 16px; }
  .transport-endpoint { padding-inline: 6px; }
  .transport-events { grid-template-columns: 1fr; }
  .transport-events li + li { border-top: 0; border-left: 1px solid var(--line); }
  .transport-events li:first-child { border-radius: 2px 2px 0 0; }
  .transport-events li:last-child { border-radius: 0 0 2px 2px; }
  .lookup-row { grid-template-columns: 1fr; }
  .lookup-row > span { transform: rotate(90deg); }
  .workflow { grid-template-columns: 1fr; }
  .workflow li, .workflow li:nth-child(even), .workflow li:nth-last-child(-n + 2) { border-right: 0; border-bottom: 1px solid var(--line); border-left: 0; }
  .workflow li:last-child { border-bottom: 0; }
  .stepper-actions .secondary-button { flex: 1 1 calc(50% - 10px); }
  .run-actions { align-items: stretch; flex-direction: column; }
  .event-log li { grid-template-columns: 62px 1fr; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

@media print {
  :root { color-scheme: light; --bg: #fff; --text: #111; --muted: #444; --line: #ccc; --card: #fff; --card-2: #fff; }
  body { background: #fff; }
  .site-header, .chapter-nav, footer, button, .button { display: none; }
  .section { break-inside: avoid; }
}
