/* Atmosphere design tokens: the only place colours, type and spacing are defined.
   Every Vectored page uses these variables; never hard-code a colour in an app. */
:root {
  color-scheme: light dark;

  /* Brand */
  --atm-night: #0b1f3a;        /* deep sky: headers, primary text on light */
  --atm-amber: #f5a524;        /* data-tag amber: the one accent, use sparingly */
  --atm-radar: #1fb6c9;        /* radar cyan: links, focus, live indicators */

  /* Surfaces & text (light) */
  --atm-bg: #f5f7fa;
  --atm-surface: #ffffff;
  --atm-surface-2: #eef2f7;
  --atm-border: #d7dee8;
  --atm-text: #0b1f3a;
  --atm-text-muted: #5b6b82;
  --atm-link: #0e7c8a;
  --atm-on-accent: #0b1f3a;

  /* Status */
  --atm-ok: #1f8a4c;
  --atm-warn: #b7791f;
  --atm-danger: #c53030;
  --atm-info: #0e7c8a;

  /* Type */
  --atm-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --atm-font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --atm-text-sm: 0.875rem;
  --atm-text-md: 1rem;
  --atm-text-lg: 1.25rem;
  --atm-text-xl: 1.75rem;

  /* Space & shape */
  --atm-space-1: 4px;
  --atm-space-2: 8px;
  --atm-space-3: 12px;
  --atm-space-4: 16px;
  --atm-space-6: 24px;
  --atm-space-8: 32px;
  --atm-radius: 10px;
  --atm-radius-sm: 6px;
  --atm-shadow: 0 1px 2px rgb(11 31 58 / 0.06), 0 4px 16px rgb(11 31 58 / 0.06);
  --atm-max: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --atm-bg: #07142a;
    --atm-surface: #0e213f;
    --atm-surface-2: #13294b;
    --atm-border: #22406a;
    --atm-text: #e6edf7;
    --atm-text-muted: #9fb0c8;
    --atm-link: #5fd3e2;
    --atm-ok: #4cc38a;
    --atm-warn: #f0b84a;
    --atm-danger: #f27373;
    --atm-info: #5fd3e2;
    --atm-shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
  }
}

:root[data-theme="dark"] {
  --atm-bg: #07142a;
  --atm-surface: #0e213f;
  --atm-surface-2: #13294b;
  --atm-border: #22406a;
  --atm-text: #e6edf7;
  --atm-text-muted: #9fb0c8;
  --atm-link: #5fd3e2;
  --atm-ok: #4cc38a;
  --atm-warn: #f0b84a;
  --atm-danger: #f27373;
  --atm-info: #5fd3e2;
  --atm-shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
}

/* Atmosphere base styles and components. Needs tokens.css first (served together as /_atmosphere/atmosphere.css). */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--atm-bg);
  color: var(--atm-text);
  font: var(--atm-text-md)/1.55 var(--atm-font);
}
a { color: var(--atm-link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--atm-radar); outline-offset: 2px; }
code, pre, .atm-mono { font-family: var(--atm-font-mono); }
code, pre { font-size: 0.92em; }
pre { background: var(--atm-surface-2); padding: var(--atm-space-4); border-radius: var(--atm-radius-sm); overflow-x: auto; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--atm-space-3); }
h1 { font-size: var(--atm-text-xl); }
h2 { font-size: var(--atm-text-lg); margin-top: var(--atm-space-6); }
img, svg { max-width: 100%; }

