/* Cloudview — chrome is pencil on chart paper; the only color is the vario scale (sink blue → lift red). */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(vendor/fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(vendor/fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(vendor/fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }

:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --raised: #eceff4;
  --text: #111827;       /* primary text, also the "ink" used for selection and primary actions */
  --text-2: #4b5565;
  --muted: #6b7487;
  --on-ink: #ffffff;
  --line: rgba(17, 24, 39, .08);
  --line-strong: rgba(17, 24, 39, .14);
  --shadow: 0 8px 24px rgba(17, 24, 39, .08), 0 1px 2px rgba(17, 24, 39, .06);
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d14; --card: #11141c; --raised: #1a1e28; --text: #eef0f5; --text-2: #a3a9b8; --muted: #7a8296;
    --on-ink: #0b0d14; --line: rgba(238, 240, 245, .08); --line-strong: rgba(238, 240, 245, .16);
    --shadow: 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark; --ctrl-icon-filter: invert(1);
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d14; --card: #11141c; --raised: #1a1e28; --text: #eef0f5; --text-2: #a3a9b8; --muted: #7a8296;
  --on-ink: #0b0d14; --line: rgba(238, 240, 245, .08); --line-strong: rgba(238, 240, 245, .16);
  --shadow: 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark; --ctrl-icon-filter: invert(1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font: 400 14px/20px var(--sans); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.fig { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }
#map { position: fixed; inset: 0; background: var(--bg); font-family: var(--sans); }

/* floating surfaces: solid card, hairline, one soft neutral shadow */
.topbar, .panel, .legend, .locate {
  position: fixed; z-index: 1000; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}

.topbar {
  top: calc(var(--gutter) + env(safe-area-inset-top)); left: var(--gutter); right: var(--gutter);
  display: flex; align-items: center; gap: 8px; height: 48px; padding: 4px; border-radius: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 4px; font-weight: 500; font-size: 16px; }
.brand img { width: 24px; height: 24px; }
.brand span { display: none; }
#search {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--raised); outline: none;
}
#search::placeholder { color: var(--muted); }
#search:focus-visible { box-shadow: inset 0 0 0 1.5px var(--text); }
.seg { display: flex; gap: 2px; height: 40px; background: var(--raised); border-radius: 8px; padding: 4px; }
.seg button {
  border: 0; background: none; height: 32px; padding: 0 12px; border-radius: 4px; cursor: pointer; color: var(--text-2);
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--line); }

/* panel: bottom sheet on phones, side card on larger screens */
/* The sheet has one fixed height and slides on the GPU: content updates every few seconds never resize it,
   and dvh does not jump when the browser's address bar shows or hides. Closed, only the handle peeks out. */
.panel {
  --peek: 52px;
  left: 0; right: 0; bottom: 0; border-radius: 16px 16px 0 0; border-bottom: 0;
  display: flex; flex-direction: column; height: 60vh; height: 60dvh; padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(calc(100% - var(--peek) - env(safe-area-inset-bottom)));
  transition: transform 320ms var(--ease); will-change: transform;
}
.panel.open { transform: none; }
.panel.dragging { transition: none; }
.handle {
  display: flex; flex: none; flex-direction: column; align-items: center; gap: 8px; width: 100%; height: var(--peek);
  padding: 8px 16px 12px; border: 0; background: none; cursor: pointer; font-weight: 500; touch-action: none;
}
.grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); }
.summary { display: flex; align-items: baseline; gap: 8px; }
.summary .count { color: var(--muted); font-size: 12px; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
@media (prefers-reduced-motion: reduce) { .panel { transition: none; } }

@media (min-width: 768px) {
  :root { --gutter: 16px; }
  .brand span { display: inline; }
  .topbar { right: auto; width: 520px; }
  .panel {
    left: auto; right: var(--gutter); top: calc(var(--gutter) * 2 + 48px); bottom: auto; border-bottom: 1px solid var(--line);
    width: 360px; height: auto; max-height: calc(100% - 48px - var(--gutter) * 4); border-radius: 16px; padding: 0;
    transform: none; transition: none;
  }
  .handle { flex-direction: row; justify-content: flex-start; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--line); cursor: default; touch-action: auto; }
  .grip { display: none; }
}

