:root {
  --bg: #f4f8fb;
  --surface: #ffffff;
  --ink: #0d2233;
  --muted: #5b6f80;
  --line: #dbe5ec;
  --accent: #0077b6;
  --sun: #f4a300;
  --good: #1a8f4f;
  --warn: #c2410c;
  --hero-a: #023e8a;
  --hero-b: #0096c7;
  --board: #0d2233;
  --board-ink: #f3d36b;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07131d; --surface: #0e1f2d; --ink: #e6eef4; --muted: #93a8b8; --line: #1d3344;
    --accent: #48b5e8; --good: #4ade80; --warn: #fb923c;
    --hero-a: #021a33; --hero-b: #035e86; --board: #040c13; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #07131d; --surface: #0e1f2d; --ink: #e6eef4; --muted: #93a8b8; --line: #1d3344;
  --accent: #48b5e8; --good: #4ade80; --warn: #fb923c;
  --hero-a: #021a33; --hero-b: #035e86; --board: #040c13; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.muted { color: var(--muted); }

/* Page: content column + ad column on the right */
.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 16px;
}
.content { min-width: 0; }
.ad-rail { display: flex; flex-direction: column; gap: 24px; }
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  width: 300px; border: 1px dashed var(--line); border-radius: 8px;
  color: var(--muted); font-size: 13px; background: var(--surface);
}
.ad-300x250 { height: 250px; }
.ad-300x600 { height: 600px; }
.ad-slot.sticky { position: sticky; top: 20px; }
/* In-content banner: clear space above and below keeps it away from the buttons and the video. */
.ad-inline { display: flex; flex-direction: column; align-items: center; margin: 28px 0 32px; }
.ad-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
/* Responsive in-content units; the reserved height stops the page jumping when an ad loads. */
.ad-responsive { width: 100%; min-height: 250px; text-align: center; padding: 0 8px; }
/* No ad available for this spot: hide the empty space and its label. */
.ad-inline:has(ins.adsbygoogle[data-ad-status="unfilled"]) { display: none; }
.ad-inline.ad-in-panel { margin: 0 0 16px; }
.ad-inline.ad-bottom { margin: 8px 0 24px; }
@media (max-width: 560px) { .ad-responsive { min-height: 200px; } }

