/* Eindhoven Airport Dashboard v1.5 */
:root {
  --night: #0f1d27;
  --panel: #152733;
  --line: #24404f;
  --text: #dbe5ea;
  --muted: #8fa3ae;
  --phosphor: #7fc8a0;
  --amber: #f2b84b;
  --sky: #6cc4e8;
  --ground: #8a9aa5;
  --mil: #e58a7a;
  --emerg: #ff5a4f;
  --asphalt: #2c3438;
  --paint: #f4f6f7;
  --font: "DejaVu Sans", "Bitstream Vera Sans", Verdana, Geneva, sans-serif;
  --font-cond: "DejaVu Sans Condensed", "DejaVu Sans", "Arial Narrow", Verdana, sans-serif;
  --font-mono: "DejaVu Sans Mono", Menlo, Consolas, monospace;
  --gap: 12px;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: inherit; }

html { background: var(--night); }
body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font: 14px/1.4 var(--font);
  padding: 0 clamp(8px, 1.5vw, 18px) 8px;
}

h1, h2 { margin: 0; font-weight: bold; }
h2 { font-size: 0.9rem; color: var(--muted); }
p { margin: 0; }

/* Kop */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 2px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--gap);
}
.title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.title h1 { font-size: 1.4rem; letter-spacing: -0.01em; }
.codes { color: var(--phosphor); font-family: var(--font-cond); font-size: 1rem; }
.clocks { display: flex; gap: 18px; }
.clock { display: flex; align-items: baseline; gap: 6px; }
.clock-label { font-size: 0.78rem; color: var(--muted); }
.clock-time { font-family: var(--font-mono); font-size: 1.2rem; font-variant-numeric: tabular-nums; }

/* Live ATC in de kop */
.atc { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.atc[hidden] { display: none; }
.atc-label { font-size: 0.78rem; color: var(--muted); }
.atc select, .atc-btn {
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 4px 8px;
}
.atc-btn { cursor: pointer; min-width: 74px; }
.atc-btn[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: var(--night); font-weight: bold; }
.atc select:focus-visible, .atc-btn:focus-visible, .atc-vol:focus-visible { outline: 2px solid var(--phosphor); outline-offset: 2px; }
.atc-vol { width: 80px; accent-color: var(--phosphor); }
.atc-status { font-size: 0.8rem; color: var(--phosphor); min-width: 0; }

/* Installatieknop */
.install-btn {
  font: inherit; font-size: 0.82rem;
  color: var(--night); background: var(--phosphor);
  border: 0; border-radius: 3px; padding: 5px 10px; cursor: pointer; font-weight: bold;
}
.install-btn[hidden] { display: none; }
.install-btn:focus-visible { outline: 2px solid var(--paint); outline-offset: 2px; }

/* Als app geopend: geen randje boven de statusbalk */
@media (display-mode: standalone) {
  .top { padding-top: 6px; }
}

/* Tegels */
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  min-width: 0;
}
.tile-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.tile > h2 { margin-bottom: 8px; }
.note { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }

