/* Keep header tight */
.compact-header { margin-bottom: 0; }

/* Layers */
.main-header, .explore-controls, .explore-section, .main-footer { position: relative; z-index: 6; }
.terrain-bg, .data-particles, .ai-network, .weather-system { z-index: 0; }

/* Dynamic header/search vars injected by JS */
:root {
  --header-h: 72px;  /* fallback */
  --controls-h: 56px; /* fallback */
}

/* The sentinel sits right under header (no height) */
#controlsSentinel { height: 0; }

/* SEARCH (a little down from header, follows header, never overrides content) */
.explore-controls {
  /* space under header */
  margin-top: 10px;
  padding: 0.5rem 5%;
  position: sticky;
  top: var(--header-h);   /* ALWAYS follows dynamic header height */
  z-index: 7;
  /* ensure smooth movement and hardware accel */
  will-change: top;
}

.controls-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  background: var(--glass-color);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  gap: 0.5rem; /* compact gaps to remove unwanted space */
}

.search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
  min-width: 240px;
}

.search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 1rem;
}

.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.filters .chip {
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  padding: .45rem .8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: .25s;
}
.filters .chip.active,
.filters .chip:hover {
  background: rgba(0, 230, 118, .15);
  border-color: rgba(0, 230, 118, .35);
}

/* When the controls are stuck, give the section below an offset equal to controls height */
.explore-controls.is-stuck + .explore-section { padding-top: calc(var(--controls-h) + 8px); }

/* SOLUTIONS */
.explore-section { padding: 0.75rem 0 3rem; }
.section-header { text-align: center; padding: 0 5%; margin-top: 0.25rem; }

/* Prevent anchor jumps being hidden by sticky bits */
#solutions { scroll-margin-top: calc(var(--header-h) + var(--controls-h) + 12px); }

.solution-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  max-width: 1200px;
  margin: 1rem auto 0;
  padding: 0 5%;
}

.solution-card {
  position: relative;
  background: var(--glass-color);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  box-shadow: var(--glass-shadow);
  padding: 1.05rem 1.05rem .9rem;
  overflow: hidden;
  transform: translateY(30px);
  opacity: 0;
  transition: transform .25s ease;
}
.solution-card:hover { transform: translateY(-6px); }

.solution-card__badge {
  position: absolute; top: 12px; right: 12px;
  font-size: .75rem; padding: .25rem .6rem; border-radius: 999px;
  background: rgba(255,255,255,0.08); border: 1px solid var(--glass-border);
}
.solution-card__icon {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255,255,255,0.08);
  margin-bottom: .7rem; font-size: 1.35rem; color: var(--accent-color);
}
.pill-list { display: flex; flex-wrap: wrap; gap: .5rem; margin: .7rem 0 .9rem; }
.pill-list li {
  list-style: none; padding: .32rem .62rem; border-radius: 999px;
  border: 1px solid var(--glass-border); background: rgba(255,255,255,0.06);
  font-size: .8rem; color: var(--text-secondary);
}
.solution-card__actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* MODAL */
.modal { position: fixed; inset: 0; display: none; z-index: 99; }
.modal.open { display: block; }
.modal__backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(3px); }
.modal__dialog {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(1100px, 92vw);
  background: var(--glass-color); border: 1px solid var(--glass-border);
  border-radius: 14px; box-shadow: var(--glass-shadow); overflow: hidden;
}
.modal__close {
  position: absolute; top: .6rem; right: .6rem;
  background: transparent; border: 1px solid var(--glass-border);
  color: var(--text-primary); padding: .4rem .55rem; border-radius: 8px; cursor: pointer;
}
.modal__header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--glass-border); }
.modal__body { padding: 0; }
.preview-iframe__wrap { width: 100%; aspect-ratio: 16/9; }
.preview-iframe__wrap iframe { width: 100%; height: 100%; border: 0; background: #0b1220; }
.modal__footer { padding: .9rem 1.25rem; border-top: 1px solid var(--glass-border); display: flex; justify-content: flex-end; }

/* RESPONSIVE */
@media (max-width: 980px) {
  /* header typically smaller on mobile, JS sets vars anyway */
}
