/* ==========================================================================
   SalonHub website header: "the window to your <word>"
   STATIC PART. This file alone gives the finished header without JavaScript:
   photo, wash and slogan. Everything that moves lives in
   js/home-hero/hero-motion.css, which js/home-hero/hero.js loads after the
   page has rendered. Markup: _includes/components/home-hero.njk.

   The header is sized by its own container, not by the viewport, so it
   adapts to whatever column the site puts it in.

     .hero                 container + colour tokens
       .hero__stage        the visible box; all layout knobs live here
         .hero__photo      photo framing > picture > img
         .hero__wash       paper-coloured gradient that keeps text legible
         .hero__copy       the site's .container, so the slogan lines up with
                           the logo and the feature tiles
           .hero__title    slogan with the .hero__word link
   ========================================================================== */

.hero {
  /* Brand tokens (Salonhub design system), mapped to the site's variables */
  --indigo: var(--color-blue-dark);
  --lavendel: #5e61cf;
  --donkergroen: var(--color-green);
  --felgeel: var(--color-yellow);
  --paper: #f3f2f6;
  --wash: 246 245 250; /* used as rgb(var(--wash) / alpha) */

  /* Colour of the word (and later the card and line) */
  --tone: var(--indigo);

  container: hero / inline-size;
  padding: 0; /* the site gives every <section> vertical padding */
  font-family: var(--font-sans);
  color: var(--indigo);
}

/* --------------------------------------------------------------------------
   Stage: the narrow layout is the default (slogan on top, photo below).
   Every number that differs between narrow and wide is a custom property,
   so the wide layout at the bottom only has to change these.
   -------------------------------------------------------------------------- */

.hero__stage {
  --title-top: 6.5rem;              /* room for the site menu above it */
  --photo-top: 15.625rem;           /* where the photo starts */
  --photo-zoom: 1.28;               /* crop tighter than plain "cover" */
  --photo-origin: 100% 0;           /* zoom from the right, so the crop
                                       comes off the photo's pale left edge */
  --photo-pos: 80% 50%;             /* object-position: which part to show */

  --head: var(--header-mobile-height); /* height of the site header on top of the stage */
  --under: 0rem;

  position: relative;
  overflow: hidden;
  block-size: 45rem;
  background: var(--paper);
}

/* Desktop header: two rows, ~132px (64–80rem), ~151px (80–96rem), ~143px (from 96rem) */
@media (min-width: 64rem) {
  .hero__stage { --head: 9.5rem; --under: 4rem; }
}

/* Phone held sideways: no taller than the screen (svh = with browser bars
   showing, so it doesn't jump). Portrait phones keep the fixed height. */
@media (orientation: landscape) {
  .hero__stage {
    block-size: min(45rem, max(24rem, 100svh));
  }
}

/* Photo ------------------------------------------------------------------- */

.hero__photo {
  position: absolute;
  inset: var(--photo-top) 0 0 0;
  scale: var(--photo-zoom);
  transform-origin: var(--photo-origin);
}

.hero__photo picture {
  display: contents;
}

.hero__photo img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  max-inline-size: none;
  object-fit: cover;
  object-position: var(--photo-pos);
}

/* Wash -------------------------------------------------------------------- */

.hero__wash {
  position: absolute;
  inset: calc(var(--photo-top) - 0.625rem) 0 auto 0;
  block-size: 8.75rem;
  /* Solid paper down to the photo's top edge, then fade out */
  background: linear-gradient(var(--paper) 0.625rem, rgb(243 242 246 / 0));
  pointer-events: none;
}

/* Slogan ------------------------------------------------------------------
   .hero__copy is also a .container (global.css): same width and padding as
   the header and the feature tiles at every breakpoint, so the slogan's left
   edge matches the logo. Centred across the stage by inset + auto margins. */

.hero__copy {
  position: absolute;
  top: var(--title-top);
  inset-inline: 0;
}

.hero__title {
  margin: 0;
  /* 28px floor, tracks the container on phones, then grows slowly to 66px */
  font-size: clamp(1.75rem, 9.74cqi, min(1.725rem + 2.667cqi, 4.125rem));
  font-weight: 400;
  line-height: 1.07;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.hero__word {
  display: inline-block;
  color: var(--tone);
  text-decoration: none;
}

.hero__word:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 0.1em;
  border-radius: 0.1em;
}

/* --------------------------------------------------------------------------
   Wide layout: photo fills the stage, slogan on the left.
   -------------------------------------------------------------------------- */

@container hero (min-width: 60rem) {
  .hero__stage {
    /* Slogan and card sit at a fraction of the part of the stage below the site header (--head),
       so a taller header pushes them down instead of covering them. 31.5% / 9.7% give the
       positions of the original design (38.4% / 18.8%) under the 72px header it was made for.
       --under: extra photo at the bottom that only shows behind the feature tiles (feature-tiles.css
       pulls them up by the same amount), left out of the calculation so it moves nothing. */
    --title-top: calc(var(--head) + (100% - var(--head) - var(--under)) * 0.315);
    --card-top: calc(var(--head) + (100% - var(--head) - var(--under)) * 0.097);
    --photo-top: 0px;
    --photo-zoom: 1.14;
    --photo-origin: 5% 50%;
    --photo-pos: 50% 50%;

    /* Half the width plus 4rem (the two-row site header covers the top), at most 50rem, and
       always 4rem shorter than the screen so the top of the feature tiles, which overlap the
       bottom of the stage, stays in view. 32rem floor leaves room for card and slogan below
       the header. */
    block-size: calc(clamp(32rem, min(50cqi + 4rem, 100svh - 4rem), 50rem) + var(--under));
  }

  .hero__wash {
    inset: 0;
    block-size: auto;
    background:
      linear-gradient(rgb(var(--wash) / 0.85), rgb(var(--wash) / 0) 7.5rem),
      linear-gradient(90deg, rgb(var(--wash) / 0.94), rgb(var(--wash) / 0.86) 30%, rgb(var(--wash) / 0.35) 50%, rgb(var(--wash) / 0) 62%);
  }
}
