/* ==========================================================================
   Home hero: "Frost to warmth" with the thermostat dial on desktop.
   Full-height dark hero, content vertically centred. Frost grows in from the
   edges, a warm wave melts it outward from the Get a Free Quote button, and
   on desktop the dial sweeps 12 -> 21 C as the melt passes.
   Only transform/opacity/text-shadow animate; the canvas and the dial are
   absolutely positioned, so nothing shifts layout. No images: the h1 is the LCP.
   ========================================================================== */

.hx {
  --hx-ink: #00142a;
  --hx-warm: #e8722a;
  --hx-pad-top: 72px;
  --hx-pad-bottom: 96px;
  position: relative;
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100svh - var(--header-height));
  /* Vertical centring: the two 1fr rows share the spare height equally. Their minimums keep clear of the
     header (top) and the scroll cue (bottom). If the content doesn't fit, the hero grows instead of overlapping. */
  display: grid;
  grid-template-rows: minmax(var(--hx-pad-top), 1fr) auto minmax(var(--hx-pad-bottom), 1fr);
  overflow: hidden;
  isolation: isolate;
  background-color: var(--hx-ink);
  background-image:
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(0, 77, 148, .55), transparent 70%),
    linear-gradient(180deg, #001b38 0%, var(--hx-ink) 100%);
  color: #fff;
}
.hx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; }
.hx-glow { position: absolute; inset: 0; z-index: -3; pointer-events: none; opacity: 0; }
.hx-shade { position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(90deg, rgba(0, 20, 42, .78) 0%, rgba(0, 20, 42, .4) 55%, transparent 100%); }

.hx-content { position: relative; width: 100%; grid-row: 2; }
.hx-inner { max-width: 760px; }

.hx-tag {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--color-orange-light); margin: 0 0 22px;
}
.hx-tag .stars { color: var(--color-gold); letter-spacing: .12em; }
.hx-tag .sep { width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, .45); }
.hx-tag .muted { color: rgba(255, 255, 255, .75); letter-spacing: .08em; }

.hx h1 {
  font-size: clamp(2.6rem, 6.6vw, 5.6rem);
  font-weight: 700;
  line-height: .98;
  letter-spacing: -.035em;
  color: #fff;
  margin: 0 0 26px;
  text-shadow: 0 2px 40px rgba(0, 10, 25, .55);
  text-wrap: balance;
}
.hx h1 .warm { color: var(--hx-warm); }

.hx-lead { font-size: clamp(17px, 1.6vw, 20px); line-height: 1.6; color: rgba(255, 255, 255, .86); max-width: 620px; margin: 0 0 22px; }
.hx-badge {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--color-cyan-light);
  padding: 7px 16px; border: 1px solid rgba(145, 215, 255, .28); border-radius: 999px;
  background: rgba(0, 57, 110, .35); margin: 0 0 34px;
}
.hx-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--color-red-light); box-shadow: 0 0 0 3px rgba(201, 67, 71, .25); flex: none; }
.hx-ctas { display: flex; flex-wrap: wrap; gap: 14px; }
.hx-ctas .btn-lg { font-size: 18px; padding: 18px 34px; }
.hx-ctas .btn-primary { box-shadow: 0 10px 30px rgba(232, 114, 42, .35); }
.hx-ctas .btn-outline { border-color: rgba(255, 255, 255, .55); }
.hx-ctas .btn svg { margin-right: 8px; }

