/* ============================================================
   GEOCORTEX SECTION — live query demo on the site globe
   ============================================================ */

.gc-sect {
  min-height: 100vh;
  position: relative;
  display: block;
  padding: 0;
  /* Breathing room so the section sits centered between the video above
     and the sections below instead of hugging the hero */
  margin: 130px 0 150px;
  pointer-events: none; /* the globe underneath stays draggable */
}

/* The section headline lives INSIDE the iframe (.embedhead in the landing
   bundle) so it centers as one block with the search bar — no site-side
   .gc-head anymore. */

/* Chat iframe — full-bleed while the centered bar invites the first
   question; collapses to the left column once the chat docks (GC_DOCKED),
   freeing the globe for direct interaction. */
.gc-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  pointer-events: auto;
  z-index: 3;
  transition: width 0.5s ease 0.9s, top 0.5s ease 0.9s, height 0.5s ease 0.9s; /* after the panel's own dock animation */
}

.gc-frame--docked {
  /* Collapsed box places the iframe's internal panel (inset 24px, width
     min(400px, 100% - 48px)) at EXACTLY the layers panel's bounds:
     viewport top 150 / bottom 28 / left 24 / width 380 — mirror symmetry.
     NOTE: iframes are replaced elements — height:auto between top/bottom
     collapses to the intrinsic 150px, so the height must be explicit. */
  top: 126px;
  width: min(428px, 100vw);
  height: calc(100% - 130px);
}

/* Layers panel — right column */
.gc-layers {
  opacity: 0;
  transform: translateX(16px);
  pointer-events: none;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.gc-layers.gc-layers--visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.gc-layers {
  position: absolute;
  top: 150px;
  bottom: 28px;
  right: 24px;
  width: min(380px, calc(100vw - 48px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* pointer-events governed by the --visible class above */
  z-index: 3;
  background: var(--pane);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--holo-faint);
  border-radius: var(--r-lg);
  padding: 16px;
}

.gc-layers-title {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: #c6dde8;
}

.gc-layers-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--holo-faint) transparent;
}

.gc-layers-empty {
  font-family: var(--sans);
  font-size: 13px;
  color: #c6dde8;
  line-height: 1.5;
}

.gc-layer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--holo-faint);
  border-radius: var(--r-sm);
  background: rgba(8, 26, 36, 0.4);
  transition: opacity 0.25s ease;
}

.gc-layer-off {
  opacity: 0.45;
}

.gc-layer-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.gc-layer-label {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gc-layer-count {
  flex: none;
  font-family: var(--sans);
  font-size: 11px;
  color: #b8d3e0;
}

.gc-layer-btn {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.gc-layer-btn:hover,
.gc-layer-btn:focus-visible {
  color: var(--ink);
  background: var(--holo-ghost);
}

/* The funnel — the page's main call to action */
.gc-funnel {
  flex: none;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--holo-faint);
}

.gc-funnel-lead {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink);
}

