/* Fonts: Barlow and Barlow Semi Condensed, SIL Open Font License (see fonts/OFL.txt) */
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); }

/* ShackWiki — shared styles
   Palette: cool panel grey, enamel blue, navy ink, amber readout. */
:root {
  --panel: #e6eaee;
  --surface: #ffffff;
  --ink: #1b2430;
  --ink-soft: #4a5666;
  --rule: #c3cbd3;
  --enamel: #1f4e79;
  --enamel-strong: #163a5b;
  --amber: #f0a81c;
  --readout-bg: #1e1a12;
  --readout-ink: #ffc24a;
  --bad: #b8432f;
  --good: #2f7d4f;
  --focus: #f0a81c;
  --radius-panel: 10px;
  --radius-input: 6px;
  --measure: 68ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --panel: #12171d;
    --surface: #1a212a;
    --ink: #e5eaf0;
    --ink-soft: #a6b1be;
    --rule: #2f3a46;
    --enamel: #7fb0e0;
    --enamel-strong: #a9cbee;
    --readout-bg: #0c0a06;
    --bad: #e07a63;
    --good: #6cc08f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --panel: #12171d;
  --surface: #1a212a;
  --ink: #e5eaf0;
  --ink-soft: #a6b1be;
  --rule: #2f3a46;
  --enamel: #7fb0e0;
  --enamel-strong: #a9cbee;
  --readout-bg: #0c0a06;
  --bad: #e07a63;
  --good: #6cc08f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--panel);
  color: var(--ink);
  font-family: "Barlow", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
a { color: var(--enamel); text-underline-offset: 2px; }
a:hover { color: var(--enamel-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
img, svg { max-width: 100%; }

h1, h2, h3 {
  font-family: "Barlow Semi Condensed", "Barlow", sans-serif;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.005em;
}
h1 { font-size: clamp(2rem, 4.5vw, 2.9rem); margin: 0 0 .5rem; }
h2 { font-size: 1.6rem; margin: 2.4rem 0 .6rem; }
h3 { font-size: 1.2rem; margin: 1.6rem 0 .4rem; }
p { margin: 0 0 1rem; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 6px 10px; z-index: 10; }

/* Header: a strip like a rig's top bezel */
.site-header { background: var(--enamel-strong); color: #fff; }
:root[data-theme="dark"] .site-header { background: #101820; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .site-header { background: #101820; } }
.site-header .wrap { display: flex; align-items: center; gap: 1rem; min-height: 60px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-family: "Barlow Semi Condensed", sans-serif; font-weight: 700; font-size: 1.35rem; display: flex; align-items: center; gap: .55rem; }
.brand:hover { color: #fff; }
.brand svg { width: 26px; height: 26px; }
.brand img { display: block; width: 240px; height: 40px; }
@media (max-width: 1180px) { .brand img { width: 168px; height: 28px; } }
@media (max-width: 640px) { .brand img { width: 156px; height: 26px; } }
.nav { display: flex; gap: .2rem; flex-wrap: wrap; margin-left: auto; }
.nav a { color: #dbe6f2; text-decoration: none; padding: .35rem .6rem; border-radius: 6px; font-weight: 500; font-size: .98rem; }
.nav a:hover, .nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.12); }
.theme-toggle { background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 6px; padding: .3rem .55rem; cursor: pointer; font: inherit; font-size: .9rem; }
.menu-toggle { display: none; }
@media (max-width: 999px) {
  .menu-toggle { display: inline-block; margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 6px; padding: .3rem .6rem; font: inherit; }
  .nav { display: none; width: 100%; flex-direction: column; padding-bottom: .6rem; margin-left: 0; }
  .nav.open { display: flex; }
  .theme-toggle { order: 2; }
}

/* Page head */
.page-head { padding: 2.2rem 0 1.2rem; }
.page-head p.lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 60ch; margin: 0; }
.crumbs { font-size: .9rem; color: var(--ink-soft); margin-bottom: .6rem; }
.crumbs a { color: inherit; }

/* Layout */
.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 2rem; align-items: start; padding-bottom: 3rem; }
@media (max-width: 920px) { .tool-layout { grid-template-columns: minmax(0, 1fr); } }

/* The instrument panel */
.instrument {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-panel);
  padding: 1.25rem;
}
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem 1rem; }
.field label, .field .label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .25rem; }
.field small { display: block; color: var(--ink-soft); font-size: .85rem; margin-top: .2rem; line-height: 1.35; }
input[type="number"], input[type="text"], select {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  padding: .55rem .65rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-input);
  background: var(--panel);
  color: var(--ink);
}
input:focus, select:focus { border-color: var(--enamel); outline: 2px solid var(--focus); outline-offset: 0; }
.inline { display: flex; gap: .4rem; }
.inline select { width: auto; }
.presets { display: flex; flex-wrap: wrap; gap: .35rem; margin: .2rem 0 1rem; }
.presets button, .btn {
  font: inherit; font-size: .92rem; font-weight: 600;
  border: 1px solid var(--rule); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: .3rem .75rem; cursor: pointer;
}
.presets button:hover, .btn:hover { border-color: var(--enamel); color: var(--enamel); }
.presets button[aria-pressed="true"] { background: var(--enamel); border-color: var(--enamel); color: var(--surface); }
.btn-primary { background: var(--enamel); border-color: var(--enamel); color: var(--surface); border-radius: var(--radius-input); padding: .55rem 1rem; }
.btn-primary:hover { color: var(--surface); background: var(--enamel-strong); }
.checks { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.checks label { font-weight: 500; font-size: .95rem; display: flex; gap: .3rem; align-items: center; }

/* The one loud element: an amber backlit readout window */
.readout {
  margin-top: 1.2rem;
  background: var(--readout-bg);
  color: var(--readout-ink);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  box-shadow: inset 0 0 0 1px rgba(255,194,74,.18), inset 0 0 28px rgba(255,170,30,.08);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .9rem 1.2rem;
}
.readout .r-label { display: block; color: #c79a4a; font-size: .85rem; font-weight: 500; }
.readout .r-value { display: block; font-family: "Barlow Semi Condensed", sans-serif; font-size: 1.85rem; font-weight: 600; line-height: 1.1; text-shadow: 0 0 10px rgba(255,170,30,.35); }
.readout .r-sub { display: block; color: #d9b06a; font-size: .9rem; }
.readout .r-wide { grid-column: 1 / -1; }
.readout.error { color: #ff9b85; }
.msg { color: var(--bad); font-weight: 600; margin: .6rem 0 0; min-height: 1.2em; }
.note { font-size: .92rem; color: var(--ink-soft); margin-top: .8rem; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.4rem; }
table { border-collapse: collapse; width: 100%; font-size: .97rem; background: var(--surface); }
th, td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; background: var(--panel); }
td.num, th.num { text-align: right; }
tr.best td { background: color-mix(in srgb, var(--amber) 16%, transparent); }

/* Article */
.article { max-width: var(--measure); }
.article ul, .article ol { padding-left: 1.3rem; margin: 0 0 1rem; }
.article li { margin-bottom: .35rem; }
.formula { background: var(--surface); border-left: 4px solid var(--enamel); padding: .6rem .9rem; margin: .8rem 0 1.2rem; font-size: 1.02rem; border-radius: 0 6px 6px 0; }
.faq details { border-bottom: 1px solid var(--rule); padding: .7rem 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: .5rem 0 0; }

/* Sidebar */
.sidebar { display: grid; gap: 1.2rem; position: sticky; top: 1rem; }
@media (max-width: 920px) { .sidebar { position: static; } }
.side-box { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-panel); padding: 1rem; }
.side-box h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
.side-box ul { list-style: none; padding: 0; margin: 0; }
.side-box li { padding: .3rem 0; border-bottom: 1px solid var(--rule); }
.side-box li:last-child { border-bottom: 0; }
.side-box a { text-decoration: none; font-weight: 500; }
.gear-note { font-size: .82rem; color: var(--ink-soft); margin-top: .6rem; }

/* Ad placeholders: replace contents with AdSense code. Hidden once real ads are added. */
.ad-slot {
  border: 1px dashed var(--rule);
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: .8rem;
  text-align: center;
  padding: 1.6rem .5rem;
  margin: 1.4rem 0;
}

/* Home */
.home-hero { padding: 2.8rem 0 1.4rem; }
.home-hero h1 { font-size: clamp(2.3rem, 6vw, 3.6rem); max-width: 18ch; }
.home-hero p { font-size: 1.2rem; color: var(--ink-soft); max-width: 56ch; }
.band-strip { margin: 1.8rem 0 .4rem; }
.band-strip svg { display: block; width: 100%; height: auto; }
.tool-group { margin-bottom: 2rem; }
.tool-group h2 { margin-top: 1.6rem; }
.tool-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-panel); }
.tool-list li { border-bottom: 1px solid var(--rule); }
.tool-list li:last-child { border-bottom: 0; }
.tool-list a { display: grid; grid-template-columns: minmax(180px, 280px) 1fr; gap: .2rem 1.2rem; padding: .9rem 1.1rem; text-decoration: none; color: var(--ink); }
.tool-list a:hover { background: var(--panel); }
.tool-list a:hover strong { color: var(--enamel); }
.tool-list strong { font-family: "Barlow Semi Condensed", sans-serif; font-size: 1.2rem; }
.tool-list span { color: var(--ink-soft); }
@media (max-width: 640px) { .tool-list a, .tool-list .soon { grid-template-columns: 1fr; } }

