/* ==========================================================================
   Hero
   --------------------------------------------------------------------------
   Two columns on a wide screen, copy left and photograph right, stacking to
   one column below 900px with the photograph first — on a phone the picture
   is what tells you what the clinic is before any of the words are read.

   Layer 3 tokens only. No raw hex anywhere in this file.
   ========================================================================== */

.hero {
  background: var(--color-bg);
  overflow: clip;              /* the photo bleeds to the right edge */
}

.hero__inner {
  max-width: var(--width-full);
  margin-inline: auto;
  display: grid;
  gap: clamp(var(--sp-6), 4vw, var(--sp-8));
  align-items: center;
  grid-template-columns: 1fr;
}

.hero__copy {
  padding-inline: var(--gutter);
  padding-block: clamp(var(--sp-5), 3vw, var(--sp-7));
  /* 44rem, not the 38rem used for body text elsewhere. Measured: at 38rem the
     heading wraps to four lines at every size down to 40px and the band runs
     to ~960px tall. At 44rem with the size below it settles to two lines and
     ~765px, which is the mock-up's proportion. */
  max-width: 44rem;
  margin-inline: auto;
}

/* --- Copy ---------------------------------------------------------------- */

.hero__eyebrow {
  color: var(--color-link-accent);
  font-size: var(--fs-h3);
  line-height: 1.1;
  margin-block-end: var(--sp-2);
}

/* Deliberately smaller than the global --fs-h1.
   The global scale tops out at 4rem, which is right for a heading that owns
   the full content width. Here the heading lives in one half of a two-column
   band, so at 4rem it wrapped to four lines and pushed the hero to 1285px
   tall — roughly double the mock-up's proportions. 2.625rem was arrived at by
   measuring line counts in the browser across widths and sizes, not guessed:
   it is the largest size that still gives two lines at the copy width set
   above. Still by some distance the largest type on the page. */
.hero__heading {
  color: var(--color-heading);
  font-size: clamp(2rem, 1.5rem + 1.7vw, 2.625rem);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  margin-block: 0 var(--sp-4);
  text-wrap: balance;
}

/* The gold rule with a leaf at its centre, as the mock-up draws it. Heavier
   than the hairline it replaced — at 1px and 70% opacity it read as an
   accident rather than as a mark. 2px at full strength is deliberate.

   The two rules are unequal on purpose, with the short one left of the leaf
   and the long one running out to the right. It spans the full copy column
   rather than a fixed 20rem, so it reaches the same right edge as the heading
   above it instead of stopping short. */
.hero__rule {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-block: 0 var(--sp-4);
}

.hero__rule::before,
.hero__rule::after {
  content: "";
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: var(--color-accent-gold);
}

.hero__rule::after { flex: 2.2; }

.hero__rule-mark {
  flex: none;
  color: var(--color-accent-gold);
  stroke-width: 1.5;
}

.hero__lede {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semi);
  color: var(--color-text-strong);
  margin-block-end: var(--sp-4);
  text-wrap: pretty;
}

/* No max-width.
   It was 34rem, which is a sensible measure in the abstract and wrong here:
   the copy column is 590px wide, so the paragraphs wrapped at 544px and their
   right edge sat 46px inside the heading, the gold rule, the buttons and the
   badge row. Every other block in this column spans the column, so this one
   does too. At 590px the measure is around 70 characters, which is at the
   wide end but is what the mock-up has. */
.hero__body {
  color: var(--color-text);
}

.hero__body > * + * { margin-block-start: var(--sp-4); }

/* --- Buttons ------------------------------------------------------------- */

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-block-start: var(--sp-5);
}

.hero__actions .btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

.btn__icon { flex: none; stroke-width: 1.75; }

/* --- Value badges -------------------------------------------------------- */

.hero__badges {
  list-style: none;
  margin: var(--sp-5) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4) 0;
}