/* aircraft list */
.list { list-style: none; margin: 0; padding: 4px 0 8px; }
.list li { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; cursor: pointer; transition: background-color 150ms var(--ease); }
.list li:hover, .list li:focus-visible { background: var(--raised); outline: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px var(--line); }
.name { flex: 1; min-width: 0; }
.name b { font-weight: 500; }
.name > span { color: var(--text-2); }
.name small, .num small { display: block; color: var(--muted); font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { text-align: right; font-family: var(--mono); font-weight: 500; font-size: 13px; font-variant-numeric: tabular-nums; }
.num small { font-family: var(--mono); }
.empty { padding: 24px 16px; color: var(--muted); text-align: center; }
.list .section { min-height: 0; padding: 16px 16px 4px; font-size: 12px; color: var(--muted); cursor: default; }
.list .section:hover { background: none; }
.list .offline { cursor: default; color: var(--muted); }
.list .offline:hover { background: none; }
.list .offline .dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); }

/* today: one lead figure, then a ranked list */
.list .highlights { display: block; min-height: 0; cursor: default; padding: 12px 16px 8px; border-bottom: 1px solid var(--line); }
.list .highlights:hover { background: none; }
.hl-lead { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.hl-lead b { font: 500 32px/1 var(--mono); font-variant-numeric: tabular-nums; }
.hl-lead span { color: var(--text-2); }
.hl-lead small { margin-left: auto; color: var(--muted); font-size: 12px; }
.hl-row { display: flex; align-items: baseline; gap: 12px; height: 32px; padding: 0 8px; margin: 0 -8px; border-radius: 8px; line-height: 32px; }
.hl-row[data-id] { cursor: pointer; transition: background-color 150ms var(--ease); }
.hl-row[data-id]:hover { background: var(--raised); }
.hl-row small { width: 104px; flex: none; color: var(--muted); font-size: 12px; }
.hl-row span { flex: 1; min-width: 0; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hl-row b { font: 500 13px/32px var(--mono); font-variant-numeric: tabular-nums; }

/* detail */
.detail { padding: 8px 16px 16px; }
.detail-head { display: flex; align-items: flex-start; gap: 8px; }
.detail-head h2 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 500; flex: 1; }
.detail-head p { margin: 0; color: var(--text-2); }
.icon-btn {
  display: grid; place-items: center; border: 0; background: var(--raised); border-radius: 8px; width: 32px; height: 32px;
  cursor: pointer; flex: none; color: var(--text-2); transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--line-strong); }
.icon-btn[aria-pressed="true"] { color: var(--text); }
.icon-btn[aria-pressed="true"] .icon { fill: currentColor; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 12px; }
.stat { background: var(--raised); border-radius: 8px; padding: 8px 12px; }
.stat small { color: var(--muted); font-size: 12px; }
.stat div { font: 500 20px/28px var(--mono); font-variant-numeric: tabular-nums; }
.stat div i { font-style: normal; font-family: var(--sans); font-size: 13px; color: var(--muted); margin-left: 4px; }
.flight { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--raised); color: var(--text-2); font-size: 13px; }
.baro { width: 100%; height: 72px; display: block; }
.baro-label { color: var(--muted); font-size: 12px; line-height: 16px; margin: 4px 0 12px; display: flex; justify-content: space-between; }
.baro-label .fig { font-size: 12px; }
.actions { display: flex; gap: 8px; }
.btn {
  flex: 1; height: 40px; border: 1px solid var(--line-strong); background: var(--card); border-radius: 8px; cursor: pointer; font-weight: 500;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), transform 120ms var(--ease);
}
.btn:hover { background: var(--raised); }
.btn:active { transform: scale(.98); }
.btn[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--on-ink); }
.meta { color: var(--muted); font-size: 12px; line-height: 16px; margin: 12px 0 0; }

.legend {
  display: none; align-items: center; gap: 8px; left: var(--gutter); bottom: var(--gutter); height: 32px;
  padding: 0 12px; border-radius: 8px; font: 500 12px/1 var(--mono); color: var(--muted);
}
.legend i { width: 120px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, #2563eb, #94a3b8 43%, #f59e0b 64%, #dc2626); }
@media (min-width: 768px) { .legend { display: flex; } }

.locate {
  right: var(--gutter); top: calc(48px + var(--gutter) * 2 + env(safe-area-inset-top)); width: 40px; height: 40px;
  border-radius: 8px; cursor: pointer; display: grid; place-items: center; color: var(--text);
}
.locate .icon { width: 18px; height: 18px; }
@media (min-width: 768px) { .locate { top: auto; bottom: var(--gutter); } }


.toast {
  position: fixed; z-index: 1100; left: 50%; transform: translateX(-50%);
  top: calc(48px + var(--gutter) * 2 + env(safe-area-inset-top)); max-width: calc(100% - 2 * var(--gutter));
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border: 0; border-radius: 8px;
  background: var(--text); color: var(--on-ink); font-weight: 500; box-shadow: var(--shadow); cursor: pointer;
  animation: rise 300ms var(--ease);
}
.toast .icon { fill: currentColor; }
.toast[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

/* airfields */
.muted { color: var(--muted); }
.log { margin-top: 8px; max-height: 224px; overflow-y: auto; }
.log table { width: 100%; border-collapse: collapse; }
.log th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12px; padding: 4px; }
.log td { padding: 4px; border-top: 1px solid var(--line); white-space: nowrap; font: 500 12px/20px var(--mono); font-variant-numeric: tabular-nums; }
.log td:first-child { white-space: normal; font: 400 13px/20px var(--sans); }
.log tr[data-id] { cursor: pointer; }
.log tr[data-id]:hover td { background: var(--raised); }

/* weather chips */
.wx {
  display: flex; align-items: center; gap: 4px; width: max-content; padding: 4px 8px 4px 4px;
  background: var(--card); color: var(--text); border-radius: 8px; box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, .12);
  font: 400 11px/16px var(--sans); white-space: nowrap;
}
.wx b { font: 500 11px/16px var(--mono); }
.wx svg { width: 20px; height: 20px; fill: var(--text); flex: none; }


