:root {
  --bg: #f2ede2;
  --panel: rgba(15, 29, 48, 0.92);
  --panel-soft: rgba(255, 255, 255, 0.08);
  --text: #f8f4ea;
  --text-muted: rgba(248, 244, 234, 0.72);
  --accent: #ff8a3d;
  --accent-soft: rgba(255, 138, 61, 0.18);
  --highlight: #6dd3ce;
  --shadow: 0 24px 60px rgba(11, 18, 29, 0.22);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 196, 132, 0.55), transparent 28%),
    linear-gradient(135deg, #f8f1e4 0%, #ddedf0 100%);
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
}

body {
  min-height: 100vh;
  overflow: hidden;
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(320px, 430px) 1fr;
  gap: 20px;
  height: 100vh;
  padding: 20px;
}

.sidebar,
.map-shell {
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(18, 32, 52, 0.98), rgba(9, 20, 35, 0.98)),
    #0f1d30;
}

.hero-panel,
.story-panel {
  padding: 24px;
}

.hero-panel {
  position: relative;
  background:
    radial-gradient(circle at top right, rgba(255, 138, 61, 0.25), transparent 35%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
}

.hero-panel h1,
.map-overlay h2,
.active-flight-card h3 {
  margin: 0;
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: -0.03em;
}

.hero-panel h1 {
  font-size: clamp(2.7rem, 5vw, 4.3rem);
  max-width: 10ch;
}

.hero-copy {
  margin: 18px 0 0;
  max-width: 34ch;
  color: var(--text-muted);
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 12px;
  color: #ffd7a8;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.story-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.story-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.story-panel__header .eyebrow {
  margin: 0;
}

.ghost-button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.ghost-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.16);
}

.active-flight-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.active-flight-card h3 {
  font-size: clamp(2rem, 3.5vw, 3rem);
}

.active-flight-meta,
.active-flight-notes {
  color: var(--text-muted);
}

.active-flight-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 14px 0 12px;
  font-size: 0.92rem;
}

.active-flight-route {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #ffe3cf;
  font-weight: 500;
}

.active-flight-notes {
  margin: 0;
  line-height: 1.6;
}

.active-flight-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin-top: 18px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff7ef;
  font-weight: 700;
  text-decoration: none;
  transition: transform 180ms ease, filter 180ms ease;
}

.active-flight-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.map-shell {
  position: relative;
  min-height: calc(100vh - 40px);
  background: #dceaf1;
}

.map {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 40px);
}

.map-overlay {
  position: absolute;
  top: 22px;
  left: 22px;
  right: 22px;
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.map-overlay__text {
  max-width: 24rem;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: rgba(15, 29, 48, 0.68);
  backdrop-filter: blur(14px);
}

.map-overlay__text .eyebrow {
  margin-bottom: 8px;
}

.map-overlay h2 {
  font-size: clamp(2.2rem, 4vw, 3.4rem);
}

.city-marker {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 18px rgba(16, 24, 32, 0.22);
}

.city-marker--destination {
  background: var(--accent);
}

.popup-card h3 {
  margin: 0 0 6px;
  font-family: "Instrument Serif", serif;
  font-size: 1.35rem;
  font-weight: 400;
  color: #162437;
}

.popup-card p {
  margin: 0 0 4px;
  color: #405267;
  line-height: 1.45;
}

.popup-card a {
  color: #d96f28;
  font-weight: 700;
  text-decoration: none;
}

.leaflet-popup-content-wrapper {
  border-radius: 16px;
  box-shadow: 0 18px 36px rgba(14, 24, 38, 0.18);
}

.leaflet-popup-content {
  margin: 14px 16px;
}

.leaflet-control-zoom {
  border: 0;
  box-shadow: 0 18px 34px rgba(14, 24, 38, 0.18);
}

.leaflet-control-zoom a {
  color: #162437;
}

@media (max-width: 1080px) {
  body {
    overflow: auto;
  }

  .page-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    min-height: auto;
  }

  .map-shell,
  .map {
    min-height: 60vh;
  }

  .map-overlay {
    position: static;
    flex-direction: column;
    padding: 20px;
  }
}