.hero__badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--sp-2);
  text-align: center;
  /* Measured, not chosen. At the copy column's width these four labels want
     to sit on two lines each, and the inline padding is what decides it: at
     8px "Support for Every Stage of Life" takes three and the row goes
     ragged, at 4px the first label collapses to one. 6px is the value where
     all four are two lines. Derived from the scale rather than hard-coded so
     it still moves with the spacing system. */
  padding-inline: calc(var(--sp-2) * 0.75);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  color: var(--color-text);

  /* Every label should sit on two lines. "Support for Every Stage of Life" is
     the long one and it was taking three, which left the row visibly ragged
     and the divider lines uneven. Reserving the height of two lines keeps the
     baseline grid honest even if one label is shorter. */
  min-block-size: calc(2 * var(--lh-snug) * 1em);
}

/* Hairline separators between badges, not after the last in a row. Uses the
   decorative divider token: these carry no meaning, they just stop four short
   labels reading as one run-on line. */
.hero__badge + .hero__badge { border-inline-start: 1px solid var(--color-divider); }
.hero__badges > :nth-child(odd) { border-inline-start: 0; }

.hero__badge-icon {
  color: var(--color-heading);
  stroke-width: 1.5;
}

/* --- Photograph ---------------------------------------------------------- */

/* The photograph does not butt up against the copy — it fades out of it, as
   the mock-up does. The gradient is a pseudo-element over the image rather
   than a mask on it, so it works regardless of the picture and can be tuned
   without touching the markup. Vertical at the top of the stack (where the
   image sits above the copy on a phone), horizontal once they are side by
   side. Purely decorative, so nothing needs to know it is there. */
.hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    var(--color-bg) 0%,
    color-mix(in srgb, var(--color-bg) 55%, transparent) 14%,
    transparent 38%
  );
}

.hero__media {
  position: relative;
  min-height: 18rem;
  /* Without a cap the image column simply matches whatever height the copy
     column ends up being, and a long introduction turns the photograph into a
     very tall narrow crop. The mock-up's hero is about two thirds of the
     viewport; this keeps it there. */
  max-height: 46rem;
}

.hero__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- Wide ---------------------------------------------------------------- */

@media (min-width: 60rem) {

  .hero__inner {
    /* Copy column slightly wider than the photograph. Measured rather than
       chosen: at 1fr/1fr the heading takes three lines, at 1.15fr/1fr it
       takes two and the band settles at ~765px, which is the mock-up's
       proportion. */
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 0;
    align-items: stretch;
  }

  .hero__copy {
    margin-inline: 0 0;
    margin-inline-start: auto;
    padding-inline-end: clamp(var(--sp-6), 4vw, var(--sp-8));
    align-self: center;

    /* Line the copy up with the header logo and every .container below it.
       The hero band is full-bleed (90rem) while the rest of the page sits in
       the standard container, so without this the heading starts well to the
       left of the logo above it and the page looks subtly misaligned all the
       way down.

       The expression is the leftover half-width between the two PLUS the
       gutter, floored at the gutter so it never goes negative on a narrow
       screen. The gutter term is not optional and was missed the first time:
       .container is capped at --width-wide and then adds padding-inline on
       top, so its text begins a full gutter inside its own box. Without it
       the hero lined up with the container's outer edge rather than its text
       and sat exactly 40px left of the logo — close enough to read as a
       mistake rather than as a layout. Verified after fixing: hero heading,
       logo, newsletter icon, first pathway card and testimonial all start at
       the same x. */
    padding-inline-start: max(
      var(--gutter),
      calc((min(90rem, 100vw) - var(--width-wide)) / 2 + var(--gutter))
    );

    /* The 44rem cap is for the single-column layout. Here the grid column
       already sets the width, and leaving the cap on would subtract the
       alignment padding above from it — which put the heading back to four
       lines even after the column was widened. */
    max-width: none;
  }

  .hero__badges {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
  }

  /* With four across, every badge but the first wants its separator back. */
  .hero__badges > :nth-child(odd) { border-inline-start: 1px solid var(--color-divider); }
  .hero__badges > :first-child { border-inline-start: 0; }

  /* Side by side, the fade runs horizontally instead: the photograph dissolves
     into the white of the copy column rather than meeting it at a hard edge.
     Written as its own rule inside the media query so the vertical version
     above still governs the stacked phone layout. */
  .hero__media::after {
    background: linear-gradient(
      to right,
      var(--color-bg) 0%,
      color-mix(in srgb, var(--color-bg) 60%, transparent) 9%,
      transparent 26%
    );
  }

  .hero__media {
    min-height: 100%;

    /* Bleed the photograph to the right edge of the window, as the mock-up
       does. The band itself is capped at 90rem and centred, which otherwise
       leaves a thin white margin down the right-hand side of the picture on
       any screen wider than that. Negative margin rather than a wider band,
       so the copy column keeps its alignment with the container. */
    margin-inline-end: calc((100vw - min(90rem, 100vw)) / -2);
  }
}