/* Layout */
.atm-header { background: var(--atm-night); color: #fff; }
.atm-header__inner, .atm-main, .atm-footer__inner {
  max-width: var(--atm-max); margin: 0 auto; padding: 0 var(--atm-space-4);
}
.atm-header__inner { display: flex; align-items: center; gap: var(--atm-space-4); min-height: 56px; flex-wrap: wrap; }
.atm-brand { display: flex; align-items: center; gap: var(--atm-space-2); color: #fff; text-decoration: none; font-weight: 700; letter-spacing: 0.02em; }
.atm-brand svg { width: 28px; height: 28px; }
.atm-brand__app { color: var(--atm-amber); font-weight: 600; }
.atm-nav { display: flex; gap: var(--atm-space-1); flex-wrap: wrap; flex: 1; }
.atm-nav a { color: #cfe0f5; text-decoration: none; padding: 6px 10px; border-radius: var(--atm-radius-sm); font-size: var(--atm-text-sm); }
.atm-nav a:hover, .atm-nav a[aria-current="page"] { background: rgb(255 255 255 / 0.1); color: #fff; }
.atm-user { font-size: var(--atm-text-sm); color: #cfe0f5; display: flex; gap: var(--atm-space-3); align-items: center; }
.atm-user a { color: #fff; }
.atm-main { padding-top: var(--atm-space-8); padding-bottom: var(--atm-space-8); min-height: 70vh; }
.atm-footer { border-top: 1px solid var(--atm-border); color: var(--atm-text-muted); font-size: var(--atm-text-sm); }
.atm-footer__inner { padding-top: var(--atm-space-4); padding-bottom: var(--atm-space-6); display: flex; gap: var(--atm-space-4); flex-wrap: wrap; justify-content: space-between; }
.atm-grid { display: grid; gap: var(--atm-space-4); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.atm-stack > * + * { margin-top: var(--atm-space-4); }
.atm-row { display: flex; gap: var(--atm-space-3); align-items: center; flex-wrap: wrap; }
.atm-spacer { flex: 1; }
.atm-muted { color: var(--atm-text-muted); }

/* Components */
.atm-card {
  background: var(--atm-surface); border: 1px solid var(--atm-border); border-radius: var(--atm-radius);
  padding: var(--atm-space-6); box-shadow: var(--atm-shadow);
}
.atm-card > h2:first-child, .atm-card > h3:first-child { margin-top: 0; }
.atm-stat { font-size: var(--atm-text-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.atm-stat__label { color: var(--atm-text-muted); font-size: var(--atm-text-sm); }

.atm-btn {
  display: inline-flex; align-items: center; gap: var(--atm-space-2); cursor: pointer;
  font: 600 var(--atm-text-sm)/1 var(--atm-font); padding: 10px 16px; border-radius: var(--atm-radius-sm);
  border: 1px solid var(--atm-border); background: var(--atm-surface); color: var(--atm-text); text-decoration: none;
}
.atm-btn:hover { background: var(--atm-surface-2); }
.atm-btn--primary { background: var(--atm-amber); border-color: var(--atm-amber); color: var(--atm-on-accent); }
.atm-btn--primary:hover { filter: brightness(1.05); background: var(--atm-amber); }
.atm-btn--danger { color: var(--atm-danger); border-color: currentColor; }
.atm-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.atm-table-wrap { overflow-x: auto; border: 1px solid var(--atm-border); border-radius: var(--atm-radius); background: var(--atm-surface); }
.atm-table { width: 100%; border-collapse: collapse; font-size: var(--atm-text-sm); }
.atm-table th, .atm-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--atm-border); vertical-align: top; }
.atm-table th { color: var(--atm-text-muted); font-weight: 600; background: var(--atm-surface-2); white-space: nowrap; }
.atm-table tr:last-child td { border-bottom: 0; }
.atm-num, .atm-table .atm-num { text-align: right; font-variant-numeric: tabular-nums; }

.atm-form { display: grid; gap: var(--atm-space-4); max-width: 560px; }
.atm-field { display: grid; gap: var(--atm-space-1); }
.atm-field label { font-weight: 600; font-size: var(--atm-text-sm); }
.atm-field small { color: var(--atm-text-muted); }
.atm-input, .atm-form :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea) {
  font: inherit; color: var(--atm-text); background: var(--atm-surface); border: 1px solid var(--atm-border);
  border-radius: var(--atm-radius-sm); padding: 9px 12px; width: 100%;
}
.atm-form :where(textarea) { min-height: 120px; }

.atm-alert { padding: var(--atm-space-3) var(--atm-space-4); border-radius: var(--atm-radius-sm); border: 1px solid; margin-bottom: var(--atm-space-4); }
.atm-alert--ok { color: var(--atm-ok); background: color-mix(in srgb, var(--atm-ok) 10%, transparent); }
.atm-alert--warn { color: var(--atm-warn); background: color-mix(in srgb, var(--atm-warn) 10%, transparent); }
.atm-alert--danger { color: var(--atm-danger); background: color-mix(in srgb, var(--atm-danger) 10%, transparent); }
.atm-alert--info { color: var(--atm-info); background: color-mix(in srgb, var(--atm-info) 10%, transparent); }

.atm-badge {
  display: inline-block; font: 600 0.75rem/1 var(--atm-font-mono); padding: 4px 8px; border-radius: 999px;
  background: var(--atm-surface-2); color: var(--atm-text); border: 1px solid var(--atm-border); white-space: nowrap;
}
.atm-badge--amber { background: var(--atm-amber); color: var(--atm-on-accent); border-color: var(--atm-amber); }
.atm-badge--ok { color: var(--atm-ok); border-color: currentColor; background: transparent; }
.atm-badge--danger { color: var(--atm-danger); border-color: currentColor; background: transparent; }

/* Live dot: something is online right now */
.atm-live { display: inline-block; margin-right: 6px; vertical-align: 1px; width: 8px; height: 8px; border-radius: 50%; background: var(--atm-ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--atm-ok) 25%, transparent); }

.atm-empty { text-align: center; color: var(--atm-text-muted); padding: var(--atm-space-8); }

/* Page widths: a centred column for sign-in, short forms and messages */
.atm-narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.atm-medium { max-width: 560px; margin-left: auto; margin-right: auto; }
.atm-readable { max-width: 720px; }

/* A whole card that is a link (event, tour, section tile) */
.atm-link-card { display: block; color: inherit; text-decoration: none; }
.atm-link-card:hover { border-color: var(--atm-radar); }
.atm-link-card:hover h2, .atm-link-card:hover h3 { text-decoration: underline; text-underline-offset: 2px; }

/* Section header: a title with actions on the right */
.atm-section-head { display: flex; gap: var(--atm-space-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--atm-space-4); }
.atm-section-head > h1, .atm-section-head > h2 { margin: 0; flex: 1; }

/* Forms: wide variant, inline row of fields, fieldsets without the browser frame, field sizes */
.atm-form--wide { max-width: none; }
.atm-form--inline { display: flex; gap: var(--atm-space-3); align-items: end; flex-wrap: wrap; max-width: none; }
.atm-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.atm-fieldset > legend { font-weight: 600; font-size: var(--atm-text-sm); padding: 0; margin-bottom: var(--atm-space-2); }
.atm-check { display: flex; gap: var(--atm-space-2); align-items: center; font-weight: 400; }
/* Field sizes: put on the input, or on the .atm-field to size the whole field */
.atm-w-xs { width: 90px; max-width: 100%; }
.atm-w-sm { width: 130px; max-width: 100%; }
.atm-w-md { width: 220px; max-width: 100%; }
.atm-w-lg { width: 320px; max-width: 100%; }
textarea.atm-textarea--short { min-height: 80px; }
textarea.atm-textarea--tall { min-height: 260px; }
textarea.atm-textarea--code { font-family: var(--atm-font-mono); font-size: var(--atm-text-sm); }

/* Spacing and text utilities, so pages never need style="" */
.atm-grow { flex: 1; min-width: 160px; }
.atm-grow--wide { min-width: 240px; }
.atm-mt { margin-top: var(--atm-space-4); }
.atm-mt-sm { margin-top: var(--atm-space-3); }
.atm-mb { margin-bottom: var(--atm-space-3); }
.atm-m0 { margin: 0; }
.atm-pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.atm-nowrap { white-space: nowrap; }
.atm-small { font-size: var(--atm-text-sm); }
.atm-hidden { display: none !important; }
.atm-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; }

/* Definition list: label / value pairs (profiles, airport details) */
.atm-dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--atm-space-2) var(--atm-space-4); margin: 0; }
.atm-dl dt { color: var(--atm-text-muted); font-size: var(--atm-text-sm); }
.atm-dl dd { margin: 0; }

/* Maps (Leaflet, drawn by /_atmosphere/map.js) */
.atm-map { height: 400px; border-radius: var(--atm-radius); border: 1px solid var(--atm-border); background: var(--atm-surface-2); }
.atm-map--short { height: 280px; }
.atm-map--tall { height: 520px; }
.leaflet-container { font: var(--atm-text-sm)/1.4 var(--atm-font); }
.leaflet-container a { color: var(--atm-link); }

@media (max-width: 640px) {
  .atm-main { padding-top: var(--atm-space-6); }
  .atm-card { padding: var(--atm-space-4); }
}
