.services-carousel {
  --card-width: min(58vw, 840px);
  --card-height: calc(var(--card-width) * .6);
  --systems-heading-size: clamp(30px, 3.65vw, 56px);
  --carousel-bottom-space: 144px;
  --carousel-photo-depth: clamp(340px, 42vw, 620px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 0 0 var(--carousel-bottom-space);
  color: #fff;
  background:
    linear-gradient(180deg, transparent 62%, #0b1422 100%),
    radial-gradient(ellipse 68% 62% at 50% 46%, #294858 0%, #152938 45%, #0b1422 100%);
}

.services-carousel-inner { position: relative; z-index: 1; max-width: 1480px; padding-inline: clamp(20px, 2.5vw, 40px); }
/* Let the screen-blended watermark reach the shared canvas; keep the carousel
   controls and cards above the decorative photo layer. */
.services-carousel > .services-carousel-inner { z-index: auto; }
.services-carousel :is(.services-stage, .services-bottom) { position: relative; z-index: 1; }
/* The viewport frames the owner's original logo without altering its pixels.
   Screen blending removes its black canvas against the Coastal Glow backdrop. */
.services-brand-watermark {
  position: absolute;
  z-index: 0;
  left: clamp(20px, 3vw, 44px);
  bottom: calc(24px - var(--carousel-bottom-space));
  display: block;
  width: clamp(180px, 21vw, 280px);
  height: auto;
  aspect-ratio: 1678 / 627;
  overflow: hidden;
  opacity: .28;
  mix-blend-mode: screen;
  pointer-events: none;
  user-select: none;
}
/* One continuous coastal photo connects the heading to the carousel. Its
   lower edge fades into the existing dark canvas behind the foreground cards. */
.services-carousel::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0 0 auto;
  height: var(--carousel-photo-depth);
  pointer-events: none;
  background-image:
    linear-gradient(90deg, rgb(3 23 101 / 78%), rgb(8 43 234 / 65%), rgb(3 23 101 / 78%)),
    url("assets/roofing-systems-coastal-banner-v1.png");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 38%, rgb(0 0 0 / 80%) 58%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 38%, rgb(0 0 0 / 80%) 58%, transparent 100%);
}
.services-heading {
  position: relative;
  z-index: 1;
  overflow: hidden;
  padding-block: clamp(28px, 3vw, 44px) clamp(12px, 1.5vw, 22px);
}
.services-heading-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(24px, 3.5vw, 54px);
}
.services-heading h2 {
  color: #fff;
  font-size: var(--systems-heading-size);
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: -.035em;
  text-transform: uppercase;
  transform: scaleX(1.05);
  transform-origin: left center;
  text-shadow: 0 2px 8px rgb(2 13 62 / 35%);
  text-wrap: balance;
}
.services-stage { position: relative; }
/* The photo deck slides in at full opacity so the blue backdrop never tints it. */
.services-carousel .services-stage[data-reveal] { opacity: 1; }
.services-deck {
  --drag: 0px;
  position: relative;
  height: calc(var(--card-height) + 32px);
  touch-action: pan-y;
  user-select: none;
  cursor: grab;
}
.services-deck.is-dragging { cursor: grabbing; }
.service-card {
  --x: 0px;
  --scale: 1;
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--card-width);
  height: var(--card-height);
  padding: 0;
  border: 0;
  background: transparent;
  transform: translate(-50%, -50%) translateX(calc(var(--x) + var(--drag))) scale(var(--scale));
  transition: transform 450ms cubic-bezier(.2,.7,.2,1);
  cursor: inherit;
  -webkit-tap-highlight-color: transparent;
}
.service-card[data-position="center"] { z-index: 3; }
.service-card[data-position="left"] { --x: calc(var(--card-width) * -.34); --scale: .74; z-index: 2; }
.service-card[data-position="right"] { --x: calc(var(--card-width) * .34); --scale: .74; z-index: 2; }
.service-card[data-position="hidden"] { --scale: .7; opacity: 0; visibility: hidden; pointer-events: none; z-index: 0; }
.service-card-face {
  display: grid;
  grid-template-rows: minmax(0, 1fr) clamp(82px, 8vw, 106px);
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 0;
  background: var(--blue-dark);
  box-shadow: 0 12px 25px rgb(0 5 30 / 38%);
  transition: box-shadow 220ms ease, transform 220ms ease;
}
.service-card[data-position="center"] .service-card-face { box-shadow: 0 14px 28px rgb(0 5 30 / 42%), 0 0 40px rgb(27 75 255 / 20%), 0 0 0 2px var(--orange); }
/* Photos and solid captions occupy separate rows, with no overlay or color filter. */
.service-card-photo { display: block; position: relative; min-height: 0; overflow: hidden; background: #fff; }
.service-card img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.service-card[data-service="tile"] img { height: 106%; object-position: center top; }
.service-card-title { display: flex; align-items: center; padding: 8px 28px; background: var(--blue-dark); color: #fff; font-size: clamp(28px, 3vw, 42px); font-weight: 700; line-height: 1.16; text-align: left; }
.service-card[data-service="flat"] .service-card-title { font-size: clamp(26px, 2.7vw, 38px); }
.service-card:is([data-position="left"], [data-position="right"]) .service-card-title { font-size: clamp(14px, 1.6vw, 20px); }
.service-card[data-position="left"] .service-card-title { padding-right: 68%; }
.service-card[data-position="right"] .service-card-title { padding-left: 68%; justify-content: flex-end; text-align: right; }
.services-arrow { position: absolute; top: 50%; z-index: 5; display: grid; place-items: center; width: 44px; height: 80px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--orange); transform: translateY(-50%); filter: drop-shadow(0 3px 6px rgb(0 5 30 / 30%)); transition: color 180ms ease; }
.services-arrow-shape { width: 24px; height: 80px; fill: currentColor; stroke: none; pointer-events: none; }
.services-previous { left: 0; }
.services-next { right: 0; }
.services-previous .services-arrow-shape { transform: rotate(180deg); }
.services-arrow:hover { color: #ff853f; }
.services-arrow:active { transform: translateY(-50%) scale(.94); }
.services-bottom { display: flex; align-items: center; flex-direction: column; gap: 12px; margin-top: 16px; }
.services-explore {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: calc(var(--card-width) * .9);
  max-width: calc(100% - 40px);
  min-height: 58px;
  min-width: 0;
  justify-content: center;
  gap: 22px;
  border: 1.5px solid var(--orange);
  background-color: var(--orange);
  color: #061744;
  font-size: 16px;
  text-align: center;
  box-shadow: 0 8px 22px rgb(0 5 30 / 28%);
}
/* White outline artwork stays inside the button, behind the readable label. */
.services-explore::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: url("assets/roofing-outline-pattern-mask.webp") repeat left 18% / 280px 280px;
  mix-blend-mode: screen;
  opacity: .38;
  mask-image: linear-gradient(90deg, #000 15%, rgb(0 0 0 / 28%) 38% 62%, #000 85%);
  pointer-events: none;
}
.services-explore > span { position: relative; z-index: 1; }
.services-explore:is(:hover, :focus-visible) { border-color: var(--blue); background-color: var(--blue); color: #fff; }
.services-hint { color: #d4defb; font-size: 12px; line-height: 1.4; }
.services-carousel button:focus-visible, .services-carousel a:focus-visible { outline: 3px solid #fff; outline-offset: 5px; }
.services-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (hover: hover) and (pointer: fine) {
  .service-card:hover .service-card-face { transform: translateY(-5px); box-shadow: 0 19px 32px rgb(0 5 30 / 42%), 0 0 0 2px var(--orange); }
}
@media (max-width: 1000px) {
  .services-carousel { --card-width: 56vw; --carousel-bottom-space: 128px; }
  .service-card-title { padding-inline: 22px; }
  .services-arrow { height: 68px; }
  .services-arrow-shape { width: 21px; height: 68px; }
}
@media (max-width: 900px) {
  .services-heading-group { flex-direction: column; gap: 14px; text-align: center; }
  .services-heading h2 { transform-origin: center; }
}
@media (max-width: 680px) {
  .services-carousel { --card-width: min(82vw, 520px); --card-height: calc(var(--card-width) * .78); --systems-heading-size: clamp(28px, 7.5vw, 42px); --carousel-bottom-space: 116px; }
  .services-brand-watermark { width: 160px; }
  .services-carousel-inner { padding-inline: 0; }
  .services-heading { padding-inline: 20px; }
  .services-bottom { margin-top: 0; }
  .services-deck { height: calc(var(--card-height) + 36px); }
  .service-card[data-position="left"] { --x: calc(var(--card-width) * -.6); --scale: .76; }
  .service-card[data-position="right"] { --x: calc(var(--card-width) * .6); --scale: .76; }
  .service-card-face { border-radius: 0; grid-template-rows: minmax(0, 1fr) 76px; }
  .service-card-title { font-size: 27px; padding-inline: 20px; }
  .service-card[data-service="flat"] .service-card-title { font-size: 24px; }
  .service-card:is([data-position="left"], [data-position="right"]) .service-card-title { visibility: hidden; }
  .services-previous { left: 8px; }
  .services-next { right: 8px; }
  .services-explore { min-height: 54px; padding-inline: 20px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .service-card, .service-card-face, .services-arrow { transition: none; }
  .service-card:hover .service-card-face { transform: none; }
}
@media (forced-colors: active) {
  .services-brand-watermark { display: none; }
}
