/* Strait of Kestrel Observatory. Neutral palette, one accent (#0e7490),
   tabular numerals, quiet surfaces. No web fonts. */

:root {
  --bg: #f4f5f6;
  --panel: #ffffff;
  --ink: #232a31;
  --ink2: #5b6570;
  --line: #d5dade;
  --line-soft: #e5e8eb;
  --accent: #0e7490;
  --accent-soft: #e3eef2;
  --warn: #b45309;
  --ok: #206a3a;
  --bad: #a33a2a;
  --radius: 8px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 { line-height: 1.15; margin: 0; }
h1 { font-size: 19px; letter-spacing: 0.01em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; margin: 14px 0 4px; }
p { margin: 6px 0; }
code {
  font: 0.86em/1.5 ui-monospace, Consolas, monospace;
  background: var(--line-soft);
  padding: 1px 4px;
  border-radius: 4px;
}

/* custom focus ring everywhere */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- header ---------- */
.hdr {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 20px 14px;
}
.brand { display: flex; gap: 14px; align-items: center; }
.sub { margin: 2px 0 0; color: var(--ink2); font-size: 13px; }
.hdr-actions { display: flex; align-items: center; gap: 14px; }
.count {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
  white-space: nowrap;
}
.btn {
  font: 600 13px/1 system-ui, sans-serif;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
}
.btn:hover { background: #0c6a84; }
.btn.ghost {
  color: var(--accent);
  background: var(--panel);
}
.btn.ghost:hover { background: var(--accent-soft); }
.btn.small { padding: 5px 10px; font-size: 12px; }

/* ---------- filter bar ---------- */
.filters {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
}
.fgroup { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flabel {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink2);
}
.chip, #anom, #route, #mFrom, #mTo {
  font: 500 13px/1 system-ui, sans-serif;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
select { border-radius: 6px; cursor: pointer; }
.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.chip[aria-pressed="false"] { opacity: 0.55; }
#chips { display: flex; gap: 8px; flex-wrap: wrap; }
.fchip {
  font: 600 12px/1 system-ui, sans-serif;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
}
.fchip span { margin-left: 4px; }

/* ---------- layout grid ---------- */
main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px 40px;
}
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 18px;
}
@media (min-width: 1024px) {
  .grid { grid-template-columns: 1fr 1fr 0.92fr; }
  #p-area { grid-column: 1 / 3; }
  #p-hist { grid-column: 3; }
  #p-scatter { grid-column: 1 / 3; }
  #p-dest { grid-column: 3; }
  #p-heat { grid-column: 1 / 3; }
  #p-perf { grid-column: 3; }
}

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: 0 1px 2px rgba(35, 42, 49, 0.05), 0 6px 18px rgba(35, 42, 49, 0.04);
}
.panel header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin-bottom: 6px;
}
.panel .note {
  font-size: 12px;
  color: var(--ink2);
  margin: 2px 0;
  max-width: 60ch;
}
.caption { font-size: 12px; color: var(--ink2); margin: 2px 0 !important; max-width: 64ch; }

/* ---------- chart boxes ---------- */
.chartbox { border-radius: 6px; }
.cbody { position: relative; }
.cbody svg, .cbody canvas { display: block; }
.tick {
  font-size: 11px;
  fill: var(--ink2);
  font-variant-numeric: tabular-nums;
}
.celln {
  font-size: 10.5px;
  fill: var(--ink);
  font-weight: 600;
}
.blab { font-size: 12px; fill: var(--ink); }
.blab.num { font-weight: 600; font-size: 12px; }
.pill { font-size: 11px; fill: var(--accent); font-weight: 700; }

.legend { display: flex; gap: 10px; flex-wrap: wrap; }
.lg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink);
}
.lg i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  display: inline-block;
}
.lg.off { opacity: 0.4; text-decoration: line-through; }

.sum {
  font-size: 13px;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding: 2px 10px;
  margin: 8px 0 4px;
}
.touch {
  font-size: 11.5px;
  color: var(--ink2);
  margin: 2px 0 0;
}
.touch.on { color: var(--accent); font-weight: 600; }

/* ---------- data tables ---------- */
details.tbl { margin: 8px 0 0; }
details.tbl summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink2);
  padding: 2px 0;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
th, td {
  text-align: left;
  padding: 3px 8px;
  border-bottom: 1px solid var(--line-soft);
}
th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink2);
  border-bottom: 1px solid var(--line);
}
.stwrap, details.tbl { max-height: 320px; overflow: auto; }

/* ---------- self-test ---------- */
.selftest { margin-top: 4px; }
.selftest header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.selftest td:nth-child(2), .selftest td:nth-child(3),
.selftest td:nth-child(5) { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.selftest tr.ok td:last-child { color: var(--ok); }
.selftest tr.bad td:last-child { color: var(--bad); }

/* ---------- tooltip ---------- */
.tip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  background: rgba(35, 42, 49, 0.96);
  color: #f2f5f7;
  border-radius: 6px;
  padding: 8px 11px;
  font-size: 12.5px;
  line-height: 1.5;
  max-width: 280px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.trow { white-space: nowrap; }
.trow i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
}
.anom { color: #ffd28a; font-weight: 700; }

/* ---------- method + footer ---------- */
.method { margin-top: 18px; }
.method p { max-width: 88ch; }
footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px 30px;
  color: var(--ink2);
  font-size: 12.5px;
}

/* ---------- noscript ---------- */
.noscript {
  max-width: 720px;
  margin: 30px auto;
  padding: 0 20px;
}
.nst td { border-bottom: 1px solid var(--line); }

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

/* ---------- narrow screens ---------- */
@media (max-width: 768px) {
  body { font-size: 14px; }
  .hdr { padding-top: 16px; }
  .filters { gap: 8px 14px; }
  .panel { padding: 12px 12px 12px; }
}