/* --- No photograph -------------------------------------------------------
   The two-column rule above has to be undone explicitly, not just left to
   fall through: with no media element the copy still sits in the first
   column of a two-column grid and the right half of the band is empty, which
   reads as a broken layout rather than a centred one. This is what that
   looked like before it was caught — the heading wrapped over four lines in a
   column barely wider than the text.

   The declaration order matters. This block comes after the media query, so
   it wins on source order for the same specificity. */
.hero--no-image .hero__inner {
  grid-template-columns: minmax(0, 1fr);
}

.hero--no-image .hero__copy {
  max-width: 48rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
  text-align: center;
}

.hero--no-image .hero__rule { margin-inline: auto; }

.hero--no-image .hero__actions {
  justify-content: center;
}

.hero--no-image .hero__body {
  margin-inline: auto;
}

/* --- Inner pages ----------------------------------------------------------
   Added 6 Oct 2026 after Liam flagged too much white space on the
   Physiotherapy hero. Measured at a 1910px window, there were about 300px of
   near-white between the end of the text and the first visible part of the
   photograph: 64px of column padding, then a fade that ran across 26% of the
   photo (235px). The heading also missed fitting on one line by 4px
   ("Physiotherapy in Saskatoon" needs 590px, the column gave 586px), and
   text-wrap: balance then split it into two short lines, leaving a white
   block to the right of each.

   Inner-page headings are short ("<Service> in Saskatoon"), so:
     - half the column padding, which is what lets that heading fit;
     - a fade over 12% of the photo instead of 26%, so the picture starts
       close to the text;
     - wrap "pretty" rather than "balance": when a heading does wrap, the
       first line stays long instead of being shortened to match the second.
   The home page hero is left exactly as it was. */
@media (min-width: 60rem) {

  .hero--page .hero__copy {
    padding-inline-end: clamp(var(--sp-5), 2vw, var(--sp-6));
  }

  .hero--page .hero__media::after {
    background: linear-gradient(
      to right,
      var(--color-bg) 0%,
      color-mix(in srgb, var(--color-bg) 50%, transparent) 5%,
      transparent 12%
    );
  }
}

.hero--page .hero__heading { text-wrap: pretty; }

/* --- Phones ---------------------------------------------------------------
   Stacked, the photograph comes FIRST, straight under the header, and the
   copy follows (Liam, 22 Oct 2026: "on mobile the hero image is always
   first"). Until then the copy came first and the photo sat after the
   badges, often below the fold. With the photo on top, the soft fade moves
   to its bottom edge, where it meets the copy, and stays short so the
   picture is not washed out. No gap between them. Buttons become full
   width, so two buttons of different lengths stop looking like a mistake. */
@media (max-width: 59.99rem) {
  .hero__inner { gap: 0; }
  /* Full width of the screen, edge to edge (Liam, 22 Oct 2026). The height
     is set directly rather than from an aspect ratio: with aspect-ratio and a
     max-height together, the browser kept the shape by narrowing the photo,
     which left a white strip down its right-hand side on tablets. */
  .hero__media {
    order: -1;
    justify-self: stretch;
    inline-size: 100%;
    aspect-ratio: auto;
    block-size: clamp(15rem, 62vw, 28rem);
    min-height: 0;
    max-height: none;
  }
  .hero__copy { padding-block: var(--sp-5) var(--sp-6); }
  .hero__media::after {
    background: linear-gradient(to top, var(--color-bg) 0%, transparent 14%);
  }
}

@media (max-width: 30rem) {
  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__actions .btn { justify-content: center; }
  .hero__heading { font-size: clamp(1.75rem, 1.2rem + 2.6vw, 2rem); }
  .hero__lede { font-size: var(--fs-base); }
  .hero__badges { gap: var(--sp-3) 0; }
}
