/* ---------------------------------------------------------------------------
 * home-services — Our services carousel (Figma 562:689). Moved out of home.css
 * so the block carries its own stylesheet (see inc/block-assets.php).
 *
 * Swiper's own CSS/JS is still enqueued from inc/enqueue.php — this file only
 * carries the theme layer on top of it.
 * ------------------------------------------------------------------------- */

.home-services {
  padding-block: 81px 50px;
  background: var(--bg, #ffffff);
}

.home-services-inner {
  max-width: calc(1760px + var(--gutter) * 2);
}

.home-services .head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 0;
}

.home-services h2 {
  margin: 0;
  font-size: clamp(24px, 1.875vw, 36px);
  line-height: 1.222;
}

.home-services .controls {
  display: flex;
  gap: 16px;
}

.home-services .controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: var(--radius, 3px);
  background: var(--brand, #008AF7);
  color: var(--white, #ffffff);
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.home-services .controls button:hover,
.home-services .controls button:focus-visible {
  background: var(--brand-dark, #0070ca);
}

.home-services .controls button.swiper-button-disabled {
  opacity: 0.4;
  cursor: default;
}

.home-services .controls .cnm-icon {
  width: 17px;
  height: 14px;
}

/* Swiper adds .swiper-button-lock when every slide already fits (nothing to page)
   and .swiper-button-disabled at either end of a track that can move. The design
   always shows both chips solid, so the locked case keeps its Figma appearance;
   only the end-of-track case dims, which is real navigation feedback. */
.home-services .controls button.swiper-button-lock {
  cursor: default;
  pointer-events: none;
}

.home-services .controls button.swiper-button-disabled:not(.swiper-button-lock) {
  opacity: 0.35;
  cursor: default;
}

.home-services .services-slider {
  padding-block: 90px;
}

/* Swiper subtracts the container's own padding when sizing slides, so real
   padding-inline (not a max-width) keeps the cards inset from the heading at
   every viewport — a max-width only bites once the container outgrows it. */
@media (min-width: 992px) {
  .home-services .services-slider {
    padding-inline: clamp(32px, 3.3vw, 64px);
  }
}

.home-services .services-slider .swiper-wrapper {
  transition-timing-function: cubic-bezier(0.3, 0, 0.2, 1);
}

.home-services .card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 44px;
  height: auto;
  min-height: 612px;
  padding: 50px;
  border-radius: var(--radius-xl, 24px);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* The card lifts on hover and on keyboard focus, so pointer and keyboard users
   get the same affordance. */
.home-services .card:hover,
.home-services .card:focus-within {
  transform: translateY(-18px) scale(1.015);
  box-shadow: 0 26px 54px rgba(var(--black-rgb, 0, 0, 0), 0.34);
}

/* Stretched link: the existing "Learn More" anchor covers the whole card, so the
   entire card is clickable while the only interactive element remains a native
   <a>. No clickable div, and focus/hover states stay on the anchor. */
.home-services .card .btn-layout.stretched::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.home-services .card .btn-layout.stretched:focus-visible {
  outline: 2px solid var(--white, #ffffff);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .home-services .card {
    transition: none;
  }

  .home-services .card:hover,
  .home-services .card:focus-within {
    transform: none;
  }

  /* Swiper sets transition-duration inline; !important is the only way to
     suppress the slide animation for reduced-motion users. */
  .home-services .services-slider .swiper-wrapper {
    transition-duration: 0ms !important;
  }
}

/* Per-card photo crop (CCD-41). At 1440 the card is 594x612 while the Trucking
   photo is 1024x684, so `cover` renders it 916px wide and drops 322px of width —
   161px off each side. That truck sits at ~80% across the frame, so the default
   `center` cuts it in half. Anchoring right keeps the whole truck in view (it
   lands 44px clear of the card's right edge); the photo's 1.5:1 aspect in a
   near-square card is why it cannot sit dead centre. */
.home-services .card--trucking-delivery {
  background-position: right center;
}

.home-services .card h3 {
  position: relative;
  width: 100%;
  margin: 0 0 6px;
  padding-bottom: 12px;
  /* Single line, never wrapping (client round 8): the vw term keeps the longest
     title ("CONCRETE RECYCLING") inside the card on narrow phones. */
  font-size: min(clamp(24px, 1.875vw, 36px), 4.8vw);
  line-height: 1.222;
  white-space: nowrap;
  /* Flush with the underline's left edge (client round 8) — was centered. */
  text-align: left;
  text-transform: uppercase;
  color: var(--light, #E8E8E8);
}

.home-services .card h3::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 417px;
  max-width: 100%;
  height: 2px;
  background: var(--brand, #008AF7);
}

.home-services .card p {
  max-width: 417px;
  margin: 0;
  font-size: 18px;
  line-height: 1.4444;
  color: var(--white, #ffffff);
}

.home-services .card .btn-layout {
  padding: 18px 28px;
  border-radius: var(--radius-md, 5px);
}

.home-services .card .cnm-icon {
  width: 9px;
  height: 13px;
}

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 1399px) {
  .home-services .card {
    min-height: 520px;
    padding: 40px;
  }
}

@media (max-width: 767px) {
  .home-services {
    padding-top: 48px;
  }

  .home-services .head {
    margin-bottom: 40px;
  }

  /* Half the desktop breathing room — 90px around single-card slides reads as
     dead space at phone widths (client round 4). */
  .home-services .services-slider {
    padding-block: 44px;
  }
}

@media (max-width: 600px) {
  /* Softer card interior on phones (client round 10); the shorter card also
     starts the title higher — less empty photo above the copy. */
  .home-services .card {
    gap: 28px;
    min-height: 440px;
    padding: 28px;
  }

  /* Largest size that still keeps the longest title ("CONCRETE RECYCLING",
     ~12.3em wide) on one line: available width is 100vw minus gutters (48px)
     and card padding (56px); /12.6 leaves a small safety margin. */
  .home-services .card h3 {
    font-size: min(24px, calc((100vw - 104px) / 12.6));
  }
}

/* --- Editor mirrors ------------------------------------------------------ *
 * See blocks/theme/hero/theme-hero.css for why these exist. Inert on the front
 * end; the `crush-block` container is declared only in assets/css/editor.css.
 * ------------------------------------------------------------------------- */

@container crush-block (min-width: 992px) {
  .home-services .services-slider {
    padding-inline: clamp(32px, 3.3vw, 64px);
  }
}

@container crush-block (max-width: 1399px) {
  .home-services .card {
    min-height: 520px;
    padding: 40px;
  }
}

/* Undoes the `@media (min-width: 992px)` rule above. A container query cannot
   un-match a media query, and that media query keeps firing in the editor
   because the browser window is wider than 992px even when the preview pane is
   not — so the pane would inherit the desktop inset. Every `min-width` @media
   in this theme needs a partner block like this one; the `max-width` ones need
   nothing, since their mirrors simply override. */
@container crush-block (max-width: 991px) {
  .home-services .services-slider {
    padding-inline: 0;
  }
}

@container crush-block (max-width: 767px) {
  .home-services {
    padding-top: 48px;
  }

  .home-services .head {
    margin-bottom: 40px;
  }

  .home-services .services-slider {
    padding-block: 44px;
  }
}

@container crush-block (max-width: 600px) {
  .home-services .card {
    gap: 28px;
    min-height: 440px;
    padding: 28px;
  }

  /* cqw, not vw: this rule sizes the title against the width the card has, and
     inside a preview pane the browser window is the wrong ruler. 100cqw is the
     preview pane, which is what 100vw stands for on the front end. */
  .home-services .card h3 {
    font-size: min(24px, calc((100cqw - 104px) / 12.6));
  }
}
