/* ============================================================
   fpvlog — modern FPV flight log
   Athletic editorial: Archivo 900 headlines, deep slate,
   signal orange, elevated cards, broadcast-style numerals.
   ============================================================ */
:root {
  --bg: #0e1114;
  --bg-2: #14181d;
  --card: #171c22;
  --card-2: #1c2229;
  --border: rgba(255,255,255,.07);
  --orange: #ff4d29;
  --orange-soft: rgba(255,77,41,.14);
  --white: #f4f6f8;
  --grey: #9aa5b0;
  --grey-2: #5c6773;
  --green: #35d07f;
  --red: #ff4d6a;
  --radius: 16px;
  --radius-s: 10px;
  --shadow: 0 8px 32px rgba(0,0,0,.35);
  --font: "Archivo", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; scrollbar-color: var(--card-2) var(--bg); }
body {
  background: var(--bg); color: var(--white);
  font-family: var(--font); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--orange); color: #fff; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px 80px; }

/* ---------------- nav ---------------- */
nav {
  display: flex; align-items: center; gap: 20px;
  padding: 26px 0 0;
}
.brand { font-weight: 900; font-size: 20px; letter-spacing: -.5px; }
.brand em { font-style: normal; color: var(--orange); }
nav .spacer { flex: 1; }

/* ---------------- hero ---------------- */
.hero { padding: 56px 0 40px; }
.hero .kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 3px;
  text-transform: uppercase; color: var(--orange); margin-bottom: 14px;
}
.hero .kicker::before { content: ""; width: 26px; height: 2px; background: var(--orange); }
.hero h1 {
  font-weight: 900; text-transform: uppercase; letter-spacing: -1.5px;
  font-size: clamp(44px, 7.5vw, 84px); line-height: .95;
}
.hero h1 .accent {
  color: transparent; -webkit-text-stroke: 2px var(--orange);
}
.hero p { color: var(--grey); max-width: 520px; margin-top: 18px; font-size: 16px; }
.hero .actions { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }

/* ---------------- buttons ---------------- */
.btn {
  font: inherit; font-weight: 700; font-size: 14px;
  background: var(--orange); color: #fff; border: 0; cursor: pointer;
  padding: 13px 26px; border-radius: 999px;
  transition: transform .15s, box-shadow .15s, background .15s;
  box-shadow: 0 6px 20px rgba(255,77,41,.3);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(255,77,41,.4); }
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: transparent; color: var(--white);
  border: 1.5px solid var(--border); box-shadow: none;
}
.btn.ghost:hover { border-color: var(--grey-2); background: var(--bg-2); }
.btn.small { padding: 9px 18px; font-size: 13px; }

/* ---------------- stat cards (broadcast numerals) ---------------- */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px; margin: 8px 0 44px;
}
.stat {
  background: linear-gradient(160deg, var(--card), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 22px 18px; position: relative; overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(var(--orange), transparent);
  opacity: 0; transition: opacity .2s;
}
.stat:hover::before { opacity: 1; }
.stat .k {
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--grey-2);
}
.stat .v {
  font-weight: 900; font-size: 38px; letter-spacing: -1px; line-height: 1.1;
  font-variant-numeric: tabular-nums; margin-top: 4px;
}
.stat .v small { font-size: 14px; font-weight: 600; color: var(--grey); letter-spacing: 0; }

/* ---------------- sections & cards ---------------- */
.section { margin-bottom: 44px; }
.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 18px; }
.section-head h2 {
  font-weight: 900; text-transform: uppercase; letter-spacing: -.5px; font-size: 24px;
}
.section-head .count { color: var(--grey-2); font-weight: 700; font-size: 14px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.card .card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--grey);
}
.card .card-head .right { margin-left: auto; color: var(--grey-2); font-variant-numeric: tabular-nums; }

/* ---------------- map ---------------- */
.map { height: 460px; }
.map.tall { height: 500px; }
.leaflet-container { background: #0a0d10; font-family: var(--font); }
.leaflet-control-attribution { background: rgba(14,17,20,.85) !important; color: var(--grey-2) !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: var(--grey-2) !important; }
.leaflet-bar a { background: var(--card) !important; color: var(--white) !important; border-color: var(--border) !important; }
.leaflet-tooltip {
  background: var(--card); color: var(--white); border: 1px solid var(--border);
  border-radius: 8px; font-family: var(--font); font-weight: 600; font-size: 13px;
  box-shadow: var(--shadow); padding: 6px 12px;
}
.leaflet-tooltip::before { display: none; }

/* ---------------- flight list ---------------- */
.flights { display: flex; flex-direction: column; gap: 12px; }
.flight-row {
  display: grid; grid-template-columns: 92px 1fr auto; gap: 20px; align-items: center;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 22px; cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}
.flight-row:hover { transform: translateX(6px); border-color: rgba(255,77,41,.4); background: var(--card-2); }
.flight-row .date {
  text-align: center; border-right: 1px solid var(--border); padding-right: 18px;
}
.flight-row .date .d { font-weight: 900; font-size: 24px; line-height: 1; }
.flight-row .date .m { font-size: 11px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--orange); margin-top: 3px; }
.flight-row .title { font-weight: 800; font-size: 17px; letter-spacing: -.2px; }
.flight-row .spot { color: var(--grey); font-size: 13px; margin-top: 2px; }
.flight-row .spot::before { content: "📍 "; font-size: 11px; }
.flight-row .metrics { display: flex; gap: 26px; }
.flight-row .metric { text-align: right; min-width: 64px; }
.flight-row .metric .mv { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.flight-row .metric .mk { font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--grey-2); }
@media (max-width: 720px) {
  .flight-row { grid-template-columns: 72px 1fr; }
  .flight-row .metrics { grid-column: 1 / -1; justify-content: space-between; gap: 10px; }
}
.empty {
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 56px 24px; text-align: center; color: var(--grey);
}

