/* Shared chrome lives in ../chrome.css. Map controls and compact hub popovers
   sit over the map, with the ISO table and email form below. */

:root { --hm-heat: #e6b8aa; --hm-cold: #b9d2e4; --hm-mixed: #d8d1e8; --hm-text: #1f2937; }

/* Stale banner above the feed */
.hm-stale { margin: 0; padding: 8px 16px; background: #fff4e5; border-bottom: 1px solid #f5bb50; color: #7a3a12; font-size: 13.5px; font-weight: 700; text-align: center; }

/* Feed of cards, the leaderboard values */
.card-by { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.card-by .mention { font-size: 11.5px; }
.feed { max-width: 940px; margin: 26px auto; padding: 0 18px; display: flex; flex-direction: column; gap: 20px; }
.card { background: linear-gradient(120deg, rgba(232,131,74,0.055), #fff 48%); border: 1px solid var(--line); border-left: 3px solid var(--coral); border-radius: 14px; box-shadow: var(--shadow); padding: 20px 24px 22px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head h1, .card-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.card .sub { margin: 12px 0 16px; font-size: 13px; color: var(--muted); }
.hm-intro span { display: block; }
.hm-intro span + span { margin-top: 2px; }
.hm-map-hint { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.card .answer { margin: 16px 0 8px; font-size: 14px; color: var(--ink); line-height: 1.55; }
.card .answer-points { margin: 0 0 8px; padding-left: 20px; font-size: 14px; color: var(--ink); line-height: 1.55; }
.card .answer-points li { margin: 4px 0; }
.card .xlink { margin: 14px 0 0; padding: 9px 14px; font-size: 12.5px; line-height: 1.4; color: var(--ink); background: rgba(20,148,138,0.07); border: 1px solid rgba(20,148,138,0.22); border-left: 3px solid #14948a; border-radius: 10px; }
.card .xlink a { color: #0f7268; font-weight: 700; text-decoration: none; border-bottom: 1px solid rgba(15,114,104,0.4); }
.card .xlink a:hover { border-bottom-color: #0f7268; }
.foot { max-width: 940px; margin: 30px auto 50px; padding: 0 18px; font-size: 12px; color: var(--muted); }
.hm-notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.hm-note { min-width: 0; padding: 16px 18px; border: 1px solid #e1e4e7; border-radius: 10px; background: #fff; }
.hm-note h2 { margin: 0 0 10px; color: var(--ink); font-size: 15px; font-weight: 700; }
.hm-note .answer-points, .hm-note .hm-sources { margin: 0; padding-left: 16px; font-size: 12px; line-height: 1.5; }
.hm-note li { margin: 4px 0; }

.kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--coral-dark); margin-bottom: 2px; }
/* Market toggle, layer panel, and map controls live over the map. */
.hm-layers { position: absolute; left: 14px; top: 14px; z-index: 7; max-width: min(380px, calc(100% - 28px)); background: rgba(255,255,255,0.96); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.10); }
.hm-layers .map-toggle { position: static; display: flex; width: 100%; margin: 0 0 8px; box-shadow: none; }
.hm-layers .map-toggle button { flex: 1; background: rgba(255,255,255,0.95); font-size: 12.5px; padding: 6px 12px; }
.hm-layers .map-toggle button.on { background: var(--coral); color: #fff; }
.hm-layers summary { min-height: 32px; padding: 6px 12px; cursor: pointer; font-weight: 800; list-style-position: inside; }
.hm-layers[open] { width: min(380px, calc(100% - 28px)); }
.hm-layer-content { max-height: min(440px, calc(100vh - 110px)); overflow: auto; padding: 0 12px 10px; }
.hm-layer-options { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 9px; padding: 0 0 8px; border: 0; border-bottom: 1px solid var(--line); }
.hm-layer-options label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; cursor: pointer; }
.hm-layer-options input { accent-color: var(--coral); margin: 0; }
.hm-layer-options input:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.hm-dayrow { display: flex; align-items: center; gap: 9px; min-height: 28px; margin: 0 0 3px; flex-wrap: wrap; }
.hm-date { font-size: 22px; font-weight: 800; color: var(--hm-text); line-height: 1.1; }
.hm-daytag { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 9px; border-radius: 999px; color: #403631; }
.hm-daytag.heat { background: var(--hm-heat); }
.hm-daytag.cold { background: var(--hm-cold); color: #334c5b; }
.hm-daytag.mixed { background: var(--hm-mixed); color: #433c55; }
.seg { display: inline-flex; border: 1px solid #d4d9de; border-radius: 9px; overflow: hidden; }
.seg button { border: none; background: #fff; color: var(--muted); font: inherit; font-weight: 700; font-size: 13px; padding: 7px 14px; cursor: pointer; }
.seg button.on { background: var(--coral); color: #fff; }
.seg button + button { border-left: 1px solid #d4d9de; }

/* Compact playback dock with daily load peaks and month labels. */
.hm-map-panel { position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 6; padding: 10px 14px 8px; background: rgba(255,255,255,0.95); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 18px rgba(0,0,0,0.09); }
.hm-play { display: flex; align-items: center; gap: 6px; }
.hm-play button { border: 1px solid #d4d9de; background: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; font-weight: 700; color: var(--ink); font-size: 13px; line-height: 1.2; }
.hm-play button.primary { background: var(--coral); border-color: var(--coral); color: #fff; min-width: 62px; }
.hm-play button:hover { border-color: var(--coral); }
.hm-slider { position: relative; min-width: 0; margin-top: 5px; }
#daySlider { width: 100%; margin: 0; accent-color: var(--coral); cursor: pointer; }
.hm-months { position: relative; height: 14px; margin: 1px 8px 0; color: var(--muted); font-size: 10px; line-height: 14px; }
.hm-months span { position: absolute; top: 0; transform: translateX(-50%); }
.hm-months span:first-child { transform: none; }
.hm-load-bars { display: flex; align-items: stretch; height: 24px; margin: 2px 8px 0; border-bottom: 1px solid #d9dfe4; cursor: pointer; }
.hm-load-bar { position: relative; flex: 1; min-width: 0; height: 100%; }
.hm-load-bar::after { position: absolute; bottom: 0; left: 0; right: 0; height: var(--bar-height, 0%); background: #b5c0cc; border-radius: 1px 1px 0 0; content: ""; }
.hm-load-bar.cold::after { background: var(--hm-cold); }
.hm-load-bar.heat::after { background: var(--hm-heat); }
.hm-load-bar.mixed::after { background: var(--hm-mixed); }
.hm-load-bar:hover::after { filter: brightness(0.95); }
.hm-load-bar.on { box-shadow: inset 1px 0 #788693; }
.hm-load-bars:focus-visible { outline: 2px solid #788693; outline-offset: 2px; }
.hm-load-caption { display: flex; justify-content: space-between; gap: 8px; margin: 2px 0 3px; color: var(--muted); font-size: 9px; line-height: 1.2; }
.hm-load-key { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.hm-load-key i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; }
.hm-load-key .cold { background: var(--hm-cold); }
.hm-load-key .heat { background: var(--hm-heat); margin-left: 3px; }
.hm-load-key #loadScale { margin-left: 4px; }

/* The map at card width, rounded like the leaderboard map */
.hm-map { position: relative; height: 620px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.hm-map .deckmap { position: absolute; inset: 0; }
.hm-map-note { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 8; max-width: calc(100% - 32px); padding: 7px 12px; background: rgba(255,255,255,0.95); border: 1px solid var(--line); border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.hm-map .map-fs-btn { position: absolute; right: 14px; bottom: calc(var(--panel-height, 190px) + 24px); z-index: 6; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,0.94); color: var(--ink); cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.10); }
.hm-map .map-fs-btn:hover { background: #fff; }
.hm-hub-popup { z-index: 9; max-width: var(--popup-width, 360px) !important; }
.hm-hub-popup .maplibregl-popup-content { width: var(--popup-width, 360px); max-height: min(460px, var(--popup-height, 460px)); overflow: hidden; padding: 0; background: rgba(255,255,255,0.74); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); border: 1px solid rgba(255,255,255,0.7); border-radius: 16px; box-shadow: 0 16px 40px rgba(120,84,58,0.08), inset 0 1px 0 rgba(255,255,255,0.7); }
.hm-hub-popup .hm-hub { width: 100%; max-height: min(440px, var(--popup-height, 460px)); overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px; background: transparent; border: 0; border-radius: 16px; box-shadow: none; }
.hm-hub-popup .hm-hub .card-head { margin-bottom: 8px; }
.hm-hub-popup .hm-hub .card-head h2 { font-size: 14px; font-weight: 500; color: var(--hm-text); }
.hm-hub-popup .hm-hub .tiles { gap: 6px; }
.hm-hub-popup .hm-hub .tile { padding: 8px 7px 7px; }
.hm-hub-popup .hm-hub .tile .v { font-size: 20px; font-weight: 700; }
.hm-hub-popup .hm-hub .tile .l { font-size: 9px; }
.hm-hub-popup .hm-hub .tile .s { font-size: 10px; }
.hm-hub-popup .hm-hub .hm-value-bar { margin: 6px 0 4px; }
.hm-hub-popup:is(.maplibregl-popup-anchor-top, .maplibregl-popup-anchor-top-left, .maplibregl-popup-anchor-top-right) .maplibregl-popup-tip { border-bottom-color: rgba(255,255,255,0.74); }
.hm-hub-popup:is(.maplibregl-popup-anchor-bottom, .maplibregl-popup-anchor-bottom-left, .maplibregl-popup-anchor-bottom-right) .maplibregl-popup-tip { border-top-color: rgba(255,255,255,0.74); }
.hm-hub-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: rgba(255,255,255,0.74); }
.hm-hub-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: rgba(255,255,255,0.74); }
.hm-map .maplibregl-ctrl-bottom-right { right: 14px; bottom: calc(var(--panel-height, 190px) + 64px); z-index: 5; }
.hm-map .maplibregl-ctrl-bottom-left { left: 14px; bottom: calc(var(--panel-height, 190px) + 24px); z-index: 5; }
.hm-map .maplibregl-ctrl-bottom-right .maplibregl-ctrl, .hm-map .maplibregl-ctrl-bottom-left .maplibregl-ctrl { margin: 0; }
.hm-map .maplibregl-ctrl-group { border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.10); }
.hm-map .maplibregl-ctrl-group button { width: 32px; height: 32px; }
#mapWrap:fullscreen, #mapWrap:-webkit-full-screen { width: 100vw; height: 100vh; border-radius: 0; background: #fff; }
#mapWrap:fullscreen .deckmap, #mapWrap:-webkit-full-screen .deckmap { border-radius: 0; }

/* Compact map legend, expanded from the Layers disclosure. */
.hm-legend { display: grid; grid-template-columns: 1fr; gap: 6px; font-size: 12px; color: #374151; }
.lg-block + .lg-block { border-top: 1px solid #eef0f2; padding-top: 6px; }
.lg-title { font-weight: 700; color: var(--ink); }
.ramp { height: 9px; border-radius: 5px; margin: 6px 0 2px; background: var(--line); }
.ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.ticks.words { font-weight: 700; color: var(--ink); }
/* Ticks placed by value, the ramp is not evenly spaced in % */
.ticks.at { position: relative; display: block; height: 15px; }
.ticks.at span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.ticks.at span:first-child { transform: none; }
.ticks.at span:last-child { transform: translateX(-100%); }
.hm-size-scale { display: flex; align-items: flex-end; gap: 16px; height: 48px; margin: 8px 0 4px; }
.hm-size-example { display: flex; min-width: 48px; height: 100%; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; }
.hm-size-dot { display: block; box-sizing: border-box; flex: none; border-radius: 50%; border: 1px solid #9dbbc9; background: #d8e4e8; }
.hm-size-example em { font-style: normal; font-size: 10.5px; font-weight: 800; color: var(--ink); }
.lg-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.grey-dot { width: 9px; height: 9px; border-radius: 50%; background: #d4dde2; border: 1px solid #fff; box-shadow: 0 0 0 1px #c9d4da; flex: none; }

/* Compact hover popup and persistent selected-hub card below the map. */
.hm-hub { min-width: 0; }
.hm-selected-card[hidden] { display: none; }
.hm-selected-card .card-head { margin-bottom: 12px; }
.hm-selected-card .card-head h2 { color: var(--hm-text); }
.hm-pick { display: flex; align-items: center; gap: 8px; width: 100%; margin: 0 0 4px; max-width: 420px; font-size: 12px; color: var(--muted); }
.hm-pick select { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid #d4d9de; border-radius: 8px; font: inherit; font-size: 13px; color: var(--ink); background: #fff; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile { padding: 12px 12px 10px; background: rgba(232,131,74,0.04); border: 1px solid var(--line); border-radius: 12px; }
.tile .v { font-size: 28px; font-weight: 800; line-height: 1.05; color: var(--hm-text); }
.tile .l { margin-top: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.tile .s { margin-top: 3px; font-size: 12px; line-height: 1.35; color: var(--ink); }
.hm-selected-card .tile .v { font-size: 22px; }
.hm-value-bar { width: 100%; height: 6px; margin: 9px 0 6px; }
.hm-value-bar > span:first-child { position: relative; display: block; width: 100%; height: 6px; overflow: hidden; border-radius: 999px; background: #e9ecef; }
.hm-value-bar > span:first-child::before { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: #7c858d; content: ""; z-index: 1; }
.hm-value-bar > span:first-child::after { position: absolute; top: 0; bottom: 0; left: var(--value-left, 50%); width: var(--value-width, 0%); border-radius: 999px; background: var(--value-color, var(--coral)); content: ""; }

/* ISO medians table */
.hm-isos { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.hm-isos th:first-child { width: 14%; }
.hm-isos th, .hm-isos td { padding: 6px 8px; text-align: right; border-bottom: 1px solid #eef0f2; font-variant-numeric: tabular-nums; }
.hm-isos th:first-child { text-align: left; }
.hm-isos thead th { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.hm-isos tbody th { font-weight: 700; color: var(--ink); }
.hm-isos tr.sel th, .hm-isos tr.sel td { font-weight: 800; color: var(--hm-text); background: rgba(232,131,74,0.08); }
.hm-isos td .hm-value-bar { display: inline-block; width: 72px; height: auto; vertical-align: middle; margin: 0 0 0 5px; }
.hm-isos td .hm-value-bar > span:first-child { min-width: 0; }
.hm-value-label { min-width: 44px; color: var(--ink); font-size: 11px; text-align: right; white-space: nowrap; }

/* Per-hub email form, display flex needs the explicit hidden rule */
.hm-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) auto; align-items: center; gap: 8px; margin: 0 0 14px; }
.hm-form[hidden] { display: none; }
.hm-form-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hm-form .hm-pick { width: 100%; min-width: 0; max-width: none; margin: 0; }
.hm-form .hm-pick select { height: 44px; padding: 10px 12px; font-size: 14px; }
.hm-form input[type="email"] { width: 100%; min-width: 0; height: 44px; padding: 10px 12px; border: 1px solid #d4d9de; border-radius: 9px; font: inherit; font-size: 14px; background: #fff; color: var(--ink); }
.hm-form button { min-height: 44px; background: var(--coral); color: #fff; border: none; border-radius: 9px; padding: 10px 16px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.hm-form button:hover { background: var(--coral-dark); }
.hm-form button:disabled { opacity: 0.6; cursor: wait; }
.hm-result { grid-column: 1 / -1; width: 100%; font-size: 13px; color: var(--ink); }
.hm-result:empty { display: none; }
.hp { position: absolute; left: -9999px; }

/* Sources list */
.hm-sources { margin: 12px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.55; color: var(--ink); }
.hm-sources li { margin: 3px 0; }

@media (max-width: 600px) {
  .feed { padding: 0 16px; gap: 14px; margin: 16px auto; }
  .card { padding: 14px 14px 16px; }
  .card-head h1, .card-head h2 { font-size: 16px; }
  .hm-notes { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .hm-note { padding: 14px; }
  .foot { padding: 0 16px; }
  .hm-map { height: 560px; }
  .hm-layers { left: 8px; right: auto; top: 8px; max-width: calc(100% - 16px); }
  .hm-layers[open] { width: min(360px, calc(100% - 16px)); }
  .hm-layer-content { max-height: min(300px, calc(100vh - 90px)); padding-right: 10px; padding-left: 10px; }
  .hm-layers .map-toggle button { font-size: 11px; padding: 6px 8px; }
  .hm-layer-options { gap: 5px 9px; }
  .hm-layer-options label { font-size: 11px; }
  .hm-map-panel { left: 8px; right: 8px; bottom: 8px; padding: 8px 9px 7px; }
  .hm-dayrow { gap: 6px; }
  .hm-date { font-size: 18px; }
  .hm-play { gap: 4px; }
  .hm-play button { padding: 7px 8px; font-size: 12px; }
  .hm-play button.primary { min-width: 54px; }
  .hm-slider { margin-top: 4px; }
  .hm-map .map-fs-btn { right: 8px; }
  .hm-map .maplibregl-ctrl-bottom-right { right: 8px; }
  .hm-map .maplibregl-ctrl-bottom-left { left: 8px; }
  .hm-hub-popup { max-width: var(--popup-width, 360px) !important; }
  .hm-hub-popup .maplibregl-popup-content { width: var(--popup-width, 360px); }
  .hm-hub-popup .hm-hub { padding: 10px 12px; }
  .hm-hub-popup .hm-hub .tile .v { font-size: 16px; }
  .hm-hub-popup .hm-hub .tile .l { font-size: 8.5px; }
  .tiles { gap: 6px; }
  .tile { padding: 10px 8px 8px; }
  .tile .v { font-size: 20px; }
  .tile .l { font-size: 10px; }
  .tile .s { font-size: 11px; }
  .hm-selected-card .tile { padding: 8px 6px 7px; }
  .hm-selected-card .tile .v { font-size: 16px; }
  .hm-selected-card .tile .l { font-size: 8.5px; }
  .hm-selected-card .tile .s { font-size: 10px; }
  .hm-isos { font-size: 12px; }
  .hm-isos th, .hm-isos td { padding: 5px 5px; }
  .hm-value-label { display: block; min-width: 0; font-size: 9.5px; }
  .hm-isos td .hm-value-bar { display: block; width: 100%; margin: 3px 0 0; }
  .hm-form { grid-template-columns: minmax(0, 1fr); }
  .hm-form input[type="email"], .hm-form button { width: 100%; min-width: 0; }
}
