/* Own adjustments on top of Pico.css. Keep this file small. */

/* --- Flight category colours (FAA convention) ----------------------------- */
:root {
  --cat-vfr: #2e7d32;     /* green */
  --cat-mvfr: #1565c0;    /* blue */
  --cat-ifr: #c62828;     /* red */
  --cat-lifr: #ad1457;    /* magenta */
  --cat-unknown: #6b7280; /* grey */
}

.badge {
  display: inline-block;
  min-width: 3.5rem;
  padding: 0.1rem 0.5rem;
  border-radius: 0.25rem;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.cat-vfr { background: var(--cat-vfr); }
.cat-mvfr { background: var(--cat-mvfr); }
.cat-ifr { background: var(--cat-ifr); }
.cat-lifr { background: var(--cat-lifr); }
.cat-unknown { background: var(--cat-unknown); }

/* --- METAR list ------------------------------------------------------------
   Line 1: time | badge | values and warnings
   Line 2:        raw METAR                                                   */
.metar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.metar-list li {
  display: grid;
  grid-template-columns: 3.5rem 4rem 1fr;
  gap: 0.1rem 0.5rem;
  align-items: baseline;
  padding: 0.3rem 0 0.3rem 0.4rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
  border-left: 3px solid transparent; /* same width as the warning border */
}

.metar-list li:last-child {
  border-bottom: none;
}

.metar-list time {
  font-variant-numeric: tabular-nums;
}

.raw {
  grid-column: 2 / -1; /* second line, below badge and values */
  padding: 0;
  background: none;
  color: var(--pico-muted-color);
  font-size: 0.8rem;
  overflow-wrap: anywhere; /* long METARs wrap instead of overflowing */
}

/* Values and warnings share the first line, wrapping if space is short */
.summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 1.2rem;
}

/* --- Values with trend marks ---------------------------------------------- */
.values {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.2rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.trend-mark {
  font-size: 0.75rem;
}

.trend-mark.better { color: var(--cat-vfr); }
.trend-mark.worse { color: var(--cat-ifr); }

/* --- Critical conditions -------------------------------------------------- */
:root {
  --warn: #e65100; /* orange */
}

/* Warnings follow the values on the first line */
.critical {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.critical:empty {
  display: none;
}

.warn {
  padding: 0 0.4rem;
  border-radius: 0.25rem;
  background: var(--warn);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Trend: only expected, so outlined instead of filled */
.warn.trend {
  background: none;
  color: var(--warn);
  border: 1px solid var(--warn);
}

/* Only the colour changes, so all rows stay aligned */
.metar-list li.has-critical {
  border-left-color: var(--warn);
}

/* Smartphone: values and raw METAR use the full width below time and badge */
@media (max-width: 576px) {
  .metar-list li {
    grid-template-columns: 3.5rem 1fr;
  }

  .metar-list .badge {
    justify-self: start;
  }

  .summary,
  .raw {
    grid-column: 1 / -1;
  }
}

/* --- Messages and footer -------------------------------------------------- */
#message.error,
article .error {
  color: var(--pico-del-color);
}

article .error {
  margin: 0;
}

/* Airport title: ICAO code and name on one line */
article header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.75rem;
}

article header h2 {
  margin: 0;
}

article header small {
  color: var(--pico-muted-color);
}

footer {
  color: var(--pico-muted-color);
  border-top: 1px solid var(--pico-muted-border-color);
  padding-top: 1rem;
}
