/* The /ham-radio page, light theme. ham-dark.css overrides it for the dark
   theme (linked with data-theme-dark, like facts-dark.css). The map canvas
   colors live in web/src/hf/mapview.ts; the swatches here match them. */

.hf-intro { margin-bottom: 16px; }

.hf-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin: 0 0 18px;
  min-width: 0;
}
.hf-card[hidden] { display: none; }
.hf-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 10px; }
.hf-card-head h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; color: #b5551d; }
.hf-card-head .card-caption { margin-left: auto; margin-right: 0; }
.hf-sub { font-size: 1.05rem; margin: 22px 0 10px; }

/* ---- Info tips: details/summary, so they work without JavaScript ---- */
.hf-info { position: relative; display: inline-block; vertical-align: middle; }
.hf-info summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  font: italic 600 11px/1 Georgia, serif;
  cursor: pointer;
  user-select: none;
}
.hf-info summary::-webkit-details-marker { display: none; }
.hf-info[open] summary, .hf-info summary:hover { color: var(--text); border-color: var(--muted); }
.hf-info-body {
  position: absolute;
  z-index: 20;
  top: 24px;
  left: -12px;
  width: min(340px, 80vw);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.16);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.45;
}
.hf-tile:nth-child(4n) .hf-info-body, .hf-tile:nth-child(4n - 1) .hf-info-body { left: auto; right: -12px; }
/* Narrow screens: a tip spans its card, just below its (i), so it never leaves the screen. */
@media (max-width: 720px) {
  .hf-card { position: relative; }
  .hf-info { position: static; }
  .hf-info .hf-info-body,
  .hf-tile:nth-child(4n) .hf-info-body,
  .hf-tile:nth-child(4n - 1) .hf-info-body { top: auto; left: 12px; right: 12px; width: auto; margin-top: 6px; }
}

