/* ============================================================
   Park Family Server — "Pacific-dusk ops board"
   Design system: deep teal-navy, Space Grotesk + Space Mono,
   per-tool wayfinding line colours, live data in mono.
   ============================================================ */

:root {
  /* base ink (dusk over the strait) */
  --ink:        #0b1a21;
  --ink-2:      #0e2731;
  --surface:    #123039;
  --surface-2:  #17404b;

  /* hairlines + text */
  --hair:       rgba(180, 214, 224, 0.10);
  --hair-2:     rgba(180, 214, 224, 0.20);
  --fog:        #dfeaed;   /* primary text — glacial white */
  --fog-dim:    #8ba6ae;   /* labels / secondary */
  --fog-faint:  #5d757e;   /* captions / disabled */

  /* signals */
  --beacon:     #ff6b4a;   /* live / primary action / "now" */
  --beacon-2:   #ff8a6e;

  /* wayfinding line colours (one per station) */
  --air:        #5ba9e6;   /* flights */
  --transit:    #33c6a6;   /* buses */
  --run:        #e0855b;   /* running */

  --sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --mono: "Space Mono", ui-monospace, "SFMono-Regular", monospace;

  --maxw: 1080px;
  --r:    16px;
  --r-sm: 10px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--fog);
  background-color: var(--ink);
  /* dusk: a low glow off the top-right, settling into deeper ink below */
  background-image:
    radial-gradient(1200px 700px at 82% -8%, rgba(91, 169, 230, 0.10), transparent 60%),
    radial-gradient(900px 600px at 12% 4%, rgba(51, 198, 166, 0.06), transparent 55%),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

::selection { background: rgba(255, 107, 74, 0.28); }

/* ---- Ops bar (persistent chrome; the cross-page signature) ---- */
.ops {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 13px clamp(16px, 4vw, 28px);
  font-family: var(--mono);
  font-size: 12px;
  border-bottom: 1px solid var(--hair);
  background: rgba(9, 22, 28, 0.72);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
}
.ops__mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--fog);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.16em;
}
.ops__mark-sub { color: var(--fog-faint); }
.ops__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--beacon);
  animation: beacon 2.6s infinite;
}
.ops__nav {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--fog-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.ops__back {
  color: var(--fog-dim);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
.ops__back:hover { color: var(--fog); }
.ops__sep { color: var(--fog-faint); }
.ops__meta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: var(--fog-dim);
  letter-spacing: 0.08em;
}
.ops__coords { white-space: nowrap; }
.ops__clock { color: var(--fog); font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .ops__coords { display: none; } }

/* ---- Page shell ---- */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 52px) clamp(16px, 4vw, 28px) 96px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fog-dim);
  margin: 0;
}

/* ---- Hero ---- */
.hero { margin-bottom: clamp(24px, 4vw, 40px); }
.hero__title {
  font-size: clamp(2.5rem, 7vw, 4.4rem);
  font-weight: 700;
  line-height: 1.0;
  letter-spacing: -0.025em;
  margin: 0.28em 0 0.24em;
}
.hero__sub {
  color: var(--fog-dim);
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  max-width: 46ch;
  margin: 0;
}

/* ---- Station board (home) ---- */
.board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(12px, 2vw, 18px);
}
@media (max-width: 620px) { .board { grid-template-columns: 1fr; } }

.station {
  --line: var(--fog-dim);
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 168px;
  padding: 22px 24px 20px;
  text-decoration: none;
  color: var(--fog);
  background: linear-gradient(180deg, var(--surface), rgba(14, 39, 49, 0.55));
  border: 1px solid var(--hair);
  border-radius: var(--r);
  overflow: hidden;
  transition: transform 0.28s var(--ease), border-color 0.28s var(--ease), box-shadow 0.28s var(--ease);
}
.station::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--line);
}
.station:hover {
  transform: translateY(-4px);
  border-color: var(--hair-2);
  box-shadow: 0 24px 48px -30px rgba(0, 0, 0, 0.9);
}
.station:focus-visible { outline: 2px solid var(--line); outline-offset: 3px; }
.station--air      { --line: var(--air); }
.station--transit  { --line: var(--transit); }
.station--run      { --line: var(--run); }

