/* home.css: Home page only (index.html). The hero (layout, proof points, the doubled-arch photo and its
   entrance) and the layouts of the why band, the services grid, first visit, before and after and the
   reviews head. Mobile first, built from the tokens and components in css/styles.css. */

/* == Hero == */

/* The headline is a plain h1 at the H1 step. On phones its four lines wrap as one balanced paragraph;
   from 43.75em each line is one unbreakable row, so the line count never depends on the font file.
   The photo box is 4:5: the photo is 90% of its width at 4:5 (112.5% of the width tall), and the green
   arch, 70% wide on the right, rises the remaining 12.5% above it. From 56.25em the box also stretches
   to the height of the text column, so the arch always reaches the top of the headline. */
.hero {
  --hero-photo-w: 90%;
  --hero-arch-w: 70%;
  padding-block: clamp(var(--space-5), 4vw, var(--space-7)) clamp(var(--space-8), 8vw, var(--space-9));
}
.hero__grid { display: grid; grid-template-areas: "title" "body" "media"; row-gap: var(--space-5); }
.hero__title { grid-area: title; }

.hero__body { grid-area: body; display: grid; gap: var(--space-5); justify-items: start; }
.hero__lead { max-width: 24em; }
.hero__proof { width: 100%; max-width: 30rem; border-top: var(--border-hairline) solid var(--color-rule); }
.hero__point {
  padding-block: var(--space-3); border-bottom: var(--border-hairline) solid var(--color-rule);
  font-weight: 700; font-size: var(--step-small); line-height: var(--leading-tight); color: var(--color-text); text-wrap: balance;
}
.hero__actions { margin-top: var(--space-2); }
.hero__trust {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3);
  font-size: var(--step-small); line-height: var(--leading-tight); color: var(--color-text-muted);
}
.hero__stars { display: inline-flex; gap: var(--space-1); color: var(--color-mark); }
.hero__stars .icon { --icon-size: var(--icon-size-xs); }
/* The fifth star is 80% filled: 4.8 out of 5 */
.hero__star-part { display: inline-grid; }
.hero__star-part > .icon { grid-area: 1 / 1; }
.hero__star-part > .icon--filled { clip-path: inset(0 20% 0 0); }

/* Motif 2: the arch photo in front of a taller shutter-green arch, both standing on a green sill.
   Phones keep the text first so "Book a visit" stays in the first screen (no Book button in the header). */
.hero__media {
  grid-area: media; position: relative; justify-self: end; width: min(88%, 19rem);
  aspect-ratio: 4 / 5; margin-top: var(--space-5);
}
.hero__arch {
  position: absolute; top: 0; right: 0; bottom: 0; width: var(--hero-arch-w);
  border-radius: var(--radius-arch); background: var(--color-brand);
}
.hero__photo { position: absolute; left: 0; bottom: 0; width: var(--hero-photo-w); aspect-ratio: 4 / 5; }
.hero__sill {
  position: absolute; left: calc(-1 * var(--space-5)); right: 0; bottom: calc(-1 * var(--rule-motif));
  height: var(--rule-motif); background: var(--color-brand); transform-origin: right;
}

@media (min-width: 43.75em) {
  .hero__line { display: block; white-space: nowrap; }
  .hero__grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); grid-template-areas: "title title" "body media";
    column-gap: var(--space-7); row-gap: var(--space-6); align-items: end;
  }
  .hero__media { width: 100%; margin-top: 0; }
}
@media (min-width: 56.25em) {
  /* The headline column is never narrower than its longest line (1fr's minimum is its content),
     so with wider text spacing the photo gives way instead of the headline overflowing */
  .hero { padding-block: clamp(var(--space-6), 3.5vw, var(--space-7)) var(--space-8); }
  .hero__grid {
    grid-template-columns: 1fr minmax(0, 32rem); grid-template-areas: "title media" "body media";
    grid-template-rows: auto 1fr;
  }
  .hero__title { align-self: start; }
  .hero__body { align-self: end; }
  .hero__media { align-self: stretch; }
  .hero__lead { max-width: 21em; }
}
@media (min-width: 62.5em) {
  /* Content-sized columns: each point breaks into two even lines, where equal thirds gave one three */
  .hero__proof { display: grid; grid-template-columns: repeat(3, auto); max-width: none; border-bottom: var(--border-hairline) solid var(--color-rule); }
  .hero__point { padding: var(--space-4) var(--space-4) var(--space-4) 0; border-bottom: 0; }
  .hero__point + .hero__point { padding-left: var(--space-4); border-left: var(--border-hairline) solid var(--color-rule); }
}