/* Basisindeling (telefoon, smalle schermen): onder elkaar */
.layout { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
.col-left, .col-right { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.radar-wrap { aspect-ratio: 1 / 1; width: 100%; max-width: 640px; margin: 0 auto; }

/* Baan: het geschilderde baannummer is de blikvanger */
.strip {
  background: var(--asphalt);
  border-radius: 3px;
  padding: 8px 0 6px;
  text-align: center;
  overflow: hidden;
  border-left: 3px solid #3a4448;
  border-right: 3px solid #3a4448;
}
.keys {
  height: 22px;
  margin: 0 14%;
  background: repeating-linear-gradient(90deg, var(--paint) 0 8px, transparent 8px 16px);
  opacity: 0.92;
}
.rwy-num {
  font-family: var(--font-cond);
  font-weight: bold;
  color: var(--paint);
  font-size: clamp(52px, 8vh, 88px);
  line-height: 1;
  margin-top: 8px;
  transform: scaleY(1.35);
  transform-origin: top center;
  padding-bottom: 0.35em;
  letter-spacing: 0.04em;
}
.rwy-dir { margin-top: 8px; font-size: 0.95rem; }
.rwy-comp { margin-top: 2px; color: var(--phosphor); font-size: 0.86rem; }

/* Wind */
.wind-body { display: grid; grid-template-columns: 104px 1fr; gap: 12px; align-items: center; }
.rose svg { display: block; width: 100%; height: auto; }
.wind-text { font-size: 1rem; font-variant-numeric: tabular-nums; }

/* Weer */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0; font-size: 0.86rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.cat { font-size: 0.76rem; padding: 2px 8px; border-radius: 3px; font-weight: bold; white-space: nowrap; }
.cat:empty { display: none; }
.cat-VFR { background: #1f5a3a; color: #c9f2da; }
.cat-MVFR { background: #1f4a6a; color: #cfe8f7; }
.cat-IFR { background: #6a2a26; color: #fbd4d0; }
.cat-LIFR { background: #5a2560; color: #f1d2f5; }

/* Radar */
.radar-tile { display: flex; flex-direction: column; min-width: 0; position: relative; }
.sel-info[hidden] { display: none; }

/* Detailkaart van een toestel */
.detail {
  margin-top: 8px;
  background: #1a3140;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.detail[hidden] { display: none; }
.d-close {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 30px; height: 30px;
  font: inherit; font-size: 1.2rem; line-height: 1;
  color: var(--paint); background: rgba(15, 29, 39, 0.75);
  border: 1px solid var(--line); border-radius: 50%; cursor: pointer;
}
.d-close:focus-visible { outline: 2px solid var(--phosphor); outline-offset: 2px; }
.d-photo { position: relative; background: #0d2029; }
.d-photo img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.d-nophoto { padding: 18px 12px; color: var(--muted); font-size: 0.82rem; text-align: center; }
.d-credit {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 3px 8px; font-size: 0.7rem; color: #e8eef1;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  text-decoration: none;
}
.d-credit:hover { text-decoration: underline; }
.d-body { padding: 10px 12px 12px; }
.d-title { margin: 0; font-size: 1.15rem; color: var(--paint); }
.d-sub { font-size: 0.85rem; font-weight: normal; color: var(--muted); }
.d-airline { margin-top: 1px; font-size: 0.88rem; }
.d-meta { margin-top: 2px; font-size: 0.8rem; color: var(--muted); }
.d-route { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: baseline; margin-top: 10px; font-size: 0.9rem; }
.d-ap-r { text-align: right; }
.d-arrow { color: var(--muted); font-size: 0.78rem; }
.d-code { color: var(--phosphor); font-size: 0.8rem; }
.d-bar { position: relative; height: 6px; background: #0d2029; border-radius: 3px; margin: 8px 0 4px; }
.d-bar span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--phosphor); border-radius: 3px; }
.d-bar i { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; background: var(--paint); border-radius: 50%; }
.d-dist { display: flex; justify-content: space-between; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.d-eta { margin-top: 4px; font-size: 0.8rem; color: var(--muted); }
.d-noroute { margin-top: 8px; font-size: 0.82rem; color: var(--muted); }
.d-facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 10px 0 0; font-size: 0.82rem; }
.d-facts dt { color: var(--muted); }
.d-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.range { display: flex; gap: 4px; }
.range button {
  font: inherit;
  font-size: 0.8rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 3px 8px;
  cursor: pointer;
}
.range button[aria-pressed="true"] { color: var(--night); background: var(--phosphor); border-color: var(--phosphor); }
.range button:focus-visible { outline: 2px solid var(--phosphor); outline-offset: 2px; }
#radar { width: 100%; height: 100%; display: block; cursor: crosshair; }
.sel-info { margin-top: 6px; font-size: 0.84rem; min-height: 1.3em; }
.sel-info strong { color: var(--paint); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 0.78rem; color: var(--muted); }
.lg::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.lg-arrival::before { background: var(--amber); }
.lg-departure::before { background: var(--sky); }
.lg-ground::before { background: var(--ground); }
.lg-overflight::before { background: var(--phosphor); }
.lg-mil::before { background: var(--mil); }

/* Lijsten */
.lists { display: flex; flex-direction: column; }
.group + .group { margin-top: 12px; }
.group h2 { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-bottom: 3px; }
.group h2 .n { color: var(--text); font-weight: normal; }
.group ul { list-style: none; margin: 0; padding: 0; }
.empty { color: var(--muted); font-size: 0.82rem; padding: 4px 0; }
.ac {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 10px;
  padding: 5px 6px 5px 9px;
  border-left: 3px solid var(--phosphor);
  border-radius: 2px;
  cursor: pointer;
  font-size: 0.88rem;
}
.ac + .ac { margin-top: 2px; }
.ac:hover, .ac:focus-visible { background: rgba(255, 255, 255, 0.04); outline: none; }
.ac:focus-visible { box-shadow: inset 0 0 0 1px var(--phosphor); }
.ac.sel { background: rgba(255, 255, 255, 0.08); }
.ac.cat-arrival { border-left-color: var(--amber); }
.ac.cat-departure { border-left-color: var(--sky); }
.ac.cat-ground { border-left-color: var(--ground); }
.ac.mil { border-left-color: var(--mil); }
.ac.emerg { border-left-color: var(--emerg); background: rgba(255, 90, 79, 0.12); }
.cs { font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ty { color: var(--muted); font-size: 0.8rem; text-align: right; }
.rt { color: var(--muted); font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al, .ds { font-size: 0.82rem; text-align: right; font-variant-numeric: tabular-nums; }
.al { grid-column: 2; grid-row: 2; }
.ds { grid-column: 1; grid-row: 3; color: var(--muted); text-align: left; }
.tag { font-size: 0.7rem; font-weight: normal; padding: 0 5px; border-radius: 2px; background: rgba(229, 138, 122, 0.2); color: var(--mil); margin-left: 4px; }
.tag-emerg { background: var(--emerg); color: #fff; }

/* METAR / TAF */
.reports { display: flex; flex-direction: column; gap: 8px; }
.report pre {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

/* Voet */
.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 8px 2px 0;
  font-size: 0.74rem;
  color: var(--muted);
}
.foot .ver { margin-left: auto; color: var(--phosphor); }

/* Tussenmaat (tablet staand): baan, wind en weer naast elkaar */
@media (min-width: 640px) and (max-width: 999px) {
  .col-left { display: grid; grid-template-columns: 1fr 1fr; }
  .col-left .weather { grid-column: 1 / -1; }
}

/* Groot scherm: alles op één pagina, niets scrollt behalve een lange lijst */
@media (min-width: 1000px) and (min-height: 560px) {
  html, body { height: 100%; }
  body { display: flex; flex-direction: column; overflow: hidden; }
  .top, .foot { flex: none; }
  .layout {
    flex: 1;
    min-height: 0;
    grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(290px, 360px);
  }
  .col-left { min-height: 0; overflow-y: auto; }
  .radar-tile { min-height: 0; }
  .radar-wrap { flex: 1; min-height: 0; aspect-ratio: auto; max-width: none; }
  .detail {
    position: absolute;
    top: 48px; left: 12px;
    width: min(290px, 46%);
    max-height: calc(100% - 60px);
    overflow-y: auto;
    margin: 0;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  }
  .col-right { min-height: 0; }
  .lists { flex: 1; min-height: 0; }
  .lists-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
  .reports { flex: none; max-height: 34%; overflow-y: auto; }
}

/* Lage schermen (laptop): baannummer nog iets compacter */
@media (min-width: 1000px) and (max-height: 760px) {
  .keys { height: 16px; }
  .rwy-num { font-size: 48px; margin-top: 6px; }
  .wind-body { grid-template-columns: 88px 1fr; }
}

@media (max-width: 560px) {
  .clock-time { font-size: 1.05rem; }
  .foot .ver { margin-left: 0; }
}
