/* mqtt.pskreporter.info — shared stylesheet
 *
 * Common visual language and layout primitives for index.html, station.html,
 * field.html and country.html. Page-specific bits (marquee sizing, KPI
 * variants, page-only widgets) stay in each page's <style> block.
 */

:root {
  --bg:        #07090a;
  --bg-2:      #0c1011;
  --surface:   #11161a;
  --surface-2: #161c20;
  --line:      #1d2629;
  --line-2:    #283238;
  --muted:     #5a6669;
  --text:      #c8d1d4;
  --bright:    #e6ecee;
  --amber:     #f7a82e;
  --amber-dim: #8a5d18;
  --green:     #4ddca8;
  --green-dim: #2a7a5e;
  --hot:       #ff5e3a;
  --cyan:      #6cd4ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(247, 168, 46, 0.06), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(77, 220, 168, 0.05), transparent 60%);
}
body::before {
  content: ""; position: fixed; inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.02) 0,
    rgba(255,255,255,0.02) 1px,
    transparent 1px,
    transparent 3px);
  pointer-events: none; z-index: 100; mix-blend-mode: overlay;
}
body::after {
  content: ""; position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5));
  pointer-events: none; z-index: 101;
}
::selection { background: var(--amber); color: var(--bg); }

* { scrollbar-width: thin; scrollbar-color: var(--line-2) var(--bg-2); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--line-2); border: 1px solid var(--bg-2); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
::-webkit-scrollbar-corner { background: var(--bg-2); }

a {
  color: var(--amber);
  text-decoration: none;
  border-bottom: 1px dotted var(--amber-dim);
}
a:hover { color: var(--bright); border-bottom-color: var(--amber); }
a.call-link, a.field-link, a.country-link, a.band-link {
  color: inherit;
  border-bottom: 1px dotted rgba(247, 168, 46, 0.25);
}
a.call-link:hover, a.field-link:hover, a.country-link:hover, a.band-link:hover {
  color: var(--amber);
  border-bottom-color: var(--amber);
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 28px 80px;
  position: relative;
  z-index: 1;
}

/* ---- header crumb bar + clock ---- */
.station-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 32px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 6px;
}
.crumb {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.crumb a { color: var(--amber); border-bottom: none; }
.crumb .dot { color: var(--green); animation: blink 1.6s infinite; }
@keyframes blink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0.15; }
}
.clock { font-variant-numeric: tabular-nums; color: var(--text); }
.clock .z { color: var(--muted); }

/* ---- lede ---- */
.lede {
  margin: 8px 0 0;
  max-width: 78ch;
  color: var(--text);
  font-size: 14px;
}
.lede em { color: var(--bright); font-style: normal; }
.lede .muted { color: var(--muted); }

/* ---- two-column FROM/TO grid (station, field, country) ---- */
.grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.grid > * { min-width: 0; }
@media (max-width: 980px) { .grid { grid-template-columns: 1fr; } }

