/* ============================================================
   Homepage Styles

   Built from the "MCA Homepage Refresh" design (hero variant A:
   full-bleed photo slideshow). Shared pieces — kicker, buttons,
   scrim, standards strip, section heads, panels, CTA band — live
   in site.css; this file only holds what is unique to the homepage.
   ============================================================ */

/* ── Hero slideshow ── */
.home-hero {
  position: relative;
  /* Hero + standards strip fill the first screen exactly */
  min-height: clamp(560px, calc(100vh - var(--header-h) - var(--strip-h)), 1000px);
  min-height: clamp(560px, calc(100svh - var(--header-h) - var(--strip-h)), 1000px);
  background: var(--dark);
  color: var(--white);
}
.home-slides {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.home-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.4s ease, transform 7s linear;
}
.home-slide.on { opacity: 1; transform: scale(1.12); }

.home-hero-copy {
  position: relative;
  padding-top: clamp(90px, 14vh, 150px);
  padding-bottom: 120px;
  pointer-events: none;
}
.home-hero-copy a { pointer-events: auto; }
.home-hero .kicker { color: var(--primary-hl); }
.home-hero h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(42px, 6.2vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 22px 0 24px;
  max-width: 13ch;
  color: var(--white);
  text-wrap: balance;
}
.home-hero h1 em { color: var(--primary-hl); }
.home-lede {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(18px, 1.7vw, 22px);
  line-height: 1.5;
  max-width: 520px;
  margin-bottom: 34px;
  color: rgba(250,247,241,0.88);
}

.home-slide-ui {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 32px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.home-slide-cap {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: rgba(250,247,241,0.8);
}
.home-dots { display: flex; gap: 8px; }
.home-dots button {
  width: 28px;
  height: 4px;
  border: none;
  border-radius: 2px;
  padding: 0;
  background: rgba(250,247,241,0.35);
  cursor: pointer;
  transition: background 0.3s, width 0.3s;
}
.home-dots button.on { background: var(--primary-hl); width: 44px; }

@media (prefers-reduced-motion: reduce) {
  .home-slide { transition: opacity 0.4s; transform: none !important; }
}

/* ── Live energy panel ──
   A frosted cream panel docked near the bottom of the hero, showing
   electricity and gas together (HOME-LIVE-PANEL-HANDOFF.md). Inside the
   hero from 1024px wide; below that, or when live-panel.js finds it would
   crowd the hero text (.live-panel-below), it is a normal card under the
   hero. Short screens get a compact one-line-per-system version. Source
   colours come from grid-palette.css. Colour only ever marks direction,
   always with an arrow and text. */
.home-top { position: relative; }

.live-panel-wrap { background: var(--paper); padding: 20px 0; }
.live-panel {
  --lp-ink: #18353F;
  --lp-muted: #55616D;
  --lp-rule: #DDD6CA;
  --lp-live: #15803D;
  --lp-up: #0F766E;
  --lp-down: #B45309;
  --lp-elec: var(--primary-deep);
  --lp-gas: #B45309;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 20px 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 4px solid var(--lp-live);
  border-radius: 10px;
  color: var(--lp-ink);
}
.live-panel-wrap.is-delayed .live-panel,
.live-panel-wrap.is-loading .live-panel { border-top-color: var(--src-other); }

/* Header row: LIVE badge, title, key, button */
.lp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--lp-rule);
}
.lp-status { display: flex; align-items: center; gap: 12px; }
.lp-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--lp-live);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.lp-pulse { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--white); animation: lp-pulse 2s ease-out infinite; }
.live-panel-wrap.is-delayed .lp-badge,
.live-panel-wrap.is-loading .lp-badge { background: var(--src-other); }
.live-panel-wrap.is-delayed .lp-pulse,
.live-panel-wrap.is-loading .lp-pulse { animation: none; }
@keyframes lp-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(22,163,74,0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}
@media (prefers-reduced-motion: reduce) { .lp-pulse { animation: none; } }
.lp-title { font-family: var(--font-sans); font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--lp-ink); }
.lp-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin-left: auto;
  font-size: 11px;
  color: var(--lp-muted);
}
.lp-key[hidden] { display: none; }
.lp-key:not([hidden]) + .lp-cta { margin-left: 0; }
.lp-key span, .lp-change { display: inline-flex; align-items: center; gap: 4px; }
.lp-key svg, .lp-change svg { width: 10px; height: 10px; fill: currentColor; flex-shrink: 0; }
.lp-key .lp-up, .lp-change.lp-up { color: var(--lp-up); font-weight: 600; }
.lp-key .lp-down, .lp-change.lp-down { color: var(--lp-down); font-weight: 600; }
.lp-cta { margin-left: auto; min-height: 34px; padding: 6px 16px; font-size: 13px; background: var(--primary-deep); color: var(--white); }
.lp-cta:hover { background: var(--heading); color: var(--white); }

