/* Aerodrome pages (/aerodromes/…). Plain CSS on purpose: ~750 pages that exist
   to be read and indexed should not wait for the Tailwind runtime the home
   page uses. Colours are the site's tokens (js/tailwind.config.js).

   The live weather block has its own file, css/aerodrome-weather.css, loaded
   only on the pages that have one.

   Colour here says what KIND of thing something is (a CTAF, a tower, a weather
   frequency), never how good the day is.

   Cached for a year (firebase.json). The pages link this file with a content
   hash that landing-page/scripts/build_aerodrome_pages.py computes, so edit it
   and re-run the generator; never bump a version by hand. */

:root {
  --sunken: #101B2E;
  --surface: #132038;
  --raised: #18243A;
  --high: #24334C;
  --content: #F4F7FC;
  --secondary: #B0BDD1;
  --tertiary: #8FA0B8;
  --edge: rgb(176 189 209 / 0.12);
  --edge-strong: rgb(176 189 209 / 0.22);
  --accent: #2E6BE8;
  --accent-hover: #3D7BF7;
  --link: #82B1FF;
  --warning: #F5B94A;
  /* Kinds of frequency */
  --ctaf: #82B1FF;
  --tower: #E2C27D;
  --ground: #C4A7FF;
  --wx: #5FD6C8;
  --approach: #F6A76B;
  --area: #B0BDD1;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--sunken);
  background-image: radial-gradient(1100px 420px at 50% -120px, rgb(46 107 232 / 0.16), transparent 70%);
  background-repeat: no-repeat;
  color: var(--content);
  font: 16px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 10; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; }

.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top { border-bottom: 1px solid var(--edge); background: var(--surface); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.top nav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.top nav a { color: var(--secondary); }
.top nav a:hover { color: var(--link); text-decoration: none; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 20px; border-radius: 12px;
  background: var(--accent); color: #fff !important; font-weight: 700; font-size: 15px;
  box-shadow: 0 8px 22px rgb(26 60 130 / 0.45);
}
.button:hover { background: var(--accent-hover); text-decoration: none; }
.top .button { min-height: 38px; font-size: 14px; box-shadow: none; }
@media (max-width: 520px) { .top nav a.plain { display: none; } }

/* Page */
main { padding: 6px 0 52px; }
.intro { padding-top: 18px; }
.crumbs { font-size: 13px; color: var(--tertiary); margin: 0 0 14px; }
.crumbs a { color: var(--tertiary); }
h1 { font-size: 30px; line-height: 1.15; margin: 0; letter-spacing: -0.015em; }
h2 { font-size: 20px; margin: 34px 0 12px; letter-spacing: -0.005em; }
h2 .unit { font-size: 12px; font-weight: 600; color: var(--tertiary); letter-spacing: 0.06em; text-transform: uppercase; margin-left: 6px; }
h3 { font-size: 15px; margin: 0 0 10px; color: var(--secondary); font-weight: 600; }
/* Anchors land below the sticky tab bar (52px) when the script is not there to do it. */
[data-tab], section[id] { scroll-margin-top: 68px; }
p { margin: 0 0 12px; }
.where { color: var(--secondary); margin: 6px 0 0; }
.small { font-size: 13px; color: var(--tertiary); }

/* Hero: the code as a badge, the name, and what kind of place it is */
.hero { display: flex; align-items: center; gap: 16px; margin: 0 0 18px; }
.hero-icao {
  flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 92px; height: 64px; padding: 0 14px;
  border-radius: 14px; font-size: 24px; font-weight: 800; letter-spacing: 0.05em; font-variant-numeric: tabular-nums; color: #fff;
  background: linear-gradient(135deg, #2E6BE8, #1E49A4);
  box-shadow: 0 10px 28px rgb(26 60 130 / 0.45), inset 0 1px 0 rgb(255 255 255 / 0.18);
}
.hero-text { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.hero--list { display: block; }
.hero--list .hero-text { gap: 0; }

/* Tags: one height, one radius, one type size. A dot gives the kind; text says it too. */
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px;
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums;
  color: var(--secondary); background: rgb(36 51 76 / 0.55); border: 1px solid var(--edge);
}
.tag--tower::before, .tag--ctaf::before, .tag--wx::before {
  content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--dot);
}
.tag--tower { --dot: var(--tower); color: var(--content); }
.tag--ctaf { --dot: var(--ctaf); color: var(--content); }
.tag--wx { --dot: var(--wx); color: var(--content); }
.tag--edition { color: var(--tower); border-color: rgb(226 194 125 / 0.3); background: rgb(226 194 125 / 0.08); letter-spacing: 0.03em; }
@media (max-width: 520px) {
  h1 { font-size: 23px; }
  .hero { gap: 12px; align-items: flex-start; }
  .hero-icao { min-width: 74px; height: 52px; font-size: 19px; border-radius: 12px; }
}

/* The section bar: sticks to the top, scrolls sideways on a phone, marks where you are. */
.tabs {
  position: sticky; top: 0; z-index: 6;
  background: rgb(16 27 46 / 0.94); border-bottom: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.tabs.is-stuck { box-shadow: 0 8px 22px rgb(3 7 18 / 0.4); }
.tabs-inner { display: flex; align-items: center; gap: 12px; height: 52px; }
.tabs-list { display: flex; flex: 1 1 auto; min-width: 0; height: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs-list::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 100%; padding: 0 14px;
  font-size: 14px; font-weight: 600; color: var(--tertiary); white-space: nowrap;
}
.tab:first-child { padding-left: 0; }
.tab:hover { color: var(--content); text-decoration: none; }
.tab::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: transparent; }
.tab:first-child::after { left: 0; }
.tab.is-active { color: var(--content); }
.tab.is-active::after { background: var(--link); }
.tab:focus-visible { outline-offset: -4px; }
.tab-count { font-size: 12px; font-weight: 500; color: var(--tertiary); font-variant-numeric: tabular-nums; }
.tabs-cta { flex: none; min-height: 36px; padding: 0 14px; font-size: 13px; box-shadow: none; }
@media (max-width: 640px) {
  .tabs-cta { display: none; }
  .tabs-list { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
}

.notice {
  border: 1px solid var(--edge-strong); border-left: 3px solid var(--warning);
  background: var(--raised); border-radius: 10px; padding: 10px 14px;
  font-size: 14px; color: var(--secondary); margin: 14px 0 0;
}
.notice strong { color: var(--content); }

/* Edition stamp */
.facts { margin-top: 22px; }
.facts > .edition > .stamp:first-child { margin-top: 0; }
.stamp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--tertiary); margin: 0 0 12px; }
.changes {
  font-size: 13px; color: var(--warning); margin: -4px 0 12px; padding: 8px 12px; border-radius: 10px;
  background: rgb(245 185 74 / 0.08); border: 1px solid rgb(245 185 74 / 0.3);
}

