/* Runway Departure/Arrival Clash Board & Live Trajectory Overlap Warnings.
   Uses monochrome Geist tokens from /css/app.css with fallbacks so light and dark
   themes adapt automatically via color-mix(in srgb, ...).
   All animations use compositor-only properties (transform, opacity) and disable
   cleanly under prefers-reduced-motion: reduce and [data-reduced-motion="true"]. */

/* ---------- Board container & header ---------- */
.sky-clash-board {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
  color: var(--ink, #0a0a0a);
  font: 400 0.9rem/1.45 var(--sans, "Geist", system-ui, sans-serif);
}

.sky-clash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sky-clash-title {
  margin: 0;
  color: var(--ink, #0a0a0a);
  font: 600 1rem/1.3 var(--sans, "Geist", system-ui, sans-serif);
  letter-spacing: -0.015em;
}

.sky-clash-airport-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-2, #d4d4d8);
  background-color: var(--paper-2, #f4f4f5);
  color: var(--ink, #0a0a0a);
  font: 600 0.72rem/1.35 var(--mono, "Geist Mono", ui-monospace, Menlo, monospace);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.sky-clash-clear-btn {
  appearance: none;
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--line, #e5e7eb);
  background-color: var(--card, #fff);
  color: var(--mute, #6b7280);
  font: 500 0.78rem/1.3 var(--sans, "Geist", system-ui, sans-serif);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease,
    opacity 150ms ease,
    transform 120ms ease;
}

.sky-clash-clear-btn:not(:disabled):hover {
  background-color: var(--hover, #f4f4f5);
  border-color: var(--line-2, #d4d4d8);
  color: var(--ink, #0a0a0a);
  opacity: 1;
}

.sky-clash-clear-btn:not(:disabled):active {
  transform: scale(0.985);
  box-shadow: none;
}

.sky-clash-clear-btn:focus-visible {
  outline: 2px solid var(--ink, #0a0a0a);
  outline-offset: 2px;
}

.sky-clash-clear-btn:disabled {
  opacity: 0.42;
  cursor: default;
}

/* ---------- Controls: callsign/runway inputs & quick-log presets ---------- */
.sky-clash-controls {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.sky-clash-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.sky-clash-fields label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--mute, #6b7280);
  font: 500 0.76rem/1.3 var(--sans, "Geist", system-ui, sans-serif);
}

input.sky-clash-input,
.sky-clash-input {
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line, #e5e7eb);
  background-color: var(--card, #fff);
  color: var(--ink, #0a0a0a);
  font: 500 0.82rem/1.35 var(--mono, "Geist Mono", ui-monospace, Menlo, monospace);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease;
}

input.sky-clash-input::placeholder,
.sky-clash-input::placeholder {
  color: var(--mute, #6b7280);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

input.sky-clash-input:hover,
.sky-clash-input:hover {
  border-color: var(--line-2, #d4d4d8);
}

input.sky-clash-input:focus-visible,
.sky-clash-input:focus-visible {
  outline: 2px solid var(--ink, #0a0a0a);
  outline-offset: 1px;
  border-color: var(--ink, #0a0a0a);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink, #0a0a0a) 12%, transparent);
}

input.sky-clash-input:disabled,
.sky-clash-input:disabled {
  opacity: 0.5;
  background-color: var(--paper-2, #f4f4f5);
  cursor: default;
}

.sky-clash-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.sky-clash-preset-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line-2, #d4d4d8);
  background-color: var(--paper-2, #f4f4f5);
  color: var(--ink, #0a0a0a);
  font: 500 0.8rem/1.25 var(--sans, "Geist", system-ui, sans-serif);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-align: center;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    box-shadow 160ms ease,
    opacity 150ms ease,
    transform 120ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.sky-clash-preset-btn:not(:disabled):hover {
  background-color: var(--hover, #f4f4f5);
  border-color: var(--ink, #0a0a0a);
  color: var(--ink, #0a0a0a);
  opacity: 1;
  box-shadow: 0 2px 8px -4px color-mix(in srgb, var(--ink, #0a0a0a) 28%, transparent);
}

.sky-clash-preset-btn:not(:disabled):active {
  transform: scale(0.985);
  box-shadow: none;
}

.sky-clash-preset-btn:focus-visible {
  outline: 2px solid var(--ink, #0a0a0a);
  outline-offset: 2px;
}

.sky-clash-preset-btn:disabled {
  opacity: 0.42;
  cursor: default;
  box-shadow: none;
}

/* ---------- Scheduled operations queue ---------- */
@keyframes sky-clash-row-enter {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sky-clash-ops {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.sky-clash-ops:empty {
  display: none;
}

.sky-clash-op-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line, #e5e7eb);
  background: var(--paper-2, #f4f4f5);
  color: var(--ink, #0a0a0a);
  transform-origin: top center;
  animation: sky-clash-row-enter 200ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.sky-clash-kind-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-2, #d4d4d8);
  background-color: var(--card, #fff);
  color: var(--ink, #0a0a0a);
  font: 600 0.7rem/1.35 var(--mono, "Geist Mono", ui-monospace, Menlo, monospace);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sky-clash-kind-badge[data-kind="departure"],
.sky-clash-op-row[data-kind="departure"] .sky-clash-kind-badge {
  background-color: var(--accent, #0a0a0a);
  border-color: var(--accent, #0a0a0a);
  color: var(--on-accent, #fff);
}

.sky-clash-kind-badge[data-kind="arrival"],
.sky-clash-op-row[data-kind="arrival"] .sky-clash-kind-badge {
  background-color: var(--card, #fff);
  border-color: var(--line-2, #d4d4d8);
  color: var(--ink, #0a0a0a);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink, #0a0a0a) 8%, transparent);
}

.sky-clash-op-meta {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink, #0a0a0a);
  font: 500 0.84rem/1.35 var(--sans, "Geist", system-ui, sans-serif);
  font-variant-numeric: tabular-nums;
}

.sky-clash-countdown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line, #e5e7eb);
  background-color: var(--card, #fff);
  color: var(--ink, #0a0a0a);
  font-family: var(--mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}

.sky-clash-op-remove {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background-color: transparent;
  color: var(--mute, #6b7280);
  font: 500 0.76rem/1.2 var(--sans, "Geist", system-ui, sans-serif);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    opacity 140ms ease,
    transform 110ms ease;
}

.sky-clash-op-remove:not(:disabled):hover {
  background-color: var(--hover, #f4f4f5);
  border-color: var(--line, #e5e7eb);
  color: var(--ink, #0a0a0a);
  opacity: 1;
}

.sky-clash-op-remove:not(:disabled):active {
  transform: scale(0.96);
}

.sky-clash-op-remove:focus-visible {
  outline: 2px solid var(--ink, #0a0a0a);
  outline-offset: 2px;
}

.sky-clash-empty {
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px dashed var(--line, #e5e7eb);
  background-color: color-mix(in srgb, var(--paper-2, #f4f4f5) 65%, transparent);
  color: var(--mute, #6b7280);
  font: 400 0.82rem/1.4 var(--sans, "Geist", system-ui, sans-serif);
  text-align: center;
}

/* ---------- Advisory Corridor Overlap Banner ---------- */
@keyframes sky-clash-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.32);
    opacity: 0.48;
  }
}

@keyframes sky-clash-alert-enter {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sky-clash-banner,
.sky-clash-banner[data-clash-state="clear"] {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed var(--line-2, #d4d4d8);
  background: var(--paper-2, #f4f4f5);
  color: var(--ink, #0a0a0a);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.sky-clash-banner[data-clash-state="amber"] {
  border: 1px solid color-mix(in srgb, var(--warn, #ca8a04) 42%, var(--line, #e5e7eb));
  border-left: 3px solid var(--warn, #ca8a04);
  background: color-mix(in srgb, var(--warn, #ca8a04) 11%, var(--card, #fff));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn, #ca8a04) 10%, transparent);
}

.sky-clash-banner[data-clash-state="red"] {
  border: 1px solid color-mix(in srgb, var(--stop, #dc2626) 48%, var(--line, #e5e7eb));
  border-left: 3px solid var(--stop, #dc2626);
  background: color-mix(in srgb, var(--stop, #dc2626) 13%, var(--card, #fff));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stop, #dc2626) 14%, transparent);
}

.sky-clash-banner-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sky-clash-pulse-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--mute, #6b7280);
  opacity: 0.72;
  transform-origin: center;
}

.sky-clash-banner[data-clash-state="amber"] .sky-clash-pulse-dot {
  background-color: var(--warn, #ca8a04);
  opacity: 1;
  animation: sky-clash-pulse 1.5s ease-in-out infinite;
}

.sky-clash-banner[data-clash-state="red"] .sky-clash-pulse-dot {
  background-color: var(--stop, #dc2626);
  opacity: 1;
  animation: sky-clash-pulse 1s ease-in-out infinite;
}

.sky-clash-banner-title {
  margin: 0;
  min-width: 0;
  color: var(--ink, #0a0a0a);
  font: 600 0.88rem/1.35 var(--sans, "Geist", system-ui, sans-serif);
  letter-spacing: -0.01em;
}

.sky-clash-disclaimer {
  margin: 0;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--ink, #0a0a0a) 12%, var(--line, #e5e7eb));
  background-color: color-mix(in srgb, var(--paper, #fafafa) 72%, transparent);
  color: var(--mute, #6b7280);
  font: 500 0.76rem/1.4 var(--mono, "Geist Mono", ui-monospace, Menlo, monospace);
  letter-spacing: 0.01em;
}

.sky-clash-banner[data-clash-state="amber"] .sky-clash-disclaimer,
.sky-clash-banner[data-clash-state="red"] .sky-clash-disclaimer {
  color: color-mix(in srgb, var(--ink, #0a0a0a) 82%, var(--mute, #6b7280));
}

.sky-clash-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.sky-clash-list:empty {
  display: none;
}

.sky-clash-alert-row {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line, #e5e7eb);
  border-left: 3px solid var(--line-2, #d4d4d8);
  background-color: var(--card, #fff);
  color: var(--ink, #0a0a0a);
  transform-origin: top center;
  animation: sky-clash-alert-enter 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.sky-clash-alert-row[data-severity="amber"] {
  border-color: color-mix(in srgb, var(--warn, #ca8a04) 36%, var(--line, #e5e7eb));
  border-left: 3px solid var(--warn, #ca8a04);
  background-color: color-mix(in srgb, var(--warn, #ca8a04) 8%, var(--card, #fff));
  animation: sky-clash-alert-enter 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.sky-clash-alert-row[data-severity="red"] {
  border-color: color-mix(in srgb, var(--stop, #dc2626) 44%, var(--line, #e5e7eb));
  border-left: 3px solid var(--stop, #dc2626);
  background-color: color-mix(in srgb, var(--stop, #dc2626) 11%, var(--card, #fff));
  animation: sky-clash-alert-enter 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.sky-clash-alert-main {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink, #0a0a0a);
  font: 600 0.84rem/1.35 var(--sans, "Geist", system-ui, sans-serif);
}

.sky-clash-alert-meta {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--mute, #6b7280);
  font: 500 0.76rem/1.35 var(--mono, "Geist Mono", ui-monospace, Menlo, monospace);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.sky-clash-alert-row[data-severity="amber"] .sky-clash-alert-meta,
.sky-clash-alert-row[data-severity="red"] .sky-clash-alert-meta {
  color: color-mix(in srgb, var(--ink, #0a0a0a) 74%, var(--mute, #6b7280));
}

/* ---------- Responsive stacking ---------- */
@media (max-width: 640px) {
  .sky-clash-fields,
  .sky-clash-presets {
    grid-template-columns: 1fr;
  }

  .sky-clash-op-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px 8px;
  }

  .sky-clash-kind-badge {
    justify-self: start;
  }

  .sky-clash-op-meta {
    grid-column: 1 / -1;
    order: 2;
  }
}

/* ---------- Reduced-motion accessibility & [data-reduced-motion="true"] parity ---------- */
[data-reduced-motion="true"] .sky-clash-board,
[data-reduced-motion="true"] .sky-clash-board *,
[data-reduced-motion="true"] .sky-clash-board *::before,
[data-reduced-motion="true"] .sky-clash-board *::after,
.sky-clash-board[data-reduced-motion="true"],
.sky-clash-board[data-reduced-motion="true"] *,
.sky-clash-board[data-reduced-motion="true"] *::before,
.sky-clash-board[data-reduced-motion="true"] *::after {
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .sky-clash-board,
  .sky-clash-board *,
  .sky-clash-board *::before,
  .sky-clash-board *::after,
  .sky-clash-clear-btn,
  .sky-clash-clear-btn:not(:disabled):active,
  input.sky-clash-input,
  .sky-clash-input,
  .sky-clash-preset-btn,
  .sky-clash-preset-btn:not(:disabled):active,
  .sky-clash-op-row,
  .sky-clash-op-remove,
  .sky-clash-op-remove:not(:disabled):active,
  .sky-clash-banner,
  .sky-clash-banner[data-clash-state="clear"],
  .sky-clash-pulse-dot,
  .sky-clash-banner[data-clash-state="amber"] .sky-clash-pulse-dot,
  .sky-clash-banner[data-clash-state="red"] .sky-clash-pulse-dot,
  .sky-clash-alert-row,
  .sky-clash-alert-row[data-severity="amber"],
  .sky-clash-alert-row[data-severity="red"] {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}
