/* --- Global reset and page chrome --- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fff2ee; /* fallback if hero does not cover the page */
  color: #84052e;      /* brand dark red for default text */
}

/* --- Hero shell: at least one screen tall, centers content vertically --- */
.hero {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;   /* clip oversized map on small screens */
  isolation: isolate;   /* own stacking context for z-index layers */
  background: #ffdad0;  /* visible if background image fails to load */
}

/* Decorative PNG layer; file path is the swap point for a new background asset */
.hero-background {
  position: absolute;
  inset: 0;
  background-image: url("../images/background.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  transform: scaleX(-1);              /* horizontal flip for composition */
  filter: saturate(1.12) brightness(.9);
  z-index: -2;                         /* behind overlay and map */
}

/* Shared coordinate system for SVG map and flight canvas */
.map-scene {
  position: absolute;
  width: min(78vw, 1250px);
  aspect-ratio: 2000 / 1280;           /* matches world-map.svg proportions */
  right: 4vw;                          /* deliberate gap from right screen edge */
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;                          /* above .hero-overlay */
  pointer-events: none;                /* clicks pass through to page below */
  contain: layout style paint;         /* isolate map + canvas for compositor */
}

.world-map {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 18px 24px rgba(132, 5, 46, .36)) drop-shadow(0 4px 7px rgba(132, 5, 46, .24));
}

/* Stacked exactly on top of .world-map inside .map-scene */
#networkCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-bubbles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.speech-bubble {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: min(26%, 228px);
  padding: 5px 9px 5px 6px;
  border-radius: 8px;
  background: #fff;
  color: #666;
  font-size: clamp(11px, 1.05vw, 13px);
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  box-shadow: 0 4px 14px rgba(132, 5, 46, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transition: opacity 200ms ease;
}

.speech-bubble__avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.speech-bubble__sep {
  color: #ccc;
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  user-select: none;
}

.speech-bubble__text {
  min-width: 0;
}

.speech-bubble--measure {
  visibility: hidden;
  pointer-events: none;
}

.speech-bubble--reduced {
  transition: none;
}

.speech-bubble.is-visible {
  opacity: 1;
}

.speech-bubble.is-hiding {
  opacity: 0;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border: 6px solid transparent;
}

.speech-bubble[data-side="top"]::after {
  left: 50%;
  bottom: -11px;
  transform: translateX(-50%);
  border-top-color: #fff;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.06));
}

.speech-bubble[data-side="bottom"]::after {
  left: 50%;
  top: -11px;
  transform: translateX(-50%);
  border-bottom-color: #fff;
}

.speech-bubble[data-side="left"]::after {
  right: -11px;
  top: 50%;
  transform: translateY(-50%);
  border-left-color: #fff;
}

.speech-bubble[data-side="right"]::after {
  left: -11px;
  top: 50%;
  transform: translateY(-50%);
  border-right-color: #fff;
}

/* Soft peach/pink wash; stronger on the left where typography sits */
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to left, rgba(255, 215, 207, .88) 0%, rgba(255, 211, 207, .74) 28%, rgba(255, 211, 207, .32) 65%, rgba(255, 211, 207, .34) 100%);
}

.hero-content {
  position: relative;
  z-index: 3;                          /* above map and animation */
  width: min(1200px, calc(100% - 60px));
  margin: 0 auto 0 100px;
}

.hero p .hero-logo-inline {
  height: 0.82em;
  width: auto;
  margin-inline: 0.08em;
  vertical-align: baseline;
}

.hero-eyebrow {
  margin-bottom: 20px;
  color: #db001e;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(1.75rem, 4.2vw, 4rem);
  line-height: 1.08;
  letter-spacing: -.04em;
  font-weight: 600;
}

.hero p {
  max-width: 580px;
  margin-top: 32px;
  margin-bottom: 0;
  color: #6f2842;
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 38px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 24px;
  border-radius: 7px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.button:hover { transform: translateY(-2px); }
.button-primary { background: #db001e; color: #fff; }
.button-primary:hover { background: #b40025; }
.button-secondary {
  color: #84052e;
  border: 1px solid rgba(132,5,46,.24);
  background: rgba(255,255,255,.36);
  backdrop-filter: blur(10px);
}
.button-secondary:hover { border-color: rgba(132,5,46,.55); }

/* --- Tablet / small desktop: hero copy bottom-aligned --- */
@media (min-width: 701px) and (max-width: 1500px) {
  .hero {
    align-items: flex-end;
    padding-bottom: 50px;
  }
}

/* --- Narrow screens: text panel bottom-aligned, secondary-button glass --- */
@media (max-width: 700px) {
  .hero {
    min-height: 100svh;
    align-items: flex-end;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }

  .hero-content {
    width: calc(100% - 32px);
    margin: 0 auto;
    padding: 22px 20px 26px;
    background: rgba(255, 255, 255, 0.36);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(132, 5, 46, 0.24);
    border-radius: 14px;
    box-shadow: none;
  }

  .map-scene {
    width: 820px;
    /* Map landmass starts ~5vw from the left edge */
    right: calc(95vw - 820px);
    top: 42%;
  }

  .hero-overlay {
    background: linear-gradient(
      165deg,
      rgba(255, 236, 231, 0.98) 0%,
      rgba(255, 224, 216, 0.88) 42%,
      rgba(255, 211, 207, 0.42) 100%
    );
  }
}