/* Entrance: the headline rises behind a mask and the photo settles, all within --dur-entrance (900ms).
   Each rising element carries its own mask, moved in step with it (the clip-path insets cancel the
   translation), so nothing stays clipped once the entrance ends (forced colours draw the full glyphs).
   Only the starting frame applies before the animation (fill: backwards), so if it never runs nothing
   stays hidden; reduced motion, print and no JavaScript skip it. On phones the wrapping headline rises as one
   block; from 43.75em its four lines rise one after another. The mask reaches 0.25em above the line
   box and 0.15em below it (Fraunces descenders reach 0.07em below), and the text starts 0.25em below it. */
@media screen and (prefers-reduced-motion: no-preference) {
  .js .hero__title { animation: hero-rise calc(var(--dur-entrance) * 0.8) var(--ease-out) backwards; }
  .js .hero__media { animation: hero-sill-mask var(--dur-entrance) linear backwards; }
  .js .hero__arch { animation: hero-arch calc(var(--dur-entrance) * 0.8) var(--ease-out) backwards; }
  .js .hero__photo { animation: hero-settle var(--dur-entrance) var(--ease-out) backwards; }
  .js .hero__photo img { animation: hero-zoom var(--dur-entrance) var(--ease-out) backwards; }
  .js .hero__sill { animation: hero-sill calc(var(--dur-entrance) * 0.6) var(--ease-out) backwards; }
}
@media screen and (prefers-reduced-motion: no-preference) and (min-width: 43.75em) {
  .js .hero__title { animation: none; }
  .js .hero__line { animation: hero-rise calc(var(--dur-entrance) * 0.7) var(--ease-out) backwards; }
  .js .hero__line:nth-child(2) { animation-delay: calc(var(--dur-entrance) * 0.1); }
  .js .hero__line:nth-child(3) { animation-delay: calc(var(--dur-entrance) * 0.2); }
  .js .hero__line:nth-child(4) { animation-delay: calc(var(--dur-entrance) * 0.3); }
}
@keyframes hero-rise {
  from { transform: translateY(calc(100% + 0.25em)); clip-path: inset(calc(-100% - 0.5em) -0.5em calc(100% + 0.1em) -0.5em); }
  to { transform: none; clip-path: inset(-0.25em -0.5em -0.15em -0.5em); }
}
/* While the arch and photo rise, nothing shows below the sill (the sill itself stays inside the mask) */
@keyframes hero-sill-mask {
  from, to { clip-path: inset(-50vh -50vw calc(-1 * var(--rule-motif)) -50vw); }
}
@keyframes hero-arch { from { transform: translateY(var(--space-7)); } }
@keyframes hero-settle { from { transform: translateY(var(--space-5)); } }
@keyframes hero-zoom { from { transform: scale(var(--zoom-entrance)); } }
@keyframes hero-sill { from { transform: scaleX(0); } }

/* == Why people come here (editorial list on green) == */

.why__grid { display: grid; gap: var(--space-7); }
.why__title { max-width: 13ch; }
.why__more { margin-top: var(--space-5); }
@media (min-width: 56.25em) {
  .why__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: var(--space-8); align-items: start; }
  .why__head { position: sticky; top: calc(var(--header-h) + var(--space-7)); }
  .why .ed-list__item { padding-block: var(--space-6); }
}

