/* Market heat map — treemap of ETF holdings */

.hm-controls {
  display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center;
  margin: 1rem 0 0.4rem;
}
.hm-presets { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hm-preset.active { outline: 2px solid var(--color-accent); }
.hm-custom { display: flex; gap: 0.5rem; margin-left: auto; }
.hm-custom input {
  width: 11rem; padding: 0.55rem 0.7rem; border-radius: 8px;
  border: 1px solid var(--color-border); background: var(--color-bg);
  color: var(--color-text); font-size: 0.95rem; text-transform: uppercase;
}
/* Sector ETF picker dropdown */
.hm-sectors { position: relative; }
.hm-sector-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  background: var(--color-card-bg); border: 1px solid var(--color-card-border);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  padding: 0.35rem; min-width: 17rem; max-width: calc(100vw - 2rem);
}
.hm-sector-menu[hidden] { display: none; }
.hm-sector-item {
  display: block; width: 100%; text-align: left;
  padding: 0.5rem 0.65rem; border: 0; border-radius: 7px; cursor: pointer;
  background: transparent; color: var(--color-text); font-size: 0.88rem;
}
.hm-sector-item strong { font-weight: 700; }
.hm-sector-item span { color: var(--color-text-muted); }
.hm-sector-item:hover {
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
}
/* Ticker suggestion dropdown */
.hm-suggest-wrap { position: relative; }
.hm-suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--color-card-bg); border: 1px solid var(--color-card-border);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  max-height: 19rem; overflow-y: auto; padding: 0.35rem;
}
.hm-suggest[hidden] { display: none; }
.hm-suggest-item {
  padding: 0.5rem 0.65rem; border-radius: 7px; cursor: pointer;
  font-size: 0.88rem; color: var(--color-text); white-space: nowrap;
  text-transform: none;
}
.hm-suggest-item strong { font-weight: 700; }
.hm-suggest-item span { color: var(--color-text-muted); }
.hm-suggest-item:hover, .hm-suggest-item.active {
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
}

.hm-meta { color: var(--color-muted); font-size: 0.9rem; min-height: 1.4em; margin: 0.4rem 0 0.1rem; }
.hm-fresh { color: var(--color-muted); font-size: 0.85rem; margin: 0 0 0.4rem; }
.hm-fresh .stale { color: #e0a43c; font-weight: 600; }

.hm-map {
  position: relative; width: 100%; height: 72vh; height: 72dvh; min-height: 480px;
  border: 1px solid var(--color-border); border-radius: 12px;
  overflow: hidden; background: var(--color-card, transparent);
  touch-action: pan-y;
}
.hm-sector {
  position: absolute; box-sizing: border-box;
  border: 1px solid rgba(128, 128, 128, 0.35);
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.hm-sector-label {
  position: absolute; top: 2px; left: 6px; z-index: 2;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--color-muted); text-transform: uppercase;
  pointer-events: none; white-space: nowrap;
}
.hm-industry {
  position: absolute; box-sizing: border-box;
  overflow: hidden;
}
.hm-industry-label {
  position: absolute; top: 1px; left: 4px; z-index: 2;
  font-size: 0.58rem; font-weight: 600; letter-spacing: 0.03em;
  color: var(--color-muted); text-transform: uppercase; opacity: 0.85;
  pointer-events: none; white-space: nowrap;
}
.hm-tile {
  position: absolute; box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.28);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden; text-decoration: none;
  transition: filter 0.15s ease;
}
.hm-tile:hover { filter: brightness(1.18); z-index: 3; }
.hm-tile .t {
  color: #fff; font-weight: 800; line-height: 1.1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55); pointer-events: none;
}
.hm-tile .p {
  color: rgba(255, 255, 255, 0.92); line-height: 1.1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55); pointer-events: none;
}
.hm-tile.loading { cursor: wait; }

.hm-legend {
  display: flex; align-items: center; gap: 0.6rem;
  margin-top: 0.7rem; color: var(--color-muted); font-size: 0.85rem;
}
.hm-gradient {
  flex: 0 1 220px; height: 10px; border-radius: 5px;
  background: linear-gradient(to right, #dc2626, #6b7280 50%, #16a34a);
}
.hm-legend-note { margin-left: auto; }
.hm-note { color: var(--color-muted); font-size: 0.8rem; margin-top: 0.5rem; }
.hm-error { color: #e5484d; margin: 1rem 0; }

/* Mobile tap-to-zoom: summary hint + back button */
.hm-map-wrap { position: relative; }
.hm-zoom-hint {
  display: inline-block;
  font-size: 0.85rem; font-weight: 600;
  color: var(--color-accent-text, #fff);
  background: var(--color-accent);
  border-radius: 999px; padding: 0.35rem 0.9rem;
  margin: 0 0 0.5rem;
}
.hm-zoom-hint[hidden] { display: none; }
.hm-back {
  position: absolute; top: 0.6rem; left: 0.6rem; z-index: 5;
  background: rgba(0, 0, 0, 0.6); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px;
  padding: 0.4rem 0.9rem; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; backdrop-filter: blur(4px);
}
.hm-back[hidden] { display: none; }
.hm-back:hover { background: rgba(0, 0, 0, 0.8); }

@media (max-width: 640px) {
  .hm-custom { margin-left: 0; width: 100%; }
  .hm-custom input { flex: 1; }
  .hm-map { height: 78vh; height: 78dvh; min-height: 420px; }
}
