/* hymaps-deck.css — unified bottom control deck (iOS bottom sheet)
 * ──────────────────────────────────────────────────────────────────────────
 * Paired with js/shared/hymaps-deck.js. THEME ONLY: every value references a
 * tokens.css token or a hymaps-glass.css page-local alias. NO hardcoded brand
 * colors. 8px spacing grid, safe-area aware, mobile-first. The deck owns the
 * bottom zone (z-index 1200, below the rail at 1300 and the nav HUD at 1600).
 */

/* ── surface ──────────────────────────────────────────────────────────────── */
.hm-deck {
  position: fixed;
  left: var(--space-md);
  right: var(--space-md);
  bottom: 0;
  z-index: 1200;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  color: var(--hm-text);
  background: var(--hm-glass);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border: 1px solid var(--hm-border);
  border-bottom: none;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-lg);
  transition: max-height var(--transition-normal) cubic-bezier(.2, .9, .3, 1),
              transform var(--transition-normal) cubic-bezier(.2, .9, .3, 1);
}

/* ── handle (grip + tap/drag target) ──────────────────────────────────────── */
.hm-deck-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--touch-target);
  padding: var(--space-sm) 0 var(--space-xs);
  background: transparent;
  border: none;
  cursor: grab;
  touch-action: none;
}
.hm-deck-handle:active { cursor: grabbing; }
.hm-deck-grip {
  display: block;
  width: 40px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--hm-border);
}

/* ── peek (always-visible primary tier) ───────────────────────────────────── */
.hm-deck-peek {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0 var(--space-lg) calc(var(--space-md) + var(--hm-safe-b));
}
.hm-deck-modes { flex: 1 1 auto; min-width: 0; display: flex; }
.hm-deck-directions { flex: 0 0 auto; }

.hm-deck-dir-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--touch-target);
  padding: 0 var(--space-lg);
  border-radius: var(--radius-full);
  border: 1px solid var(--hm-accent);
  background: var(--hm-accent);
  color: var(--hm-bg);
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}
.hm-deck-dir-btn iconify-icon { font-size: 20px; }

/* ── body (expanded-only; scrolls) ────────────────────────────────────────── */
.hm-deck-body {
  display: none;
  flex-direction: column;
  gap: var(--space-md);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-xs) var(--space-lg) calc(var(--space-lg) + var(--hm-safe-b));
  max-height: min(72dvh, 560px);
}

/* ── states ───────────────────────────────────────────────────────────────── */
.hm-deck.is-expanded .hm-deck-body { display: flex; }
.hm-deck.is-hidden .hm-deck-peek,
.hm-deck.is-hidden .hm-deck-body { display: none; }

/* ── "Map settings" <details> ─────────────────────────────────────────────── */
.hm-deck-settings { border-top: 1px solid var(--hm-border); }
.hm-deck-settings-sum {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--touch-target);
  padding: var(--space-md) 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--hm-text);
  list-style: none;
}
.hm-deck-settings-sum::-webkit-details-marker { display: none; }
.hm-deck-settings-sum > iconify-icon:first-child { font-size: 20px; color: var(--hm-muted); }
.hm-deck-sum-caret { margin-left: auto; color: var(--hm-muted); transition: transform var(--transition-fast); }
.hm-deck-settings[open] .hm-deck-sum-caret { transform: rotate(180deg); }

.hm-deck-sec:not(:empty) { padding: var(--space-sm) 0; }
.hm-deck-settings .hm-deck-sec:not(:empty) + .hm-deck-sec:not(:empty) {
  border-top: 1px solid var(--hm-border);
}

/* ── re-homed controls: neutralize their floating fixed positioning ─────────
   The lead removes the superseded fixed-position blocks during integration;
   these higher-specificity rules make the deck robust regardless of order. */
#hm-deck .hm-modes,
#hm-deck .hm-maptype,
#hm-deck .hm-off-ctrls,
#hm-deck .hm-hud {
  position: static;
  left: auto; right: auto; top: auto; bottom: auto;
  transform: none;
  z-index: auto;
  margin: 0;
  max-width: none;
}
#hm-deck .hm-modes {
  width: 100%;
  gap: 4px;
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  justify-content: space-between;
  flex-wrap: wrap;
}
#hm-deck .hm-maptype {
  width: 100%;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--space-sm);
  pointer-events: auto;
}
#hm-deck .hm-off-ctrls {
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
#hm-deck .hm-hud { width: 100%; }

/* live-layers grouped list mounts into #hm-deck-layers; size it to the deck */
#hm-deck-layers .hml-body {
  padding: 0;
  max-height: none;
  overflow: visible;
}

/* ── responsive / motion ──────────────────────────────────────────────────── */
@media (max-width: 374px) {
  .hm-deck-dir-btn span { display: none; }
  .hm-deck-dir-btn { padding: 0 var(--space-md); }
}
@media (prefers-reduced-motion: reduce) {
  .hm-deck { transition: none; }
}
