/* Let the map use the first screen while the article below remains scrollable. */
body:has(.flight-atlas) header {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  padding: 0;
  pointer-events: none;
}

body:has(.flight-atlas) header nav {
  pointer-events: auto;
}

body:has(.flight-atlas) header > h1 {
  position: absolute;
  top: 4.5rem;
  left: clamp(1rem, 3vw, 3rem);
  width: auto;
  margin: 0;
  color: #f5f3ef;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.2;
  text-align: left;
  text-shadow: 0 1px 10px #10151d;
}

main:has(.flight-atlas) {
  max-width: none;
  margin: 0;
  border: 0;
}

article:has(.flight-atlas) {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.flight-intro {
  position: absolute;
  z-index: 3;
  top: 7.2rem;
  left: clamp(1rem, 3vw, 3rem);
  max-width: min(34rem, 68vw);
  margin: 0;
  color: #e0e3e8;
  font-size: clamp(0.9rem, 1.15vw, 1.1rem);
  line-height: 1.4;
  text-align: left;
  text-shadow: 0 1px 8px #10151d;
}

.flight-atlas {
  position: relative;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 36rem;
  margin: 0 0 3rem;
  overflow: hidden;
  color: #f5f3ef;
  background: #10151d;
}

.flight-map-shell {
  position: absolute;
  inset: 0;
  min-height: 0;
}

#flight-map {
  position: absolute;
  inset: 0;
  background: #10151d;
}

.flight-map-controls {
  position: absolute;
  z-index: 2;
  top: 10.5rem;
  left: clamp(1rem, 3vw, 3rem);
  display: grid;
  grid-template-columns: minmax(10rem, 16rem) auto;
  gap: 0.45rem 0.6rem;
  align-items: center;
  max-width: min(22rem, calc(100% - 2rem));
  padding: 0.8rem;
  background: rgba(16, 21, 29, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.45rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.24);
  font-size: 0.8rem;
}

.flight-search-label,
.flight-filter-label,
.flight-view-label {
  grid-column: 1 / -1;
  margin: 0;
  color: #c6cbd2;
}

.flight-map-controls input,
.flight-map-controls select,
.flight-map-controls button {
  box-sizing: border-box;
  min-width: 0;
  margin: 0;
  padding: 0.55rem 0.65rem;
  color: #f5f3ef;
  background: #222a35;
  border: 1px solid #47515f;
  border-radius: 0.25rem;
  font: inherit;
}

.flight-map-controls button {
  grid-column: 1 / -1;
  cursor: pointer;
}

.flight-map-controls button:hover,
.flight-map-controls input:focus,
.flight-map-controls select:focus {
  border-color: #f7c66a;
  outline: 2px solid rgba(247, 198, 106, 0.35);
}

.flight-map-credit {
  position: absolute;
  right: 0.5rem;
  bottom: 0.35rem;
  z-index: 2;
  padding: 0.15rem 0.35rem;
  color: #e4e6e9;
  background: rgba(16, 21, 29, 0.78);
  font: 0.65rem/1.4 sans-serif;
}

.flight-detail {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: clamp(1rem, 3vw, 3rem);
  width: min(22rem, 30vw);
  max-height: calc(100% - 3rem);
  padding: 1.25rem;
  overflow: auto;
  color: #f5f3ef;
  background: rgba(16, 21, 29, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.55rem;
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.24);
  transform: translateY(-50%);
  backdrop-filter: blur(8px);
}

.flight-detail h2 {
  margin: 0 0 0.35rem;
  color: #fff;
  font-size: 1.45rem;
  line-height: 1.2;
}

.flight-detail p {
  color: #c6cbd2;
  font-size: 0.88rem;
}

