/* =========================================================================
   Central Gas — home hero, "From cold to warm"
   The page opens cold with the heating off; the logo's fire lights and the
   warmth spreads (assets/js/hero-warmth.js). Scoped under .cg-hero.
   Markup: template-parts/home/hero.php. Loaded on the front page only.
   ========================================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  --cg-frost: #070B14;      /* the cold house at night */
  --cg-ice: #A9BED8;        /* cold ink */
  --cg-ember: #0E1729;      /* warm base: deep site navy */
  --cg-flame: #F77F00;      /* brand flame */
  --cg-amber: #FFB627;      /* brand amber */
  --cg-red: #D62828;        /* brand red */
  --cg-water: #2FA4E7;      /* brand water */
  --cg-navy: #1E3A8A;       /* brand navy */
  --cg-ink: #FFF4E6;        /* warm white text */
  --cg-ink-2: rgba(255, 238, 220, .74);
  --cg-ink-3: rgba(255, 232, 210, .52);
  --cg-line: rgba(255, 228, 200, .14);
  --cg-display: var(--font-head);
  --cg-body: var(--font-body);
  --cg-gutter: clamp(20px, 5vw, 64px);
  --cg-ease: cubic-bezier(.22, .8, .22, 1);
}

/* ---------- 3. Hero shell ---------- */
.cg-hero {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* no-WebGL / reduced-motion fallback: the warm end state as a plain gradient */
  background:
    radial-gradient(60% 50% at 50% 30%, rgba(232, 88, 12, .26), transparent 70%),
    radial-gradient(90% 80% at 50% 35%, #22355a 0%, var(--navy) 45%, var(--cg-ember) 80%);
}
.cg-hero__sky {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: -1;
  display: block;
}
.js .cg-hero { background: var(--cg-frost); }
.js .cg-hero.no-gl { background:
    radial-gradient(60% 50% at 50% 30%, rgba(232, 88, 12, .26), transparent 70%),
    radial-gradient(90% 80% at 50% 35%, #22355a 0%, var(--navy) 45%, var(--cg-ember) 80%); }

/* ---------- 5. Hero layout ---------- */
.cg-hero__inner {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "stage" "copy";
  align-content: start;
  gap: 4px;
  padding: 8px var(--cg-gutter) 0;
}
.cg-stage { grid-area: stage; position: relative; }
.cg-copy  { grid-area: copy; position: relative; }

@media (min-width: 961px) {
  .cg-hero__inner {
    grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
    grid-template-areas: "copy stage";
    align-items: center;
    align-content: center;
    gap: clamp(24px, 4vw, 64px);
    padding: 0 var(--gutter);
    max-width: var(--container); width: 100%; margin: 0 auto;
  }
}

/* ---------- 6. Emblem (always whole) ---------- */
.cg-emblem {
  position: relative;
  width: min(100%, 460px);
  margin: 0 auto;
  aspect-ratio: 668 / 665;
}
.cg-emblem__fire,
.cg-emblem__parts,
.cg-emblem__parts img { position: absolute; }
.cg-emblem__parts { inset: 0; }
.cg-emblem__parts img { inset: 0; width: 100%; height: 100%; }
/* WebGL fire canvas: 60px padding around the 668x665 frame for its glow */
.cg-emblem__fire {
  left: calc(-60 / 668 * 100%);
  top: calc(-60 / 665 * 100%);
  width: calc(788 / 668 * 100%);
  height: calc(785 / 665 * 100%);
  pointer-events: none;
}
.cg-emblem.has-gl .cg-emblem__fireimg { visibility: hidden; }

/* cold → warm per part. Delay grows with distance from the gear so warmth
   visibly travels outward through the (whole, unmoved) emblem. */
.js .cg-emblem__parts img {
  filter: saturate(.08) brightness(.42) contrast(.9);
  transition: filter 1.1s var(--cg-ease);
}
.js .cg-emblem__parts .p-gear  { transition-delay: .15s; }
.js .cg-emblem__parts .p-roof  { transition-delay: .3s; }
.js .cg-emblem__parts .p-water { transition-delay: .5s; }
.js .cg-emblem.no-gl .cg-emblem__fireimg { filter: saturate(.08) brightness(.42); transition: filter 1s var(--cg-ease); }
.is-warm .cg-emblem__parts img,
.is-warm .cg-emblem.no-gl .cg-emblem__fireimg { filter: none; }

/* ---------- 7. Thermostat readout ---------- */
.cg-thermo {
  position: absolute;
  right: 0; bottom: -6px;
  display: flex; align-items: center; gap: 10px;
  color: var(--cg-ice);
  transition: color 1.2s var(--cg-ease) .6s;
  font-variant-numeric: tabular-nums;
}
.cg-thermo__dial { width: 44px; height: 44px; flex: none; }
.cg-thermo__track { stroke: rgba(169, 190, 216, .18); }
.cg-thermo__arc { stroke: currentColor; transition: stroke 1.2s var(--cg-ease) .6s; }
.cg-thermo__temp { font: 600 22px/1 var(--cg-display); letter-spacing: -.01em; display: block; }
.cg-thermo__state { font: 500 12px/1.2 var(--cg-body); opacity: .8; display: block; margin-top: 3px; }
.is-warm .cg-thermo { color: var(--cg-amber); }
@media (min-width: 961px) {
  .cg-thermo { right: -2%; bottom: -8px; }
  .cg-thermo__dial { width: 52px; height: 52px; }
  .cg-thermo__temp { font-size: 26px; }
}
@media (max-width: 960px) {
  .cg-thermo { bottom: auto; top: -4px; right: -4px; gap: 8px; }
  .cg-thermo__dial { width: 36px; height: 36px; }
  .cg-thermo__temp { font-size: 18px; }
  .cg-thermo__state { font-size: 11px; }
}

/* ---------- 8. Copy ---------- */
.cg-title {
  font: 700 clamp(36px, 9.6vw, 52px)/1.05 var(--cg-display);
  letter-spacing: -.03em;
  margin: 0 0 20px;
  text-wrap: balance;
  color: var(--cg-ink);
}
.cg-title .w { display: inline-block; }
@media (min-width: 961px) { .cg-title { font-size: clamp(44px, 4.2vw, 60px); } }
.js .cg-title .w {
  color: var(--cg-ice);
  opacity: .42;
  filter: blur(4px);
  transform: translateY(.06em);
  transition: color 1s var(--cg-ease), opacity .9s var(--cg-ease), filter .9s var(--cg-ease), transform 1s var(--cg-ease);
}
.is-warm .cg-title .w { color: var(--cg-ink); opacity: 1; filter: none; transform: none; }
.is-warm .cg-title .w:nth-child(1) { transition-delay: .55s; }
.is-warm .cg-title .w:nth-child(2) { transition-delay: .62s; }
.is-warm .cg-title .w:nth-child(3) { transition-delay: .69s; }
.is-warm .cg-title .w:nth-child(4) { transition-delay: .76s; }
.is-warm .cg-title .w:nth-child(5) { transition-delay: .83s; }
.is-warm .cg-title .w:nth-child(6) { transition-delay: .95s; }
.is-warm .cg-title .w:nth-child(7) { transition-delay: 1.02s; }

.cg-lede {
  max-width: 30em;
  text-wrap: pretty;
  margin: 0 0 26px;
  font-size: clamp(16px, 1.25vw, 18px);
  line-height: 1.55;
  color: var(--cg-ink-2);
}
.js .cg-lede, .js .cg-ctas {
  opacity: 0; transform: translateY(8px);
  transition: opacity .8s var(--cg-ease), transform .8s var(--cg-ease);
}
.is-warm .cg-lede { opacity: 1; transform: none; transition-delay: 1.15s; }
.is-warm .cg-ctas { opacity: 1; transform: none; transition-delay: 1.3s; }

.cg-ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.cg-trust {
  list-style: none; margin: 22px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  font-size: 14px; line-height: 1.3; color: var(--cg-ink-2);
}
.cg-trust li { display: inline-flex; align-items: center; gap: 7px; }
.cg-trust svg { width: 15px; height: 15px; flex: none; color: #3CD872; }
.cg-hero .cg-trust a { text-decoration: none; border-bottom: 1px dotted var(--cg-ink-3); }
.cg-hero .cg-trust a:hover { color: #fff; border-bottom-color: #fff; }
.js .cg-trust { opacity: 0; transition: opacity .8s var(--cg-ease); }
.is-warm .cg-trust { opacity: 1; transition-delay: 1.45s; }
.cg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 24px;
  border-radius: 999px;
  font: 600 16px/1 var(--cg-body);
  text-decoration: none;
  transition: background-color .25s, border-color .25s, transform .25s var(--cg-ease);
}
.cg-btn svg { width: 20px; height: 20px; flex: none; }
.cg-btn:active { transform: scale(.98); }
.cg-btn--call {
  background: var(--flame-700);
  color: #fff;
  box-shadow: 0 10px 40px -10px rgba(232, 88, 12, .7);
}
.cg-btn--call:hover { background: var(--flame-ink); }
.cg-btn--call .cg-btn__num { opacity: 1; }
.cg-btn--book {
  background: #fff;
  color: var(--navy);
}
.cg-btn--book svg { color: var(--flame-700); }
.cg-btn--book:hover { background: var(--cg-ink); }
.cg-btn--wa {
  width: 54px; padding: 0;
  color: var(--cg-ink);
  border: 2px solid rgba(255, 255, 255, .5);
  background: transparent;
}
.cg-btn--wa svg { width: 24px; height: 24px; }
.cg-btn--wa svg { color: #3CD872; }
.cg-btn--wa:hover { border-color: #fff; background: rgba(255, 255, 255, .1); }
.cg-btn__num { font-variant-numeric: tabular-nums; font-weight: 500; opacity: .8; }

@media (max-width: 960px) {
  .cg-copy { padding-top: 22px; }
  .cg-ctas .cg-btn { flex: 1 1 0; padding: 0 16px; }
  .cg-ctas .cg-btn--wa { flex: none; padding: 0; }
  .cg-ctas .cg-btn { gap: 7px; padding: 0 12px; font-size: 15px; white-space: nowrap; }
  .cg-ctas .cg-btn svg { width: 18px; height: 18px; }
  .cg-ctas .cg-btn--wa { padding: 0; }
  .cg-btn__num { display: none; }
}

/* ---------- 9. Services: a heating "pipe" that warms left to right ---------- */
.cg-services {
  position: relative;
  margin: 40px var(--cg-gutter) 0;
  padding: 0 0 max(28px, env(safe-area-inset-bottom));
}
.cg-services__title {
  font: 600 15px/1.3 var(--cg-display);
  color: var(--cg-ink-3);
  margin: 0 0 6px;
}
.cg-pipe {
  position: relative; height: 2px; border-radius: 2px;
  background: rgba(169, 190, 216, .16);
  overflow: hidden;
}
.cg-pipe::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--cg-water), var(--cg-amber) 38%, var(--cg-flame) 70%, var(--cg-red));
  transform-origin: left center;
}
.js .cg-pipe::after { transform: scaleX(0); transition: transform 1.4s var(--cg-ease) 1.2s; }
.is-warm .cg-pipe::after { transform: none; }

.cg-services ul { list-style: none; margin: 0; padding: 0; display: grid; }
.cg-svc {
  display: grid;
  grid-template-columns: 28px 1fr 16px;
  align-items: center;
  gap: 14px;
  padding: 15px 0;
  text-decoration: none;
  border-bottom: 1px solid var(--cg-line);
}
.cg-svc__icon { width: 26px; height: 26px; color: var(--cg-amber); }
.cg-svc__name { display: block; font: 600 17px/1.25 var(--cg-display); letter-spacing: -.005em; color: var(--cg-ink); }
.cg-svc__note { display: block; font-size: 13.5px; line-height: 1.35; color: var(--cg-ink-3); margin-top: 2px; }
.cg-svc__go { width: 16px; height: 16px; color: var(--cg-ink-3); transition: transform .25s var(--cg-ease), color .25s; }
.cg-svc:hover .cg-svc__go { transform: translateX(3px); color: var(--cg-amber); }
.cg-svc:hover .cg-svc__name { color: #fff; }
.js .cg-services li { opacity: 0; transition: opacity .8s var(--cg-ease); }
.is-warm .cg-services li { opacity: 1; }
.is-warm .cg-services li:nth-child(1) { transition-delay: 1.35s; }
.is-warm .cg-services li:nth-child(2) { transition-delay: 1.45s; }
.is-warm .cg-services li:nth-child(3) { transition-delay: 1.55s; }
.is-warm .cg-services li:nth-child(4) { transition-delay: 1.65s; }
.is-warm .cg-services li:nth-child(5) { transition-delay: 1.75s; }

@media (min-width: 961px) {
  .cg-services { max-width: calc(var(--container) - 2 * var(--gutter)); width: calc(100% - 2 * var(--gutter)); margin: 56px auto 0; padding-bottom: 36px; }
  .cg-services__title { position: absolute; top: -28px; left: 0; }
  .cg-services ul { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .cg-svc {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 10px;
    padding: 22px 22px 6px 0;
    border-bottom: 0;
    height: 100%;
  }
  .cg-services li + li .cg-svc { padding-left: 22px; border-left: 1px solid var(--cg-line); }
  .cg-svc__go { display: none; }
  .cg-svc__name { font-size: 17px; }
}

/* ---------- 12. Reduced motion: warm end state, no transitions ---------- */
@media (prefers-reduced-motion: reduce) {
  .cg-hero *, .cg-hero *::after { transition: none !important; }
}

/* ---------- 13. Theme integration ---------- */
.cg-hero {
  margin-block-start: calc(-1 * var(--header-h));
  padding-block-start: var(--header-h);
  color: var(--cg-ink);
  font-family: var(--cg-body);
}
.cg-hero a { color: inherit; }
.cg-hero .cg-btn--book { color: var(--navy); }
.cg-hero img { max-width: none; }
.cg-hero .cg-emblem img { display: block; }
.cg-hero__inner { padding-block-start: clamp(8px, 3vh, 32px); }
