* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #112b3a;
  --navy-light: #1c3d51;
  --paper: #f7f5f0;
  --ink: #1b1b1b;
  --muted: #6d7278;
  --accent: #c0562c;
  --line: #d9d5cb;
  --row-alt: #efece4;
  --dial: #0f5c6b;
}

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.45;
}

header {
  background: var(--navy);
  color: #eef2f5;
  padding: 1.2rem 1.5rem 0;
}
header h1 { font-size: 1.6rem; letter-spacing: .02em; }
header .sub { color: #a8bcc9; font-size: .85rem; margin-top: .15rem; }

nav#tabs { margin-top: .9rem; display: flex; gap: .25rem; flex-wrap: wrap; }
nav#tabs a {
  color: #dde6ec;
  text-decoration: none;
  padding: .45rem .95rem;
  border-radius: 6px 6px 0 0;
  font-size: .95rem;
}
nav#tabs a.active { background: var(--paper); color: var(--navy); font-weight: bold; }
nav#tabs a:not(.active):hover { background: var(--navy-light); }

main { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1.5rem 3rem; }

.tab { display: none; }
h2 { font-size: 1.25rem; margin-bottom: .3rem; }
h3 { font-size: 1.05rem; margin: 1.4rem 0 .4rem; color: var(--navy); }
p { margin-bottom: .6rem; }

/* ------------------------------------------------ location + filter bar */

#controls {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .7rem .85rem;
  margin-bottom: 1.1rem;
}
#controls .row {
  display: flex;
  gap: .6rem;
  align-items: center;
  flex-wrap: wrap;
}
#controls .row + .row { margin-top: .55rem; }
#controls label { font-size: .9rem; color: var(--muted); }
#controls label.check { display: flex; align-items: center; gap: .3rem; }

button, select, input[type=text], input[type=search] {
  font-family: inherit;
  font-size: .92rem;
  padding: .35rem .5rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
}
button {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  cursor: pointer;
}
button:hover { background: var(--navy-light); }
input[type=search] { width: 100%; max-width: 32rem; font-size: 1rem; padding: .5rem .6rem; }

#where { font-size: .85rem; color: var(--accent); }

#legend {
  margin: .6rem 0 0;
  padding-top: .55rem;
  border-top: 1px solid var(--line);
  font-size: .78rem;
  color: var(--muted);
}
#legend b { color: var(--ink); font-weight: bold; }

.count-in-head {
  font-weight: normal;
  font-size: .8rem;
  color: var(--muted);
  margin-left: .35rem;
}

/* ------------------------------------------------------- station detail */

.crumb { font-size: .85rem; margin-bottom: .5rem; }
.station-title { display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; }
.station-freq { font-size: 1.1rem; font-weight: normal; color: var(--dial); font-variant-numeric: tabular-nums; }
.sub-dist { font-size: .9rem; color: var(--accent); margin-bottom: .8rem; }

/* The favorite star sits in the title beside the frequency. Outlined rather
   than a filled button, so it reads as a mark on the station and not a second
   action competing with "Log this catch". */
.station-title .star {
  background: none;
  border: 1px solid var(--muted);
  color: var(--navy);
  border-radius: 1rem;
  padding: .1rem .65rem;
  font-size: .85rem;
  font-weight: normal;
  cursor: pointer;
  align-self: center;
}
.station-title .star.on { color: var(--accent); border-color: var(--accent); }
.station-title .star:hover { background: none; color: var(--accent); }
.star-label { margin-left: .35rem; }
.station-links { line-height: 1.7; }
.quick-log { margin: -.3rem 0 .4rem; }
.quick-log button { font-size: .85rem; padding: .3rem .8rem; }

table.facts { border-collapse: collapse; margin: .9rem 0; font-size: .9rem; }
table.facts th {
  text-align: left;
  font-weight: normal;
  color: var(--muted);
  padding: .3rem 1.2rem .3rem 0;
  white-space: nowrap;
  vertical-align: top;
}
table.facts td { padding: .3rem 0; }
.small { font-size: .85rem; }

/* ------------------------------------------------------------ DX log */