/* Scroll cue, pinned to the bottom of the hero */
.hx-cue { position: absolute; left: 50%; bottom: 24px; width: 26px; height: 42px; margin-left: -13px; border: 2px solid rgba(255, 255, 255, .35); border-radius: 14px; }
.hx-cue::after { content: ""; position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--color-orange); animation: hx-cue 1.8s 4s 3 both; }
@keyframes hx-cue { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

/* Staggered entrance (the h1 is NOT faded, so LCP isn't delayed) */
.hx-in { animation: hx-up .7s cubic-bezier(.2, .7, .2, 1) both; animation-delay: var(--d, 0s); }
@keyframes hx-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Warm glow: fades in on the melt, then a slow breathe is the only idle motion */
.hx-glow::before, .hx-glow::after { content: ""; position: absolute; inset: 0; }
.hx-glow::before { background: radial-gradient(ellipse 70% 75% at 22% 82%, rgba(232, 114, 42, .34), rgba(232, 114, 42, .08) 50%, transparent 75%); }
.hx-glow::after { background: radial-gradient(ellipse 50% 60% at 85% 20%, rgba(255, 196, 120, .12), transparent 70%); }
.hx-playing .hx-glow { animation: hx-fade 1.6s 1.9s ease-out forwards; }
.hx-settled .hx-glow { opacity: 1; }
.hx-settled .hx-glow::before { animation: hx-breathe 9s ease-in-out infinite alternate; }
.hx-settled .hx-glow::after { animation: hx-breathe 9s -4.5s ease-in-out infinite alternate; }
@keyframes hx-fade { to { opacity: 1; } }
@keyframes hx-breathe { from { opacity: 1; } to { opacity: .72; } }

/* "Heating" thaws from icy blue to warm orange as the melt passes */
.hx-playing h1 .warm { animation: hx-thaw 2.4s .2s ease-out both; }
.hx-settled h1 .warm { color: var(--hx-warm); text-shadow: 0 0 18px rgba(232, 114, 42, .25); }
@keyframes hx-thaw {
  0%, 45% { color: #cfeeff; text-shadow: 0 0 16px rgba(191, 233, 255, .6); }
  70% { color: var(--hx-warm); text-shadow: 0 0 30px rgba(255, 170, 80, .9); }
  100% { color: var(--hx-warm); text-shadow: 0 0 18px rgba(232, 114, 42, .25); }
}

/* ---------- Thermostat dial (desktop only) ---------- */
.hx-dial { display: none; }
@media (min-width: 1024px) {
  .hx { --dial-w: clamp(300px, 32vw, 500px); }
  /* keep the text column clear of the dial */
  .hx-inner { max-width: min(760px, calc(100% - var(--dial-w) - 32px)); }
  .hx-dial {
    display: block; position: absolute; z-index: -2; pointer-events: none;
    top: 50%; right: max(24px, calc((100% - var(--container-max)) / 2 + var(--container-padding)));
    width: var(--dial-w); aspect-ratio: 1;
    transform: translateY(-50%);
  }
  /* warm halo behind the dial, lit when it lands on 21 */
  .hx-dial::before {
    content: ""; position: absolute; inset: -30%; z-index: -1; border-radius: 50%; opacity: 0;
    background: radial-gradient(circle, rgba(232, 114, 42, .30), rgba(232, 114, 42, .06) 45%, transparent 70%);
    transition: opacity 1.4s ease-out;
  }
  .hx-landed .hx-dial::before { opacity: 1; }
}
.hx-dial svg { width: 100%; height: 100%; display: block; overflow: visible; opacity: 0; }
.hx-dial .tick { stroke: rgba(255, 255, 255, .14); stroke-width: 2.4; stroke-linecap: round; }
.hx-dial .tick.major { stroke-width: 3.4; }
.hx-dial .track { fill: none; stroke: rgba(255, 255, 255, .07); stroke-width: 12; stroke-linecap: round; }
.hx-dial .arc { fill: none; stroke: url(#hx-dial-grad); stroke-width: 12; stroke-linecap: round; filter: drop-shadow(0 0 10px rgba(232, 114, 42, .45)); }
.hx-dial .face { fill: rgba(0, 27, 56, .55); stroke: rgba(255, 255, 255, .08); stroke-width: 1.5; }
.hx-dial .knob { fill: #fff; filter: drop-shadow(0 0 8px rgba(255, 190, 120, .9)); }
.hx-dial .num { font-family: inherit; font-weight: 700; font-size: 128px; letter-spacing: -.04em; fill: #fff; font-variant-numeric: tabular-nums; }
.hx-dial .deg { font-weight: 600; font-size: 46px; fill: var(--color-orange-light); }
.hx-dial .lbl { font-weight: 600; font-size: 15px; letter-spacing: .28em; fill: rgba(255, 255, 255, .6); }
.hx-dial .st { opacity: 0; transition: opacity .35s ease; }
.hx-dial[data-state="cold"] .st-cold, .hx-dial[data-state="comfort"] .st-comfort, .hx-dial[data-state="hot"] .st-hot { opacity: 1; }

@media (max-width: 768px) {
  .hx { --hx-pad-top: 40px; --hx-pad-bottom: 84px; }
  .hx-shade { background: linear-gradient(180deg, rgba(0, 20, 42, .5) 0%, rgba(0, 20, 42, .42) 70%, rgba(0, 20, 42, .1) 100%); }
  .hx h1 { font-size: clamp(2.35rem, 11vw, 3.4rem); }
  .hx-tag { font-size: 13px; letter-spacing: .12em; flex-wrap: wrap; row-gap: 4px; margin-bottom: 16px; }
  .hx-tag .sep { display: none; }
  .hx-badge { font-size: 13px; border-radius: 14px; align-items: flex-start; text-align: left; }
  .hx-badge::before { margin-top: 6px; }
  .hx-ctas .btn { width: 100%; }
  .hx-ctas .btn-lg { padding: 16px 20px; }
}

/* Short screens (small phones, landscape): content won't fit centred, so top-align it under the header */
@media (max-height: 700px) {
  .hx { grid-template-rows: var(--hx-pad-top) auto minmax(var(--hx-pad-bottom), 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .hx-in, .hx-cue::after, .hx-glow, .hx * { animation: none !important; transition: none !important; }
  .hx-glow { opacity: 1; }
}
