/* ==========================================================================
   Block: homepage hero (template-parts/blocks/hero.php)
   Approved design: locked. Includes the artwork composition, drawing clearance and settle animation.
   ========================================================================== */

/* Hero --------------------------------------------------------------- */
.hero { padding-top: var(--space-fluid-sm); background: var(--color-band); } /* full-width band; artwork sits flush on its bottom edge */
.hero__inner {
  display: grid;
  gap: var(--space-3);
}
.hero__inner > * { min-width: 0; }

.hero__copy { display: grid; gap: var(--space-2); justify-items: start; }
.hero__eyebrow {
  color: var(--color-accent-text);
  font-family: var(--font-body);
  font-weight: var(--font-weight-strong);
  font-size: var(--fs-eyebrow);
  letter-spacing: var(--tracking-eyebrow);
  line-height: var(--lh-tight);
}
.hero__title {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-heading);
  font-size: var(--fs-h1);
  line-height: var(--lh-h1);
  letter-spacing: var(--tracking-h1);
  color: var(--color-text);
  text-wrap: balance; /* phones: never leaves "care." or "life." alone on a line */
}
.hero__title-accent {
  display: block; /* visual line break; real space kept in the text */
  font-style: var(--font-heading-style-accent);
  color: var(--color-warm-coral); /* 2.88:1 on Bisque: below AA for large text; kept at the client's request (10 Nov 2026) */
}
.hero__lede {
  max-width: 26em; /* ~55-65 characters per line in Source Sans 3 */
  font-size: var(--fs-lede);
  line-height: 1.4; /* was 1.5 (client request, 10 Nov 2026) */
}
.hero__actions {
  display: grid;
  justify-items: start;
  gap: 6px;
  width: 100%;
  margin-top: var(--space-1);
}
.hero__chat { width: 100%; margin-bottom: 8px; padding-inline: 1em; } /* full width on phones; tighter side padding keeps the label on one line */

/* Hero testimonial: never wider than the lede, so the drawing clearance holds */
.hero__testimonial { max-width: calc(26 * var(--fs-lede)); }

/* Hero artwork: one composition, uniformly scaled ------------------- */
/* Mobile crop frame (approved 6 Nov 2026): shows canvas y 0-1000 of 1390, i.e. down to the base of the illustration.
   Layer positions and scale are unchanged; only the visible window is shorter. */
.hero-art-frame {
  width: min(100%, 34rem);
  margin-inline: auto;
  aspect-ratio: 2000 / 1000;
  min-height: 0; /* stop content height overriding the crop ratio */
  overflow: hidden;
  overflow: clip;
}
.hero-art {
  position: relative;
  width: min(100%, 34rem);
  margin-inline: auto;
  aspect-ratio: var(--art-ratio);
  isolation: isolate;
}
.hero-art__layer { position: absolute; margin: 0; }
.hero-art__layer img { width: 100%; height: 100%; }
/* Shape v2 (vector, 1728 × 864 artboard), scale 1.12: its blob fills the original shape footprint (x 56-1680, y 0-864) */
.hero-art__shape {
  --shape-x: 4.5; --shape-y: 14.6; --shape-w: 1935.4;
  left: calc(var(--shape-x) / 2000 * 100%);
  top: calc(var(--shape-y) / 1390 * 100%);
  width: calc(var(--shape-w) / 2000 * 100%);
  height: auto;
  aspect-ratio: 1728 / 864;
}
/* Illustration v2 (vector, 1736.4 × 756.6): placed in design units x/y/w below */
.hero-art__illustration {
  --ill-x: 55; --ill-y: 149; --ill-w: 1893;
  left: calc(var(--ill-x) / 2000 * 100%);
  top: calc(var(--ill-y) / 1390 * 100%);
  width: calc(var(--ill-w) / 2000 * 100%);
  height: auto;
  aspect-ratio: 1736.4 / 756.6;
}
.hero-art__shape { z-index: 1; }
.hero-art__illustration { z-index: 2; }
/* Combined artwork: same width/scale as the separate illustration (x 55, width 1893);
   its extra 125.6 units of shape above the drawing put the top at y 12.1, so the ground line stays at y 974. */
.hero-art__comp {
  --comp-x: 55; --comp-y: 12.1; --comp-w: 1893;
  left: calc(var(--comp-x) / 2000 * 100%);
  top: calc(var(--comp-y) / 1390 * 100%);
  width: calc(var(--comp-w) / 2000 * 100%);
  height: auto;
  aspect-ratio: 1736.41 / 882.19;
  z-index: 2;
}
/* Artwork switch (data-art on .hero-art): only the chosen version is displayed, and lazy loading means the other is not downloaded. */
.hero-art[data-art="combined"] .hero-art__shape,
.hero-art[data-art="combined"] .hero-art__illustration,
.hero-art:not([data-art="combined"]) .hero-art__comp { display: none; }
/* Cutout 1200 × 1193 shown at 1356 × 1348 design units, x = 318, flush to the bottom edge */
.hero-art__people { z-index: 3; left: 15.9%; bottom: 0; width: 67.8%; aspect-ratio: 1200 / 1193; }