/* accessible page title (the map itself is the visible heading) and a fallback without JavaScript */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.noscript { position: fixed; inset: auto 16px 16px; z-index: 2000; padding: 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.noscript a { color: var(--text); }
.list .intro { display: block; text-align: left; line-height: 20px; cursor: default; }
.list .intro:hover { background: none; }
.list .intro a { display: block; margin-top: 8px; color: var(--text); }

/* MapLibre chrome in Cloudview style */
.maplibregl-map { font-family: var(--sans); }
.maplibregl-ctrl-group { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow) !important; border-radius: 8px; overflow: hidden; }
.maplibregl-ctrl-group button { width: 40px; height: 40px; color: var(--text); }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line); }
.maplibregl-ctrl-group button:hover { background: var(--raised) !important; }
.maplibregl-ctrl button .maplibregl-ctrl-icon { filter: var(--ctrl-icon-filter, none); }
.maplibregl-ctrl-top-left { top: calc(48px + var(--gutter) * 2 + env(safe-area-inset-top)); left: calc(var(--gutter) - 10px); }
.maplibregl-ctrl-bottom-right { bottom: calc(56px + env(safe-area-inset-bottom)); }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib.maplibregl-compact { background: var(--card); color: var(--muted); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--text-2); }
.layer-ctrl { position: relative; overflow: visible; }
.layer-ctrl > button { display: grid; place-items: center; }
.layer-ctrl > button .icon { width: 18px; height: 18px; }
.layer-menu {
  position: absolute; left: 48px; top: 0; min-width: 232px; padding: 8px; border-radius: 8px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); font: 13px/20px var(--sans);
}
.layer-menu[hidden] { display: none; }
.layer-menu label { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: 4px; cursor: pointer; color: var(--text); }
.layer-menu label:hover { background: var(--raised); }
.layer-menu input { accent-color: var(--text); margin: 0; }
.layer-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.maplibregl-popup-content { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 16px; font: 13px/20px var(--sans); }
.maplibregl-popup-content b { font-weight: 500; }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 18px; width: 28px; height: 28px; }
.me { width: 14px; height: 14px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 2px var(--card), 0 1px 3px rgba(0, 0, 0, .3); }
@media (max-width: 767px) { .maplibregl-ctrl-group:has(.maplibregl-ctrl-zoom-in) { display: none; } }
@media (min-width: 768px) { .maplibregl-ctrl-bottom-right { bottom: 0; } }
.layer-menu label small { margin-left: auto; padding-left: 8px; color: var(--muted); font: 500 11px/1 var(--mono); white-space: nowrap; }

/* ---------- features: outlandings, replay, forecast, competition, push ---------- */
.out-banner { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; padding: 8px 12px; margin: 0 0 12px; border-radius: 8px; background: var(--raised); font-size: 13px; }
.out-banner .fig { color: var(--text-2); font-size: 12px; }
.out-actions { display: flex; gap: 8px; width: 100%; margin-top: 4px; }
.out-actions .btn { flex: 1; height: 32px; display: grid; place-items: center; text-decoration: none; color: var(--text); font-size: 13px; }
.list .outs { display: block; min-height: 0; cursor: default; padding: 4px 16px; }
.list .outs:hover { background: none; }
.list .outs .out-banner { margin: 4px 0; }
.replay-btn { width: 100%; margin-bottom: 12px; }
.btn.primary { background: var(--text); color: var(--on-ink); border-color: var(--text); }
.rank { width: 20px; flex: none; text-align: right; color: var(--muted); font-size: 12px; }

