/* =========================================================
   Phone styles: services
   Loaded after css/style.css, only at max-width 768px (the link carries the
   media query), so everything here wins over the desktop and old narrow rules
   by order. Written for phones first, not the desktop layout stacked.

   1. Hero         shorter photo, heading and line anchored low-left
   2. Blocks       image on top (16:10), text below
   3. Engagement   a vertical rail with the five steps hanging off it
   Type sizes only through the tiers in style.css.
   ========================================================= */


/* ---------- 1. Hero ---------- */
.services-hero {
  min-height: 0;
  text-align: left;
}

.services-hero .header-placeholder {
  height: clamp(400px, 60svh, 560px);
  min-height: 0;
}

@supports not (height: 1svh) {
  .services-hero .header-placeholder {
    height: clamp(400px, 60vh, 560px);
  }
}

.services-hero .header-placeholder__overlay {
  align-items: flex-start;
  justify-content: flex-end;
  text-align: left;
  padding: 0 var(--gutter, 20px) 44px;
}

.services-hero .header-placeholder__overlay::before {
  background: linear-gradient(180deg,
    rgba(4, 25, 23, 0.18) 0%,
    rgba(4, 25, 23, 0.3) 40%,
    rgba(4, 25, 23, 0.78) 100%);
}

.services-hero .header-placeholder__overlay h1 {
  --fs-scale: 1.05;
  margin-bottom: 10px;
}

.services-hero .header-placeholder__overlay p {
  max-width: 21em;
  margin: 0;
}


/* ---------- 2. Blocks ----------
   One column: the photo on top in a 16:10 crop that runs to the screen
   edges' gutter, the text below. The label, name and copy keep the
   desktop's order; the Learn More pill gets the full 48px tap height. */
.svc {
  padding: 48px var(--gutter, 20px) 56px;
}

.svc__inner {
  row-gap: 52px;
}

.svc-block,
.svc-block:nth-child(even) {
  display: block;
}

.svc-block__media,
.svc-block:nth-child(even) .svc-block__media {
  margin-bottom: 22px;
}

.svc-block__body,
.svc-block:nth-child(even) .svc-block__body {
  padding-top: 0;
}

.svc-block__name {
  margin-bottom: 10px;
}

.svc-block__text {
  max-width: none;
}

.svc-more {
  min-height: var(--tap, 48px);
  margin-top: 20px;
  touch-action: manipulation;
}

.svc-more:hover {
  /* no sticky hover on touch: only the open state keeps the tint */
  border-color: var(--line);
  background: var(--ivory-card);
}

.svc-more[aria-expanded="true"] {
  border-color: var(--teal-deep);
  background: color-mix(in srgb, var(--teal-deep) 9%, var(--ivory-card));
}

.svc-ask {
  margin-top: 4px;
}

.svc-ask a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap, 48px);
}

.svc-detail__list li:first-child {
  margin-top: 20px;
}


/* ---------- 3. Engagement ----------
   A vertical rail: the line runs down the left through the five nodes, and
   each step reads to its right. The rail draws top to bottom in a second as
   the list enters view, the nodes lighting as it passes. A five-node row
   would leave words of ten letters about 60px each at 390, so the list wins. */
.svc-flow {
  padding: 44px var(--gutter, 20px) 52px;
}

.svc-flow h2 {
  margin-bottom: 26px;
}

.svc-flow__row {
  display: block;
}

.svc-flow__row::before,
.svc-flow__row::after {
  top: 22px;
  bottom: 22px;
  left: 21px;
  right: auto;
  width: 2px;
  height: auto;
}

.js-svc .svc-flow__row::after {
  transform: scaleY(0);
  transform-origin: center top;
}

.js-svc .svc-flow__row.is-in::after {
  transform: none;
}

.svc-step {
  min-height: 82px;
}

.svc-step:last-child {
  min-height: 44px;
}

.svc-step a {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-areas: "n w" "n l";
  grid-template-rows: auto 1fr;
  align-items: start;
  gap: 0 18px;
  padding: 0;
  text-align: left;
  min-height: 44px;
}

.svc-step__num {
  grid-area: n;
  margin-bottom: 0;
}

.svc-step__word {
  grid-area: w;
  margin-top: 7px;
}

.svc-step__line {
  grid-area: l;
  max-width: none;
}

.js-svc .svc-step__word,
.js-svc .svc-step__line {
  transform: translateX(8px);
}

.js-svc .svc-flow__row.is-in .svc-step__word,
.js-svc .svc-flow__row.is-in .svc-step__line {
  transform: none;
}

/* Hover and focus progress runs down the rail (scaleY from the top). The
   fill is the first step's ::before, laid out like the rail. */
.svc-step:first-child::before,
.svc-flow__row.is-engaged .svc-step:first-child::before {
  top: 22px;
  left: 21px;
  right: auto;
  width: 2px;
  height: calc(100% - 44px);
  transform-origin: center top;
}

.svc-step:first-child::before {
  transform: scaleY(0);
}

.svc-flow__row.is-engaged .svc-step:first-child::before {
  transform: scaleY(calc(var(--to, 0) / 4));
}

@media (prefers-reduced-motion: reduce) {
  .svc-step:first-child::before,
  .svc-flow__row.is-engaged .svc-step:first-child::before {
    transform: none;
  }

  .svc-step:first-child::before { height: 0; }

  .svc-flow__row.is-engaged .svc-step:first-child::before {
    height: calc(var(--to, 0) * (100% - 44px) / 4);
  }
}


/* S15 phone scale (<= 599px only): hero title on H1, blocks on 64/64
   (ivory blocks, cream flow, so each meets another colour) */
@media (max-width: 599px) {
  .services-hero .header-placeholder__overlay h1 {
    --fs-scale: 1;
  }

  .svc {
    padding-top: var(--section-pad-y, 64px);
    padding-bottom: var(--section-pad-y, 64px);
  }

  .svc-flow {
    padding-top: var(--section-pad-y, 64px);
    padding-bottom: var(--section-pad-y, 64px);
  }
}