/* At a glance */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(180deg, var(--raised), var(--surface)); border: 1px solid var(--edge);
  border-top: 2px solid var(--edge-strong);
}
.tile-label { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--tertiary); }
.tile-value { font-size: 24px; font-weight: 750; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile-value--long { font-size: 18px; line-height: 1.6; }
.tile-sub { font-size: 12px; color: var(--tertiary); overflow-wrap: anywhere; }
.tile--ctaf { border-top-color: var(--ctaf); } .tile--ctaf .tile-value { color: var(--ctaf); }
.tile--tower { border-top-color: var(--tower); } .tile--tower .tile-value { color: var(--tower); }
.tile--area { border-top-color: var(--area); }

/* Frequencies: one card each, coloured by kind */
.freqs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.freq {
  --kind: var(--area);
  display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 12px 14px 12px 16px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--edge); border-left: 3px solid var(--kind);
}
.freq-kind { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--kind); }
.freq-values { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.freq-mhz { font-size: 22px; font-weight: 750; line-height: 1.25; font-variant-numeric: tabular-nums; }
.freq-unit { font-size: 13px; color: var(--secondary); overflow-wrap: anywhere; }
.freq-when { font-size: 12px; color: var(--tertiary); }
.freq--ctaf { --kind: var(--ctaf); background: linear-gradient(180deg, rgb(130 177 255 / 0.09), var(--surface)); }
.freq--tower { --kind: var(--tower); }
.freq--ground { --kind: var(--ground); }
.freq--wx { --kind: var(--wx); }
.freq--approach { --kind: var(--approach); }
.freq--area { --kind: var(--area); }
.freq--other { --kind: var(--tertiary); }

/* Tower hours: one 24-hour UTC bar per published window */
.box { margin: 14px 0 0; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--edge); }
.box .small { margin: 10px 0 0; }
.hours { display: grid; gap: 8px; }
.hours-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) minmax(0, 190px); gap: 12px; align-items: center; font-size: 13px; }
.hours-days { font-weight: 600; color: var(--content); }
.hours-track { position: relative; height: 14px; border-radius: 7px; background: var(--high); overflow: hidden; }
.hours-open { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, #C9A55E, var(--tower)); }
.hours-text { color: var(--secondary); font-variant-numeric: tabular-nums; }
.hours-note { display: block; font-size: 12px; color: var(--tertiary); }
.hours-axis .hours-days { font-weight: 500; font-size: 11px; color: var(--tertiary); letter-spacing: 0.06em; }
.hours-axis .hours-track { height: 14px; background: none; overflow: visible; }
.hours-axis i { position: absolute; top: 0; font-style: normal; font-size: 11px; color: var(--tertiary); transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.hours-axis i:first-child { transform: none; }
.hours-axis i:last-child { transform: translateX(-100%); }
@media (max-width: 600px) {
  .hours-row { grid-template-columns: 78px minmax(0, 1fr); }
  .hours-text { grid-column: 1 / -1; margin-top: -4px; }
  .hours-axis .hours-text { display: none; }
}

/* Tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--edge); border-radius: 14px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 14px; border-top: 1px solid var(--edge); vertical-align: top; }
thead th { border-top: 0; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--tertiary); white-space: nowrap; background: rgb(36 51 76 / 0.45); }
tbody tr:nth-child(even) td { background: rgb(36 51 76 / 0.18); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.kind { font-weight: 700; white-space: nowrap; }
/* A thin bar under the number: as long as the value is to the largest in its column. */
td.bar { background-image: linear-gradient(90deg, rgb(130 177 255 / 0.55), rgb(130 177 255 / 0.55)) !important; background-repeat: no-repeat !important; background-position: right 14px bottom 5px !important; background-size: calc(var(--w, 0%) - 14px) 3px !important; }
@media (max-width: 520px) { table { font-size: 14px; } th, td { padding: 9px 8px; } td.bar { background-position: right 8px bottom 5px !important; background-size: calc(var(--w, 0%) - 8px) 3px !important; } }
.table-scroll + h3, .table-scroll + .small { margin-top: 14px; }
.table-scroll + .small { margin-top: 8px; }
h3 + .table-scroll { margin-top: 0; }
.facts h3 { margin-top: 18px; }
.box h3 { margin-top: 0; }

/* Schematic */
figure { margin: 0; }
.schematic { border: 1px solid var(--edge); border-radius: 14px; overflow: hidden; background: #132438; max-width: 620px; box-shadow: 0 14px 40px rgb(3 7 18 / 0.35); }
.schematic svg { display: block; width: 100%; height: auto; }
figcaption { font-size: 13px; color: var(--tertiary); margin-top: 10px; max-width: 620px; }

/* Call to action */
.cta {
  border: 1px solid rgb(130 177 255 / 0.35); border-radius: 18px; padding: 22px; margin: 36px 0 0;
  background: linear-gradient(135deg, rgb(46 107 232 / 0.22), rgb(24 36 58 / 0.9) 60%);
}
.cta h2 { margin: 0 0 6px; }
.cta p { color: var(--secondary); max-width: 62ch; }
.cta .small { margin: 12px 0 0; }

/* Nearby aerodromes, and the list page */
.nears { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.near {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: baseline;
  padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--edge); color: var(--content);
}
.near:hover { border-color: rgb(130 177 255 / 0.5); background: var(--raised); text-decoration: none; }
.near-icao { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--link); letter-spacing: 0.02em; }
.near-name { font-size: 14px; overflow-wrap: anywhere; }
.near-far { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--tertiary); margin-top: 2px; }
.arrow { flex: none; color: var(--secondary); }
.nears--list { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.nears--list .near { padding: 8px 12px; }

.sources { margin: 38px 0 0; padding-top: 16px; border-top: 1px solid var(--edge); font-size: 13px; color: var(--tertiary); }
.sources p { margin: 0 0 8px; }

footer.bottom { border-top: 1px solid var(--edge); background: var(--raised); padding: 22px 0 30px; font-size: 13px; color: var(--tertiary); }
footer.bottom .wrap > p { margin: 0 0 10px; }
footer.bottom nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 12px; }
footer.bottom nav a { color: var(--secondary); }
