/* StarMap interactive demo styling — overlays a control panel + legend on an
   OpenLayers map, themed to match the StarMap landing page (navy / gold). */

.sm-demo {
  margin-top: 2.5rem;
}

.sm-demo .sm-demo-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.sm-demo .sm-demo-head p {
  margin: 0.35rem 0 0 0;
  max-width: 52rem;
}

.sm-map-wrap {
  position: relative;
  width: 100%;
  height: 76vh;
  min-height: 460px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(244, 197, 66, 0.28);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
  background: #0b1322;
}

#sm-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* OpenLayers tweaks */
#sm-map .ol-attribution {
  font-size: 0.7rem;
}
#sm-map .ol-zoom {
  top: auto;
  bottom: 0.6em;
  right: 0.6em;
  left: auto;
}
#sm-map .ol-zoom .ol-zoom-in,
#sm-map .ol-zoom .ol-zoom-out {
  background: rgba(8, 14, 24, 0.85);
  color: var(--gold2, #f4c542);
  border: 1px solid rgba(244, 197, 66, 0.3);
}

/* ---- Control panel ---- */
.sm-panel {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 270px;
  max-width: calc(100% - 28px);
  background: rgba(8, 14, 24, 0.93);
  border: 1px solid rgba(244, 197, 66, 0.24);
  border-radius: 16px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  color: #fff;
  z-index: 5;
  overflow: hidden;
}

.sm-panel-header {
  padding: 0.85rem 1rem 0.6rem;
  border-bottom: 1px solid rgba(244, 197, 66, 0.16);
}

.sm-panel-header h3 {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--gold2, #f4c542);
}

#sm-dataset-desc {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.35;
}

.sm-panel-body {
  padding: 0.8rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: calc(76vh - 96px);
  overflow-y: auto;
}

.sm-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.sm-field label {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}

.sm-field select,
.sm-field input[type="range"] {
  width: 100%;
}

.sm-field select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid rgba(244, 197, 66, 0.28);
  border-radius: 9px;
  padding: 0.5rem 0.6rem;
  font-size: 0.86rem;
  cursor: pointer;
}

.sm-field select:focus {
  outline: none;
  border-color: var(--gold2, #f4c542);
}

.sm-field select option {
  background: #0b1322;
  color: #fff;
}

.sm-field input[type="range"] {
  accent-color: var(--gold, #d4a017);
}

/* ---- Legend ---- */
.sm-legend {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 230px;
  max-width: calc(100% - 28px);
  max-height: 42%;
  overflow-y: auto;
  background: rgba(8, 14, 24, 0.92);
  border: 1px solid rgba(244, 197, 66, 0.22);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  color: #fff;
  z-index: 5;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.8rem;
}

.sm-legend-title {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold2, #f4c542);
  margin-bottom: 0.55rem;
  word-break: break-word;
}

.sm-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.32rem;
}

.sm-swatch {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.sm-legend-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.9);
}

.sm-legend-bar {
  height: 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.sm-legend-range {
  display: flex;
  justify-content: space-between;
  margin-top: 0.3rem;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.78);
}

.sm-legend-note {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 0.3rem;
}

/* ---- Hover info (bottom-left, clear of the right-side legend) ---- */
.sm-info {
  position: absolute;
  bottom: 14px;
  left: 14px;
  max-width: 260px;
  display: none;
  background: rgba(8, 14, 24, 0.92);
  border: 1px solid rgba(244, 197, 66, 0.22);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  color: #fff;
  font-size: 0.82rem;
  line-height: 1.4;
  z-index: 5;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

@media (max-width: 736px) {
  .sm-map-wrap { height: 70vh; }
  .sm-panel { width: 220px; }
  .sm-legend { width: 180px; }
  .sm-info { display: none !important; }
}
