/* PilotCB Brand V1 — approved visual-master palette and shared theme contract */
:root {
  --pilotcb-navy: #00091b;
  --pilotcb-blue: #014cd2;
  --pilotcb-flight-blue: #0161ee;
  --pilotcb-silver: #c1c7d2;
  --pilotcb-soft-silver: #a1aabc;
  --pilotcb-white: #f2f3f5;
  --pilotcb-ink: #01102a;

  /* Operational colors remain independent from brand decoration. */
  --operational-critical: #ff5f71;
  --operational-caution: #f8b83c;
  --operational-success: #3bd889;
  --operational-information: #45aef5;
  --flight-vfr: #3bd889;
  --flight-mvfr: #45aef5;
  --flight-ifr: #ff5f71;
  --flight-lifr: #b668ff;
  --data-live: #3bd889;
  --data-stale: #f8b83c;
  --data-estimated: #d7a33d;
  --data-unavailable: #9eb5ca;
  --route-observed: #45aef5;
  --route-reference: #a1aabc;
  --route-estimated: #f8b83c;
  --runway-open: #3bd889;
  --runway-caution: #f8b83c;
  --runway-closed: #ff5f71;
  --flow-normal: #3bd889;
  --flow-constrained: #f8b83c;
  --gate-confirmed: #3bd889;
  --gate-estimated: #f8b83c;
}

:root,
[data-theme="day"] {
  color-scheme: light;
  --theme-canvas: #dbe3eb;
  --theme-shell: #05276c;
  --theme-surface-primary: #f2f3f5;
  --theme-surface-secondary: #e5e9ef;
  --theme-surface-elevated: #ffffff;
  --theme-surface-inset: #cbd3de;
  --theme-border-subtle: #c1c7d2;
  --theme-border-strong: #798aa6;
  --theme-text-primary: #01102a;
  --theme-text-secondary: #3b4c6a;
  --theme-text-muted: #4f668b;
  --theme-brand-primary: #014cd2;
  --theme-brand-deep: #05276c;
  --theme-interactive: #014cd2;
  --theme-focus: #0161ee;
  --theme-route: #0161ee;
  --theme-effect-shadow: 0 20px 55px rgba(1, 16, 42, 0.16);
}

[data-theme="night"] {
  color-scheme: dark;
  --theme-canvas: #04111d;
  --theme-shell: #030f1a;
  --theme-surface-primary: #071b2d;
  --theme-surface-secondary: #0a2237;
  --theme-surface-elevated: #0d2941;
  --theme-surface-inset: #051726;
  --theme-border-subtle: rgba(104, 168, 216, 0.16);
  --theme-border-strong: rgba(104, 168, 216, 0.27);
  --theme-text-primary: #edf6ff;
  --theme-text-secondary: #9eb5ca;
  --theme-text-muted: #66839d;
  --theme-brand-primary: #45aef5;
  --theme-brand-deep: #1787e8;
  --theme-interactive: #1787e8;
  --theme-focus: #8bd2ff;
  --theme-route: #45aef5;
  --theme-effect-shadow: 0 16px 44px rgba(0, 5, 12, 0.26);
}

.pilotcb-logo {
  display: block;
  max-width: 100%;
  height: auto;
}

.pilotcb-appearance-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 70px;
  min-height: 44px;
  padding: 0 0.65rem;
  border: 1px solid var(--theme-border-strong);
  border-radius: 7px;
  color: var(--theme-text-primary);
  background: color-mix(in srgb, var(--theme-surface-elevated) 88%, transparent);
  cursor: pointer;
  font: 700 0.65rem/1 Inter, "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  touch-action: manipulation;
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.pilotcb-appearance-toggle:hover {
  border-color: var(--theme-focus);
  background: color-mix(in srgb, var(--theme-surface-elevated) 76%, var(--theme-interactive) 24%);
}

.pilotcb-appearance-toggle:focus-visible {
  outline: 3px solid var(--theme-focus);
  outline-offset: 3px;
}

.pilotcb-appearance-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pilotcb-appearance-icon--night,
[data-theme="night"] .pilotcb-appearance-icon--day { display: none; }

[data-theme="night"] .pilotcb-appearance-icon--night { display: block; }

.public-header .pilotcb-appearance-toggle,
.site-header .pilotcb-appearance-toggle,
.product-bar .pilotcb-appearance-toggle {
  color: var(--pilotcb-white);
  border-color: rgba(193, 199, 210, 0.34);
  background: rgba(4, 21, 37, 0.72);
}

.public-header .pilotcb-appearance-toggle:hover,
.site-header .pilotcb-appearance-toggle:hover,
.product-bar .pilotcb-appearance-toggle:hover {
  border-color: rgba(139, 210, 255, 0.82);
  background: rgba(15, 55, 87, 0.9);
}

@media (max-width: 820px) {
  .pilotcb-appearance-toggle {
    min-width: 44px;
    width: 44px;
    padding: 0;
  }

  .pilotcb-appearance-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pilotcb-appearance-toggle { transition-duration: 0.01ms; }
}