.station__head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fog-dim);
}
.station__status {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line);
  box-shadow: 0 0 12px var(--line);
  animation: beacon 3s infinite;
}
.station__glyph {
  position: absolute;
  top: 18px; right: 18px;
  width: 26px; height: 26px;
  color: var(--line);
  opacity: 0.85;
}
.station__glyph svg { width: 100%; height: 100%; }
.station__datum {
  margin-top: auto;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1.6rem, 3.4vw, 2.15rem);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--fog);
}
.station__datum.is-waiting { color: var(--fog-faint); }
.station__label { margin-top: 4px; color: var(--fog-dim); font-size: 0.95rem; }
.station__cta {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--line);
}

/* ---- Page title block (sub-pages) ---- */
.pagehead { margin-bottom: clamp(22px, 3.5vw, 34px); }
.pagehead__title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0.3em 0 0.2em;
}
.pagehead__title .accent { color: var(--accent, var(--beacon)); }
.pagehead__sub { color: var(--fog-dim); margin: 0; max-width: 52ch; }

/* ---- Panels / cards ---- */
.panel {
  background: linear-gradient(180deg, var(--surface), rgba(14, 39, 49, 0.5));
  border: 1px solid var(--hair);
  border-radius: var(--r);
  padding: clamp(18px, 3vw, 26px);
}
.panel__title {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fog-dim);
  margin: 0 0 14px;
}

/* metric row (definition-style data) */
.metrics { display: grid; gap: 2px; }
.metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hair);
}
.metric:last-child { border-bottom: 0; }
.metric__label { color: var(--fog-dim); font-size: 0.9rem; }
.metric__value {
  font-family: var(--mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--fog);
}
.metric__value--lg { font-size: 1.4rem; }

/* big stat trio (run stats) */
.statrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 560px) { .statrow { grid-template-columns: 1fr; } }
.stat { padding: 4px 0; }
.stat__k { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--fog-dim); }
.stat__v { font-family: var(--mono); font-weight: 700; font-size: clamp(1.6rem, 4vw, 2.2rem); color: var(--fog); font-variant-numeric: tabular-nums; margin-top: 6px; }
.stat__v .unit { font-size: 0.9rem; color: var(--fog-dim); font-weight: 400; margin-left: 4px; }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label,
.form-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fog-dim);
}
input, select {
  font-family: var(--sans);
  font-size: 0.98rem;
  color: var(--fog);
  background: rgba(6, 16, 21, 0.55);
  border: 1px solid var(--hair-2);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  min-width: 0;
}
input::placeholder { color: var(--fog-faint); }
input:focus, select:focus {
  outline: none;
  border-color: var(--beacon);
  box-shadow: 0 0 0 3px rgba(255, 107, 74, 0.18);
}
input[type="number"] { font-family: var(--mono); }

.btn {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink);
  background: var(--beacon);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn:hover { background: var(--beacon-2); transform: translateY(-1px); box-shadow: 0 12px 26px -14px rgba(255, 107, 74, 0.7); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--fog); outline-offset: 2px; }
.btn--ghost {
  color: var(--fog);
  background: transparent;
  border-color: var(--hair-2);
}
.btn--ghost:hover { background: var(--surface-2); box-shadow: none; }

/* ---- Inline run form ---- */
.runform {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px 16px;
  align-items: end;
}
.runform .field--wide { grid-column: 1 / -1; }
.dur-group { display: flex; gap: 8px; }
.dur-group input { width: 100%; text-align: center; }

/* ---- Data card grid (flights / runs) ---- */
.cardgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.datacard {
  --line: var(--fog-dim);
  position: relative;
  background: linear-gradient(180deg, var(--surface), rgba(14, 39, 49, 0.5));
  border: 1px solid var(--hair);
  border-left: 3px solid var(--line);
  border-radius: var(--r-sm);
  padding: 16px 18px;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.datacard:hover { transform: translateY(-2px); border-color: var(--hair-2); }
.datacard--air { --line: var(--air); }
.datacard--run { --line: var(--run); }
.datacard__title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--fog);
  margin-bottom: 12px;
  word-break: break-word;
}
.datacard__row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-top: 1px solid var(--hair); }
.datacard__row:first-of-type { border-top: 0; }
.datacard__k { color: var(--fog-dim); font-size: 0.82rem; }
.datacard__v { font-family: var(--mono); font-size: 0.9rem; color: var(--fog); text-align: right; }
.datacard__note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hair);
  color: var(--fog-dim);
  font-size: 0.88rem;
  font-style: italic;
}
.datacard__del {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fog-faint);
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.datacard__del:hover { color: var(--beacon); border-color: var(--beacon); }

