/* ============================================================
   BPSHOW - the "Dive Deeper" rotating slideshow on
   building-pulse.html (replaced the old "On Your Phone"
   section, 2026-07-23 per KP).

   A full-width landscape panel that auto-rotates through the 12
   real dive-deeper charts from the BuildingPulse dashboard,
   streaming live from the public-demo building. Auto-advances
   every 4s, pauses while the visitor interacts (hover / focus /
   drag / touch) and resumes when they let go. Dots + arrows +
   swipe for manual control.

   Charts: Chart.js 4.4.1 (line/bar/pie) + custom canvas
   (heatmaps, fuel-mix area) + DOM (gauge, forecaster).
   Behavior: bpshow.js. Palette borrows the dashboard's ink/paper.
   ============================================================ */
.bpshow {
  --bx-ink: #0E2A52;
  --bx-ink-2: #24405f;
  --bx-ink-3: #5a6b7f;
  --bx-line: rgba(14, 42, 82, 0.10);
  --bx-navy: #12315c;
  --bx-teal: #0f766e;
  --bx-red: #c0392b;
  --bx-amber: #d6a51c;
  margin-top: clamp(20px, 3vw, 34px);
  font-family: var(--font-d, system-ui, sans-serif);
  color: var(--bx-ink);
}

/* - stage: prev arrow · viewport · next arrow - */
.bpshow__stage { display: flex; align-items: center; gap: clamp(6px, 1.2vw, 16px); }
.bpshow__viewport {
  position: relative; flex: 1 1 auto; min-width: 0;
  overflow: hidden; border-radius: 20px;
}
.bpshow__track {
  display: flex;
  transition: transform .55s cubic-bezier(.4, 0, .2, 1);
}
.bpshow__slide {
  position: relative;
  flex: 0 0 100%; width: 100%;
  display: flex; flex-direction: column;
  box-sizing: border-box;
  height: clamp(452px, 45vw, 608px);
  padding: clamp(18px, 2.2vw, 30px) clamp(20px, 2.4vw, 34px) clamp(16px, 2vw, 26px);
  background: linear-gradient(150deg, #f4f7f6 0%, #eef2f1 55%, #f5f1ec 100%);
  border: 0.5px solid var(--bx-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 20px 44px -30px rgba(14, 42, 82, 0.4);
  border-radius: 20px;
}
/* while sliding, hide the non-active slides' overflow artifacts */
.bpshow__track:not(.is-ready) .bpshow__slide { visibility: hidden; }
.bpshow__track.is-ready .bpshow__slide[aria-hidden="true"] { }

/* - per-slide header - */
.bpshow__shead { flex: 0 0 auto; }
.bpshow__eyebrow {
  display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--bx-ink-3);
}
.bpshow__desc {
  margin: 7px 0 0; max-width: 62ch;
  font-size: clamp(13px, 1.15vw, 15px); line-height: 1.5; color: var(--bx-ink-2);
}
.bpshow__desc .bpshow__inlinebig { font-size: 1.5em; font-weight: 800; color: var(--bx-ink); letter-spacing: -0.02em; }

/* - toolbars (segmented + month nav) - */
.bpshow__toolbar { flex: 0 0 auto; display: flex; margin-top: 12px; }
.bpshow__toolbar--center { justify-content: center; }
.bpshow__seg {
  display: inline-flex; padding: 3px; border-radius: 999px;
  background: rgba(14, 42, 82, 0.05); border: 0.5px solid var(--bx-line);
}
.bpshow__seg button {
  border: 0; background: transparent; cursor: pointer;
  font: 700 12px/1 var(--font-d); color: var(--bx-ink-3);
  padding: 7px 15px; border-radius: 999px; white-space: nowrap;
  transition: color .2s, background .2s, box-shadow .2s;
}
.bpshow__seg button[aria-pressed="true"] {
  color: var(--bx-ink); background: #fff;
  box-shadow: 0 2px 6px -2px rgba(14, 42, 82, 0.25);
}
.bpshow__monthnav { display: inline-flex; align-items: center; gap: 12px; }
.bpshow__monthnav b { font-size: 14px; font-weight: 800; color: var(--bx-ink); min-width: 128px; text-align: center; }
.bpshow__monthnav button {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 0.5px solid var(--bx-line); color: var(--bx-ink-2);
  box-shadow: 0 2px 6px -3px rgba(14, 42, 82, 0.3); transition: background .2s, color .2s;
}
.bpshow__monthnav button svg { width: 15px; height: 15px; }
.bpshow__monthnav button:hover { background: var(--bx-navy); color: #fff; }
.bpshow__monthnav button:disabled { opacity: 0.4; cursor: default; }

/* - chart area (fills the remaining slide height) - */
.bpshow__chart { position: relative; flex: 1 1 auto; min-height: 0; margin-top: 12px; }
.bpshow__chart canvas { display: block; width: 100%; height: 100%; }

/* - arrows - */
.bpshow__arrow {
  flex: 0 0 auto; width: clamp(38px, 3.4vw, 48px); height: clamp(38px, 3.4vw, 48px);
  border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 0.5px solid var(--bx-line); color: var(--bx-ink);
  box-shadow: 0 8px 20px -10px rgba(14, 42, 82, 0.4);
  transition: background .2s, color .2s, transform .2s;
}
.bpshow__arrow svg { width: 42%; height: 42%; }
.bpshow__arrow:hover { background: var(--bx-navy); color: #fff; transform: scale(1.06); }
.bpshow__arrow:active { transform: scale(0.97); }

/* - dots - */
.bpshow__dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; margin-top: clamp(16px, 2vw, 24px); }
.bpshow__dots button {
  width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(14, 42, 82, 0.18); transition: background .25s, transform .25s, width .25s;
}
.bpshow__dots button:hover { background: rgba(14, 42, 82, 0.4); }
.bpshow__dots button[aria-selected="true"] { background: var(--bx-navy); width: 24px; border-radius: 999px; }

/* ── 1 · Where your energy goes ─────────────────────────── */
.bpshow__chart--mix { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(18px, 3vw, 44px); align-items: center; }
.bpshow__pie { position: relative; height: 100%; min-height: 0; }
.bpshow__mixlegend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bpshow__mixlegend li { display: flex; align-items: center; gap: 11px; font-size: 14px; }
.bpshow__mixlegend .sw { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }
.bpshow__mixlegend .nm { font-weight: 700; color: var(--bx-ink); }
.bpshow__mixlegend .vl { margin-left: auto; font-weight: 700; color: var(--bx-ink); font-variant-numeric: tabular-nums; }
.bpshow__mixlegend .vl span { font-weight: 600; color: var(--bx-ink-3); }

/* ── 3 · After-hours gauge ──────────────────────────────── */
.bpshow__chart--gauge { display: flex; flex-direction: column; justify-content: center; gap: clamp(18px, 2.6vw, 30px); }
.bpshow__gaugehead { display: flex; align-items: baseline; gap: 12px; }
.bpshow__gaugepct { font-size: clamp(44px, 6vw, 68px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--bx-ink); }
.bpshow__gaugetag { font-size: 13px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--bx-amber); }
.bpshow__gaugebar {
  position: relative; height: 12px; border-radius: 999px;
  background: linear-gradient(90deg, #16a34a, #7FBF54 28%, #E9B94F 55%, #e8873a 78%, #dc2626 100%);
  box-shadow: inset 0 1px 3px rgba(14, 42, 82, 0.18);
}
.bpshow__gaugeneedle { position: absolute; top: -4px; bottom: -4px; width: 3px; border-radius: 3px; background: var(--bx-ink); transform: translateX(-50%); transition: left .5s cubic-bezier(.3,1,.4,1); }
.bpshow__gaugescale { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--bx-ink-3); }
.bpshow__gaugestats { display: grid; grid-template-columns: repeat(3, 1fr); }
.bpshow__gaugestats > div { text-align: center; padding: 6px 0; }
.bpshow__gaugestats > div + div { border-left: 1px solid var(--bx-line); }
.bpshow__gaugestats b { display: block; font-size: clamp(20px, 2.4vw, 27px); font-weight: 800; color: var(--bx-ink); letter-spacing: -0.02em; }
.bpshow__gaugestats span { display: block; margin-top: 4px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--bx-ink-3); }

