:root {
  --bg: #0b1220;
  --surface: #141d31;
  --surface-high: #1d2842;
  --border: #26324f;
  --text: #e7eefb;
  --muted: #90a3c4;
  --accent: #f5a524;

  --vfr: #2ea043;
  --mvfr: #3b82f6;
  --ifr: #e5484d;
  --lifr: #c026d3;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  /* Respects the notch and the home indicator on iPhone. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem 0.5rem;
}

h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#view-list h1::before {
  content: "";
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
}

.actions {
  display: flex;
  gap: 0.5rem;
}

main {
  padding: 0 1.25rem;
}

button {
  font-family: inherit;
}

.icon {
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.icon:active {
  background: var(--surface-high);
}

.icon.danger {
  width: 36px;
  height: 36px;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
}

.icon.danger:active {
  color: var(--ifr);
  border-color: var(--ifr);
}

.primary {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.9rem;
  font-size: 1rem;
  font-weight: 700;
  color: #08101f;
  background: var(--accent);
  border: none;
  border-radius: 12px;
}

.primary:disabled {
  color: var(--muted);
  background: var(--surface-high);
}

.link {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--accent);
  background: none;
  border: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.card.error {
  border-color: var(--ifr);
}

.card.empty {
  text-align: center;
}

.card.empty p {
  margin: 0.25rem 0;
  color: var(--muted);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.icao {
  display: block;
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.name {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 0.9rem;
}

.category {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #08101f;
}

.category.VFR { background: var(--vfr); }
.category.MVFR { background: var(--mvfr); }
.category.IFR { background: var(--ifr); }
.category.LIFR { background: var(--lifr); }

/* The raw METAR: every group is tappable and reveals its interpretation. */
.raw {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 1.05rem;
  line-height: 1.9;
  margin-bottom: 0.75rem;
}

.group {
  font: inherit;
  color: var(--text);
  background: var(--surface-high);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.15rem 0.45rem;
}

.group[aria-expanded="true"] {
  background: var(--accent);
  color: #08101f;
  font-weight: 700;
}

.group.unknown {
  border-color: var(--ifr);
  border-style: dashed;
}

.interpretation {
  min-height: 3.2rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.95rem;
}

.interpretation code {
  font-family: var(--mono);
  color: var(--accent);
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
  margin: 1rem 0 0;
}

.stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
}

.stat dt {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat dd {
  margin: 0.2rem 0 0;
  font-family: var(--mono);
  font-size: 1.05rem;
}

/* Airport selector */

.search-input {
  width: 100%;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  font: inherit;
  font-family: var(--mono);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  -webkit-appearance: none;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.5rem;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.result:active {
  background: var(--surface-high);
  border-color: var(--accent);
}

.result-codes {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
}

.result-name {
  color: var(--muted);
  font-size: 0.85rem;
}

.notice {
  margin: 1rem 1.25rem 0;
  padding: 0.9rem 1rem;
  background: var(--surface-high);
  border: 1px solid var(--accent);
  border-radius: 12px;
  font-size: 0.9rem;
}

.notice p {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

footer {
  padding: 0.5rem 1.25rem 2rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.disclaimer strong {
  color: var(--text);
}

.source {
  font-size: 0.75rem;
}
