/* Home: the opening faucet, then the sideways catalogue of five snapping strips. Builds on site.css tokens only. */

/* OPENING: text at upper left, the photograph takes the rest of the window, fitted whole.
   --opening-used is everything that is not picture: masthead, text, the gap, and the cookie strip on the bottom edge. */
.home-open { --opening-used: 25.5rem; padding-bottom: clamp(1.5rem, 5vh, 3rem); }
.home-open .farend__blob picture { display: block; }
.home-open .farend__blob video {
  width: auto; max-width: 100%;
  max-height: max(15rem, calc(100svh - var(--opening-used)));
  border-radius: var(--photo-r);
}
.home-open .pair { max-width: 40rem; }

/* on a phone the offer ticket pushes the masthead down: count that height too */
@media (max-width: 47.99rem) {
  .has-promo .home-open { --opening-used: 31.5rem; }
}

@media (min-width: 56rem) {
  .home-open { --opening-used: 22.5rem; }
  /* the pair stands beside the picture, the two notes set together at its middle */
  .home-open .farend { display: flex; align-items: stretch; }
  .home-open .farend__blob { flex: 0 1 auto; min-width: 0; align-self: start; }
  .home-open .pair {
    flex: 1 0 15rem; max-width: 24rem;
    grid-template-columns: 1fr; align-content: center;
    gap: var(--gap);
  }
}

/* MARKERS: one per label on this page, whatever state the figure is in - "You notice" filled mint, "A plumber checks" hollow */
.home .pair .pair__item:first-child .pair__label::before { background: var(--mint); box-shadow: none; }
.home .pair .pair__item:last-child .pair__label::before { background: none; box-shadow: inset 0 0 0 .14rem var(--ink-dim); }

/* CATALOGUE BAR: counter, chapter links, Previous / Next - all unboxed text */
.cat__bar {
  display: grid; align-items: center; gap: .25rem var(--gap);
  grid-template-columns: auto 1fr;
  grid-template-areas: "count nav" "chap chap";
  padding-block: .75rem .25rem;
}
.cat__count {
  grid-area: count; display: flex; align-items: center; gap: .5rem;
  margin: 0; font-size: 1.125rem; white-space: nowrap;
}
.flap {
  display: inline-block; min-width: 1.15em; padding: .12em .28em .08em;
  background: var(--plum); color: var(--mint); border-radius: .2rem;
  font: 800 2.25rem/1 var(--display); text-align: center;
}
/* one discrete half-flap frame, then the whole digit: no easing */
.flap.is-flip { animation: flap .07s steps(1, end); }
@keyframes flap {
  from { clip-path: inset(0 0 50% 0); }
  to { clip-path: inset(0); }
}

.cat__chapters {
  grid-area: chap; display: flex; gap: 0 1.5rem;
  margin: 0; padding: .25rem; list-style: none;
  overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.cat__chapters a {
  display: inline-flex; align-items: center; min-height: var(--line);
  color: var(--ink); text-decoration: none;
}
.cat__chapters a:hover { text-decoration: underline; }
.cat__chapters a[aria-current="true"] {
  color: var(--mint);
  text-decoration: underline; text-decoration-thickness: .22em;
}

.cat__nav { grid-area: nav; display: flex; gap: 1.5rem; justify-self: end; }
html:not(.js) .cat__nav { display: none; }

@media (min-width: 62rem) {
  .cat__bar { grid-template-columns: auto 1fr auto; grid-template-areas: "count chap nav"; }
  .cat__chapters { justify-content: center; }
}

/* TRACK: sideways scroll-snap; vertical wheel is left alone */
.cat__track {
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: thin; scrollbar-color: var(--mulberry) transparent;
}
.cat__track:focus-visible { outline-offset: -.25rem; }

/* STRIP: phone order is picture, heading, services; desk is heading / picture / services */
.strip {
  flex: 0 0 100%; min-width: 0;
  scroll-snap-align: start; scroll-snap-stop: always;
  display: grid; gap: var(--gap); align-content: start;
  padding: 2rem max(var(--edge), calc((100% - 96rem) / 2 + var(--edge))) 1.25rem;
}
.strip__fig { order: -1; }
.strip__head { display: grid; gap: 1rem; justify-items: start; }
.strip__title { font-size: clamp(2.75rem, .9rem + 4.4vw, 6.5rem); }
.strip__say { margin: 0; max-width: 24rem; }

/* upright photographs keep their whole height inside the window, and stay near the height of the wide ones
   so no strip makes the track much taller than the first */
.strip__fig--tall .farend__blob { width: min(100%, calc(min(46svh, 30rem) * .8)); }

.strip__svcs { display: grid; gap: var(--gap); align-content: start; justify-items: start; }
.strip__svcs .svc { gap: 0; }
.strip__svcs .svc__name a { display: inline-block; padding-block: .6rem; }

@media (min-width: 62rem) {
  .strip {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr) minmax(0, 1fr);
    align-items: start;
  }
  .strip__fig { order: 0; }
  .strip__head { padding-top: .5rem; }

  /* upright strips: a wider middle column, the pair beside the picture instead of under it,
     so the strip is no taller than a strip with a wide photograph */
  .strip--tall { grid-template-columns: minmax(0, 1.2fr) minmax(0, 2.5fr) minmax(0, 1fr); }
  .strip__fig--tall { display: flex; align-items: flex-start; }
  .strip__fig--tall .farend__blob { flex: none; width: min(64%, calc(min(64svh, 34rem) * .8)); }
  .strip__fig--tall .pair {
    flex: 1 1 0; min-width: 0; align-self: center;
    grid-template-columns: 1fr;
  }
}

/* HAND-OFF: the owner's sentence on paint, then where to go next; it follows the catalogue closely */
.home-end { padding-top: var(--gap); padding-bottom: 0; }
.home-end__say { margin: 0; max-width: 46rem; font-size: 1.375rem; line-height: 1.4; }

@media (min-width: 62rem) {
  /* the paint runs the width of the grid: sentence at the left, the three links in a column at its right */
  .home-end .handoff {
    max-width: none;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    grid-template-areas: "head links" "say links";
    column-gap: var(--gap);
  }
  .home-end .handoff > h2 { grid-area: head; }
  .home-end .home-end__say { grid-area: say; }
  .home-end .handoff__links {
    grid-area: links; align-self: end;
    flex-direction: column; flex-wrap: nowrap; gap: 0;
  }
}