.capture {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .8rem .85rem;
  margin-bottom: 1rem;
}
.capture .row { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.capture .row + .row, .capture label.wide { margin-top: .6rem; }
.capture label { font-size: .9rem; color: var(--muted); }
.capture label.wide { display: block; }
.capture textarea {
  display: block;
  width: 100%;
  font-family: inherit;
  font-size: .92rem;
  padding: .4rem .5rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  margin-top: .2rem;
}

.catch { border-left: 3px solid var(--line); padding: .1rem 0 .1rem .7rem; margin-bottom: .8rem; }
.catch-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .9rem; }
.catch p { margin: .2rem 0 0; font-size: .9rem; }

.sig {
  font-variant-numeric: tabular-nums;
  font-weight: bold;
  font-size: .78rem;
  border-radius: 3px;
  padding: 0 .35rem;
  color: #fff;
  background: var(--muted);
}
.sig-5 { background: #2c6e49; }
.sig-4 { background: #4c956c; }
.sig-3 { background: #b9862f; }
.sig-2 { background: #c0562c; }
.sig-1 { background: #8c3b1d; }

/* Width is held whether or not the tick is in it, so the call signs below an
   unheard station still line up with the ones below a heard one. */
.heard {
  display: inline-block;
  width: 1em;
  margin-right: .15rem;
  color: #2c6e49;
  font-weight: bold;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: .82rem;
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { background: none; color: var(--navy); }

/* ------------------------------------------------------------ the dial */

/* The base .chans rule has to come before the media query, not after it. Both
   are one class deep, so the later one wins on a tie -- and when this sat below
   the query its `overflow: hidden` beat the `overflow-y: auto` inside it. The
   list was clipped at max-height with no way to scroll the rest into view.
   Only overflow-x is hidden now, which is all the rounded corners needed. */
.chans {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow-x: hidden;
}

/* Two things on one screen from 820px, which is an iPad in portrait: the list
   beside the panel, sticky and scrolling in its own column.

   Below that, two pages rather than two halves. The list ran to 209 channels at
   400 km and the panel began underneath all of it, so choosing a frequency
   meant six screens of scrolling to reach the stations you had just chosen. The
   URL already told the two apart -- #dial against #dial/590 -- and only the
   rendering insisted on drawing both. Now the bare route is the picker and a
   chosen frequency is the stations, with a crumb back.

   Done in CSS off a class rather than by routing, so a rotation or a resize
   lands on the right layout with no listener and nothing re-rendered. */
.split { display: grid; gap: 1.1rem; }
@media (min-width: 820px) {
  .split { grid-template-columns: 15rem 1fr; align-items: start; }
  .chans { position: sticky; top: .5rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
}
.dial-back { display: none; }
@media (max-width: 819px) {
  .split:not(.split-picked) .panel { display: none; }
  .split-picked .chans { display: none; }
  .dial-back { display: block; }
}
.chans-head {
  margin: 0;
  padding: .4rem .6rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: var(--row-alt);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}
a.chan {
  display: grid;
  grid-template-columns: 5.2rem 1fr auto;
  gap: .4rem;
  align-items: baseline;
  padding: .3rem .6rem;
  border-bottom: 1px solid #eeebe3;
  text-decoration: none;
  color: var(--ink);
  font-size: .88rem;
}
a.chan:last-child { border-bottom: none; }
a.chan:hover { background: #fbfaf6; }
a.chan-on { background: var(--navy); color: #fff; }
a.chan-on:hover { background: var(--navy); }
.chan-freq { font-variant-numeric: tabular-nums; font-weight: bold; color: var(--dial); white-space: nowrap; }
a.chan-on .chan-freq { color: #9fe0ea; }
.chan-top { font-size: .82rem; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; }
.chan-n { font-size: .72rem; color: var(--muted); }
a.chan-on .chan-n { color: #a8bcc9; }

.tune { display: flex; align-items: baseline; gap: .8rem; margin-bottom: .5rem; }
.tune h2 { flex: 1; text-align: center; color: var(--dial); font-variant-numeric: tabular-nums; }
.tune-btn { font-size: .85rem; text-decoration: none; white-space: nowrap; }
.tune-off { color: var(--line); }
.adj { font-size: .9rem; margin-bottom: .3rem; }

.daynight { display: flex; align-items: center; gap: .4rem; margin-bottom: .6rem; font-size: .85rem; }
.daynight button {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: .2rem .7rem;
  font-size: .85rem;
}
.daynight button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.daynight .muted { margin-left: .3rem; }

/* dB below the strongest arrival on this band in range, as a figure over a rule
   whose length grades it. Both, not either.

   The figure, because a bar alone could only be read through a tooltip and a
   touch screen has no way to open one -- this ships as a standalone web app, so
   a phone is not the edge case. The rule, because a column of numbers gives a
   reader nothing to scan down, and four widths do at a glance what reading
   thirty figures does slowly.

   The rule sits under the number rather than behind it: text over a colour
   fill has to fight it for contrast, and the fill would have to be so pale it
   stopped grading anything. */
td.sig-cell { width: 4.2rem; }
.sig-rel {
  display: inline-block;
  position: relative;
  padding-bottom: .34rem;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* Track, then fill over it. */
.sig-rel::after, .sig-rel::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: .22rem;
  border-radius: 2px;
}
.sig-rel::after { right: 0; background: var(--row-alt); }
/* Length comes from the figure above it, set per row by signalBadge, so the
   rule and the number can never disagree. Colour stays categorical. */
.sig-rel::before { background: currentColor; z-index: 1; width: var(--sig, 0); }
.sig-a { color: #2c6e49; }
.sig-b { color: #4c956c; }
.sig-c { color: #b9862f; }
.sig-d { color: #c0562c; }
/* No figure to grade, so no rule to grade it with. */
.sig-none, .sig-off {
  padding-bottom: 0;
  font-size: .72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sig-none::before, .sig-none::after,
.sig-off::before, .sig-off::after { display: none; }
.log-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* One refresh per row, closed until asked for. The summary has to read as a
   line of a list rather than a heading, since there will eventually be fifty of
   them. */
.chg-day { border-top: 1px solid var(--line); }
.chg-day:last-of-type { border-bottom: 1px solid var(--line); }
.chg-day > summary {
  cursor: pointer;
  padding: .55rem .2rem;
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex-wrap: wrap;
  font-size: .9rem;
}
.chg-day > summary:hover { background: var(--row-alt); }
.chg-day .chg-n {
  font-variant-numeric: tabular-nums;
  font-size: .78rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 .45rem;
}
/* The breakdown runs long once a refresh has several kinds of news in it, so it
   sizes down rather than wrapping the date onto its own line. */
.chg-day > summary .muted { font-size: .74rem; }
.chg-day .scroll { margin: 0 0 .7rem; }
.chg-day table { font-size: .84rem; }
/* Two coordinate rows read as one event, so it gets a badge of its own rather
   than borrowing lat's or lon's. */
.chg-moved { background: #dde6f0; }

tr.row-off td { opacity: .55; }

th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--ink); }
th.sorted { color: var(--accent); }

.as-heard {
  font-size: .78rem;
  font-weight: normal;
  color: var(--accent);
  white-space: nowrap;
  margin-left: .3rem;
}

/* #place-entry sets its own display, which would beat the hidden attribute. */
[hidden] { display: none !important; }
#place-entry { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
#change-place {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: .85rem;
  text-decoration: underline;
  cursor: pointer;
}
#change-place:hover { background: none; color: var(--navy); }

/* ------------------------------------------------------------- results */

.note { font-size: .88rem; color: var(--muted); margin-bottom: .9rem; }
.count { font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.empty { color: var(--muted); padding: 1.2rem 0; }

/* The map has a page to itself, so it takes the height a map wants: most of the
   viewport, with a floor for short windows and a ceiling so it does not run
   away on a desktop. A 200 km square wants to be square-ish, not a letterbox.
   Leaflet needs a height in CSS -- it measures the container and draws nothing
   given none. */
#map-box {
  height: clamp(24rem, 72vh, 44rem);
  border: 1px solid var(--line);
  border-radius: 8px;
}
#map-out { margin-top: .6rem; }
#nearby-map-link { margin: .2rem 0 1rem; }
/* Shorter than the map page: here the map is one fact among the others, not
   the point of the page. */
#station-map {
  height: 17rem;
  margin: .5rem 0 .4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}
/* Leaflet ships its own popup and control styling; only the type needs to stop
   looking like someone else's page. */
.leaflet-container { font: inherit; background: var(--line); }
.leaflet-popup-content { font-size: .85rem; line-height: 1.45; }
.leaflet-popup-content hr { border: 0; border-top: 1px solid var(--line); margin: .4rem 0; }

.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
thead th {
  background: var(--row-alt);
  text-align: left;
  padding: .45rem .6rem;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: .38rem .6rem; border-bottom: 1px solid #eeebe3; vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfaf6; }

td.freq {
  font-variant-numeric: tabular-nums;
  font-weight: bold;
  color: var(--dial);
  white-space: nowrap;
}
td.freq .unit { font-weight: normal; font-size: .72rem; color: var(--muted); margin-left: .2rem; }
td.call { font-weight: bold; letter-spacing: .03em; white-space: nowrap; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; color: #333; }
td.svc { font-size: .82rem; color: var(--muted); white-space: nowrap; }
td.licensee { font-size: .82rem; color: var(--muted); max-width: 22rem; }


.tag {
  font-size: .68rem;
  font-weight: normal;
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  padding: 0 .28rem;
  margin-left: .35rem;
  letter-spacing: .02em;
}
.flag {
  font-size: .7rem;
  background: var(--navy);
  color: #fff;
  border-radius: 3px;
  padding: 0 .28rem;
  letter-spacing: .04em;
}
.chg { font-size: .78rem; border-radius: 3px; padding: 0 .3rem; background: var(--row-alt); }
.chg-added { background: #d8ead8; }
.chg-removed { background: #f0d8d4; }

#about-meta { font-size: .82rem; margin-top: 1.4rem; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .88em; background: var(--row-alt); padding: 0 .25rem; border-radius: 3px; }
a { color: var(--accent); }

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.4rem 1.5rem 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .8rem;
}
footer p { margin-bottom: .35rem; }
footer p:last-child { margin-bottom: 0; }

/* Name, what this build is, who owns it — the order an About box has used since
   long before any of this, and the same three lines on every one of these
   sites. */
/* The band switch. Built from the same parts as the Day/Night and ordering
   toggles -- a row of buttons with one filled -- but heavier and sitting above
   the view rather than inside it, because those two change a setting and this
   one chooses which view you are in. Equal widths so it reads as a switch with
   three positions rather than as three things to click. */
/* Miles or kilometres. Small and to one side: it is set once and then wants
   to be out of the way, unlike the band switch it borrows its look from. */
.units { display: inline-flex; margin-left: auto; }
.units button {
  background: #fff; color: var(--muted); border: 1px solid var(--line);
  padding: .12rem .5rem; font-size: .8rem; cursor: pointer;
}
.units button + button { border-left: none; }
.units button:first-child { border-radius: 5px 0 0 5px; }
.units button:last-child { border-radius: 0 5px 5px 0; }
.units button.on { background: var(--navy); color: #fff; border-color: var(--navy); }

.seg { display: flex; gap: 0; margin: 0 0 .45rem; max-width: 24rem; }
.seg button {
  flex: 1;
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: .42rem .6rem;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
}
.seg button + button { border-left: none; }
.seg button:first-child { border-radius: 6px 0 0 6px; }
.seg button:last-child { border-radius: 0 6px 6px 0; }
.seg button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.seg button:not(.on):hover { background: var(--row-alt); }

/* Sits in Leaflet's own control bar, so it inherits the zoom buttons' size,
   border and hover. Only the glyph needs centring. */
.leaflet-bar a.recenter { display: flex; align-items: center; justify-content: center; }

#band-blurb { color: var(--muted); margin-bottom: .8rem; }

/* Only when it has something in it -- FM and TV file one power and get no
   buttons, and an empty div with a margin would push their headings down for
   nothing. */
#band-mode:not(:empty) { margin-bottom: 1.1rem; }

/* Reads as a statement of what is being shown, not as something to click, so
   it takes the label's colour and none of the select's chrome. */
#legend .tag-key { font-family: ui-monospace, Menlo, monospace; font-size: .82em; }

.fixed-filter { font-size: .9rem; color: var(--muted); margin-right: .5rem; }
.fixed-filter strong { color: var(--ink); }

td.net { white-space: nowrap; }
td.net .tag { margin-left: .3rem; }

.colophon { line-height: 1.5; margin-bottom: .7rem; }
.colophon strong { color: var(--ink); font-size: .9rem; }

@media (max-width: 640px) {
  main { padding: 1rem .75rem 2.5rem; }
  header { padding: 1rem .9rem 0; }
  footer { padding: 1.2rem .9rem 2rem; }
  /* Matched by class, not position. Dial renders a Signal column the other
     views do not, so nth-child(7) landed on Service there and left the last
     column headed Licensee above the service codes. */
  td.licensee, th.licensee { display: none; }
}
