/* Silvermere airport demo — frosted-glass overlay UI (dark text on bright glass) */
:root {
  --ink: #0a1020;
  --ink-soft: #2a3550;
  --glass: rgba(255, 255, 255, 0.74);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --edge: rgba(255, 255, 255, 0.9);
  --line: rgba(10, 16, 32, 0.16);
  --accent: #0b5fff;
  --accent-ink: #ffffff;
  --ok: #0a7a3d;
  --warn: #a15c00;
  --bad: #b3141f;
  --radius: 14px;
  --gap: 12px;
  --tap: 44px;
  --topbar-h: 64px;
  --bottom-h: 112px;
  --shadow: 0 8px 28px rgba(0, 10, 30, 0.28);
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1220;
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}

/* Full-bleed canvas underneath everything */
canvas, #scene, #app-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* Overlay root: lets pointer events through except on panels */
.ui {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr minmax(280px, 340px);
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    "banner banner banner"
    "top    top    top"
    "list   .      detail"
    "bottom bottom bottom";
  gap: var(--gap);
  padding: var(--gap);
}
.ui > * { pointer-events: auto; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}

/* Disclaimer */
.ui-banner {
  grid-area: banner;
  justify-self: center;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  background: #ffe27a;
  color: #2b1d00;
  border: 1px solid #b88a00;
  border-radius: 999px;
  box-shadow: var(--shadow);
  text-align: center;
}

/* Top KPIs */
.ui-top {
  grid-area: top;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  padding: 8px;
}
.kpi {
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  min-width: 0;
}
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.kpi-value {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.kpi.is-delayed .kpi-value { color: var(--bad); }
.kpi.is-clock .kpi-value { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* Left: flight list */
.ui-list {
  grid-area: list;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px;
  gap: 8px;
}
.ui-search {
  width: 100%;
  min-height: var(--tap);
  padding: 0 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ui-search::placeholder { color: #55607a; }
.flight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
}
.flight-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: center;
  width: 100%;
  min-height: var(--tap);
  padding: 6px 10px;
  margin-bottom: 4px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
}
.flight-item:hover { background: rgba(255, 255, 255, 0.9); }
.flight-item[aria-selected="true"] {
  background: #fff;
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.flight-name { font-weight: 700; }
.flight-meta { font-size: 12px; color: var(--ink-soft); grid-column: 1; }
.flight-delay { font-weight: 700; font-variant-numeric: tabular-nums; grid-row: 1 / span 2; grid-column: 2; }
.flight-empty { padding: 12px; color: var(--ink-soft); }

/* Right: detail panel */
.ui-detail {
  grid-area: detail;
  align-self: start;
  max-height: 100%;
  overflow-y: auto;
  padding: 14px;
}
.detail-title { margin: 0 0 2px; font-size: 18px; font-weight: 800; }
.detail-sub { margin: 0 0 10px; color: var(--ink-soft); }
.detail-empty { margin: 0; color: var(--ink-soft); }
.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0;
}
.detail-grid dt { font-weight: 600; color: var(--ink-soft); }
.detail-grid dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.phase-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
}
.is-ok { color: var(--ok); }
.is-warn { color: var(--warn); }
.is-bad { color: var(--bad); }

/* Timeline */
.ui-bottom {
  grid-area: bottom;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px var(--gap);
  align-items: center;
  padding: 10px 12px;
}
.timeline { min-width: 0; }
.timeline-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.timeline-track {
  position: relative;
  height: 14px;
  background: rgba(10, 16, 32, 0.16);
  border-radius: 999px;
  overflow: hidden;
}
.timeline-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #0b5fff, #00a3a3);
  border-radius: inherit;
  transition: width 0.15s linear;
}

.ctrl-group { display: flex; gap: 6px; flex-wrap: wrap; }
.btn {
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 14px;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover { background: #eef3ff; }
.btn:focus-visible, .ui-search:focus-visible, .flight-item:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* Tablet */
@media (max-width: 1000px) {
  .ui {
    grid-template-columns: minmax(220px, 280px) 1fr minmax(240px, 300px);
  }
  .ui-bottom { grid-template-columns: 1fr; }
}

/* Mobile: stack panels, scrollable column */
@media (max-width: 700px) {
  html, body { overflow: auto; }
  .ui {
    position: fixed;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 8px;
    gap: 8px;
    pointer-events: none;
  }
  .ui-banner { font-size: 12px; border-radius: 12px; }
  .ui-top { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .kpi-value { font-size: 20px; }
  /* leave the canvas visible between the KPI strip and the panels */
  .ui-list { margin-top: 28vh; max-height: 34vh; flex: none; }
  .ui-detail { align-self: stretch; max-height: none; }
  .ui-bottom { position: sticky; bottom: 0; }
  .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .timeline-fill { transition: none; }
}
