/* ============================================================
   Ricky's Gutters: storm hero

   The base is THE brand gradient: linear-gradient(to right, #0043ea, #00c8ff).
   It is always visible and is never replaced. The storm only darkens over it.
   Clouds pan back and forth (the original `alternate` behaviour, kept on
   purpose) and go dark and heavy during the storm phase via a filter that
   js/storm.js drives through --storm-cloud-filter.
   ============================================================ */

.rg-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;

  /* THE brand gradient. Exactly this, nothing layered over it. */
  background-image: linear-gradient(to right, #0043ea 0%, #00c8ff 100%);

  /* defaults so the hero is right before storm.js runs */
  --storm-far: .85;
  --storm-mid: .70;
  --storm-near: .50;
  --storm-scrim: 0;
  --storm-cloud-filter: brightness(1.06) contrast(1.02);
}

/* ---------- cloud layers ---------- */

.rg-hero__clouds { position: absolute; inset: 0; pointer-events: none; }

.rg-hero__cloud {
  position: absolute; inset: 0;
  transition: opacity 4.8s cubic-bezier(.45,.05,.55,.95);
  will-change: opacity;
}
.rg-hero__cloud i {
  position: absolute; inset: 0;
  display: block;
  background-image: url('/assets/cloud-hero-cut-fade-desktop.webp');
  background-repeat: no-repeat;
  background-position: 0% center;

  /* Sized by HEIGHT, never `cover`. The plate is 2951x768 (aspect 3.84), so
     sizing off height guarantees it is always wider than the hero and there
     is always horizontal slack to pan through. */
  background-size: auto 118%;

  /* Percent panning cannot expose bare gradient. The softened curve slows the
     plate naturally before each reversal instead of snapping direction. */
  animation-name: rg-cloud-pan;
  animation-timing-function: cubic-bezier(.45,.05,.55,.95);
  animation-iteration-count: infinite;
  animation-direction: alternate;

  filter: var(--storm-cloud-filter);
  transition: filter 4.8s cubic-bezier(.45,.05,.55,.95);
  will-change: background-position, filter;
}

@keyframes rg-cloud-pan {
  from { background-position-x: 0%; }
  to   { background-position-x: 100%; }
}
@keyframes rg-cloud-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

/* The three layers share one image, so without differentiation the same cloud
   silhouette shows up two or three times at once. Each layer gets a different
   crop (size + vertical offset), the far one is mirrored, and negative delays
   start them at different points so they never travel in lockstep. */

.rg-hero__cloud--far { opacity: var(--storm-far); }
.rg-hero__cloud--far i {
  mix-blend-mode: screen;
  background-size: auto 138%;
  background-position-y: 22%;
  transform: scaleX(-1);          /* mirrored, different silhouette */
  animation-duration: 205s;
  animation-delay: -62s;
  filter: var(--storm-cloud-filter) blur(3px);
}

/* mid + near sit on normal blend so the storm filter can darken them into
   thunderheads. On screen blend, darkening just fades them out */
.rg-hero__cloud--mid { opacity: var(--storm-mid); }
.rg-hero__cloud--mid i {
  mix-blend-mode: normal;
  background-size: auto 112%;
  background-position-y: 46%;
  animation-duration: 128s;
}

.rg-hero__cloud--near { opacity: var(--storm-near); animation: rg-cloud-bob 34s ease-in-out infinite; }
.rg-hero__cloud--near i {
  mix-blend-mode: normal;
  background-size: auto 165%;     /* zoomed right in, so the shapes read bigger */
  background-position-y: 72%;
  animation-duration: 82s;
  animation-delay: -37s;
}

/* ---------- overlays ---------- */

/* Storm darkening is switched OFF: the gradient stays exactly the same
   through every phase. The mechanism is left in place. Set the phase
   `scrim` values in js/storm.js back above 0 to re-enable it. */
.rg-hero__scrim {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, var(--rg-navy-ink) 0%, rgba(0,27,74,.42) 46%, rgba(0,27,74,.06) 78%);
  opacity: var(--storm-scrim);
  transition: opacity 4.8s cubic-bezier(.45,.05,.55,.95);
  will-change: opacity;
}
.rg-hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.rg-hero__house { position: absolute; bottom: 0; left: 0; width: 100%; pointer-events: none; }
.rg-hero__house img { display: block; width: 100%; height: auto; }

/* ---------- content ---------- */

.rg-hero__inner {
  position: relative; z-index: 2;
  max-width: var(--rg-max);
  margin: 0 auto;
  padding: 64px var(--rg-gutter) 88px;
  display: flex; gap: 56px; align-items: flex-start;
}
.rg-hero__copy { width: 100%; padding-top: 8px; }