.replay-bar, .fc-bar {
  position: fixed; z-index: 1100; display: flex; align-items: center; gap: 8px; height: 48px; padding: 4px 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); font-size: 13px;
}
.replay-bar[hidden], .fc-bar[hidden] { display: none; }
.replay-bar { left: 50%; transform: translateX(-50%); bottom: calc(var(--gutter) + env(safe-area-inset-bottom)); width: min(560px, calc(100% - 2 * var(--gutter))); }
.replay-bar input[type=range], .fc-bar input[type=range] { flex: 1; min-width: 0; accent-color: var(--text); }
.replay-bar select { height: 32px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card); padding: 0 4px; }
.r-time, .fc-hour { min-width: 44px; font-size: 13px; }
.fc-bar { left: var(--gutter); bottom: calc(var(--gutter) * 2 + 32px); padding: 4px 12px; }
.fc-bar input[type=range] { width: 140px; flex: none; }
.fc-bar .seg { height: 32px; padding: 2px; }
.fc-bar .seg button { height: 28px; padding: 0 8px; }
.fc-title { color: var(--muted); }
.wx.fc .q { width: 10px; height: 10px; border-radius: 50%; flex: none; margin: 0 4px; box-shadow: 0 0 0 1px var(--line); }
@media (max-width: 767px) {
  .replay-bar, .fc-bar { top: calc(48px + 40px + var(--gutter) * 3 + env(safe-area-inset-top)); bottom: auto; }
  .fc-bar { left: var(--gutter); right: var(--gutter); }
  .fc-bar input[type=range] { flex: 1; width: auto; }
  .fc-title { display: none; }
}

.push-row { display: flex; align-items: center; gap: 12px; min-height: 0; padding: 12px 16px; cursor: default; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--line); }
.list .push-row:hover { background: none; }
.push-row span { flex: 1; }
.push-row .btn { flex: none; height: 32px; padding: 0 12px; }
.maplibregl-ctrl-group .layer-menu .menu-btn { width: 100%; height: 32px; border-top: 0; padding: 0 8px; border: 0; border-radius: 4px; background: none; text-align: left; cursor: pointer; color: var(--text); font: 13px/20px var(--sans); }
.maplibregl-ctrl-group .layer-menu .menu-btn:hover { background: var(--raised) !important; }

.comp-dialog { width: min(440px, calc(100% - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.comp-dialog::backdrop { background: rgba(0, 0, 0, .4); }
.comp-dialog h2 { margin: 0 0 16px; font-size: 18px; font-weight: 500; }
.comp-dialog label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 13px; color: var(--text-2); }
.comp-dialog input, .comp-dialog textarea { font: inherit; font-size: 14px; color: var(--text); background: var(--raised); border: 0; border-radius: 8px; padding: 8px 12px; }
.comp-dialog .actions { margin-top: 16px; }
.comp-dialog .task-info { margin: 0; font-size: 13px; }

/* sunset, final glide, retrieve, airfield weather, day verdict */
.flight.glide .dot { display: inline-block; margin: 0 6px 1px 0; }
.flight.glide b { color: var(--text); font-weight: 500; }
.flight.retrieve { display: flex; align-items: center; gap: 8px; }
.flight.retrieve span { flex: 1; }
.flight.retrieve .btn { flex: none; height: 32px; padding: 0 12px; display: inline-flex; align-items: center; text-decoration: none; color: var(--text); }
.maplibregl-popup-content .flight { margin: 8px 0 0; }
.metar pre { margin: 8px 0 0; padding: 8px; border-radius: 8px; background: var(--raised); white-space: pre-wrap; font: 11px/16px var(--mono); max-height: 160px; overflow-y: auto; }
.field-links { margin: 8px 0 0; }
.field-links a { color: var(--text); }
.day-row .dot { flex: none; align-self: flex-start; margin-top: 6px; }
.day-row b { color: var(--text); font-weight: 500; }
.day-row small { color: var(--muted); font-size: 12px; }

/* cookie notice: above the bottom sheet's handle on phones, bottom left on larger screens */
.notice {
  position: fixed; z-index: 1100; left: var(--gutter); right: var(--gutter); bottom: calc(52px + var(--gutter) + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; line-height: 20px; color: var(--text-2);
  animation: notice-in 300ms var(--ease);
}
@keyframes notice-in { from { opacity: 0; transform: translateY(8px); } }
.notice p { margin: 0; flex: 1; }
.notice a { color: var(--text); }
.notice .btn { flex: none; height: 36px; padding: 0 16px; }
@media (min-width: 768px) { .notice { right: auto; max-width: 440px; bottom: calc(var(--gutter) * 2 + 32px); } }