/* ---- Conditions tiles ---- */
.hf-headline { font-size: 1rem; margin-bottom: 12px; }
.hf-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .hf-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hf-tile {
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--bg);
  border-left: 4px solid #6aa66a;
  min-width: 0;
}
.hf-tile.hf-watch { border-left-color: #e0a12b; }
.hf-tile.hf-disturbed { border-left-color: #d0453b; }
.hf-tile.hf-unknown { border-left-color: var(--line); }
.hf-tile-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.hf-tile-value { font-size: 1.55rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.25; }
.hf-tile-value small { font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.hf-tile-value.hf-scales { font-size: 1.25rem; padding: 3px 0; }
.hf-tile-note { color: var(--muted); font-size: 0.82rem; }
.hf-charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 14px; }
.hf-charts[hidden] { display: none; }
.hf-more { margin-top: 12px; }
.hf-card a:not([class]) { color: var(--accent-moon); }
@media (min-width: 720px) { .hf-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hf-figure { margin: 0; min-width: 0; }
.hf-figure figcaption { margin-top: 4px; font-size: 0.82rem; }

/* ---- Charts ---- */
.hf-chart, .hf-hourgrid { display: block; width: 100%; height: auto; }
.hf-hourgrid { max-width: 640px; }
.hf-axis { font-size: 9px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.hf-axis-local { font-size: 8px; opacity: 0.8; }
.hf-axis-strong { fill: var(--text); font-weight: 700; }
.hf-grid { stroke: var(--line); stroke-width: 0.7; }
.hf-grid-strong { stroke: #d0453b; stroke-dasharray: 3 2; opacity: 0.7; }
.hf-now-line { stroke: var(--text); stroke-width: 1.2; stroke-dasharray: 2 2; }
.hf-kp { fill: #6aa66a; }
.hf-kp1 { fill: #e0a12b; }
.hf-kp2 { fill: #e06b2b; }
.hf-kp3 { fill: #c8322f; }
.hf-forecast { opacity: 0.45; }
.hf-xray-line { fill: none; stroke: #c76b1c; stroke-width: 1.5; }

/* Contact chance, 10% steps (the map uses the same colors). */
.hf-cell { stroke: none; }
.hf-c0 { fill: #ebe8e1; background: #ebe8e1; }
.hf-c1 { fill: #ecbe48; background: #f3d98b; }
.hf-c2 { fill: #bec846; background: #d5dc8f; }
.hf-c3 { fill: #6ebe5a; background: #aedb9f; }
.hf-c4 { fill: #28a05f; background: #7fcb9e; }
.hf-c5 { fill: #0a7350; background: #3da47b; }
.hf-na { fill: transparent; stroke: var(--line); stroke-dasharray: 2 2; }
.hf-strip { display: block; width: 120px; height: 12px; }

/* ---- Setup bar ---- */
.hf-tool { display: block; }
.hf-setup { position: relative; }
.hf-station { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin-bottom: 12px; }
.hf-setup-label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.hf-grid { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; padding: 1px 6px; border-radius: 6px; background: var(--bg); }
.hf-station-form { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.hf-station-form[hidden] { display: none; }
.hf-station-form label { display: flex; flex-direction: column; gap: 3px; font-size: 0.85rem; color: var(--muted); }
.hf-error { flex-basis: 100%; color: #c8322f; font-size: 0.88rem; }
.hf-error[hidden] { display: none; }
.hf-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
@media (min-width: 820px) { .hf-controls { grid-template-columns: 0.7fr 1.6fr 0.8fr 1fr 2.2fr; } }
.hf-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; min-width: 0; }
.hf-controls select, .hf-station-form input, .hf-target-form input, .hf-map-band select {
  font: inherit;
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 8px;
  min-width: 0;
}
.hf-when { grid-column: 1 / -1; }
@media (min-width: 820px) { .hf-when { grid-column: auto; } }
.hf-when input { width: 100%; accent-color: #b5551d; }
.hf-when output { font-size: 0.88rem; color: var(--text); text-transform: none; letter-spacing: 0; }
.hf-best { margin-top: 12px; font-weight: 600; }
.hf-best:empty, .hf-status:empty { display: none; }
.hf-status { margin-top: 4px; font-size: 0.82rem; }
.hf-station-form button[type="submit"], .hf-target-form button {
  font: inherit;
  font-size: 0.92rem;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #b5551d;
  color: #fff;
  cursor: pointer;
}

/* Buttons in segmented groups (the map layers, short or long path). */
.hf-tool .segmented button {
  font: inherit;
  font-size: 0.88rem;
  border: 0;
  background: none;
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.hf-tool .segmented button[aria-pressed="true"] { background: var(--accent-sun-soft); color: var(--text); font-weight: 600; }
.hf-tool .segmented button:focus-visible { outline: 2px solid #b5551d; outline-offset: 1px; }

/* ---- Bands table ---- */
.hf-bands-table, .hf-path-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.hf-bands-table th, .hf-bands-table td, .hf-path-table th, .hf-path-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.hf-bands-table thead th, .hf-path-table thead th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.hf-bands-table tr.is-selected { background: var(--accent-sun-soft); }
.hf-band-name { white-space: nowrap; }
.hf-band-name small { display: block; color: var(--muted); font-weight: 400; font-size: 0.75rem; }
.hf-band-pick { font: inherit; font-weight: 650; background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.hf-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.hf-chip-closed { background: #ece9e3; color: #6b6f78; }
.hf-chip-short { background: #f6e6bd; color: #6d4f05; }
.hf-chip-regional { background: #e4efc1; color: #43520d; }
.hf-chip-long { background: #c9ebd2; color: #155b34; }
.hf-chip-dx { background: #0a7350; color: #fff; }
.hf-chip-na { background: transparent; border: 1px dashed var(--line); color: var(--muted); font-weight: 500; }
.hf-reach { margin-left: 6px; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.hf-rough { display: block; color: var(--muted); font-size: 0.75rem; }
.hf-places-cell { color: var(--muted); font-size: 0.86rem; }
.hf-grade { display: inline-block; min-width: 44px; text-align: center; padding: 2px 8px; border-radius: 8px; font-size: 0.8rem; font-weight: 650; }
.hf-grade-good { background: #c9ebd2; color: #155b34; }
.hf-grade-fair { background: #f6e6bd; color: #6d4f05; }
.hf-grade-poor { background: #f5d4cf; color: #8a2a20; }
.hf-grade-none { color: var(--muted); }
.hf-table-note { margin-top: 10px; font-size: 0.82rem; }
[data-hf="bands"] { overflow-x: auto; }
.hf-xn-show { display: none; }
@media (max-width: 420px) {
  .hf-reach { display: block; margin: 2px 0 0; }
  .hf-grade { min-width: 0; padding: 2px 6px; }
  .hf-xn-hide { display: none; }
  span.hf-xn-show { display: inline; }
  .hf-bands-table .hf-grade { display: block; width: max-content; }
  .hf-bands-table .hf-grade + .hf-grade { margin-top: 4px; }
  .hf-bands-table .hf-chip { padding: 2px 7px; font-size: 0.78rem; }
  .hf-bands-table .hf-rough, .hf-reach { font-size: 0.78rem; }
  .hf-bands-table thead th { letter-spacing: 0.02em; }
}
@media (max-width: 640px) {
  .hf-hide-narrow { display: none; }
  .hf-path-table { font-size: 0.86rem; }
  .hf-needs { font-size: 0.8rem; }
  .hf-tool .segmented button { padding: 4px 9px; }
  .hf-bands-table th, .hf-bands-table td, .hf-path-table th, .hf-path-table td { padding: 6px 4px; }
}

/* ---- Map ---- */
.hf-map-card .hf-card-head h2 { margin-right: auto; }
.hf-map-band { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.hf-map { position: relative; }
.hf-map-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: #cfe0ef;
  cursor: crosshair;
}
.hf-map-frame > svg, .hf-map-frame > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hf-map-frame canvas { pointer-events: none; }
.hf-map-base { pointer-events: none; }
.hf-map-land { fill: #f3efe4; }
.hf-map-outlines { pointer-events: none; }
.hf-map-coast { fill: none; stroke: rgb(60 55 40 / 0.55); stroke-width: 0.7; }
.hf-map-borders { fill: none; stroke: rgb(60 55 40 / 0.25); stroke-width: 0.5; }
.hf-map-graticule { fill: none; stroke: rgb(0 0 0 / 0.07); stroke-width: 0.6; }
.hf-map-marks { overflow: visible; }
.hf-map-sun { fill: #f2b631; stroke: #fff; stroke-width: 0.6; vector-effect: non-scaling-stroke; }
.hf-station-ring { fill: none; stroke: #b5551d; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.hf-station-dot { fill: #b5551d; }
.hf-target-mark path { stroke: #1d1f24; stroke-width: 2; fill: none; }
.hf-path { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.hf-path-short { stroke: #1d1f24; opacity: 0.35; stroke-dasharray: 4 3; }
.hf-path-long { stroke: #7a3fa0; opacity: 0.35; stroke-dasharray: 2 3; }
.hf-path.is-active { opacity: 0.95; stroke-dasharray: none; }
.hf-place { stroke: #fff; stroke-width: 0.8; vector-effect: non-scaling-stroke; cursor: pointer; }
.hf-place.hf-c0 { fill: #9aa0a8; }
.hf-map-busy {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgb(0 0 0 / 0.15);
  border-top-color: #b5551d;
  animation: hf-spin 0.9s linear infinite;
}
.hf-map-busy[hidden] { display: none; }
@keyframes hf-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hf-map-busy { animation: none; } }
.hf-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 10px; font-size: 0.82rem; }
.hf-legend-title { color: var(--muted); }
.hf-legend-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.hf-legend-item i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; }
.hf-map-caption { min-height: 1.4em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hf-m0 { background: rgb(70 60 140 / 0.6); }
.hf-m1 { background: rgb(90 80 175 / 0.65); }
.hf-m2 { background: rgb(60 110 200 / 0.65); }
.hf-m3 { background: rgb(40 150 200 / 0.7); }
.hf-m4 { background: rgb(40 175 150 / 0.7); }
.hf-m5 { background: rgb(110 190 80 / 0.75); }
.hf-m6 { background: rgb(215 200 60 / 0.75); }
.hf-m7 { background: rgb(240 150 45 / 0.8); }
.hf-m8 { background: rgb(225 75 50 / 0.8); }
.hf-m9 { background: rgb(190 40 140 / 0.85); }
.hf-f0 { background: rgb(70 60 140 / 0.55); }
.hf-f1 { background: rgb(70 100 190 / 0.6); }
.hf-f2 { background: rgb(40 150 200 / 0.65); }
.hf-f3 { background: rgb(40 175 150 / 0.7); }
.hf-f4 { background: rgb(160 200 70 / 0.75); }
.hf-f5 { background: rgb(240 150 45 / 0.8); }
.hf-d1 { background: rgb(250 210 90 / 0.6); }
.hf-d2 { background: rgb(245 165 60 / 0.7); }
.hf-d3 { background: rgb(235 110 50 / 0.75); }
.hf-d4 { background: rgb(215 60 50 / 0.8); }
.hf-d5 { background: rgb(170 30 70 / 0.85); }
.hf-d6 { background: rgb(120 20 90 / 0.9); }

/* ---- Path planner ---- */
.hf-target-form { position: relative; display: flex; gap: 8px; }
.hf-target-form input { flex: 1; }
.hf-suggestions { position: absolute; z-index: 10; top: 100%; left: 0; right: 90px; margin: 4px 0 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.hf-suggestions:empty { display: none; }
.hf-suggestions button { display: block; width: 100%; text-align: left; font: inherit; padding: 8px 12px; background: none; border: 0; color: var(--text); cursor: pointer; }
.hf-suggestions button:hover, .hf-suggestions button:focus-visible { background: var(--accent-sun-soft); }
.hf-quicks { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.hf-quick { font: inherit; font-size: 0.85rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.hf-quick:hover { border-color: var(--muted); }
.hf-path { margin-top: 12px; }
.hf-path-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.hf-path-head h3 { font-size: 1.1rem; }
.hf-path-facts { color: var(--muted); font-size: 0.88rem; flex-basis: 100%; }
.hf-path-toggle { margin-top: 6px; }
.hf-path-summary { margin: 12px 0 4px; font-size: 1rem; }
.hf-path-later { color: var(--muted); }
.hf-path-iono { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 12px 0; font-size: 0.88rem; }
.hf-path-iono dt { color: var(--muted); cursor: help; }
.hf-path-iono dd { margin: 0; font-variant-numeric: tabular-nums; }
.hf-path-table tr.is-best { background: var(--accent-sun-soft); }
.hf-pill { display: inline-block; min-width: 42px; text-align: center; padding: 1px 6px; border-radius: 7px; font-size: 0.82rem; font-weight: 650; font-variant-numeric: tabular-nums; color: #1d1f24; }
.hf-pill.hf-c4, .hf-pill.hf-c5 { color: #fff; }
.hf-pill.hf-c0 { color: var(--muted); }
.hf-pill.hf-na { background: none; border: 1px dashed var(--line); color: var(--muted); font-weight: 500; }
.hf-needs { font-size: 0.86rem; }
.hf-path .hf-figure { margin-top: 16px; overflow-x: auto; }
.hf-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- Guide ---- */
.hf-guide-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 640px) { .hf-guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .hf-guide-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.hf-guide-grid article { padding: 10px 12px; border-radius: 12px; background: var(--bg); }
.hf-guide-grid h3 { font-size: 1rem; margin-bottom: 4px; }
.hf-guide-grid h3 small { color: var(--muted); font-weight: 400; font-size: 0.8rem; margin-left: 4px; }
.hf-guide-grid p { font-size: 0.9rem; }
.hf-explain { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 860px) { .hf-explain { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.hf-diagram { width: 100%; height: auto; border-radius: 12px; }
.hf-d-sky { fill: #dfe9f3; }
.hf-d-f2 { fill: #7fa7d6; opacity: 0.55; }
.hf-d-e { fill: #a6bfdc; opacity: 0.7; }
.hf-d-dl { fill: #d9b38a; opacity: 0.6; }
.hf-d-ground { fill: #c9c0a7; }
.hf-d-ray { fill: none; stroke: #b5551d; stroke-width: 2.2; stroke-linejoin: round; }
.hf-d-ray-lost { stroke: #7a3fa0; stroke-dasharray: 5 4; }
.hf-d-ray-absorbed { stroke: #8a6a3a; stroke-width: 3; }
.hf-d-station { fill: #1d1f24; }
.hf-d-label { font-size: 13px; font-weight: 700; fill: #2d3a55; }
.hf-d-note { font-size: 11px; fill: #2d3340; }
.hf-terms { margin: 0; font-size: 0.92rem; }
.hf-terms dt { font-weight: 650; margin-top: 8px; }
.hf-terms dd { margin: 2px 0 0; }

/* ---- Method ---- */
.hf-method details { border-top: 1px solid var(--line); padding: 8px 0; }
.hf-method details:first-of-type { border-top: 0; }
.hf-method summary { cursor: pointer; font-weight: 600; }
.hf-method ul { margin: 8px 0 0; padding-left: 20px; font-size: 0.9rem; }
.hf-method li { margin-bottom: 6px; }
.hf-method p { margin-top: 8px; font-size: 0.92rem; }