/* ---------- the form section ----------
   Narrow/tablet: a centered section below the hero so the form never squeezes.
   Desktop (>=1120px): stacked over the hero on the right, with a reserved
   content lane so copy cannot slide underneath it. */

.rg-formsec {
  background: var(--rg-navy);
  padding: 0;
}
.rg-formsec__in { max-width: none; margin: 0 auto; padding: 0; }
.rg-formsec .rg-qf {
  border-radius: 0;
  box-shadow: none;
}

@media (min-width: 1120px) {
  .rg-heroblock {
    position: relative;
    --rg-form-w: clamp(390px, 34vw, 520px);
    --rg-form-gap: clamp(36px, 4.5vw, 72px);
  }

  .rg-hero { min-height: 710px; }
  .rg-hero__inner {
    min-height: 710px;
    padding-top: 64px;
    padding-right: calc(var(--rg-gutter) + var(--rg-form-w) + var(--rg-form-gap));
    padding-bottom: 64px;
    padding-left: var(--rg-gutter);
    align-items: center;
  }
  .rg-hero__copy { width: 100%; max-width: 690px; padding-top: 0; }

  .rg-formsec {
    position: absolute;
    inset: 0;
    background: none;
    padding: 0;
    z-index: 3;
    /* only the card itself should catch the pointer. The rest of this layer
       sits over the hero copy and must not swallow its clicks */
    pointer-events: none;
    align-self: stretch;
  }
  .rg-formsec__in {
    width: 100%;
    max-width: var(--rg-max);
    min-height: 710px;
    padding: 64px var(--rg-gutter);
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
  .rg-formsec .rg-qf {
    width: var(--rg-form-w);
    border-radius: var(--rg-r-lg);
    box-shadow: var(--rg-shadow-card);
    pointer-events: auto;
    transform: translateY(-34px);
  }
}

@media (min-width: 1120px) and (max-width: 1280px) {
  .rg-hero,
  .rg-hero__inner,
  .rg-formsec__in { min-height: 680px; }
  .rg-hero__inner { gap: 26px; padding-top: 48px; padding-bottom: 48px; }
  .rg-hero__copy { max-width: 630px; }
}

/* ---------- weather badge ---------- */

.rg-hero__badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(0,27,74,.42);
  border: 1px solid rgba(127,219,255,.5);
  border-radius: var(--rg-r-pill);
  padding: 6px 12px;
  color: #EAF7FF;
  font-family: var(--rg-font-head);
  font-size: .75rem;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  backdrop-filter: blur(3px);
  overflow: hidden;
}
.rg-hero__badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--rg-cyan-light);
  flex: 0 0 7px;
  box-shadow: 0 0 0 0 rgba(127,219,255,.75);
  animation: rg-pulse 2.4s ease-out infinite;
}
@keyframes rg-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(127,219,255,.7); }
  70%  { box-shadow: 0 0 0 11px rgba(127,219,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(127,219,255,0); }
}
/* Keep rotating proof points readable throughout each change. */
.rg-hero__badge [data-storm-label] { display: inline-block; }
/* storm phase turns the badge hot */
.rg-hero[data-phase="storm"] .rg-hero__badge {
  background: rgba(0,15,44,.6);
  border-color: rgba(255,255,255,.7);
  color: #fff;
}
.rg-hero[data-phase="storm"] .rg-hero__badge .dot { background: #fff; }

/* ---------- headline ---------- */

.rg-hero__title {
  font-family: var(--rg-font-head);
  font-size: clamp(2.7rem, 1.8rem + 2.1vw, 3.65rem);
  line-height: 1.03;
  font-weight: 900;
  color: var(--rg-on-dark);
  margin: 20px 0 0;
  letter-spacing: 0;
  text-wrap: balance;
  text-shadow: 0 2px 4px rgba(0,20,56,.34), 0 6px 26px rgba(0,20,56,.30);
}
.rg-hero__title span { display: inline-block; }
.rg-hero__lede {
  font-size: var(--rg-body);
  line-height: 1.6;
  color: #fff;
  max-width: 620px;
  margin: 16px 0 0;
  text-shadow: 0 1px 2px rgba(0,20,56,.62), 0 2px 10px rgba(0,20,56,.45);
}
.rg-hero__rainline {
  display: inline-block;
  font-weight: 800;
}
.rg-hero__rainmessage {
  display: block;
  margin-top: 2px;
}

@media (min-width: 561px) {
  .rg-hero__rainmessage { white-space: nowrap; }
}

/* ---------- calls to action ---------- */

/* Call button and reviews card sit side by side, left to right */
.rg-hero__actions {
  display: flex; align-items: stretch; gap: 16px;
  margin-top: 28px; flex-wrap: wrap;
}

.rg-btn-call {
  display: inline-flex; align-items: center; justify-content: center; gap: 11px;
  background: var(--rg-action);
  color: var(--rg-action-ink);
  padding: 0 30px;
  border-radius: var(--rg-r-md);
  min-height: 68px;
  font-family: var(--rg-font-head);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: .2px;
  text-decoration: none;
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.rg-btn-call img {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  filter: brightness(0) saturate(100%) invert(11%) sepia(28%) saturate(1486%) hue-rotate(176deg) brightness(95%) contrast(93%);
}
.rg-btn-call:hover {
  background: var(--rg-action-hover); color: var(--rg-action-ink);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0,20,56,.34);
}
.rg-btn-call:active { transform: translateY(0); }
/* ---------- the reviews block: the loudest trust signal in the hero ---------- */

.rg-hero__reviews {
  position: relative;
  display: flex; align-items: center; gap: 18px;
  margin-top: 0;
  padding: 12px 18px;
  max-width: 460px;
  border-radius: var(--rg-r-md);
  border: 1px solid rgba(127,219,255,.52);
  background: linear-gradient(135deg, rgba(255,255,255,.98) 0%, rgba(244,251,255,.96) 100%);
  box-shadow: 0 16px 34px rgba(0,20,56,.30), inset 0 1px 0 rgba(255,255,255,.88);
  text-decoration: none;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.rg-hero__reviews::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, rgba(127,219,255,.18) 46%, transparent 62%);
  opacity: .62;
  transform: translateX(-120%);
  transition: transform .55s ease;
}
.rg-hero__reviews:hover {
  transform: translateY(-2px);
  border-color: rgba(0,200,255,.72);
  box-shadow: 0 20px 42px rgba(0,20,56,.38), inset 0 1px 0 rgba(255,255,255,.9);
}
.rg-hero__reviews:hover::before { transform: translateX(120%); }
.rg-hero__reviews .g { width: 38px; height: 38px; flex: 0 0 38px; }
.rg-hero__reviews .score {
  font-family: var(--rg-font-head);
  font-size: 2.1rem; font-weight: 900; color: var(--rg-navy);
  line-height: 1; letter-spacing: 0;
}
.rg-hero__reviews .meta { display: flex; flex-direction: column; gap: 4px; }
.rg-hero__reviews .stars { display: flex; gap: 2px; }
.rg-hero__reviews .stars img {
  width: 16px;
  height: 16px;
  transform-origin: center;
  animation: rg-star-glint 6.2s ease-in-out infinite;
}
.rg-hero__reviews .stars img:nth-child(2) { animation-delay: .12s; }
.rg-hero__reviews .stars img:nth-child(3) { animation-delay: .24s; }
.rg-hero__reviews .stars img:nth-child(4) { animation-delay: .36s; }
.rg-hero__reviews .stars img:nth-child(5) { animation-delay: .48s; }
@keyframes rg-star-glint {
  0%, 62%, 100% { filter: none; transform: scale(1); }
  70% { filter: drop-shadow(0 0 6px rgba(249,168,37,.85)) brightness(1.18); transform: scale(1.14); }
  78% { filter: none; transform: scale(1); }
}
.rg-hero__reviews .count {
  font-size: var(--rg-helper); font-weight: 500; color: var(--rg-text-body); white-space: nowrap;
}
.rg-hero__reviews .count b { color: var(--rg-navy); font-weight: 800; }
.rg-hero__reviews .go {
  margin-left: auto;
  color: var(--rg-navy);
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: #E8F5FF;
  box-shadow: inset 0 0 0 1px rgba(0,58,147,.12);
  transition: transform .2s ease, background .2s ease, color .2s ease;
}
.rg-hero__reviews .go svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-origin: center;
  transition: transform .2s ease;
}
.rg-hero__reviews:hover .go { background: var(--rg-navy); color: #fff; }
.rg-hero__reviews:hover .go svg { transform: scale(1.16); }

/* ---------- responsive ---------- */

/* Laptop range: the call button + reviews card were overflowing the ~465px
   copy column and wrapping onto two rows. Tighten the card so they stay on
   one line, drop the arrow (the whole card is still a link), and cap the
   headline so it stops breaking onto four lines. */
@media (min-width: 1120px) and (max-width: 1280px) {
  .rg-hero__inner { gap: 26px; padding-top: 48px; padding-bottom: 48px; }
  .rg-hero__actions { gap: 10px; flex-wrap: nowrap; }
  .rg-hero__title { font-size: clamp(2.55rem, 1.35rem + 1.7vw, 3rem); letter-spacing: 0; }
  .rg-btn-call { padding: 0 16px; font-size: 1rem; gap: 8px; min-height: 62px; }
  .rg-btn-call img { width: 20px; height: 20px; }
  .rg-hero__reviews { gap: 9px; padding: 10px; min-height: 62px; }
  .rg-hero__reviews .g { width: 28px; height: 28px; flex: 0 0 28px; }
  .rg-hero__reviews .score { font-size: 1.5rem; }
  .rg-hero__reviews .stars img { width: 12px; height: 12px; }
  .rg-hero__reviews .count { font-size: 12px; }
  .rg-hero__reviews .go {
    width: 30px;
    min-width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
  .rg-hero__reviews .go svg { width: 16px; height: 16px; }
}

/* Between 1100 and 1280 there is room, just not much, so trim the card a little */
@media (min-width: 1101px) and (max-width: 1280px) {
  .rg-hero__actions { gap: 12px; flex-wrap: nowrap; }
  .rg-btn-call { padding: 0 22px; font-size: 1.1rem; }
  .rg-hero__reviews { gap: 12px; padding: 10px 14px; }
  .rg-hero__reviews .score { font-size: 1.75rem; }
}

@media (min-width: 1120px) {
  .rg-hero__title span { white-space: nowrap; }
}

@media (max-width: 1119px) {
  .rg-hero__inner { flex-direction: column; padding: 28px var(--rg-gutter) 56px; gap: 24px; }
  .rg-hero__copy { width: 100%; max-width: 720px; }
  .rg-hero__title { letter-spacing: 0; }
  .rg-hero__lede { max-width: none; }
  .rg-hero__actions { flex-direction: column; gap: 12px; width: 100%; max-width: 520px; }
  .rg-btn-call { width: 100%; min-height: 60px; font-size: 1.15rem; }
  .rg-hero__reviews { width: 100%; }
  /* The house/gutter photo is back on mobile. Cropped to a band rather than
     shown at its full 1.19 aspect, which at 375px would eat 315px of height. */
  /* Desktop anchors the image to the hero's bottom edge, so the visible band
     is the BOTTOM of the plate: the roofline and gutter run. Mobile crops to
     the same place instead of the middle of the sky. */
  /* The whole house sits behind the content, uncropped, anchored to the hero's
     bottom edge, same as desktop. The reviews card overlaps its upper part
     rather than the content reserving a strip above it. */
  /* The plate is a cutout whose top fades to fully transparent. Alpha is 0
     for the top 30%, ~100 at 75% down, and only solid in the last 6%. So the
     real house lives in the bottom quarter of the file. At 100% width that
     quarter is only ~75px tall on a phone and lands below the reviews card,
     leaving a dead strip. Scaling to 200% and centring puts the solid part
     directly under the card. Desktop needs none of this: the image is 1194px
     there, so its bottom quarter is already ~300px. */
  .rg-hero__house {
    height: auto;
    width: 170%;
    left: 54%;
    transform: translateX(-50%);
  }
  .rg-hero__house img { width: 100%; height: auto; }

  .rg-hero__cloud i { background-image: url('/assets/cloud-hero-cut-fade-mobile2.webp'); }

  .rg-hero__reviews { max-width: none; padding: 12px 14px; gap: 12px; }
  .rg-hero__reviews .score { font-size: 1.9rem; }
  .rg-hero__reviews .count { white-space: normal; }
}

@media (max-width: 560px) {
  .rg-hero__inner { padding-bottom: 20px; }
  .rg-hero__house { width: 158%; left: 56%; }
}

@media (max-width: 544px) {
  .rg-hero__title {
    font-size: clamp(1.65rem, 1.12rem + 2.5vw, 2rem);
    line-height: 1.08;
    letter-spacing: 0;
    text-wrap: balance;
  }
  .rg-hero__title span {
    max-width: 100%;
  }
}

@media (max-width: 360px) {
  .rg-hero__title span { display: inline; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .rg-hero__cloud i,
  .rg-hero__cloud--near,
  .rg-hero__badge .dot,
  .rg-hero__reviews .stars img { animation: none !important; }
  .rg-hero__scrim { opacity: 0 !important; }
  .rg-hero__canvas { display: none; }
}

/* ============================================================
   Mobile audit fixes (≤750px)
   ============================================================ */
@media (max-width: 750px) {
  /* badge was wrapping to three lines at 375px */
  .rg-hero__badge {
    max-width: 100%;
  }

}