.flight-kicker {
  margin: 0 0 0.5rem;
  color: #f7c66a !important;
  font-size: 0.7rem !important;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.flight-destinations {
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.flight-destinations li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.82rem;
}

.flight-destinations strong {
  color: #fff;
  font-weight: 600;
}

.flight-destinations span {
  flex: none;
  color: #abb3bd;
  font-variant-numeric: tabular-nums;
}

.flight-city-airports {
  margin: 1rem 0;
  padding: 0.75rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.flight-city-airports h3 {
  margin: 0 0 0.45rem;
  color: #c6cbd2;
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.flight-city-airports ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.2rem 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flight-city-airports li {
  color: #f5f3ef;
  font-size: 0.73rem;
  line-height: 1.35;
}

.flight-city-airports li strong {
  color: #f7c66a;
}

.flight-country-key {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.75rem 0;
  color: #d8dce2 !important;
  font-size: 0.72rem !important;
}

.flight-country-key[hidden] {
  display: none;
}

.flight-country-key span {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  background: #f2b84b;
  border: 1px solid #ffe09a;
  border-radius: 0.15rem;
}

.flight-map-controls select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.flight-data-note {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.73rem !important;
  line-height: 1.45;
}

.flight-atlas .maplibregl-ctrl-group {
  background: #222a35;
}

.flight-atlas .maplibregl-ctrl-group button {
  background-color: #222a35;
}

.flight-atlas .maplibregl-ctrl-group button span {
  filter: invert(1);
}

/* The explainer follows below the map as an ordinary, readable article. */
.flight-atlas ~ p,
.flight-atlas ~ h2,
.flight-atlas ~ .flight-network-stats {
  width: min(100% - 2rem, 42rem);
  margin-right: auto;
  margin-left: auto;
}

.flight-atlas ~ p {
  font-size: 1rem;
  line-height: 1.7;
}

.flight-atlas ~ h2 {
  margin-top: 2.5rem;
  font-size: 1.7rem;
}

.flight-atlas ~ .flight-network-stats {
  margin-top: 3rem;
  padding: 1.5rem;
  color: #f5f3ef;
  background: #151b24;
  border: 1px solid #303945;
  border-radius: 0.75rem;
}

.flight-network-stats .flight-stats-kicker {
  margin: 0 0 0.35rem;
  color: #f7c66a;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.flight-network-stats h2 {
  margin: 0 0 1.25rem;
  font-size: 1.65rem;
}

.flight-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.flight-stat-card {
  min-width: 0;
  padding: 1rem;
  background: #1c2430;
  border: 1px solid #303945;
  border-radius: 0.5rem;
}

.flight-stat-card p {
  margin: 0;
  color: #c6cbd2;
  font-size: 0.8rem;
  line-height: 1.5;
}

.flight-stat-card .flight-stat-label {
  margin-bottom: 0.6rem;
  color: #f7c66a;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flight-stat-card h3 {
  margin: 0 0 0.55rem;
  color: #fff;
  font-size: 1.08rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  body:has(.flight-atlas) header > h1 {
    top: 4.25rem;
    font-size: 1.35rem;
  }

  .flight-intro {
    top: 6.3rem;
    max-width: calc(100% - 2rem);
    font-size: 0.85rem;
  }

  .flight-atlas {
    min-height: 42rem;
    margin-bottom: 2rem;
  }

  .flight-map-controls {
    top: 8.8rem;
    left: 0.75rem;
    grid-template-columns: minmax(8rem, 1fr) auto;
    max-width: min(18rem, calc(100% - 1.5rem));
    padding: 0.65rem;
  }

  .flight-detail {
    top: auto;
    right: 0.75rem;
    bottom: 2.25rem;
    left: 0.75rem;
    width: auto;
    max-height: 32%;
    padding: 0.8rem 1rem;
    transform: none;
  }

  .flight-detail h2 {
    font-size: 1.15rem;
  }

  .flight-destinations {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 0.75rem;
  }

  .flight-city-airports ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flight-destinations li {
    padding: 0.35rem 0;
    font-size: 0.74rem;
  }

  .flight-atlas ~ .flight-network-stats {
    padding: 1rem;
  }

  .flight-stats-grid {
    grid-template-columns: 1fr;
  }

  .flight-detail > p {
    margin: 0.35rem 0;
  }
}
