.home-service-scroll-row {
  display: contents;
}

.home-service-best-list {
  flex-direction: column;
}

.home-service-best-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
}

html:has(body[data-route="home"] [data-home-services-scroll]),
body[data-route="home"]:has([data-home-services-scroll]),
body[data-route="home"]:has([data-home-services-scroll]) :is(
  .site-shell,
  .page-root
) {
  overflow-x: clip;
}

@media (min-width: 1100px) and (prefers-reduced-motion: no-preference) {
  .home-services-scroll-section.is-scroll-ready {
    position: relative;
    height: clamp(260rem, 500vh, 360rem);
    padding: 0 !important;
    background: var(--color-surface);
  }

  .home-services-scroll-section.is-scroll-ready .home-services-scroll-stage {
    position: sticky;
    top: var(--site-header-height);
    z-index: 20;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    width: 100%;
    height: calc(100svh - var(--site-header-height));
    min-height: 0;
    overflow: hidden;
    background: var(--color-surface) url("../images/services/backgrounds/services-background.png") center / cover no-repeat;
    isolation: isolate;
  }

  .home-services-stage-intro {
    position: absolute;
    top: clamp(0.75rem, 1.8vh, 1.35rem);
    left: 50%;
    z-index: 3;
    display: grid;
    justify-items: center;
    width: min(calc(100% - 13rem), 64rem);
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
  }

  .home-services-stage-kicker {
    margin: 0 0 clamp(0.65rem, 1.4vh, 1rem);
    color: var(--color-accent);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.28em;
    text-transform: uppercase;
  }

  .home-services-stage-intro h2 {
    max-width: none;
    margin: 0;
    color: var(--color-navy-dark);
    font-size: clamp(2.2rem, 2.8vw, 3.45rem);
    line-height: 0.98;
    letter-spacing: -0.045em;
    text-wrap: balance;
  }

  .home-services-stage-intro h2 span {
    display: block;
    white-space: nowrap;
  }

  .home-services-stage-lead {
    max-width: 50rem;
    margin: clamp(0.85rem, 1.6vh, 1.2rem) 0 0;
    color: var(--color-text-secondary);
    font-size: clamp(0.9rem, 1.05vw, 1.08rem);
    line-height: 1.55;
    text-wrap: balance;
  }

  .home-services-stage-highlights {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(100%, 47rem);
    margin-top: clamp(1rem, 2vh, 1.4rem);
  }

  /* Reversible advanced-home preview: remove the modifier class to restore the highlights. */
  .home-services-scroll-section--hide-highlights .home-services-stage-highlights {
    display: none;
  }

  .home-services-scroll-section--hide-highlights .home-services-stage-kicker {
    margin-bottom: clamp(0.9rem, 1.8vh, 1.25rem);
  }

  .home-services-scroll-section--hide-highlights .home-services-stage-intro h2 {
    line-height: 1.04;
  }

  .home-services-scroll-section--hide-highlights .home-services-stage-lead {
    margin-top: clamp(1.2rem, 2.4vh, 1.75rem);
    line-height: 1.65;
  }

  .home-services-scroll-section--hide-highlights .home-services-pair-progress {
    margin-top: clamp(2.6rem, 5vh, 4rem);
  }

  .home-services-stage-highlight {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr);
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    padding: 0 1.2rem;
    text-align: left;
  }

  .home-services-stage-highlight + .home-services-stage-highlight {
    border-left: 1px solid var(--color-border);
  }

  .home-services-stage-highlight-icon {
    display: grid;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    color: var(--color-accent);
  }

  .home-services-stage-highlight-icon svg {
    width: 2rem;
    height: 2rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .home-services-stage-highlight > span:last-child {
    display: grid;
    min-width: 0;
  }

  .home-services-stage-highlight strong {
    color: var(--color-navy-dark);
    font-size: 0.88rem;
    line-height: 1.2;
  }

  .home-services-stage-highlight small {
    margin-top: 0.2rem;
    color: var(--color-text-secondary);
    font-size: 0.68rem;
    line-height: 1.25;
  }

  .home-services-scroll-section.is-scroll-ready .home-services-panel {
    position: relative;
    z-index: 2;
    min-height: 0;
    padding: clamp(1rem, 1.8vw, 1.75rem) clamp(1.5rem, 1.6vw, 1.875rem);
    overflow: hidden;
    background: transparent;
  }

  .home-services-scroll-section.is-scroll-ready .home-services-grid {
    --home-service-pair-gap: clamp(0.9rem, 1.5vw, 1.35rem);
    --home-service-pair-centre: 72%;
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
  }

  .home-services-scroll-section.is-scroll-ready .home-service-scroll-row {
    position: absolute;
    top: var(--home-service-pair-centre);
    right: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--home-service-pair-gap);
    height: 27rem;
    min-height: 27rem;
    z-index: 1;
    transform-origin: center;
    will-change: transform, opacity;
  }

  .home-services-scroll-section.is-scroll-ready .home-service-card {
    height: 100%;
    min-height: 0;
    border-radius: 0 !important;
  }

  .home-services-pair-progress {
    --home-services-progress: 0;
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    width: min(100%, 47rem);
    height: 2.35rem;
    margin: clamp(1.35rem, 2.6vh, 1.75rem) 0 0;
    padding: 0;
    list-style: none;
    pointer-events: auto;
  }

  .home-services-pair-progress::before,
  .home-services-pair-progress::after {
    position: absolute;
    top: 0.32rem;
    left: 12.5%;
    z-index: 0;
    width: 75%;
    height: 3px;
    content: "";
  }

  .home-services-pair-progress::before {
    background: var(--color-border-strong);
  }

  .home-services-pair-progress::after {
    background: var(--color-accent);
    transform: scaleX(var(--home-services-progress));
    transform-origin: left center;
    will-change: transform;
  }

  .home-services-pair-progress li {
    position: relative;
    z-index: 1;
    color: var(--color-text-muted);
  }

  .home-services-pair-progress button {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0 0 0.05rem;
    border: 0;
    appearance: none;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    cursor: pointer;
    pointer-events: auto;
  }

  .home-services-pair-progress button:hover {
    color: var(--color-accent);
  }

  .home-services-pair-progress button:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 0.18rem;
  }

  .home-services-pair-progress li::after {
    position: absolute;
    top: 0;
    left: 50%;
    width: 0.72rem;
    height: 0.72rem;
    border: 2px solid var(--color-border-strong);
    border-radius: 50%;
    background: var(--color-surface);
    content: "";
    transform: translateX(-50%);
    pointer-events: none;
  }

  .home-services-pair-progress li.is-active {
    color: var(--color-accent);
  }

  .home-services-pair-progress li.is-reached::after {
    border-color: var(--color-accent);
    background: var(--color-accent);
  }

  .home-services-pair-progress li.is-active.is-reached::after {
    box-shadow: 0 0 0 0.2rem var(--color-accent-wash);
  }

}

@media (min-width: 1100px) and (max-height: 760px) and (prefers-reduced-motion: no-preference) {
  .home-services-stage-intro {
    top: 0.5rem;
  }

  .home-services-stage-intro h2 {
    font-size: clamp(1.75rem, 2.5vw, 2.5rem);
  }

  .home-services-stage-lead,
  .home-services-stage-highlights {
    display: none;
  }

  .home-services-scroll-section--hide-highlights .home-services-pair-progress {
    margin-top: clamp(1rem, 2vh, 1.35rem);
  }

  .home-services-scroll-section.is-scroll-ready .home-services-grid {
    --home-service-pair-centre: 60%;
  }

  .home-services-scroll-section.is-scroll-ready .home-service-copy {
    display: none;
  }
}