/* ---------------- modal ---------------- */
dialog {
  background: var(--card); color: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 30px; width: min(460px, 92vw); font-family: var(--font);
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
dialog::backdrop { background: rgba(8,10,12,.7); backdrop-filter: blur(4px); }
dialog h2 { font-weight: 900; font-size: 20px; letter-spacing: -.3px; margin-bottom: 4px; }
dialog .sub { color: var(--grey); font-size: 13px; margin-bottom: 18px; }
dialog label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--grey); margin: 16px 0 6px; }
input, select {
  font: inherit; background: var(--bg-2); color: var(--white);
  border: 1.5px solid var(--border); border-radius: var(--radius-s);
  padding: 11px 14px; width: 100%; transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--orange); outline: none; }
input[type="file"] { padding: 9px; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700; border: 0; border-radius: 999px;
  background: var(--orange-soft); color: var(--orange);
  padding: 7px 14px; margin-right: 12px; cursor: pointer;
}
dialog .row { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }
.msg { font-size: 13px; font-weight: 600; margin-top: 12px; min-height: 18px; }
.msg.ok { color: var(--green); } .msg.err { color: var(--red); }

/* ================= flight detail ================= */
.flight-hero { padding: 44px 0 30px; }
.flight-hero .back { color: var(--grey); font-size: 13px; font-weight: 600; }
.flight-hero .back:hover { color: var(--white); }
.flight-hero h1 {
  font-weight: 900; text-transform: uppercase; letter-spacing: -1px;
  font-size: clamp(30px, 5vw, 52px); line-height: 1; margin-top: 14px;
}
.flight-hero .meta { color: var(--grey); margin-top: 10px; font-size: 14px;
  display: flex; gap: 18px; flex-wrap: wrap; }
.flight-hero .meta b { color: var(--white); font-weight: 700; }

/* live HUD */
.hud {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.hud .cell {
  background: linear-gradient(160deg, var(--card), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px 14px;
}
.hud .k { font-size: 10px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--grey-2); }
.hud .v { font-weight: 900; font-size: 30px; letter-spacing: -.5px;
  font-variant-numeric: tabular-nums; line-height: 1.15; }
.hud .v small { font-size: 12px; font-weight: 600; color: var(--grey); }
.hud .cell.primary { border-color: rgba(255,77,41,.35); background:
  linear-gradient(160deg, rgba(255,77,41,.12), var(--bg-2)); }
.hud .cell.primary .v { color: var(--orange); }

/* replay bar */
.controls {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 10px 12px 10px 10px;
  margin-bottom: 22px; flex-wrap: wrap; box-shadow: var(--shadow);
  position: sticky; top: 12px; z-index: 500;
}
.controls .btn { padding: 10px 20px; }
.controls .time { font-weight: 800; font-variant-numeric: tabular-nums;
  min-width: 130px; font-size: 15px; }
.controls input[type=range] { flex: 1; accent-color: var(--orange); min-width: 150px; }
.controls select { width: auto; border-radius: 999px; padding: 8px 14px; }

.cols { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; margin-bottom: 22px; }
@media (max-width: 940px) { .cols { grid-template-columns: 1fr; } }
.vstack { display: flex; flex-direction: column; gap: 18px; }

video { display: block; width: 100%; background: #000; }
.video-missing { padding: 44px 20px; text-align: center; color: var(--grey-2); font-size: 13px; font-weight: 600; }

canvas.chart { display: block; width: 100%; height: 190px; cursor: crosshair; }
.legend { display: flex; gap: 18px; font-size: 12px; font-weight: 600; color: var(--grey);
  padding: 10px 20px; border-top: 1px solid var(--border); }
.legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.legend .dot.alt { background: var(--orange); }
.legend .dot.spd { background: #4da3ff; }

footer { color: var(--grey-2); font-size: 12px; margin-top: 56px;
  border-top: 1px solid var(--border); padding-top: 18px; }