@media (max-width: 760px) {
  body {
    overflow: hidden;
  }

  .page-shell {
    position: relative;
    display: block;
    height: 100svh;
    min-height: 100svh;
    padding: 0;
  }

  .map-shell {
    position: absolute;
    inset: 0;
    z-index: 1;
    min-height: 100svh;
    border-radius: 0;
    box-shadow: none;
  }

  .sidebar {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    grid-template-rows: auto 1fr auto;
    align-items: stretch;
    height: 100svh;
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(7, 17, 29, 0) 0%, rgba(7, 17, 29, 0.14) 48%, rgba(7, 17, 29, 0.3) 100%);
    pointer-events: none;
    box-shadow: none;
    border-radius: 0;
  }

  .hero-panel {
    position: relative;
    z-index: 3;
    width: min(19rem, 100%);
    padding: 16px 18px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(12, 24, 38, 0.72);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 34px rgba(10, 18, 28, 0.22);
    pointer-events: auto;
  }

  .story-panel {
    position: absolute;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 12px;
    left: 12px;
    right: 12px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    min-width: 0;
    max-height: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    pointer-events: auto;
  }

  .hero-panel h1 {
    max-width: 11ch;
    font-size: clamp(1.9rem, 8.5vw, 2.6rem);
  }

  .hero-copy {
    display: none;
  }

  .story-panel__header {
    display: block;
    margin-bottom: 0;
  }

  .story-panel__header .eyebrow {
    display: none;
  }

  .ghost-button {
    display: none;
  }

  .active-flight-card {
    justify-content: flex-start;
    padding: 14px 14px 16px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(12, 24, 38, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 18px 34px rgba(10, 18, 28, 0.22);
  }

  .active-flight-card > :first-child {
    margin-top: 0;
  }

  .active-flight-card .eyebrow {
    margin-bottom: 8px;
  }

  .active-flight-card h3 {
    font-size: clamp(1.6rem, 7vw, 2.1rem);
    line-height: 0.98;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .active-flight-meta {
    min-width: 0;
    gap: 8px 12px;
    margin: 8px 0 0;
    font-size: 0.8rem;
  }

  .active-flight-route {
    display: flex;
    max-width: 100%;
    min-width: 0;
    margin: 8px 0 0;
    padding: 7px 10px;
    font-size: 0.82rem;
    white-space: normal;
  }

  .active-flight-notes {
    display: none;
  }

  .active-flight-link {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: 10px;
    padding: 10px 14px;
  }

  .leaflet-control-zoom {
    margin: 0 10px 10px 0;
  }

  .map,
  .map-shell {
    min-height: 100svh;
  }

  .map-overlay {
    display: none;
  }

  .leaflet-top.leaflet-left,
  .leaflet-top.leaflet-right {
    top: calc(12px + env(safe-area-inset-top));
  }

  .leaflet-bottom.leaflet-right {
    bottom: calc(180px + env(safe-area-inset-bottom));
  }

  .leaflet-control-zoom {
    border-radius: 18px;
    overflow: hidden;
  }
}

@media (max-width: 480px) {
  .eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.16em;
  }

  .sidebar {
    padding-left: 10px;
    padding-right: 10px;
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  .hero-panel {
    padding: 14px 16px;
    border-radius: 20px;
  }

  .hero-panel h1 {
    font-size: clamp(1.75rem, 9vw, 2.25rem);
  }

  .hero-copy,
  .active-flight-notes {
    font-size: 0.88rem;
  }

  .story-panel {
    left: 10px;
    right: 10px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    max-height: none;
    padding: 0;
    border-radius: 24px;
  }

  .story-panel__header {
    margin-bottom: 8px;
  }

  .active-flight-card {
    padding: 12px 12px 14px;
  }

  .active-flight-card h3 {
    font-size: clamp(1.5rem, 8vw, 1.85rem);
  }

  .leaflet-bottom.leaflet-right {
    bottom: calc(155px + env(safe-area-inset-bottom));
  }

}