.section-title {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fog-dim);
  margin: 34px 0 4px;
}

.empty {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--fog-dim);
  border: 1px dashed var(--hair-2);
  border-radius: var(--r-sm);
  padding: 20px;
  text-align: center;
}
.note-error { color: var(--beacon); }

/* ---- Map "scope" ---- */
.scope {
  position: relative;
  border: 1px solid var(--hair-2);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 30px 60px -40px rgba(0, 0, 0, 0.9);
}
.scope #map { width: 100%; height: min(62vh, 560px); background: var(--ink); }
.scope__caption {
  position: absolute;
  left: 12px; bottom: 12px;
  z-index: 500;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--fog);
  background: rgba(9, 22, 28, 0.78);
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 6px 12px;
  backdrop-filter: blur(6px);
}

/* leaflet overrides to match the palette */
.leaflet-container { background: var(--ink) !important; font-family: var(--sans); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--surface-2);
  color: var(--fog);
  border: 1px solid var(--hair-2);
  box-shadow: 0 16px 40px -20px rgba(0,0,0,.9);
}
.leaflet-popup-content-wrapper { border-radius: 12px; }
.leaflet-popup-content { font-size: 0.9rem; }
.leaflet-container a.leaflet-popup-close-button { color: var(--fog-dim); }
.leaflet-bar a { background: var(--surface); color: var(--fog); border-color: var(--hair) !important; }
.leaflet-bar a:hover { background: var(--surface-2); }
.leaflet-control-attribution {
  background: rgba(9,22,28,.7) !important;
  color: var(--fog-faint) !important;
}
.leaflet-control-attribution a { color: var(--fog-dim) !important; }
/* plane silhouettes read as light on the dark basemap */
.leaflet-marker-icon.plane-marker { filter: brightness(0) invert(1) drop-shadow(0 1px 2px rgba(0,0,0,.6)); }

/* transit direction legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--fog-dim);
}
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend .legend-icon { width: 12px; height: 20px; }

/* ---- Login ---- */
.signin {
  min-height: calc(100vh - 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 22px;
}
.signin__card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, var(--surface), rgba(14, 39, 49, 0.6));
  border: 1px solid var(--hair);
  border-radius: var(--r);
  padding: 34px 30px 28px;
}
.signin__eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--fog-dim); }
.signin__title { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; margin: 8px 0 22px; }
.signin__form { display: grid; gap: 16px; }
.signin__form .btn { margin-top: 6px; }
.signin__error {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--beacon);
  background: rgba(255, 107, 74, 0.1);
  border: 1px solid rgba(255, 107, 74, 0.3);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 18px;
}
.signin__foot { margin-top: 22px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; }
.signin__foot a { color: var(--fog-dim); text-decoration: none; }
.signin__foot a:hover { color: var(--fog); }

/* ---- Spinner ---- */
.spinner-overlay {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(9, 22, 28, 0.6);
  backdrop-filter: blur(3px);
  z-index: 2000;
}
.spinner-overlay.is-on { display: flex; }
.spinner {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 3px solid var(--hair-2);
  border-top-color: var(--beacon);
  animation: spin 0.9s linear infinite;
}

/* ---- animations ---- */
@keyframes beacon {
  0%   { box-shadow: 0 0 0 0 rgba(255, 107, 74, 0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(255, 107, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 107, 74, 0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rise { opacity: 0; animation: rise 0.6s var(--ease) forwards; }
.rise-1 { animation-delay: 0.05s; }
.rise-2 { animation-delay: 0.12s; }
.rise-3 { animation-delay: 0.19s; }
.rise-4 { animation-delay: 0.26s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .rise { opacity: 1; transform: none; }
}