/* == Services: one featured card and five row cards, every card one link == */

/* The featured photo bleeds to the card's edges through .card's own --card-pad */
.service-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
.service-grid__item .card__title { font-size: var(--step-list); line-height: var(--leading-tight); }

/* Phones: the five rows are compact menu lines (title and price, then the line of text). When the
   title's 4em and the price can't share a line (very large text), the price drops under the title.
   At 320 to 322px "Whitening" pokes 4px into the gap rather than split (overflow-wrap: normal). */
.service-grid__item--row {
  flex-flow: row wrap; gap: var(--space-2) var(--space-5); align-items: baseline;
  padding: var(--space-4) var(--space-5);
}
.service-grid__item--row .card__title { flex: 1 1 4em; min-width: 0; overflow-wrap: normal; }
.service-grid__item--row .card__price { flex: none; margin-inline-start: auto; }
.service-grid__item--row .card__text { flex-basis: 100%; order: 1; }
.service-grid__item--row .card__more { display: none; }

.service-grid__item--featured { gap: 0; }
.service-grid__item--featured .card__media { margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) var(--card-pad); }
.service-grid__item--featured .photo { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.service-grid__item--featured .card__title { font-size: var(--step-h3); }
.service-grid__body { display: flex; flex: 1; flex-direction: column; gap: var(--space-3); }
.service-grid__item--featured .card__price { padding-top: var(--space-2); }
.service-grid__item--featured .card__more { margin-top: 0; padding-top: 0; }

@media (min-width: 43.75em) {
  .service-grid__item--row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-6); padding: var(--card-pad); }
  .service-grid__item--row .card__title { overflow-wrap: inherit; }
  .service-grid__item--row .card__price { grid-column: 2; grid-row: 1; justify-self: end; margin-inline-start: 0; }
  .service-grid__item--row .card__text { grid-column: 1; order: 0; }
  .service-grid__item--row .card__more { display: inline-flex; grid-column: 2; grid-row: 2; align-self: end; justify-self: end; padding-top: 0; }
  /* A full-width featured card: the photo sits inside the padding at 3:2, the text beside it at the top */
  .service-grid__item--featured { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--card-pad); align-items: start; }
  .service-grid__item--featured .card__media { margin: 0; }
  .service-grid__item--featured .card__media .photo { border-radius: var(--radius-sm); }
}
@media (min-width: 68.75em) {
  /* The featured card beside five compact menu rows. The 4/8 split keeps each row's line of text to
     two lines, so the two columns come out about level; the featured text centres in what is left. */
  .service-grid { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--space-3) var(--space-5); }
  .service-grid__item--row { padding-block: var(--space-4); }
  .service-grid__item--featured { grid-row: 1 / span 5; display: flex; }
  .service-grid__item--featured .card__media { margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) var(--space-6); }
  .service-grid__item--featured .card__media .photo { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
  .service-grid__item--featured .service-grid__body { justify-content: center; }
  .service-grid__item--featured .card__text { font-size: var(--step-lead); line-height: var(--leading-lead); }
}

/* == Your first visit: the button sits in the scrolly grid, under the steps == */

.first-visit__title { max-width: 18ch; }
.first-visit__cta { margin-top: var(--space-7); }
@media screen and (min-width: 56.25em) {
  .js .first-visit__cta { grid-column: 2; margin-top: 0; }
}

/* == Before and after (on blush: its neighbours are sage) == */

.before-after__grid { display: grid; gap: var(--space-7); }
.before-after__title { max-width: 12ch; margin-bottom: var(--space-5); }
.before-after__more { margin-top: var(--space-4); }
@media (min-width: 56.25em) {
  .before-after__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: var(--space-8); align-items: center; }
}

/* == Reviews == */

.testimonials__title { max-width: 16ch; }

/* == Print: the sticky why head stays in place == */

@media print { .why__head { position: static; } }