/* ── 4 · 8 · Heatmaps ───────────────────────────────────── */
.bpshow__chart--heat { display: flex; flex-direction: column; }
.bpshow__heat { position: relative; flex: 1 1 auto; min-height: 0; display: grid; gap: 2px; }
.bpshow__heat .hcell { border-radius: 2px; }
.bpshow__heat .hcell--empty { background: rgba(14, 42, 82, 0.05); }
.bpshow__heatscale { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 10px; font-size: 11px; font-weight: 700; color: var(--bx-ink-3); }
.bpshow__heatscale .bar { width: 120px; height: 7px; border-radius: 999px; }
.bpshow__heatscale .bar--kw { background: linear-gradient(90deg, #2ca25f, #b6d957, #f6d743, #f08a3c, #e0392b); }
.bpshow__heatscale .bar--co2 { background: linear-gradient(90deg, #2ca25f, #b6d957, #f6d743, #f08a3c, #e0392b); }

/* ── 7 · Fuel-mix legend ────────────────────────────────── */
.bpshow__chart--area { }
.bpshow__fmlegend { flex: 0 0 auto; display: flex; flex-wrap: wrap; justify-content: center; gap: 7px 9px; margin-top: 12px; }
.bpshow__fmlegend .chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--bx-ink-2); padding: 4px 11px 4px 8px; border-radius: 999px; background: #fff; border: 0.5px solid var(--bx-line); }
.bpshow__fmlegend .chip i { width: 9px; height: 9px; border-radius: 3px; }

/* ── 10 · Bill savings forecaster ───────────────────────── */
.bpshow__chart--forecaster { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); gap: clamp(18px, 3vw, 40px); align-items: center; }
.bpshow__fcsliders { display: flex; flex-direction: column; gap: clamp(16px, 2.4vw, 26px); }
.bpshow__fcrow { display: flex; flex-direction: column; gap: 10px; }
.bpshow__fchead { display: flex; align-items: baseline; justify-content: space-between; }
.bpshow__fclabel { font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 7px; }
.bpshow__fclabel::before { content: ''; width: 9px; height: 9px; border-radius: 3px; }
.bpshow__fclabel--demand { color: #c2410c; } .bpshow__fclabel--demand::before { background: #ea580c; }
.bpshow__fclabel--usage { color: var(--bx-teal); } .bpshow__fclabel--usage::before { background: var(--bx-teal); }
.bpshow__fcval { font-size: 14px; color: var(--bx-ink-3); font-weight: 600; }
.bpshow__fcval b { font-size: 19px; font-weight: 800; color: var(--bx-ink); }
.bpshow__fcval em { font-style: normal; font-weight: 700; margin-left: 6px; font-size: 12px; }
.bpshow__fcval em.good { color: #157a3a; } .bpshow__fcval em.flat { color: var(--bx-ink-3); } .bpshow__fcval em.bad { color: var(--bx-red); }
/* custom slider - directional track fill + colored thumb halo + markers,
   matching the dashboard's Bill Savings Forecaster (KP 2026-07-23) */
.bpshow__slider { position: relative; height: 22px; margin: 26px 0 28px; cursor: pointer; touch-action: none; outline: none; }
.bpshow__slider::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  height: 6px; border-radius: 999px; background: rgba(14,42,82,0.12);
}
.bpshow__slider-fill {
  position: absolute; top: 50%; transform: translateY(-50%); left: 0; width: 0; height: 6px;
  border-radius: 999px; background: rgba(14,42,82,0.18);
  transition: background .2s ease;
}
.bpshow__slider-tick {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 2px; height: 15px; border-radius: 2px; background: rgba(14,42,82,0.4);
}
.bpshow__slider-tick span {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--bx-ink-3); white-space: nowrap; pointer-events: none;
}
.bpshow__slider-tick[data-tick="last"] span { bottom: calc(100% + 4px); }
.bpshow__slider-tick[data-tick="now"] span { top: calc(100% + 4px); }
.bpshow__slider-thumb {
  position: absolute; top: 50%; left: 0; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 2px solid var(--bx-navy); transform: translate(-50%, -50%);
  box-shadow: 0 3px 8px -2px rgba(14,42,82,0.4);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.bpshow__slider:focus-visible .bpshow__slider-thumb { box-shadow: 0 0 0 4px rgba(18,49,92,0.25), 0 3px 8px -2px rgba(14,42,82,0.4); }
.bpshow__slider-thumb.is-trim { border-color: #16a34a; box-shadow: 0 0 0 7px rgba(22,163,74,0.16), 0 3px 8px -2px rgba(14,42,82,0.4); }
.bpshow__slider-thumb.is-over { border-color: #dc2626; box-shadow: 0 0 0 7px rgba(220,38,38,0.16), 0 3px 8px -2px rgba(14,42,82,0.4); }
.bpshow__fchint { margin: 4px 0 0; font-size: 12px; color: var(--bx-ink-3); }
/* circular reset in the forecaster's top-right, mirroring the dashboard's
   green-tinted reset control (KP 2026-07-23) */
.bpshow__chart--forecaster { position: relative; }
.bpshow__fcreset {
  position: absolute; top: 0; right: 0; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(22,163,74,0.10); border: 0.5px solid rgba(22,163,74,0.32); color: #157a3a;
  box-shadow: 0 2px 6px -3px rgba(14,42,82,0.3);
  transition: background .2s ease, color .2s ease, transform .35s ease;
}
.bpshow__fcreset svg { width: 16px; height: 16px; }
.bpshow__fcreset:hover { background: #157a3a; color: #fff; }
.bpshow__fcreset:active { transform: rotate(-40deg); }
.bpshow__fcresult { background: rgba(255,255,255,0.6); border: 0.5px solid var(--bx-line); border-radius: 16px; padding: clamp(18px, 2.2vw, 26px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.8); }
.bpshow__fceyebrow { font-size: 10.5px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: var(--bx-ink-3); }
.bpshow__fcbill { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.bpshow__fcbill span { font-size: clamp(34px, 4vw, 46px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--bx-ink); }
.bpshow__fcbill em { font-style: normal; font-size: 13px; font-weight: 800; color: #157a3a; }
.bpshow__fcbill em.flat { color: var(--bx-ink-3); }
.bpshow__fcsplit { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin-top: 18px; gap: 2px; }
.bpshow__fcsplit-e { border-radius: 999px; background: linear-gradient(90deg, #0a4f47, #14957f); transition: flex-basis .3s; }
.bpshow__fcsplit-d { border-radius: 999px; background: linear-gradient(90deg, #c2410c, #ea8c1f); transition: flex-basis .3s; }
.bpshow__fclegend { display: flex; gap: 18px; margin-top: 12px; font-size: 12px; font-weight: 600; color: var(--bx-ink-3); }
.bpshow__fclegend b { color: var(--bx-ink); font-weight: 800; }
.bpshow__fclegend .e::before, .bpshow__fclegend .d::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.bpshow__fclegend .e::before { background: var(--bx-teal); }
.bpshow__fclegend .d::before { background: #ea580c; }

/* - shared tooltip (heatmaps + area) - */
.bpshow .bpa__tip {
  position: absolute; z-index: 6; pointer-events: none;
  background: #fff; border: 1px solid var(--bx-line); border-radius: 10px;
  box-shadow: 0 8px 22px -10px rgba(14,42,82,0.4); padding: 8px 11px; white-space: nowrap;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
.bpshow .bpa__tip[hidden] { display: none; }
.bpshow .bpa__tip b { display: block; font-size: 13px; font-weight: 800; color: var(--bx-ink); margin-bottom: 3px; }
.bpshow .bpa__tip .row { display: flex; justify-content: space-between; gap: 18px; font-size: 11.5px; font-weight: 600; color: #2f4358; }
.bpshow .bpa__tip .row b { display: inline; font-size: 11.5px; color: var(--bx-ink); font-weight: 800; }

/* - live/demo stamp - */
.bpshow__stamp { position: absolute; top: clamp(18px, 2.2vw, 30px); right: clamp(20px, 2.4vw, 34px); z-index: 4; font-size: 10px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--bx-ink-3); opacity: 0.7; }
.bpshow__stamp[data-live="1"] { color: #157a3a; opacity: 1; }
.bpshow__stamp[data-live="1"]::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #16a34a; margin-right: 5px; vertical-align: 1px; animation: bpshow-pulse 2.2s ease-in-out infinite; }
@keyframes bpshow-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

@media (max-width: 860px) {
  .bpshow__slide { height: auto; min-height: clamp(430px, 96vw, 560px); }
  .bpshow__chart--mix, .bpshow__chart--forecaster { grid-template-columns: 1fr; gap: 18px; }
  .bpshow__pie { height: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  .bpshow__track { transition: none; }
  .bpshow__stamp[data-live="1"]::before { animation: none; }
}
