/* kd7swh.com — one stylesheet.
 *
 * Constraints (load-bearing, not stylistic whims):
 *  - system font stack, no @font-face, no external requests
 *  - body-text contrast >= 4.5:1 in both schemes
 *  - visible focus on everything interactive; outlines never removed
 *  - almost no motion, and none at all under prefers-reduced-motion
 *  - body measure capped near 70 characters
 *  - printable — net control may want the week on paper
 */

:root {
  --bg: #ffffff;
  --text: #1b1b1b;          /* 16.7:1 on --bg */
  --muted: #4d4d4d;         /*  7.4:1 on --bg */
  --link: #0b57d0;          /*  6.3:1 on --bg */
  --link-visited: #6a3fa0;
  --accent: #8c4a00;        /* LUN accent, 6.4:1 on --bg */
  --rule: #d5d5d5;
  --focus: #0b57d0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --text: #e8e8e8;        /* 15.2:1 on --bg */
    --muted: #b0b0b0;       /*  7.7:1 on --bg */
    --link: #8ab4f8;        /*  8.6:1 on --bg */
    --link-visited: #c5a3e8;
    --accent: #ffb26b;      /*  9.5:1 on --bg */
    --rule: #3a3a3a;
    --focus: #8ab4f8;
  }
}

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  line-height: 1.55;
  font-size: 1.0625rem;
}

/* ------------------------------------------------------------ structure */

.site-header, main, .site-footer {
  max-width: 44rem;               /* ~70ch of body text */
  margin-inline: auto;
  padding-inline: 1rem;
}

main { padding-block: 1rem 3rem; }

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.7rem; margin-block: 1.2rem 0.6rem; }
h2 { font-size: 1.3rem; margin-block: 2rem 0.5rem; }

p, li { max-width: 70ch; }

/* ---------------------------------------------------------------- links */

a { color: var(--link); }
a:visited { color: var(--link-visited); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ------------------------------------------------------------ skip link */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--bg);
  color: var(--link);
  padding: 0.5rem 1rem;
}

.skip:focus {
  left: 0;
  z-index: 1;
}

/* ----------------------------------------------------------- header/nav */

.site-header {
  padding-block: 0.9rem;
  border-bottom: 1px solid var(--rule);
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  align-items: baseline;
}

.site-header a {
  text-decoration: none;
  color: var(--text);
}

.site-header a:hover { text-decoration: underline; }
.site-header a:visited { color: var(--text); }

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* The LUN section is community material, visually distinct from the
 * personal pages. */
.site-header .lun-link,
.site-header .lun-link:visited {
  color: var(--accent);
  font-weight: 600;
}

/* ----------------------------------------------------------- note list */

.note-list { list-style: none; padding-left: 0; }

.note-list li { margin-block: 0.6rem; }

.note-date {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ------------------------------------------------------- space weather */

/* Condition colors are a colorblind-safe palette (Okabe-Ito family), used
 * ONLY as an extra cue: every rating also carries a word and a symbol, and
 * the cell text itself stays high-contrast, so nothing depends on color.
 * Applied to the symbol/marker and a faint cell tint, never to the words. */
:root {
  --cond-good: #0a6ebd;      /* blue   */
  --cond-fair: #9a6700;      /* amber  */
  --cond-poor: #b3450f;      /* rust   */
  --cond-good-bg: #e7f1fb;
  --cond-fair-bg: #fbf1dd;
  --cond-poor-bg: #fbe6dc;
}
@media (prefers-color-scheme: dark) {
  :root {
    --cond-good: #7fb8e6;
    --cond-fair: #e6b34d;
    --cond-poor: #f0895e;
    --cond-good-bg: #14232f;
    --cond-fair-bg: #2a2312;
    --cond-poor-bg: #2c1a12;
  }
}
:root[data-theme="light"] {
  --cond-good: #0a6ebd; --cond-fair: #9a6700; --cond-poor: #b3450f;
  --cond-good-bg: #e7f1fb; --cond-fair-bg: #fbf1dd; --cond-poor-bg: #fbe6dc;
}
:root[data-theme="dark"] {
  --cond-good: #7fb8e6; --cond-fair: #e6b34d; --cond-poor: #f0895e;
  --cond-good-bg: #14232f; --cond-fair-bg: #2a2312; --cond-poor-bg: #2c1a12;
}

table.bands { border-collapse: collapse; width: 100%; margin-block: 1rem; }
table.bands th, table.bands td {
  text-align: left; padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--rule);
}
table.bands th[scope="row"] { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cond-mark { font-weight: 700; }
.cond-good { background: var(--cond-good-bg); }
.cond-fair { background: var(--cond-fair-bg); }
.cond-poor { background: var(--cond-poor-bg); }
.cond-good .cond-mark { color: var(--cond-good); }
.cond-fair .cond-mark { color: var(--cond-fair); }
.cond-poor .cond-mark { color: var(--cond-poor); }
.cond-closed .cond-mark { color: var(--muted); }
.vhf-note { margin-block: 0.75rem; }

/* Scale badges: a colored left border by severity, alongside the number+text. */
.badge-caution { border-left: 4px solid var(--cond-fair); }
.badge-alert { border-left: 4px solid var(--cond-poor); }

/* Kp meter: color the filled cells by activity band (decorative; aria-hidden). */
.kp-good .kp-filled { color: var(--cond-good); }
.kp-fair .kp-filled { color: var(--cond-fair); }
.kp-alert .kp-filled { color: var(--cond-poor); }

.provenance { color: var(--muted); font-size: 0.95rem; }

.banner {
  border: 2px solid var(--rule);
  padding: 0.75rem 1rem;
  border-radius: 4px;
}

table.conditions, table.outlook {
  border-collapse: collapse;
  width: 100%;
  margin-block: 1rem;
}

table.conditions th, table.conditions td,
table.outlook th, table.outlook td {
  text-align: left;
  vertical-align: top;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--rule);
}

table.conditions th[scope="row"],
table.outlook th[scope="row"] { white-space: nowrap; }

caption {
  text-align: left;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

/* Severity is carried by the text after the badge, never by color. */
.badge {
  display: inline-block;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0 0.4rem;
  font-variant-numeric: tabular-nums;
}

ul.scales { list-style: none; padding-left: 0; }
ul.scales li { margin-block: 0.5rem; }

.kp-meter {
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.1em;
}
.kp-meter-text, .muted { color: var(--muted); font-size: 0.9rem; }

.stale-note { color: var(--muted); font-style: italic; }

pre.wwv {
  border: 1px solid var(--rule);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-size: 0.95rem;
}

dl.glossary dt { font-weight: 600; margin-top: 0.8rem; }
dl.glossary dd { margin-left: 0; margin-bottom: 0.4rem; }

.notice { color: var(--muted); font-size: 0.85rem; }
ul.sources { font-size: 0.9rem; }

@media print {
  table.conditions, table.outlook, pre.wwv { break-inside: avoid; }
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 1rem 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer a { color: var(--muted); }

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ----------------------------------------------------------------- print */

@media print {
  .site-header nav, .site-footer, .skip { display: none; }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  a { color: #000; }

  li { break-inside: avoid; }

  main { max-width: none; padding: 0; }
}