.col { background: var(--surface); padding: 0; }
.col header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.col header .who {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.col header .who strong { color: var(--bright); font-weight: 500; }
.col header .total {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.col header .total b { color: var(--bright); font-weight: 500; }
.col.from header, .col.tx header { border-left: 3px solid var(--amber); }
.col.to   header, .col.rx header { border-left: 3px solid var(--green); }

.col-section {
  padding: 12px 16px 14px;
  border-bottom: 1px dashed var(--line);
}
.col-section:last-child { border-bottom: none; }
.col-section h4 {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 500;
}
.empty {
  color: var(--muted);
  font-style: italic;
  font-size: 11.5px;
}

/* ---- hot-row primitive ---- */
.hr {
  display: grid;
  grid-template-columns: 80px 1fr 50px;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  font-variant-numeric: tabular-nums;
}
.hr .label { color: var(--bright); font-size: 12px; }
.hr .pct { color: var(--muted); font-size: 11px; text-align: right; }
.hr .bar {
  height: 6px;
  background: var(--line-2);
  overflow: hidden;
}
.hr .bar > span {
  display: block;
  height: 100%;
  transition: width 800ms ease-out;
}
/* Default bar gradient amber for FROM/TX, green for TO/RX */
.col.from .hr .bar > span, .col.tx .hr .bar > span {
  background: linear-gradient(90deg, var(--amber-dim), var(--amber));
}
.col.to .hr .bar > span, .col.rx .hr .bar > span {
  background: linear-gradient(90deg, var(--green-dim), var(--green));
}
/* Row variants */
.hr.callsign { grid-template-columns: 110px 1fr 36px; }
.col.from .hr.callsign .label, .col.tx .hr.callsign .label { color: var(--amber); }
.col.to   .hr.callsign .label, .col.rx .hr.callsign .label { color: var(--green); }
.hr.field { grid-template-columns: 56px 1fr 36px; }
.hr.field .label { color: var(--cyan); font-weight: 500; }
.hr.country { grid-template-columns: 110px 1fr 36px; }
.hr.country .label { color: var(--cyan); font-size: 11.5px; }
.hr.continent { grid-template-columns: 64px 1fr 36px; }
.hr.continent .label { color: var(--cyan); font-size: 11px; letter-spacing: 0.18em; }

/* ---- best DX block ---- */
.dx-best {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-left-width: 3px;
  align-items: center;
}
.col.from .dx-best, .col.tx .dx-best { border-left-color: var(--amber); }
.col.to   .dx-best, .col.rx .dx-best { border-left-color: var(--green); }
.dx-best .who {
  font-size: 13px;
  color: var(--bright);
  font-variant-numeric: tabular-nums;
}
.col.from .dx-best .partner, .col.tx .dx-best .partner { color: var(--green); }
.col.to   .dx-best .partner, .col.rx .dx-best .partner { color: var(--amber); }
.dx-best .meta { font-size: 11px; color: var(--muted); }
.dx-best .km {
  font-size: 18px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}
.col.to .dx-best .km, .col.rx .dx-best .km { color: var(--green); }

/* ---- biggest ears panel (two side-by-side rankings) ---- */
.ears-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
}
.ears-block {
  background: var(--surface);
  padding: 12px 14px 14px;
}
.ears-block h4 {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 500;
}
.ears-block .hr .label { color: var(--green); }
.ears-block.volume .hr .bar > span {
  background: linear-gradient(90deg, var(--amber-dim), var(--amber));
}
.ears-block.dx .hr .bar > span {
  background: linear-gradient(90deg, var(--green-dim), var(--green));
}
.ears-block .hr { grid-template-columns: 110px 1fr 70px; }
.ears-block .hr .pct { font-size: 11px; }
@media (max-width: 700px) { .ears-grid { grid-template-columns: 1fr; } }

/* ---- panel + tape ---- */
.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  margin-top: 28px;
}
.panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel header .tag { color: var(--green); }
.panel header .corner-mark {
  color: var(--amber-dim);
  letter-spacing: normal;
  font-size: 10px;
}

.tape {
  background: var(--bg);
  font-size: 12px;
  height: 360px;
  overflow: hidden;
  position: relative;
  /* column-reverse + scroll-anchoring would slowly auto-scroll the
     page to the bottom as new rows are appended. Opt out. */
  overflow-anchor: none;
}
.tape * { overflow-anchor: none; }
@media (min-height: 900px) and (min-width: 981px) { .tape { height: 600px; } }
@media (min-height: 1200px) and (min-width: 981px) { .tape { height: 800px; } }
.tape-list {
  display: flex;
  flex-direction: column-reverse;
  padding: 8px 0;
}
.tape-row {
  padding: 3px 14px;
  border-bottom: 1px dashed rgba(40, 50, 56, 0.35);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  animation: rowfade 600ms ease-out;
  align-items: center;
}
@keyframes rowfade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tape-fade {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  background: linear-gradient(to top, var(--bg), transparent);
  pointer-events: none;
}

/* ---- connection pill ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.pill .led {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
}
.pill.live { color: var(--green); border-color: var(--green-dim); }
.pill.live .led {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: livepulse 2s infinite;
}
.pill.warn { color: var(--amber); border-color: var(--amber-dim); }
.pill.warn .led { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.pill.dead { color: var(--hot); border-color: rgba(255, 94, 58, 0.5); }
.pill.dead .led { background: var(--hot); }
@keyframes livepulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ---- callsign / field / country prompt-form (when no param) ---- */
.prompt-form {
  margin: 28px 0;
  padding: 24px;
  border: 1px dashed var(--amber-dim);
  background: var(--surface);
}
.prompt-form label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.prompt-form input {
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--bright);
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  padding: 10px 12px;
  outline: none;
}
.prompt-form input:focus { border-color: var(--amber); }
.prompt-form button {
  background: var(--amber);
  border: 1px solid var(--amber);
  color: var(--bg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 10px 16px;
  cursor: pointer;
  margin-left: 8px;
  font-weight: 500;
}
.prompt-form button:hover {
  background: var(--bright);
  border-color: var(--bright);
}
.prompt-form .hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

/* ---- footer ---- */
footer {
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
}
footer a { color: var(--amber); }