.gc-cta {
  display: block;
  text-align: center;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #020507;
  text-decoration: none;
  background: linear-gradient(135deg, var(--holo) 0%, #4fc3e8 100%);
  border-radius: var(--r-md);
  padding: 14px 18px;
  box-shadow:
    0 0 28px rgba(123, 228, 255, 0.35),
    0 10px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.gc-cta:hover,
.gc-cta:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    0 0 44px rgba(123, 228, 255, 0.55),
    0 14px 34px rgba(0, 0, 0, 0.45);
}

/* The globe dock is a mobile-only device — desktop drags the globe directly */
.gc-globe-dock {
  display: none;
}

@media (max-width: 979px) {
  .gc-sect {
    min-height: auto;
    padding: 90px 12px 24px;
    /* The desktop 130/150 gutters are sized for a full-viewport section; at
       phone width they just read as dead space under the demo. */
    margin: 40px 0 48px;
    /* Mobile owns its own touch surfaces (the dock below is the ONLY place a
       gesture reaches the globe), so the section must swallow touches rather
       than let them fall through to the full-viewport map canvas. */
    pointer-events: auto;
  }

  .gc-frame {
    position: relative;
    inset: auto;
    display: block;
    width: 100%;
    height: 62vh;
    margin-bottom: 14px;
    transition: height 0.4s ease;
  }

  /* Collapsed chat (mobile): just the bar + handle — the globe gets the stage */
  .gc-frame--collapsed {
    height: 170px;
  }

  /* ── The globe dock ────────────────────────────────────────────────
     Revealed by the bridge once an answer actually lands ([hidden] until
     then), so the pre-query section is just the chat. The porthole is a
     real hotbox: its bounds ARE the interactive region, one-to-one with
     what the visitor sees. Mapbox's own touch handlers stay DISABLED on
     mobile — enabling them puts touch-action:none on a fixed, viewport-
     sized canvas and the whole page stops scrolling. */
  .gc-globe-dock {
    display: block;
    margin: 0 0 14px;
  }

  .gc-globe-dock[hidden] {
    display: none;
  }

  .gc-globe-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 2px 8px;
  }

  .gc-globe-bar-label {
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #c6dde8;
  }

  .gc-globe-toggle {
    flex: none;
    font-family: var(--display);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--holo);
    background: rgba(8, 26, 36, 0.6);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid var(--holo-faint);
    border-radius: 999px;
    /* 44px tall: a thumb target, not a link */
    padding: 12px 20px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
  }

  .gc-globe-toggle:hover,
  .gc-globe-toggle:focus-visible {
    color: var(--ink);
    border-color: rgba(123, 228, 255, 0.5);
  }

  /* The porthole: a rounded window in the flow — the globe (fixed behind the
     transparent page) shows through it. pointer-events:auto + touch-action:
     none make this — and ONLY this — the surface where a drag spins the
     planet; the bridge reads the gestures and drives the camera itself. */
  .gc-globe-window {
    display: block;
    position: relative;
    height: 54vh;
    pointer-events: auto;
    /* Vertical swipes still scroll the page until the bridge marks the window
       live (--live) — an inert porthole must never eat a scroll. */
    touch-action: pan-y;
    border: 1px solid var(--holo-faint);
    border-radius: var(--r-lg);
    box-shadow:
      0 0 24px rgba(123, 228, 255, 0.1),
      inset 0 0 60px rgba(2, 5, 7, 0.25);
    transition: height 0.35s ease, opacity 0.25s ease;
  }

  /* Live: this window — and nothing else on the page — owns the gesture. */
  .gc-globe-dock--live .gc-globe-window {
    touch-action: none;
  }

  /* Hidden: the window (and with it the hotbox) folds away — the globe
     itself keeps rendering behind the page, untouched. */
  .gc-globe-dock--closed .gc-globe-window {
    height: 0;
    opacity: 0;
    pointer-events: none;
    border-width: 0;
    overflow: hidden;
  }

  .gc-globe-window::after {
    content: 'drag to spin · pinch to zoom';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    color: #9fc4d4;
    background: rgba(2, 5, 7, 0.5);
    padding: 4px 12px;
    border-radius: 999px;
    pointer-events: none;
  }

  .gc-globe-dock--closed .gc-globe-window::after {
    display: none;
  }

  @media (prefers-reduced-motion: reduce) {
    .gc-globe-window {
      transition: none;
    }
  }

  /* In the flow on mobile — so, unlike the desktop overlay, an invisible
     panel is not a free lunch: opacity:0 still reserved its full height
     (title + empty state + funnel) as dead space under the chat before the
     first question. Keep it out of the layout until it has something to say. */
  .gc-layers {
    display: none;
    position: relative;
    inset: auto;
    width: 100%;
    max-height: 40vh;
  }

  .gc-layers.gc-layers--visible {
    display: flex;
  }
}


/* Query mode: the volumetric light wash stands down with the rest of the show */
#map::after {
  transition: opacity 0.6s ease;
}

body.gc-query #map::after {
  opacity: 0;
}


/* ── The data map modal ──────────────────────────────────────────── */

.gc-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(2, 5, 7, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: gcModalIn 0.35s ease;
}

@keyframes gcModalIn {
  from { opacity: 0; }
}

/* Same container language as the demo video, floating with 200px of
   breathing room on every side (50px on mobile). */
.gc-modal {
  position: absolute;
  inset: 100px;
  /* The .video-embed container language, replicated — the real class carries
     width:100% + aspect-ratio:16/9, which would override this inset box and
     shove the modal down-right. Never reuse it here. */
  background: rgba(4, 12, 18, 0.85);
  border: 1px solid rgba(123, 228, 255, 0.22);
  border-top: 2px solid var(--holo);
  border-radius: var(--r-lg);
  box-shadow:
    0 0 80px rgba(123, 228, 255, 0.2),
    inset 0 0 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: gcModalRise 0.45s ease;
}

@keyframes gcModalRise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
}

.gc-modal-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #020507;
}

.gc-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
  background: rgba(8, 26, 36, 0.6);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--holo-faint);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.gc-modal-close:hover,
.gc-modal-close:focus-visible {
  color: var(--holo);
  border-color: rgba(123, 228, 255, 0.5);
}

@media (max-width: 768px) {
  .gc-modal {
    inset: 25px;
  }
}