/* Hero */
.hero {
  background: linear-gradient(160deg, var(--hero-a), var(--hero-b));
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 24px 20px;
  margin-bottom: 20px;
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.eyebrow { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.logo { display: block; flex-shrink: 1; min-width: 0; width: auto; height: 80px; max-width: 50%; object-fit: contain; }
@media (max-width: 560px) {
  .topbar { flex-direction: column-reverse; align-items: flex-start; gap: 10px; }
  .logo { height: auto; width: 100%; max-width: 320px; }
}
.card {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(6px);
  margin-bottom: 16px;
}
.card-label { margin: 0 0 6px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; opacity: .8; }

/* Status frame: countdown | photo | runway */
.status { display: grid; grid-template-columns: 1fr 240px 1fr; gap: 20px; align-items: center; }
.status-next, .status-runway { display: flex; flex-direction: column; justify-content: center; }
.countdown, .runway-id {
  font: 700 clamp(36px, 5vw, 52px)/1 "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.next-flight, .runway-verdict { margin-top: 10px; font-size: 15px; opacity: .95; }
.status-runway { padding: 12px 14px; border-radius: 10px; border: 1px solid transparent; }
.status-runway.beach { background: rgba(244,163,0,.2); border-color: var(--sun); }
.status-runway.beach .runway-id { color: #ffd166; }
.thumb { margin: 0; }
.thumb-img {
  aspect-ratio: 3 / 2; border-radius: 10px; overflow: hidden; /* Planespotters photos are 3:2 */
  background: rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center;
}
.thumb-img > a { position: relative; display: block; width: 100%; height: 100%; color: #fff; }
.thumb-img img { width: 100%; height: 100%; object-fit: contain; display: block; } /* never crop nose or tail */
.photo-credit {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px;
  font-size: 10px; line-height: 1.3; background: rgba(0,0,0,.6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thumb-placeholder { font-size: 44px; opacity: .5; }
.next-aircraft { margin-top: 4px; font-size: 14px; opacity: .75; }

/* Arrivals / departures */
.boards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.board-col { min-width: 0; }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; margin-bottom: 6px; }
.board-head .card-label { margin: 0; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid rgba(255,255,255,.4); color: #fff; white-space: nowrap; }
.badge.sample { border-color: #ffd166; color: #ffd166; }
.badge-btn {
  font: 600 12px Inter, sans-serif; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid #ffd166; background: rgba(255,209,102,.12); color: #ffd166; white-space: nowrap;
}
.badge-btn:hover { background: #ffd166; color: #1a1200; }
.badge-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Weekly schedule dialog */
.schedule-dialog {
  width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
.schedule-dialog[open] { display: flex; flex-direction: column; }
.schedule-dialog::backdrop { background: rgba(2, 20, 40, .6); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dialog-head h2 { margin: 0; font-size: 20px; }
.dialog-close { font-size: 26px; line-height: 1; width: 36px; height: 36px; border: 0; border-radius: 8px; background: var(--bg); color: var(--ink); cursor: pointer; }
.day-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.day-tabs button {
  font: 600 13px Inter, sans-serif; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.day-tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.day-tabs button .today { font-weight: 500; opacity: .75; margin-left: 4px; }
.dialog-body { overflow: auto; border-radius: 10px; min-height: 0; }
.sched { width: 100%; border-collapse: collapse; background: var(--board); color: var(--board-ink); font: 13px "JetBrains Mono", ui-monospace, monospace; }
.sched th { position: sticky; top: 0; background: var(--board); text-align: left; font-weight: 500; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #8fa6b8; padding: 8px 10px; border-bottom: 1px solid #22394b; }
.sched td { padding: 8px 10px; border-bottom: 1px solid #16293a; white-space: nowrap; }
.sched tr:last-child td { border-bottom: 0; }
.sched .t { color: #fff; font-weight: 700; }
.sched .muted { color: #8fa6b8; white-space: normal; }
.sched thead tr:first-child th { font-size: 12px; color: var(--board-ink); letter-spacing: .12em; }
.sched .type { display: block; font-size: 11px; color: #8fa6b8; white-space: normal; }
.sched tr.cancelled td { text-decoration: line-through; opacity: .6; }
.sched tr.cancelled .status-cancelled { text-decoration: none; }
.sched-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.sched-grid .sched { border-radius: 10px; overflow: hidden; }
.schedule-date { margin: 0 0 10px; font-weight: 600; }
@media (max-width: 640px) { .sched-grid { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; border-radius: 10px; }
.board { width: 100%; table-layout: fixed; border-collapse: collapse; background: var(--board); color: var(--board-ink); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; }
.board th:nth-child(1) { width: 68px; }
.board th:nth-child(2) { width: 34%; }
.board th:nth-child(4) { width: 92px; }
.board td { overflow: hidden; text-overflow: ellipsis; }
.board th { text-align: left; font-weight: 500; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #8fa6b8; padding: 8px 10px; border-bottom: 1px solid #22394b; }
.board td { padding: 8px 10px; border-bottom: 1px solid #16293a; white-space: nowrap; vertical-align: top; }
.board tr:last-child td { border-bottom: 0; }
.board tr.next td { background: rgba(243,211,107,.12); }
.board .muted { color: #8fa6b8; }
.board .type { display: block; font-size: 11px; color: #8fa6b8; overflow: hidden; text-overflow: ellipsis; }
.board .rev { display: block; color: #fb923c; font-size: 12px; }
.status-delayed { color: #fb923c; }
.status-cancelled { color: #f87171; }
.status-ok { color: #4ade80; }
.status-kind { color: #67e8f9; }
.clock { margin: 4px 0 0; font-size: 13px; opacity: .8; }

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.panel h2 { margin: 0; font-size: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel .badge { color: var(--muted); border-color: var(--line); background: var(--bg); }
.fine { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

/* Wind */
.wind-grid { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: center; }
.compass { width: 100%; max-width: 220px; }
.compass .ring { fill: var(--bg); stroke: var(--line); stroke-width: 2; }
.compass .cardinal { fill: var(--muted); font: 600 13px Inter, sans-serif; text-anchor: middle; }
.compass .strip { fill: var(--muted); opacity: .35; }
.compass .rwy-num { fill: var(--ink); font: 700 11px "JetBrains Mono", monospace; text-anchor: middle; }
.compass .arrow { stroke: var(--accent); stroke-width: 5; stroke-linecap: round; }
.compass .arrow-head { fill: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0; }
.stats div { background: var(--bg); border-radius: 10px; padding: 12px; }
.stats dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stats dd { margin: 4px 0 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metar { margin: 14px 0 0; font: 13px "JetBrains Mono", monospace; color: var(--muted); word-break: break-word; }

/* Live stream */
.frame { margin: 0; }
.frame iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; background: var(--bg); }
.frame figcaption { margin-top: 6px; font-size: 13px; color: var(--muted); }

.safety { border-left: 4px solid #cc252c; }
.safety-tag { display: block; width: 100%; height: auto; border-radius: 10px; margin-bottom: 16px; }
.safety p { margin: 8px 0 0; }
.footer { padding: 0 4px 20px; font-size: 13px; color: var(--muted); }
.bmc-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px;
  background: #ffdd00; color: #000; font-weight: 700; font-size: 14px; text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.bmc-btn:hover { background: #ffe94d; }
.bmc-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bmc-btn[hidden], .bmc-line[hidden] { display: none; }
.contact-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 999px;
  border: 1px solid var(--accent); color: var(--accent); background: var(--surface);
  font-weight: 600; font-size: 14px; text-decoration: none;
}
.contact-btn:hover { background: var(--accent); color: #fff; }
.contact-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bmc-line { font-size: 14px; color: var(--ink); }
.bmc-line a { font-weight: 600; }

/* Narrower screens: drop the ad column, then stack the frames */
@media (max-width: 1100px) {
  .page { grid-template-columns: minmax(0, 1fr); max-width: 960px; }
  .ad-rail { display: none; }
}
@media (max-width: 860px) {
  .status { grid-template-columns: 1fr 180px; }
  .status-runway { grid-column: 1 / -1; }
  .boards { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .page { padding: 12px 16px; }
  .hero { padding: 24px 16px 16px; }
  .status { grid-template-columns: 1fr; }
  .thumb { max-width: 260px; }
  .wind-grid { grid-template-columns: 1fr; }
  .compass { margin: 0 auto; display: block; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .board { font-size: 13px; }
}