/* Map */
#map { height: 320px; border-radius: 8px; margin-top: 1rem; border: 1px solid var(--rule); z-index: 0; }

/* Length strip on the random-wire tool */
.lenstrip { margin-top: 1rem; }
.lenstrip svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 1rem; font-size: .88rem; color: var(--ink-soft); margin-top: .3rem; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: .3rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding: 2rem 0 2.5rem; color: var(--ink-soft); font-size: .93rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; }
.site-footer nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.site-footer a { color: inherit; }

.prose { max-width: var(--measure); padding-bottom: 3rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Band conditions dashboard ---------- */
:root { --chart-grid: #d3dae1; --k-quiet: #2f7d4f; --k-active: #c98a0b; --k-storm: #b8432f; --s1: #1f4e79; --s2: #7a4fa3; --s3: #9fb3c8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chart-grid: #2a343f; --k-quiet: #5fb685; --k-active: #e7ad35; --k-storm: #e47a62; --s1: #7fb0e0; --s2: #b591d8; --s3: #4c5f73; } }
:root[data-theme="dark"] { --chart-grid: #2a343f; --k-quiet: #5fb685; --k-active: #e7ad35; --k-storm: #e47a62; --s1: #7fb0e0; --s2: #b591d8; --s3: #4c5f73; }

.dash { display: grid; gap: 1.2rem; }
.dash > .ad-slot { margin: 0; }
.dash-status { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between; font-size: .95rem; color: var(--ink-soft); }
.readout.big { margin-top: 0; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.dash-grid { display: grid; gap: 1.2rem; }
.dash-grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.dash-grid > * { min-width: 0; }
.dash-grid.flat h3 { margin-top: .2rem; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-panel); padding: 1rem 1.1rem 1.1rem; min-width: 0; }
.panel h2 { font-size: 1.3rem; margin: 0 0 .25rem; text-wrap: balance; }
.panel h3 { font-size: 1.05rem; margin: 1.1rem 0 .3rem; }
.panel-note { color: var(--ink-soft); font-size: .92rem; margin: 0 0 .7rem; max-width: 70ch; }
.panel table { font-size: .93rem; }
.panel .table-wrap { margin: .4rem 0 .2rem; }
.muted { color: var(--ink-soft); }

.pill { display: inline-block; font-weight: 600; font-size: .85rem; padding: .1rem .55rem; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.pill.good { color: var(--good); border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.pill.fair { color: var(--ink); border-color: var(--k-active); background: color-mix(in srgb, var(--k-active) 18%, transparent); }
.pill.poor { color: var(--bad); border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }
table.bands th[scope="row"] { font-family: "Barlow Semi Condensed", sans-serif; font-size: 1.05rem; }
.vhf { list-style: none; padding: 0; margin: .9rem 0 0; display: grid; gap: .5rem; font-size: .93rem; }

.chart { position: relative; min-height: 120px; }
.chart.tall { min-height: 200px; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .tick { stroke: var(--ink-soft); }
.chart .axis { fill: var(--ink-soft); font: 500 12px "Barlow", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.chart .ref { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 4 4; opacity: .7; }
.chart .ref-label { fill: var(--ink-soft); font: 500 11px "Barlow", system-ui, sans-serif; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.thick { stroke-width: 3; }
.chart .line.s1, .chart .end.s1 { stroke: var(--s1); }
.chart .line.s2, .chart .end.s2 { stroke: var(--s2); }
.chart .line.s3 { stroke: var(--s3); stroke-width: 1.5; }
.chart .area { stroke: none; opacity: .14; }
.chart .area.s1 { fill: var(--s1); }
.chart .area.s2 { fill: var(--s2); }
.chart .end { fill: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--ink-soft); stroke-width: 1; }
.chart .bar { stroke: var(--surface); stroke-width: 0; cursor: default; }
.chart .bar:focus { outline: none; stroke: var(--ink); stroke-width: 2; }
.chart .bar.k-quiet { fill: var(--k-quiet); }
.chart .bar.k-active { fill: var(--k-active); }
.chart .bar.k-storm { fill: var(--k-storm); }
.chart .bar.predicted { opacity: .55; }
.chart .hatch { display: none; }
.chart rect[tabindex]:focus { outline: 2px solid var(--focus); }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: .35rem; }
.legend .sw.k-quiet { background: var(--k-quiet); } .legend .sw.k-active { background: var(--k-active); } .legend .sw.k-storm { background: var(--k-storm); }
.legend .sw.s1 { background: var(--s1); } .legend .sw.s2 { background: var(--s2); } .legend .sw.s3 { background: var(--s3); }
.chart-cap { font-size: .9rem; color: var(--ink-soft); margin: .4rem 0 0; }
.chart-data { margin-top: .5rem; font-size: .9rem; }
.chart-data summary { cursor: pointer; color: var(--enamel); font-weight: 600; }
.chart-data .table-wrap { max-height: 260px; overflow: auto; }
.chart-tip { position: fixed; z-index: 20; pointer-events: none; background: var(--ink); color: var(--surface); font-size: .85rem; line-height: 1.35; padding: .35rem .55rem; border-radius: 6px; max-width: 260px; }

.sun-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 1rem; }
.sun-row figure { margin: 0; }
.sun-row img { width: 100%; height: auto; border-radius: 8px; background: #000; display: block; }
.sun-row figcaption { font-size: .88rem; color: var(--ink-soft); margin-top: .35rem; }

#alerts { display: grid; gap: .1rem; }
.alert { border-bottom: 1px solid var(--rule); padding: .5rem 0; }
.alert summary { cursor: pointer; font-size: .93rem; }
.alert-time { font-weight: 600; color: var(--ink-soft); margin-right: .2rem; }
.alert pre { white-space: pre-wrap; font-size: .82rem; background: var(--panel); padding: .6rem; border-radius: 6px; margin: .5rem 0 0; max-height: 240px; overflow: auto; }

/* ---------- Grey line ---------- */
#glmap { height: clamp(300px, 55vw, 560px); border-radius: 8px; border: 1px solid var(--rule); background: #aad3df; z-index: 0; }
.clock .r-value { font-size: 2.1rem; }
.pill.day { color: var(--ink); border-color: var(--rule); background: var(--panel); }
.pill.grey { color: #6b4a00; border-color: #c98a0b; background: #ffe2a3; }
.pill.night { color: var(--surface); border-color: #22324a; background: #22324a; }
:root[data-theme="dark"] .pill.night { color: var(--ink); background: #0a1630; border-color: #3a4d6b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.night { color: var(--ink); background: #0a1630; border-color: #3a4d6b; } }
.sw.gl-day { background: #f4f4f4; border: 1px solid var(--rule); } .sw.gl-grey { background: #f0c867; } .sw.gl-twi { background: #5f6d86; } .sw.gl-night { background: #1c2a45; }

/* ---------- J-pole, reference pages ---------- */
.jp-wrap { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.jp-diagram svg { width: 100%; height: auto; color: var(--enamel); }
@media (max-width: 560px) { .jp-wrap { grid-template-columns: minmax(0, 1fr); } .jp-diagram { max-width: 180px; margin: 0 auto; } }
.rst-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0 1.4rem; }
.rst-grid ul { padding-left: 1.1rem; margin: 0; font-size: .95rem; }
.morse { font-size: 1.15rem; letter-spacing: .12em; white-space: nowrap; }
.readout .morse { letter-spacing: .08em; white-space: normal; word-break: break-word; }
#gl-dx td.num { white-space: nowrap; }

/* ---------- Morse ---------- */
textarea { width: 100%; font: inherit; font-size: 1.05rem; padding: .55rem .65rem; border: 1px solid var(--rule); border-radius: var(--radius-input); background: var(--panel); color: var(--ink); resize: vertical; }
textarea:focus { border-color: var(--enamel); outline: 2px solid var(--focus); outline-offset: 0; }
.morse-in { letter-spacing: .08em; }
.mt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 1rem; }
.mchars { display: flex; flex-wrap: wrap; gap: .3rem; margin: .6rem 0 0; }
.mchar { display: inline-grid; justify-items: center; min-width: 2.2rem; padding: .25rem .35rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--panel); }
.mchar.sp { min-width: .8rem; border-color: transparent; background: none; }
.mchar b { font-family: "Barlow Semi Condensed", sans-serif; font-size: 1.05rem; }
.mchar i { font-style: normal; font-size: .95rem; letter-spacing: .1em; color: var(--ink-soft); white-space: nowrap; }
.mchar.on { background: var(--readout-bg); border-color: var(--amber); }
.mchar.on b, .mchar.on i { color: var(--readout-ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .9rem; }
.drop { display: grid; gap: .3rem; border: 2px dashed var(--rule); border-radius: var(--radius-panel); padding: 1.1rem; text-align: center; cursor: pointer; background: var(--panel); }
.drop:hover, .drop.over { border-color: var(--enamel); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.adv { margin-top: .9rem; }
.adv summary { cursor: pointer; font-weight: 600; color: var(--enamel); }
.dec-text { font-size: 1.5rem !important; word-break: break-word; letter-spacing: .03em; }
.wave-wrap { overflow-x: auto; margin-top: 1rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }
.wave-wrap canvas { display: block; }
.jp-wrap.wide { grid-template-columns: 260px minmax(0, 1fr); }
@media (max-width: 640px) { .jp-wrap.wide { grid-template-columns: minmax(0, 1fr); } .jp-wrap.wide .jp-diagram { max-width: 260px; } }
.nowrap { white-space: nowrap; }
table.bp td, table.bp th { vertical-align: top; }
[hidden] { display: none !important; }
table.ref-cables tr.grp th { background: var(--panel); font-family: "Barlow Semi Condensed", sans-serif; font-size: 1rem; padding-top: .8rem; }
table.ref-cables th[scope="row"] { font-weight: 500; white-space: nowrap; }
#cmp tr.sel th { font-weight: 700; }
table.ref-cables td, #cmp td { white-space: nowrap; }

/* ---------- Beam heading ---------- */
:root { --map-sea: #d6e6f2; --map-land: #f4f1e8; --map-border: #b9b2a0; --map-grat: #c3d5e3; --map-ring: #6f8aa3; --sp: #d9480f; --lp: #1f4e79; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --map-sea: #0f2235; --map-land: #2b3540; --map-border: #4b5866; --map-grat: #1b3047; --map-ring: #6f8aa3; --sp: #ff8a4c; --lp: #8fbce8; } }
:root[data-theme="dark"] { --map-sea: #0f2235; --map-land: #2b3540; --map-border: #4b5866; --map-grat: #1b3047; --map-ring: #6f8aa3; --sp: #ff8a4c; --lp: #8fbce8; }
.beam-inputs .bh-wide { grid-column: span 2; }
@media (max-width: 560px) { .beam-inputs .bh-wide { grid-column: auto; } }
.beam-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .beam-grid { grid-template-columns: minmax(0, 1fr); } .dial-panel { max-width: 420px; } }
.dial svg { width: 100%; height: auto; display: block; }
.dial .dial-face { fill: var(--panel); stroke: var(--rule); stroke-width: 2; }
.dial .tick { stroke: var(--ink-soft); stroke-width: 1; }
.dial .tick-l { stroke: var(--ink); stroke-width: 2; }
.dial text { font: 600 13px "Barlow", sans-serif; fill: var(--ink-soft); text-anchor: middle; }
.dial text.card { font: 700 17px "Barlow Semi Condensed", sans-serif; fill: var(--ink); }
.dial .sp { stroke: var(--sp); stroke-width: 5; stroke-linecap: round; }
.dial .sp-head { fill: var(--sp); }
.dial .lp { stroke: var(--lp); stroke-width: 3; stroke-dasharray: 6 5; stroke-linecap: round; }
.dial .hub { fill: var(--readout-bg); stroke: var(--amber); stroke-width: 2; }
.dial .hub-t { font: 700 17px "Barlow Semi Condensed", sans-serif; fill: var(--readout-ink); }
.legend .sw.sp { background: var(--sp); } .legend .sw.lp { background: var(--lp); }
.map-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.map-head h2 { margin: 0; }
.map-tools { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; }
.chk { font-size: .95rem; display: flex; gap: .3rem; align-items: center; }
.map-box { aspect-ratio: 1 / 1; max-width: 640px; margin: 0 auto; position: relative; }
.map-box:has(svg.flat) { aspect-ratio: 600 / 330; max-width: none; }
.map-box svg { width: 100%; height: 100%; display: block; cursor: crosshair; }
.map-wait { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; }
.bmap .sea { fill: var(--map-sea); }
.bmap .grat { fill: none; stroke: var(--map-grat); stroke-width: .6; }
.bmap .land { fill: var(--map-land); stroke: none; }
.bmap .border { fill: none; stroke: var(--map-border); stroke-width: .5; }
.bmap .night1 { fill: #0a1630; fill-opacity: .10; }
.bmap .night2 { fill: #0a1630; fill-opacity: .14; }
.bmap .night3 { fill: #0a1630; fill-opacity: .08; }
.bmap .ring { fill: none; stroke: var(--map-ring); stroke-width: .8; stroke-dasharray: 3 4; opacity: .7; }
.bmap .ring-t { font: 500 11px "Barlow", sans-serif; fill: var(--ink-soft); }
.bmap .rim { fill: none; stroke: var(--ink-soft); stroke-width: 1.2; }
.bmap .edge-tick { stroke: var(--ink-soft); stroke-width: 1; }
.bmap .edge-t { font: 600 12px "Barlow", sans-serif; fill: var(--ink); text-anchor: middle; }
.bmap .sp-line { fill: none; stroke: var(--sp); stroke-width: 3; stroke-linecap: round; }
.bmap .lp-line { fill: none; stroke: var(--lp); stroke-width: 2.2; stroke-dasharray: 7 6; }
.bmap .me { fill: var(--enamel); stroke: var(--surface); stroke-width: 2; }
.bmap .them { fill: var(--sp); stroke: var(--surface); stroke-width: 2; }
.bmap .them-t { font: 700 14px "Barlow Semi Condensed", sans-serif; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.bmap .them-t.end { text-anchor: end; }
.bh-table { max-height: 520px; overflow: auto; }
.bh-table thead th { position: sticky; top: 0; z-index: 1; }
#bh-tab tbody tr { cursor: pointer; }
#bh-tab tbody tr:hover th, #bh-tab tbody tr:hover td { background: var(--panel); }
.map-box .zoom-tools { position: absolute; top: 8px; right: 8px; display: grid; gap: 4px; }
.map-box .zoom-tools button { width: 36px; height: 36px; font: 600 1.15rem "Barlow", sans-serif; line-height: 1; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); border-radius: 6px; cursor: pointer; }
.map-box .zoom-tools button:hover { border-color: var(--enamel); color: var(--enamel); }
.map-box .zoom-level { position: absolute; left: 10px; bottom: 8px; font: 600 .85rem "Barlow", sans-serif; color: var(--ink-soft); background: var(--surface); padding: 0 .35rem; border-radius: 4px; }
.map-box .zoom-level:empty { display: none; }
.map-box svg { touch-action: pan-y; }
.map-box svg.zoomed { touch-action: none; cursor: grab; }
.map-box svg.zoomed:active { cursor: grabbing; }
.map-box svg:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.bmap .spoke { stroke: var(--map-ring); stroke-width: .7; opacity: .5; }
#bh-move[aria-pressed="true"] { background: var(--sp); border-color: var(--sp); color: #fff; }
.move-hint { margin: 0 0 .6rem; padding: .5rem .75rem; border-radius: 6px; background: color-mix(in srgb, var(--sp) 14%, var(--surface)); border: 1px solid var(--sp); font-weight: 600; font-size: .95rem; }
.map-box.moving svg, .map-box.moving svg.zoomed { cursor: crosshair; }
.map-box.moving .bmap .me { stroke: var(--sp); stroke-width: 3; }

/* Screen-reader only text */
.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
#ct-list h3{margin:1.4rem 0 .4rem;font-size:1.1rem}
#ct-list td small{display:block}
#sp-tab tbody tr:focus-visible{outline:2px solid var(--amber);outline-offset:-2px}
.diagram { margin: 1rem 0; }
.diagram svg { display: block; width: 100%; max-width: 640px; height: auto; }
.readout .r-value, .readout .r-sub { overflow-wrap: anywhere; }
.readout { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); }
.sat-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .sat-grid { grid-template-columns: minmax(0, 1fr); } }
.readout.big { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); }
.dash { grid-template-columns: minmax(0, 1fr); }
/* Exam quiz */
.ex-card { max-width: 46rem; }
.ex-q { font-size: 1.25rem; font-weight: 600; margin: .4rem 0 1rem; }
.ex-opts { display: grid; gap: .55rem; }
.ex-opt { text-align: left; font: inherit; padding: .75rem 1rem; border-radius: var(--radius-input); border: 1px solid var(--rule); background: var(--panel); color: var(--ink); cursor: pointer; }
.ex-opt:hover:not(:disabled) { border-color: var(--amber); }
.ex-opt:disabled { cursor: default; }
.ex-opt.right { border-color: var(--good); box-shadow: inset 0 0 0 2px var(--good); }
.ex-opt.wrong { border-color: var(--bad); box-shadow: inset 0 0 0 2px var(--bad); }
.ex-fb { margin: 1rem 0 .4rem; padding: .8rem 1rem; border-radius: var(--radius-input); border-left: 4px solid var(--good); background: var(--surface); }
.ex-fb.no { border-left-color: var(--bad); }
#ex-review li { margin-bottom: .6rem; }
#ex-review span { display: block; color: var(--ink-soft); }
.dtmf { display: grid; grid-template-columns: repeat(4, minmax(0, 4.2rem)); gap: .5rem; }
.dtmf .btn { font-size: 1.3rem; padding: .7rem 0; justify-content: center; }
#bp-msg, #dm-msg, #ct-msg { color: var(--ink); }
.sstv-canvas { display: block; width: 100%; max-width: 640px; height: auto; image-rendering: auto; background: #111; border-radius: var(--radius-input); margin: .6rem 0; }
/* Satellite map */
#sm-map { width: 100%; height: auto; display: block; }
.sm-sea { fill: #dfe9f3; } .sm-land { fill: #c9d3c0; stroke: #a3ad99; stroke-width: .5; }
.sm-grid { fill: none; stroke: rgba(0,0,0,.08); }
.sm-night { fill: rgba(10,20,40,.28); stroke: none; }
.sm-track { fill: none; stroke: var(--amber); stroke-width: 2.5; }
.sm-foot { fill: rgba(255,170,0,.12); stroke: var(--amber); stroke-width: 1.2; }
.sm-sat { fill: #1b3a5c; stroke: #fff; stroke-width: 1; cursor: pointer; }
.sm-sat.sel { fill: var(--amber); stroke: #000; stroke-width: 1.5; }
.sm-me { fill: #c0392b; stroke: #fff; stroke-width: 2; }
.sm-lbl { font-size: 15px; font-weight: 700; fill: #111; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
:root[data-theme="dark"] .sm-sea { fill: #16222f; } :root[data-theme="dark"] .sm-land { fill: #2b3a2d; stroke: #3f5141; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sm-sea { fill: #16222f; } :root:not([data-theme="light"]) .sm-land { fill: #2b3a2d; stroke: #3f5141; } }
.sm-wrap { margin-top: 1rem; border-radius: var(--radius-panel); overflow: hidden; border: 1px solid var(--rule); }
/* Live diagrams */
.live-diag { margin: 1.4rem 0 .4rem; padding: .8rem; border: 1px solid var(--rule); border-radius: var(--radius-input, 8px); background: var(--panel); color: var(--ink); }
.live-diag svg { max-width: 680px; margin: 0 auto; }
.live-diag figcaption { font-size: .85rem; color: var(--ink-soft); text-align: center; margin-top: .3rem; }

/* Header logo on very small phones (after the base header rules so it wins) */
@media (max-width: 374px) { .brand img { width: 126px; height: 21px; } .theme-toggle, .menu-toggle { padding: .2rem .4rem; font-size: .85rem; } .site-header .wrap { gap: .5rem; } }

/* Printable reference charts (Morse, phonetic alphabet) */
.mc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .4rem; }
.mc-cell { display: flex; flex-direction: column; align-items: center; padding: .45rem .3rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--panel); }
.mc-cell b { font-family: "Barlow Semi Condensed", sans-serif; font-size: 1.25rem; }
.mc-cell span { font-size: .95rem; color: var(--ink-soft); letter-spacing: .06em; }
@media print {
  .site-header, .site-footer, .sidebar, .ad-slot, .no-print, .crumbs, .skip, .live-diag figcaption, details.faq, .faq { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .wrap { max-width: none; }
  .tool-layout { display: block !important; }
  .print-chart { break-inside: avoid; border: 0; }
  .mc-grid { grid-template-columns: repeat(6, 1fr); }
  .mc-cell { border-color: #999; background: #fff; }
  .mc-cell span { color: #000; }
  a { color: #000; text-decoration: none; }
}
.mc-cell span.morse { font-size: 1.45rem; line-height: 1.1; letter-spacing: .12em; color: var(--ink); font-weight: 700; }
