/* Work instruction extraction, a document control desk.
   Cool steel desk, white Word pages with a ruler, navy control ink, revision red in the margin.
   Source Sans 3 for the desk, Source Serif 4 only inside documents, Source Code Pro for what the parser writes. */
:root {
  color-scheme: light;
  --desk: #dfe4ea; --desk-2: #cdd5de; --paper: #ffffff; --ink: #1b2f52; --ink-2: #2c4a7c; --text: #1c222b; --muted: #576272;
  --rule: #d6dce3; --rule-2: #b4bfcb; --red: #b42318; --red-soft: #fdeceb; --green: #1d6b46; --green-soft: #e3f1e9;
  --hl: #fff1a6; --hl-line: #d9b800; --term: #13213a; --term-text: #e8edf3; --term-dim: #9daec4;
  --serif: "Source Serif 4", Georgia, serif; --sans: "Source Sans 3", "Segoe UI", sans-serif; --mono: "Source Code Pro", Consolas, monospace;
  --page-shadow: 0 1px 2px rgba(19, 33, 58, .12), 0 14px 30px -20px rgba(19, 33, 58, .45);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--desk); color: var(--text); font: 400 17px/1.55 var(--sans); overflow-x: hidden; }
h1, h2, h3 { font-family: var(--sans); font-weight: 700; color: var(--ink); line-height: 1.12; margin: 0; letter-spacing: -.012em; }
p { margin: 0; }
a { color: var(--ink); text-underline-offset: 3px; }
code { font: 400 0.9em/1 var(--mono); }
:focus-visible { outline: 3px solid var(--ink-2); outline-offset: 2px; }
.wrap { width: min(1240px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: 16px; top: -60px; background: var(--paper); padding: 10px 14px; z-index: 5; }
.skip:focus { top: 12px; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* control bar */
.bar { background: var(--ink); color: #fff; }
.bar .wrap { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; font-size: 15px; }
.bar a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; text-decoration: none; color: #fff; }
.bar a:hover { text-decoration: underline; }
.bar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.bar .docid { font: 400 13px/1.3 var(--mono); color: #b9c7dc; }
.bar .docid b { color: #fff; font-weight: 600; }

/* hero: the template and what it becomes */
.hero { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 48px; align-items: start; padding: 52px 0 28px; }
.kind { display: inline-flex; align-items: center; gap: 10px; font: 600 13px/1.3 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--red); }
.kind::before { content: ""; width: 4px; height: 18px; background: var(--red); }
.hero h1 { font-size: clamp(34px, 4.6vw, 60px); margin: 16px 0 18px; max-width: 15ch; }
.hero .lede { max-width: 58ch; font-size: 18.5px; color: #2b3440; }
.acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px; border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); font: 600 15px/1.2 var(--sans); text-decoration: none; cursor: pointer; border-radius: 2px; }
.btn:hover { background: #eef2f7; }
.btn.solid { background: var(--ink); color: #fff; }
.btn.solid:hover { background: var(--ink-2); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.btn small { font: 400 13px/1 var(--mono); opacity: .8; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.map { position: relative; margin: 0; min-width: 0; }
.map-cap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; font: 600 12.5px/1.4 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.map-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.mini-page { position: relative; z-index: 1; background: var(--paper); box-shadow: var(--page-shadow); padding: 0 0 18px; min-width: 0; }
.ruler { height: 22px; margin-bottom: 14px; border-bottom: 1px solid var(--rule-2); background: linear-gradient(90deg, #eef1f5 0 26px, #fff 26px calc(100% - 26px), #eef1f5 calc(100% - 26px)); position: relative; }
.ruler::after { content: ""; position: absolute; left: 26px; right: 26px; bottom: 0; height: 6px; background: repeating-linear-gradient(90deg, var(--rule-2) 0 1px, transparent 1px 12px); }
.mp { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 0; width: 100%; padding: 6px 18px 6px 0; border: 0; border-left: 3px solid transparent; background: transparent; text-align: left; font: 400 15px/1.5 var(--serif); color: var(--text); cursor: pointer; transition: background-color .15s; }
.mp .pn { font: 400 12px/1.9 var(--mono); color: var(--muted); text-align: right; padding-right: 8px; }
.mp b { font-weight: 600; color: var(--ink); }
.mp:hover { background: #f3f6fa; }
.mp[aria-pressed="true"] { background: var(--hl); border-left-color: var(--hl-line); }
.mp[aria-pressed="true"] .pn { color: var(--text); font-weight: 600; }
.mini-json { position: relative; z-index: 1; margin: 0; padding: 14px 0; background: var(--term); color: var(--term-dim); font: 400 12.5px/1.6 var(--mono); overflow-x: auto; white-space: pre; min-width: 0; box-shadow: var(--page-shadow); }
.mini-json .jk { display: block; padding: 0 16px; border-left: 3px solid transparent; transition: background-color .15s, color .15s; }
.mini-json .jk b { color: #ffd76a; font-weight: 600; }
.mini-json .jk.on { background: rgba(255, 241, 166, .12); border-left-color: #ffd76a; color: #fff; }
.mini-json .pl { padding: 0 16px 0 19px; display: block; }
.wire { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; overflow: visible; }
.wire path { fill: none; stroke: var(--hl-line); stroke-width: 2; }
.wire circle { fill: var(--hl-line); }
.wire .draw { stroke-dasharray: var(--len, 400); stroke-dashoffset: var(--len, 400); animation: wire .5s cubic-bezier(.2, .7, .2, 1) forwards; }
@keyframes wire { to { stroke-dashoffset: 0; } }
.map-note { margin-top: 12px; min-height: 2.9em; font-size: 15px; color: #2b3440; }
.map-note code { color: var(--ink); background: #fff; padding: 1px 5px; border: 1px solid var(--rule); }

/* document properties strip */
.props { margin-top: 8px; }
.fields { margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--paper); box-shadow: var(--page-shadow); border-top: 3px solid var(--ink); }
.fields div { padding: 12px 16px; border-right: 1px solid var(--rule); min-width: 0; }
.fields div:last-child { border-right: 0; }
.fields dt { font: 600 11.5px/1.3 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.fields dd { margin: 3px 0 0; font: 600 15px/1.35 var(--sans); color: var(--ink); overflow-wrap: anywhere; }

/* section headings, numbered like the document they describe */
section { padding: 64px 0 8px; }
.shead { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 0 20px; margin-bottom: 24px; max-width: 980px; }
.shead .no { align-self: start; padding: 4px 0 0; border-right: 3px solid var(--red); font: 600 14px/1.3 var(--mono); color: var(--red); height: 100%; min-height: 40px; }
.shead .no::before { content: "Section "; display: block; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.shead h2 { font-size: clamp(26px, 3.1vw, 38px); }
.shead p { grid-column: 2; margin-top: 10px; max-width: 70ch; color: #36404c; }

/* bench */
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.presets .lab { font: 600 13px/1 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: 4px; }
.pill { min-height: 44px; padding: 6px 14px; border: 1px solid var(--rule-2); background: var(--paper); color: var(--text); font: 600 15px/1.2 var(--sans); cursor: pointer; border-radius: 2px; }
.pill:hover { border-color: var(--ink); }
.pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.bench { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 22px; align-items: start; }
#paper { background: var(--paper); box-shadow: var(--page-shadow); min-width: 0; }
.phead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 14px; padding: 10px 16px; background: #f2f5f9; border-bottom: 1px solid var(--rule); }
.phead h3 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.phead h3::before { content: "W"; display: inline-grid; place-items: center; width: 20px; height: 20px; background: var(--ink-2); color: #fff; font: 700 12px/1 var(--sans); border-radius: 2px; }
.phead .meta { font: 400 13px/1.3 var(--mono); color: var(--muted); }
.ptools { display: flex; flex-wrap: wrap; gap: 8px; }
.ptools .btn { min-height: 40px; font-size: 14px; padding: 6px 12px; }
.ptools.pad { padding: 10px 16px 0; }
.filebtn { position: relative; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.filebtn:focus-within { outline: 3px solid var(--ink-2); outline-offset: 2px; }
.inserts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--rule); background: #f8fafc; font-size: 14px; }
.inserts > span { color: var(--muted); margin-right: 4px; }
.inserts b { color: var(--ink); font-weight: 600; }
.inserts button { min-height: 36px; padding: 4px 10px; border: 1px solid var(--rule-2); background: var(--paper); color: var(--text); font: 400 14px/1.2 var(--sans); cursor: pointer; border-radius: 2px; }
.inserts button:hover { border-color: var(--ink); color: var(--ink); }
#paper .ruler { margin-bottom: 0; }
.hint { padding: 9px 16px 0; font-size: 13px; color: var(--muted); }
.hint kbd { font: 400 12px/1 var(--mono); border: 1px solid var(--rule-2); border-bottom-width: 2px; padding: 2px 5px; border-radius: 3px; background: var(--paper); color: var(--text); }
#doc, #fdoc { padding: 8px 0 22px; }
.para, .fpara { display: grid; grid-template-columns: 44px minmax(0, 1fr) 112px; align-items: start; border-left: 3px solid transparent; transition: background-color .2s; }
.pno { padding: 9px 8px 0 10px; text-align: right; font: 400 13px/1.6 var(--mono); color: var(--muted); }
.pbody { min-width: 0; padding: 2px 0; }
.para textarea { display: block; width: 100%; border: 0; resize: none; overflow: hidden; background: transparent; padding: 6px 8px; font: 400 17px/1.55 var(--serif); color: var(--text); border-radius: 0; }
.para textarea:focus { outline: none; background: #f2f6fb; box-shadow: inset 0 -2px 0 var(--ink-2); }
.fpara p { padding: 6px 8px; font: 400 17px/1.55 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; }
.read { padding: 10px 12px 0 6px; font: 400 12px/1.4 var(--mono); color: var(--muted); text-align: left; }
.read[data-kind="title"], .read[data-kind="safety"] { color: var(--ink); }
.read[data-kind="step"] { color: var(--green); }
.read[data-kind="other"] { color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 8px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 2px 8px; border: 1px solid var(--red); background: var(--red-soft); color: var(--red); font: 600 12px/1 var(--mono); cursor: pointer; border-radius: 2px; }
.chip svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 1.8; fill: none; }
.tbl .pbody { padding: 6px 8px; }
.fake-table { border: 1px solid var(--rule-2); width: min(240px, 100%); }
.fake-table span { display: block; padding: 6px 10px; font: 400 15px/1.4 var(--serif); }
.rm-table { margin: 10px 12px 0 6px; justify-self: start; }
.para.hot, .fpara.hot { background: var(--hl); border-left-color: var(--hl-line); }
.para.err, .fpara.err { border-left-color: var(--red); background: var(--red-soft); }
.para.flash, .fpara.flash { background: var(--hl); }
#paper[data-mode="file"] .edit-only { display: none; }
#paper:not([data-mode="file"]) .file-only { display: none; }
.fnote { padding: 10px 16px 0; font-size: 14px; color: var(--muted); }

.res { min-width: 0; display: grid; gap: 14px; position: sticky; top: 14px; }
.term { background: var(--term); color: var(--term-text); font: 400 13.5px/1.6 var(--mono); }
.term .th { display: flex; justify-content: space-between; gap: 10px; padding: 8px 14px; border-bottom: 1px solid #2a3d5c; color: var(--term-dim); font-size: 12px; }
.term .th b { font-weight: 600; }
.res[data-state="ok"] #exit { color: #8fd8a8; }
.res[data-state="bad"] #exit { color: #f6a49b; }
.term pre { margin: 0; padding: 12px 14px 14px; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.term .cmd { color: var(--term-dim); }
.term .cmd b { color: var(--term-text); font-weight: 400; }
.sheet { background: var(--paper); box-shadow: var(--page-shadow); padding: 18px 20px 20px; position: relative; }
.sheet .lab { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet .lab span { font: 600 12px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: 6px; }
#stamp { flex: none; padding: 5px 10px; border: 2px solid currentColor; outline: 1px solid currentColor; outline-offset: 2px; font: 600 13px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .04em; transform: rotate(-2deg); }
.res[data-state="ok"] #stamp { color: var(--green); }
.res[data-state="bad"] #stamp { color: var(--red); }
#jump { margin-top: 12px; }
#view { margin-top: 14px; }
#view h3 { font: 600 22px/1.25 var(--serif); display: inline; margin-right: 6px; letter-spacing: 0; }
.ref { display: inline-flex; align-items: center; min-height: 28px; padding: 0 6px; margin-left: 2px; border: 1px solid var(--rule-2); background: transparent; color: var(--muted); font: 400 12px/1 var(--mono); cursor: pointer; border-radius: 2px; vertical-align: 3px; }
.ref:hover, .ref:focus-visible { background: var(--hl); color: var(--text); border-color: var(--hl-line); }
.safety { margin-top: 14px; padding: 10px 14px; border: 1px solid var(--red); border-left-width: 4px; }
.safety b { display: block; font: 600 12px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--red); }
.safety p { display: inline; white-space: pre-wrap; overflow-wrap: anywhere; font: 400 16px/1.5 var(--serif); }
.steps { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 34px minmax(0, 1fr); padding: 10px 0; border-top: 1px solid var(--rule); counter-increment: s; }
.steps li::before { content: counter(s); font: 700 17px/1.5 var(--sans); color: var(--ink); }
.steps p { display: inline; white-space: pre-wrap; overflow-wrap: anywhere; font: 400 16px/1.5 var(--serif); }
.steps li > div { min-width: 0; }
.files { background: var(--paper); box-shadow: var(--page-shadow); min-width: 0; }
.ftabs { display: flex; flex-wrap: wrap; align-items: stretch; border-bottom: 1px solid var(--rule); background: #f2f5f9; }
.ftabs [role="tab"] { min-height: 44px; padding: 8px 14px; border: 0; border-right: 1px solid var(--rule); background: transparent; font: 600 14px/1.2 var(--mono); color: var(--muted); cursor: pointer; }
.ftabs [role="tab"] small { font-weight: 400; }
.ftabs [role="tab"][aria-selected="true"] { color: var(--ink); background: var(--paper); box-shadow: inset 0 3px 0 var(--ink); }
.ftabs .btn { margin: 4px 6px 4px auto; min-height: 36px; font-size: 14px; padding: 4px 10px; }
#file-out { margin: 0; padding: 12px 14px; max-height: 340px; overflow: auto; font: 400 13px/1.55 var(--mono); white-space: pre; }

/* refusal register */
.reg-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }
.reg-tools label { font-weight: 600; font-size: 15px; }
.reg-tools input { min-height: 44px; width: min(340px, 100%); padding: 8px 12px; border: 1px solid var(--rule-2); background: var(--paper); font: 400 15px/1.2 var(--mono); border-radius: 2px; }
.reg-tools output { font: 400 14px/1.2 var(--mono); color: var(--muted); }
.register { background: var(--paper); box-shadow: var(--page-shadow); }
.stage { display: grid; grid-template-columns: 230px minmax(0, 1fr); border-bottom: 1px solid var(--rule-2); }
.stage:last-child { border-bottom: 0; }
.stage > header { padding: 16px 18px; border-right: 1px solid var(--rule); background: #f4f6f9; }
.stage > header h3 { font-size: 18px; }
.stage > header p { font-size: 14px; color: var(--muted); margin-top: 4px; }
.stage ul { list-style: none; margin: 0; padding: 0; }
.stage li { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr) auto; gap: 4px 16px; align-items: baseline; padding: 9px 16px; border-bottom: 1px solid #e8ecf1; }
.stage li:last-child { border-bottom: 0; }
.stage li code { color: var(--red); font-size: 13.5px; overflow-wrap: anywhere; }
.stage li span { font-size: 15px; }
.try { min-height: 32px; padding: 2px 10px; border: 1px solid var(--ink); background: transparent; color: var(--ink); font: 600 13px/1 var(--sans); cursor: pointer; border-radius: 2px; }
.try:hover { background: var(--ink); color: #fff; }
.stage.empty { display: none; }
.stage li[hidden] { display: none; }
.cli-only { font: 400 12px/1.2 var(--mono); color: var(--muted); }

/* recorded */
.rec { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; }
figure { margin: 0; min-width: 0; background: var(--paper); box-shadow: var(--page-shadow); }
figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 9px 14px; border-bottom: 1px solid var(--rule); background: #f2f5f9; font: 600 13px/1.4 var(--mono); color: var(--ink); }
figcaption span + span { font-weight: 400; color: var(--muted); }
figure pre { margin: 0; padding: 12px 14px; overflow: auto; max-height: 460px; font: 400 13px/1.55 var(--mono); }
figure.map { background: none; box-shadow: none; }
.parity { margin-top: 16px; padding: 10px 14px; border-left: 4px solid var(--green); background: var(--green-soft); font-size: 15px; max-width: 900px; }
.parity[data-same="false"] { border-color: var(--red); background: var(--red-soft); }
.code { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.code .notes { display: grid; gap: 14px; min-width: 0; }
.code .notes > * { min-width: 0; }
.code .notes p { max-width: 60ch; }
.limits-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule-2); }
.limits-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule-2); font-size: 15px; }
.limits-list b { font: 600 14px/1.5 var(--mono); color: var(--ink); white-space: nowrap; }
.term.static pre { white-space: pre; overflow: auto; }
.term .ok { color: #8fd8a8; }

.stops { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; background: var(--paper); box-shadow: var(--page-shadow); border-top: 3px solid var(--red); padding: 26px 28px; }
.stops h2 { font-size: 26px; margin-bottom: 10px; }
.stops h3 { font-size: 19px; margin-bottom: 8px; }
.stops ul { margin: 14px 0 0; padding-left: 20px; }
.stops li + li { margin-top: 6px; }
.stops p + p { margin-top: 10px; }
footer { margin-top: 64px; background: var(--ink); color: #c9d4e4; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px; padding: 20px 0 30px; font-size: 15px; }
footer a { min-height: 44px; display: inline-flex; align-items: center; color: #fff; }

@media (max-width: 1080px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 34px; }
  .hero h1 { max-width: 20ch; }
  .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fields div:nth-child(3) { border-right: 0; }
  .fields div:nth-child(-n+3) { border-bottom: 1px solid var(--rule); }
  .bench { grid-template-columns: minmax(0, 1fr); }
  .res { position: static; }
  .stage li { grid-template-columns: minmax(0, 1fr) auto; }
  .stage li span { grid-column: 1; }
  .stage li .try, .stage li .cli-only { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}
@media (max-width: 860px) {
  .rec, .code, .stops { grid-template-columns: minmax(0, 1fr); }
  .stage { grid-template-columns: minmax(0, 1fr); }
  .stage > header { border-right: 0; border-bottom: 1px solid var(--rule); padding: 12px 16px; }
  .stops { padding: 20px 18px; }
}
@media (max-width: 760px) {
  .map-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .wire { display: none; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .bar .docid span { display: none; }
  .hero { padding-top: 30px; }
  .hero .lede { font-size: 17px; }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields div { padding: 9px 12px; border-bottom: 1px solid var(--rule); }
  .fields div:nth-child(3) { border-right: 1px solid var(--rule); }
  .fields div:nth-child(even) { border-right: 0; }
  .fields div:nth-last-child(-n+2) { border-bottom: 0; }
  .fields dd { font-size: 14px; }
  .shead { grid-template-columns: minmax(0, 1fr); }
  .shead .no { border-right: 0; border-left: 3px solid var(--red); padding: 0 0 0 10px; margin-bottom: 10px; min-height: 0; height: auto; }
  .shead .no::before { display: inline; }
  .shead p { grid-column: 1; }
  section { padding-top: 48px; }
  .para, .fpara { grid-template-columns: 30px minmax(0, 1fr); }
  .pno { padding: 9px 2px 0 0; }
  .read { grid-column: 2; padding: 0 8px 6px; }
  .rm-table { grid-column: 2; margin: 0 8px 8px; }
  .para textarea, .fpara p { font-size: 16px; }
  .inserts button { min-height: 44px; }
  .ptools .btn, .ftabs .btn, .try, .chip, .ref { min-height: 44px; }
  .ref { min-width: 44px; justify-content: center; }
  .phead, .inserts { padding-inline: 12px; }
  .sheet { padding: 14px; }
  .limits-list li { flex-direction: column; gap: 0; }
  .presets .pill { flex: 1 1 auto; }
  .hint { display: none; }
  .mp { min-height: 44px; }
}
@media (max-width: 380px) {
  .fields { grid-template-columns: minmax(0, 1fr); }
  .fields div { border-right: 0 !important; border-bottom: 1px solid var(--rule) !important; }
  .fields div:last-child { border-bottom: 0 !important; }
}
/* The shortened JSON wraps inside its panel, so no line runs past the edge */
.mini-json { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Footer contacts */
footer .foot-contact { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0 22px; border-top: 1px solid #34496d; }
.foot-contact span { margin-right: 2px; color: #9daec4; font: 600 12px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
footer .foot-contact a { overflow-wrap: anywhere; }

/* Headings without a lone last word, copy that wraps evenly, a small press on buttons */
h1, h2, h3 { text-wrap: balance; }
.lede, .shead p, .map-note, .parity, .stops p, .code .notes p, .stage > header p { text-wrap: pretty; }
.stops p, .stops li { max-width: 68ch; }
.btn:active:not(:disabled), .pill:active, .inserts button:active, .try:active, .chip:active, .ref:active, .ftabs [role="tab"]:active { transform: translateY(1px); }

/* Touch screens: 44 pixel targets, and the search field at 16 pixels so a phone does not zoom on focus */
@media (pointer: coarse) {
  .mp, .para textarea, .inserts button, .ptools .btn, .ftabs .btn, .try, .chip { min-height: 44px; }
  .ref { min-height: 44px; min-width: 44px; justify-content: center; vertical-align: 0; }
  .reg-tools input { font-size: 16px; }
}
/* Phones and tablets: reading copy at 16 pixels */
@media (max-width: 1023px) {
  .map-note, .stage li span, .parity, footer .wrap, .hint, .fnote, .limits-list li, .stage > header p { font-size: 16px; }
  .reg-tools input { font-size: 16px; }
}
@media (max-width: 340px) {
  .wrap { width: calc(100% - 24px); }
  .bar .wrap { gap: 8px; }
  .hero h1 { font-size: 31px; }
  .phead, .inserts, .ptools.pad { padding-inline: 10px; }
  .sheet { padding: 12px; }
  .mini-json .jk { padding: 0 10px; }
  .mini-json .pl { padding: 0 10px 0 13px; }
  .stage li { padding: 9px 12px; }
  .sheet .lab { flex-wrap: wrap; row-gap: 10px; }
  #stamp { margin-left: 3px; }
}

/* Very wide screens: the page scales up instead of floating in a narrow column */
@media (min-width: 2048px) { :root { --page-zoom: 1.15; } body { zoom: 1.15; } }
@media (min-width: 2400px) { :root { --page-zoom: 1.3; } body { zoom: 1.3; } }
@media (min-width: 2880px) { :root { --page-zoom: 1.5; } body { zoom: 1.5; } }
@media (min-width: 3300px) { :root { --page-zoom: 1.75; } body { zoom: 1.75; } }
@media (min-width: 3700px) { :root { --page-zoom: 2; } body { zoom: 2; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .wire .draw { stroke-dashoffset: 0; }
}