/* One row per system: label | sentence and bar | trend line | figures */
.lp-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 20px;
}
.lp-row[hidden] { display: none; }
.lp-row + .lp-row { padding-top: 7px; border-top: 1px solid var(--lp-rule); }
.lp-row:not(:last-child) { padding-bottom: 7px; }
.lp-row--elec { --lp-sys: var(--lp-elec); }
.lp-row--gas  { --lp-sys: var(--lp-gas); }
.lp-label { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.lp-sys {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lp-sys);
}
.lp-sys i { display: block; width: 9px; height: 9px; border-radius: 2px; background: var(--lp-sys); }
.lp-time { font-size: 11px; line-height: 1.35; color: var(--lp-muted); }
.lp-time.is-old { color: var(--lp-down); font-weight: 600; }
.lp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 600;
  white-space: nowrap;
}
.lp-chip[hidden] { display: none; }
.lp-chip i { display: block; width: 6px; height: 6px; border-radius: 50%; }
.lp-chip--ok   { color: #166534; background: #DCFCE7; }
.lp-chip--ok i { background: #16A34A; }
.lp-chip--warn   { color: #92400E; background: #FEF3C7; }
.lp-chip--warn i { background: #D97706; }

.lp-main { min-width: 0; }
.lp-sentence { font-family: var(--font-serif); font-size: 17px; line-height: 1.3; color: var(--lp-ink); text-wrap: pretty; }
.live-panel-wrap.is-loading .lp-sentence { color: var(--lp-muted); }
.lp-bar {
  display: flex;
  gap: 2px;
  height: 5px;
  margin-top: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--paper-deep);
}
.lp-seg { flex: 1 1 0; min-width: 2px; background: var(--src); }
.lp-spark { color: var(--lp-sys); line-height: 0; }
.lp-spark[hidden] { display: none; }
.lp-spark svg { display: block; overflow: visible; }

.lp-figs { display: flex; gap: 20px; }
.lp-fig { display: flex; flex-direction: column; gap: 0; min-width: 92px; }
.lp-fig[hidden] { display: none; }
.lp-fig > span { font-size: 11px; line-height: 1.35; color: var(--lp-muted); }
.lp-fig b {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--lp-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lp-fig b small { font-size: inherit; font-weight: inherit; }
.lp-change { min-height: 15px; font-size: 11px; line-height: 1.35; color: var(--lp-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.lp-attrib { margin-top: 10px; font-size: 12px; line-height: 1.5; color: var(--text); }
.lp-attrib a { color: var(--primary-deep); text-decoration: underline; text-underline-offset: 2px; }

/* ── Docked in the hero (1024px and wider) ── */
@media (min-width: 1024px) {
  .home-top:not(.live-panel-below) .live-panel-wrap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    padding: 0 0 6px;
    background: none;
    pointer-events: none;
  }
  .home-top:not(.live-panel-below) .live-panel {
    pointer-events: auto;
    background: rgba(249,246,240,0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.6);
    border-top: 4px solid var(--lp-live);
    box-shadow: 0 12px 32px rgba(10,24,31,0.25);
  }
  .home-top:not(.live-panel-below) .live-panel-wrap.is-delayed .live-panel,
  .home-top:not(.live-panel-below) .live-panel-wrap.is-loading .live-panel { border-top-color: var(--src-other); }
  /* The licence lines sit under the panel, in the hero */
  .home-top:not(.live-panel-below) .lp-attrib {
    pointer-events: auto;
    margin-top: 4px;
    font-size: 11px;
    line-height: 16px;
    color: rgba(250,247,241,0.78);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .home-top:not(.live-panel-below) .lp-attrib a { color: inherit; }

  /* Hero text: a little less top space and a heading sized to the screen
     height, so the text clears the panel. Caption and dots sit above it. */
  .home-top.has-live-panel:not(.live-panel-below) .home-hero-copy { padding-top: clamp(24px, 3vh, 96px); padding-bottom: 0; }
  .home-top.has-live-panel:not(.live-panel-below) .home-hero h1 { font-size: clamp(42px, min(6.2vw, 6.6vh), 84px); margin: 16px 0 18px; }
  .home-top.has-live-panel:not(.live-panel-below) .home-lede { margin-bottom: 24px; }
  .home-top.has-live-panel:not(.live-panel-below) .home-slide-ui { bottom: calc(var(--lp-h, 300px) + 14px); }
}
/* Trend lines need the width */
@media (min-width: 1024px) and (max-width: 1279px) {
  .lp-spark { display: none; }
}

/* ── Compact: one line per system. live-panel.js chooses it on screens
   under 860px tall, or when the full panel would crowd the hero text. ── */
@media (min-width: 1024px) {
  .home-top.live-panel-compact .live-panel { gap: 8px; padding: 10px 20px 12px; }
  .home-top.live-panel-compact .lp-head { padding-bottom: 8px; }
  .home-top.live-panel-compact .lp-key,
  .home-top.live-panel-compact .lp-bar,
  .home-top.live-panel-compact .lp-spark,
  .home-top.live-panel-compact .lp-change,
  .home-top.live-panel-compact .lp-chip { display: none; }
  .home-top.live-panel-compact .lp-every { display: none; }
  .home-top.live-panel-compact .lp-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; }
  .home-top.live-panel-compact .lp-row + .lp-row { padding-top: 8px; }
  .home-top.live-panel-compact .lp-row:not(:last-child) { padding-bottom: 8px; }
  .home-top.live-panel-compact .lp-label { flex-direction: row; align-items: baseline; gap: 10px; width: 170px; white-space: nowrap; }
  .home-top.live-panel-compact .lp-sentence { font-size: 16px; }
  .home-top.live-panel-compact .lp-figs { gap: 16px; }
  .home-top.live-panel-compact .lp-fig { flex-direction: row; align-items: baseline; gap: 5px; min-width: 0; }
  .home-top.live-panel-compact .lp-fig > span { font-size: 11px; }
  .home-top.live-panel-compact .lp-fig b { font-size: 15px; }
  .home-top.live-panel-compact .lp-cta { margin-left: auto; min-height: 40px; padding-top: 9px; padding-bottom: 9px; }
}

/* ── Below the hero: rows stack ── */
@media (max-width: 1023px) {
  .lp-row { grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; }
  .lp-label { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
  .lp-main { grid-column: 1; }
  .lp-spark { grid-column: 2; grid-row: 2; }
  .lp-figs { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .lp-fig { min-width: 0; }
  .lp-key { margin-left: 0; order: 3; flex-basis: 100%; }
  .lp-cta { order: 4; min-height: 44px; }
}
@media (max-width: 600px) {
  .live-panel { padding: 14px 16px 16px; }
  .lp-spark { display: none; }
  .lp-row { grid-template-columns: minmax(0, 1fr); }
  .lp-sentence { font-size: 19px; }
  .lp-fig b { font-size: 17px; white-space: normal; }
  .lp-fig b small { display: block; font-size: 12px; font-weight: 500; line-height: 1.3; color: var(--lp-muted); }
  .lp-change { white-space: normal; }
  .lp-cta { width: 100%; margin-left: 0; }
}

/* ── Service cards ── */
.home-svc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 20px;
}
.home-svc {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.home-svc-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--white);
}
.home-svc-img--contain { object-fit: contain; }
.home-svc-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  padding: 22px 24px 24px;
}
.home-svc-n {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.4px;
  color: var(--primary);
}
.home-svc h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.home-svc-more {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text);
}
.home-svc:hover .home-svc-more { color: var(--primary); }

/* ── Tools ── */
.home-tool-grid {
  display: grid;
  grid-template-columns: minmax(0,1.4fr) minmax(0,1fr);
  gap: 20px;
}
.home-tcard {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  color: var(--heading);
}
a.home-tcard:hover { transform: none; }
.home-tag {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--white);
}
.home-tag--deep { background: var(--primary-deep); }
.home-tcard h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.1;
}
.home-tcard h3 a { color: inherit; }
.home-tcard h3 a:hover { color: var(--primary); opacity: 1; }
.home-tcard p { font-size: 14.5px; line-height: 1.6; color: var(--text); }
.home-tlist {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
  border-top: 1px solid var(--rule);
}
.home-tlist a {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14.5px;
  color: var(--heading);
}
.home-tlist a:hover { color: var(--primary); opacity: 1; }
.home-tlist a span:last-child {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .home-tool-grid { grid-template-columns: minmax(0,1fr); }
  .home-svc-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 600px) {
  .home-svc-grid { grid-template-columns: minmax(0,1fr); }
  .home-slide-ui { flex-direction: column-reverse; align-items: flex-start; }
}
