/* Weight and Balance Practice: a POH page. Navy ink on cool paper, placard-style data boxes, a safety-orange accent,
   and B612 headings, the typeface made for cockpit displays (SIL Open Font License, fonts/OFL.txt). Numbers use tabular
   figures in the system sans, so columns line up and "2,317" keeps a tight comma. */
@font-face { font-family: "B612"; src: url("fonts/b612-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
:root {
  --bg: #eef2f6;
  --paper: #ffffff;
  --ink: #13233a;
  --muted: #4a5a6e;
  --line: #c3cdd8;
  --accent: #b4470e;
  --accent-ink: #ffffff;
  --accent-soft: #fbe9dd;
  --ok: #1b6b3a;
  --ok-soft: #e0f1e6;
  --close: #845500;
  --close-soft: #f7edd6;
  --env: #d9e6f3;
  --grid: #e3e9ef;
  --focus: #1a5fb4;
  --head: "B612", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 4px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1620;
    --paper: #16202c;
    --ink: #e4ebf3;
    --muted: #a3b0bf;
    --line: #2f3e50;
    --accent: #f39257;
    --accent-ink: #1c0d04;
    --accent-soft: #3a2416;
    --ok: #7fd394;
    --ok-soft: #17301f;
    --close: #f0c066;
    --close-soft: #3a2f17;
    --env: #1d3047;
    --grid: #223040;
    --focus: #8ab8ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); font-variant-numeric: tabular-nums; }
.wrap { max-width: 900px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-underline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.hero { padding: 22px 0 6px; border-bottom: 3px solid var(--ink); }
h1 { font: 700 clamp(1.7rem, 5vw, 2.5rem)/1.12 var(--head); margin: 0 0 8px; letter-spacing: -0.01em; }
.lede { margin: 0 0 12px; color: var(--muted); max-width: 64ch; }
h2 { font: 700 1.25rem/1.25 var(--head); margin: 0 0 10px; }

/* setup */
.setup { margin: 14px 0 6px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.chip { position: relative; display: block; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
/* annunciator buttons: dark and lit when on, outlined when off */
.chip span { display: block; min-height: 44px; height: 100%; padding: 7px 10px 7px 30px; border: 1.5px solid var(--ink); border-radius: var(--r); background: var(--paper); line-height: 1.25; }
.chip span::before { content: ""; position: absolute; left: 11px; top: 13px; width: 10px; height: 10px; border: 1.5px solid var(--muted); border-radius: 2px; }
.chip b { display: block; font-size: 0.95rem; }
.chip small { display: block; color: var(--muted); font-size: 0.875rem; margin-top: 1px; }
.chip input:checked + span { background: var(--ink); color: var(--paper); }
.chip input:checked + span small { color: var(--paper); opacity: 0.8; }
.chip input:checked + span::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 2px rgba(243, 146, 87, 0.35); }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.chip .short { display: none; }
.setrow { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-top: 10px; }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.presets { display: flex; gap: 0 18px; flex-wrap: wrap; margin: 2px 0 0; }
select, input { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r); min-height: 44px; padding: 6px 10px; }
select { padding-right: 28px; max-width: 100%; }
.btn { font: inherit; font-weight: 650; min-height: 44px; padding: 8px 16px; border-radius: var(--r); border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { padding: 6px 14px; }
.btn:hover { filter: brightness(0.95); }
.link { font: inherit; background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.rules { margin-top: 6px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rules summary { cursor: pointer; padding: 11px 0; font-weight: 600; min-height: 44px; }
.rules summary span { font-weight: 400; color: var(--muted); }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; }
.rule-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; font-weight: 600; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 8px 0 10px; }

.note { margin: 10px 0; padding: 10px 12px; border-left: 4px solid var(--close); background: var(--close-soft); border-radius: 0 var(--r) var(--r) 0; }
.note.info { border-left-color: var(--ok); background: var(--ok-soft); }

/* the sheet */
.sheet { margin: 14px -16px 0; padding: 14px 16px 10px; background: var(--paper); border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); }
.sheet:focus { outline: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.sheet-head h2 { margin: 0; }
.code { font-family: var(--mono); letter-spacing: 0.05em; }
.score { margin: 0; font-weight: 650; color: var(--muted); }
.caution { margin: 4px 0 10px; font-size: 0.92rem; font-weight: 600; color: var(--accent); }

/* airplane data: a placard */
.acdata { border: 1.5px solid var(--ink); border-radius: var(--r); margin: 0 0 10px; }
.acdata > summary { cursor: pointer; padding: 10px 12px; min-height: 44px; background: var(--ink); color: var(--paper); font-family: var(--head); font-weight: 700; }
.acdata > summary small { font-family: var(--sans); font-weight: 400; opacity: 0.85; }
.acdata[open] > summary { border-bottom: 1.5px solid var(--ink); }
.acgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 4px 18px; padding: 10px 12px 6px; align-items: start; }
.actabs { min-width: 0; }
table.dt { border-collapse: collapse; width: 100%; font-size: 0.9rem; margin: 0 0 10px; }
.dt caption { text-align: left; font: 700 0.92rem var(--head); color: var(--ink); padding-bottom: 2px; }
.dt th { text-align: left; font-weight: 600; font-size: 0.82rem; color: var(--muted); border-bottom: 1.5px solid var(--ink); padding: 3px 6px 3px 0; }
.dt td { border-bottom: 1px solid var(--line); padding: 4px 6px 4px 0; vertical-align: top; }
.dt td.n { white-space: nowrap; }
.dn { margin: 0 0 6px; padding-left: 1.1em; font-size: 0.88rem; color: var(--muted); }
.acfig { margin: 0; }
.acfig figcaption { font-size: 0.82rem; color: var(--muted); text-align: center; }
svg.env { width: 100%; height: auto; display: block; max-width: 420px; }
.env .eg { stroke: var(--grid); stroke-width: 1; }
.env .eb { fill: var(--env); stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.env .et { font: 10px var(--sans); fill: var(--muted); }
.env .ea { font: 10.5px var(--sans); fill: var(--muted); }
.env .ep { fill: var(--accent); stroke: var(--paper); stroke-width: 1.5; }
.env .el { font: 700 11px var(--sans); fill: var(--accent); }

/* problems */
.probs { list-style: none; margin: 0; padding: 0; }
.prob { padding: 14px 0 10px; border-top: 1px solid var(--line); }
.ptop { margin: 0; display: flex; align-items: center; gap: 10px; }
.num { font: 700 0.95rem var(--sans); color: var(--accent-ink); background: var(--accent); min-width: 1.9em; text-align: center; padding: 1px 4px; border-radius: 2px; }
.tag { font-size: 0.875rem; color: var(--muted); }
.q { margin: 6px 0 8px; max-width: 70ch; }
.given { margin: 0 0 8px; max-width: 440px; border-top: 1.5px solid var(--ink); }
.given > div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 3px 0; font-size: 0.95rem; }
.given dt { color: var(--muted); }
.given dd { margin: 0; text-align: right; }
.given .gnote { font-size: 0.85rem; color: var(--muted); justify-content: flex-end; }
.rt { margin: 0 0 8px; font-size: 0.9rem; color: var(--muted); }
.ref { margin: 0 0 8px; }
.ref > summary { cursor: pointer; color: var(--accent); font-size: 0.92rem; min-height: 44px; display: flex; align-items: center; }
.ref .acgrid { padding: 6px 0; }
.arow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ain { display: inline-flex; align-items: center; gap: 6px; }
.ain input { width: 9.5em; }
.ain .unit { color: var(--muted); }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; flex: 1 1 100%; max-width: 720px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; min-height: 44px; padding: 6px 10px 6px 36px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--paper); }
.choice span::before { content: ""; position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border: 2px solid var(--muted); border-radius: 50%; }
.choice input:checked + span { border-color: var(--ink); }
.choice input:checked + span::before { border: 5px solid var(--ink); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.fbwrap:empty { display: none; }
.fb { margin: 8px 0 0; padding: 6px 10px; border-radius: var(--r); display: inline-block; max-width: 100%; }
.fb.right { background: var(--ok-soft); color: var(--ok); }
.fb.close { background: var(--close-soft); color: var(--close); }
.fb.wrong, .fb.unread { background: var(--accent-soft); color: var(--accent); }
.prob.is-right .ain input, .prob.is-right .choice input:checked + span { border-color: var(--ok); }
.prob.is-wrong .ain input, .prob.is-wrong .choice input:checked + span { border-color: var(--accent); }
.work { margin-top: 4px; }
.work > summary { cursor: pointer; color: var(--muted); font-size: 0.92rem; padding: 10px 0; min-height: 44px; display: flex; align-items: center; }
.work > summary::marker { content: ""; }
.work > summary::before { content: "+"; margin-right: 6px; }
.work[open] > summary::before { content: "−"; }
.ans { margin: 0 0 6px; }
.ans b { }
.steps { margin: 4px 0; padding-left: 1.6em; font-size: 0.92rem; line-height: 1.55; overflow-wrap: anywhere; }
.plot { margin: 6px 0; max-width: 340px; }
.tablewrap { overflow-x: auto; }
table.wt, table.wb, table.src { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.wt { max-width: 640px; }
.wt th, .wt td, .wb th, .wb td { text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.wt th:first-child, .wt td:first-child, .wb th:first-child, .wb td:first-child { text-align: left; white-space: normal; padding-left: 0; }
.wt td:not(:first-child), .wb td:not(:first-child) { font-size: 0.88rem; }
.wt th, .wb th { font-size: 0.82rem; color: var(--muted); border-bottom: 1.5px solid var(--ink); }
.wt tfoot td, .wb tfoot td { font-weight: 700; border-top: 1.5px solid var(--ink); border-bottom: 0; }
.sheet-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }

.share { margin: 16px 0 8px; }
.print-row { display: flex; align-items: flex-end; gap: 8px 10px; flex-wrap: wrap; }
.print-row label { display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; font-weight: 600; }
.share-out label { display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; font-weight: 600; }
.share-out input { width: 100%; font-size: 16px; }
.recent { margin-top: 12px; border-top: 1px solid var(--line); }
.recent summary { cursor: pointer; padding: 11px 0; font-weight: 600; min-height: 44px; }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 4px 0; }
.recent small { display: block; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 16px; transform: translate(-50%, 140%); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r); max-width: calc(100% - 32px); transition: transform 0.2s; z-index: 20; }
.toast.on { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* content */
.content { padding: 18px 0 8px; }
.content h2 { margin-top: 28px; }
.content p { max-width: 70ch; }
.wb { max-width: 600px; margin: 0 0 10px; }
.src th, .src td { text-align: left; vertical-align: top; padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); }
.src th { border-bottom: 1.5px solid var(--ink); font-size: 0.85rem; color: var(--muted); }
.checked { color: var(--muted); font-size: 0.9rem; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 11px 0; font-weight: 600; min-height: 44px; }
.faq details p { margin: 0 0 12px; }
.disclaimer { margin-top: 22px; padding-left: 12px; border-left: 4px solid var(--accent); }
.sources { font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }

footer { border-top: 3px solid var(--ink); margin-top: 20px; padding: 16px 0 28px; color: var(--muted); font-size: 0.92rem; }
.indep { margin: 0 0 10px; }
.sb-footer p { margin: 6px 0; }
.sb-more { line-height: 1.8; }
.sb-footer a { color: var(--ink); }

@media (max-width: 700px) {
  .acgrid { grid-template-columns: minmax(0, 1fr); }
  .acfig { max-width: 380px; }
}
@media (max-width: 600px) {
  .chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .chip small, .chip .long { display: none; }
  .chip .short { display: block; }
  .chip span { padding: 10px 12px 10px 30px; }
  .hero { padding-top: 14px; }
}
@media (max-width: 480px) {
  body { font-size: 16.5px; }
  .ain input { width: 8em; }
  .wt { font-size: 0.8rem; }
  .wt th, .wt td { padding: 3px 3px; }
  .wt th { white-space: normal; font-size: 0.74rem; vertical-align: bottom; }
  .wt td:not(:first-child) { font-size: 0.78rem; }
  .wt td:first-child { min-width: 5.5em; }
  .src td:nth-child(2) { min-width: 8em; }
}

/* print: only the worksheet and key */
.print-root { display: none; }
@page { margin: 0.55in 0.6in; }
@media print {
  :root { --ink: #000; --muted: #333; --line: #999; --paper: #fff; --env: #e6eef6; --grid: #ddd; --accent: #000; }
  body { background: #fff; color: #000; font: 10.5pt/1.38 var(--sans); }
  main, footer, .toast, .skip { display: none !important; }
  .print-root { display: block; }
  table.pt { width: 100%; border-collapse: collapse; }
  table.pt > tbody > tr > td, table.pt > thead > tr > td { padding: 0; }
  .prun { font: 8.5pt var(--sans); color: #555; text-align: right; padding-bottom: 6pt !important; }
  .ph { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2pt solid #000; margin-bottom: 7pt; }
  .ph h2 { font: 700 15pt var(--head); margin: 0; }
  .ph p { margin: 0; font: 10.5pt var(--sans); }
  .pmeta { display: flex; justify-content: space-between; gap: 12pt; margin: 4pt 0 8pt; }
  .pconv { border: 1pt solid #000; padding: 4pt 7pt; margin: 0 0 5pt; font-size: 9.5pt; }
  .pconv b { margin-right: 4pt; }
  .pcaution { font-size: 9.5pt; font-weight: 700; margin: 0 0 6pt; }
  .pnote { font-size: 9pt; color: #333; margin: 8pt 0 0; }
  .pac { break-inside: avoid; page-break-inside: avoid; border: 1pt solid #000; padding: 5pt 7pt 3pt; margin: 0 0 8pt; }
  .pac h3 { font: 700 11pt var(--head); margin: 0 0 3pt; }
  .pac .acgrid { display: grid; grid-template-columns: minmax(0, 1fr) 2.9in; gap: 0 12pt; padding: 0; }
  .pac table.dt { font-size: 8.5pt; margin-bottom: 4pt; }
  .pac .dt caption { font-size: 9pt; }
  .pac .dt th { font-size: 7.5pt; padding: 1pt 4pt 1pt 0; }
  .pac .dt td { padding: 1pt 4pt 1pt 0; }
  .pac .dn { font-size: 8pt; margin: 0; columns: 2; column-gap: 14pt; }
  .pac .acfig figcaption { display: none; }
  svg.env { max-width: 2.9in; }
  .env .eb { fill: #e6eef6; stroke: #000; stroke-width: 1.6; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .env .eg { stroke: #ccc; }
  .env .et, .env .ea { fill: #333; }
  .env .ep { fill: #000; stroke: #fff; }
  .pq { margin: 0; padding-left: 20pt; }
  .pq > li { break-inside: avoid; page-break-inside: avoid; padding: 5pt 0 6pt; border-bottom: 0.75pt solid #999; }
  .pq > li p { margin: 0; }
  .pgiven { margin: 3pt 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 18pt; font-size: 9.5pt; }
  .pgiven > div { display: flex; justify-content: space-between; gap: 8pt; border-bottom: 0.5pt dotted #999; }
  .pgiven dt { color: #333; }
  .pgiven dd { margin: 0; }
  .pgiven .gnote { grid-column: 1 / -1; border: 0; color: #333; font-size: 8.5pt; }
  .prt { font-size: 9pt; color: #333; margin-top: 2pt !important; }
  .pans { margin-top: 0.5in !important; text-align: right; }
  .pchoice { margin-top: 5pt !important; display: flex; flex-wrap: wrap; gap: 3pt 16pt; font-size: 10pt; }
  .psheet + .pkey { break-before: page; page-break-before: always; }
  .pk { margin: 0; padding-left: 20pt; }
  .pk > li { break-inside: avoid; page-break-inside: avoid; padding: 4pt 0 5pt; border-bottom: 0.75pt solid #bbb; }
  .pk p { margin: 0; }
  .pkq { font-size: 9pt; color: #333; }
  .pka { font: 700 11pt var(--sans); margin-top: 2pt !important; }
  .pkt { width: auto; min-width: 4.6in; border-collapse: collapse; font-size: 8.5pt; margin: 2pt 0; }
  .pkt th, .pkt td { padding: 0.5pt 6pt; text-align: right; border-bottom: 0.5pt solid #bbb; white-space: nowrap; }
  .pkt th:first-child, .pkt td:first-child { text-align: left; padding-left: 0; }
  .pkt td:not(:first-child) { }
  .pkt tfoot td { font-weight: 700; border-top: 0.75pt solid #000; }
  .pks { margin: 1pt 0 0; padding-left: 14pt; font-size: 9pt; line-height: 1.35; }
  .pkplot svg { width: 2.4in; }
}