/* Small phones: 16px chat label so "Chat with a real person - 24/7" stays on one line at 320px */
@media (max-width: 374.98px) {
  .hero__chat { font-size: 1rem; gap: 0.45em; }
}

@media (min-width: 576px) {
  .hero-art-frame { width: min(100%, 36rem); }
  .hero__actions { width: auto; }
  /* From 576px (client requests, 10 Nov 2026): 18px label, nudged left by 0.25em (now 4.5px). Phones stay full width, centred, 17px. */
  .hero__chat { width: auto; margin-left: -0.25em; padding-inline: 1.75em; font-size: 1.125rem; }
  .hero-art { width: min(100%, 36rem); }
}

@media (min-width: 768px) {
  .hero-art-frame { display: contents; } /* full composition from tablet up */
  .hero-art { width: min(100%, 27rem); }
}

@media (min-width: 1025px) {
  /* Headline capped so "A better quality of care." (about 10.3em in Playfair) stays inside the lede's width, keeping the drawing clearance */
  :root { --fs-h1: clamp(2.5rem, 3.65vw, 3.3rem); }
  /* Two hero columns */
  .hero__inner {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    column-gap: var(--column-gap);
    align-items: end;
  }
  .hero__copy { align-self: center; padding-bottom: var(--space-fluid-sm); }
  /* Artwork may extend into the column gap: its left edge is transparent canvas, so copy is never covered */
  .hero-art { --art-w: 112%; width: var(--art-w); margin-inline: calc(100% - var(--art-w)) 0; }

  /* Testimonial: smaller on desktop (client request, 10 Nov 2026) */
  .hero__testimonial { gap: 8px; }
  .hero__testimonial .testimonial__quote { font-size: 1.125rem; line-height: 24px; }
  .hero__testimonial .testimonial__cite { font-size: 0.875rem; }
}

/* Drawing clearance (client request, 9 Nov 2026): from 1025px the combined drawing's left edge sits a fixed
   --art-clearance (40px) to the right of where the hero text visibly ends, at every width, and the settle animation
   scales from that left edge (bottom-left origin) so the clearance holds throughout. Sizes are unchanged (100% to 90%).
   The visible text edge is the lede's right edge (26em wide, or the full copy column when narrower); the h1 and buttons
   end within a few pixels of it or short of it. Container query units give the column widths: .hero__inner is the
   container, copy column = 0.95 / 2 and art column = 1.05 / 2 of (container − column gap), artwork = 112% of the art
   column (or the svh limit below). Browsers without container queries keep the original canvas position.
   Layered (rollback) mode is not adjusted. */
@supports (width: 1cqw) {
  @media (min-width: 1025px) {
    .hero__inner { container-type: inline-size; }
    .hero-art {
      --art-clearance: 40px;
      --art-cell-w: calc((100cqw - var(--column-gap)) * 0.525);
      --art-w-abs: calc(var(--art-cell-w) * 1.12);
      --copy-cell-w: calc((100cqw - var(--column-gap)) * 0.475);
      --copy-text-w: min(26 * var(--fs-lede), var(--copy-cell-w)); /* matches .hero__lede max-width: 26em */
    }
    .hero-art .hero-art__comp { /* extra specificity: beats the base transform-origin in the settle block below */
      /* left edge = visible text edge + clearance, measured from the artwork box's left edge */
      left: calc(var(--art-clearance) - var(--column-gap) + var(--art-w-abs) - var(--art-cell-w) - (var(--copy-cell-w) - var(--copy-text-w)));
      transform-origin: 0% 100%;
    }
  }
}

/* Viewport fit: progressive enhancement. Trims artwork (never type) on shorter desktop screens. */
@supports (height: 100svh) {
  @media (min-width: 1025px) and (min-height: 640px) {
    .hero-art { --art-w: min(112%, calc((100svh - 330px) * 2000 / 1390)); }
    @supports (width: 1cqw) {
      .hero-art { --art-w-abs: min(var(--art-cell-w) * 1.12, (100svh - 330px) * 2000 / 1390); }
    }
  }
}

/* Illustration settle: on load, scale slowly from 100% to 90% over 40s (client request, 9 Nov 2026; previously 95%, which was barely noticeable; 70% and 85% over 20s tried first).
   Origin is bottom-centre so the wall/ground line stays put. Starts once the SVG has loaded (JS adds .is-loaded).
   Applies to whichever artwork version is active: the separate illustration, or the combined SVG (which also scales the shape). */
.hero-art__illustration,
.hero-art__comp {
  --ill-scale-end: 0.9;
  --ill-anim-duration: 40s;
  transform-origin: 50% 100%;
}
@keyframes illustration-settle {
  from { transform: scale(1); }
  to   { transform: scale(var(--ill-scale-end)); }
}

@media (prefers-reduced-motion: no-preference) {
  .js .hero-art__illustration.is-loaded,
  .js .hero-art__comp.is-loaded {
    animation: illustration-settle var(--ill-anim-duration) cubic-bezier(0.33, 0, 0.2, 1) both;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hero-art__illustration,
  .hero-art__comp { transform: scale(var(--ill-scale-end)); } /* no motion: show the settled state */
}
