/*
  PMD Stack Layers. The active layer (data-active) sets the vertical position
  of the pill, card, services and connector lines; data-accent sets the glow
  and dot colour.
*/

.pmd-stack-layers__stage {
  --accent: var(--pmd-teal);
  /* Centre of the active layer's square as a share of the layer artwork's
     height (SVG geometry: 170 / 342 / 537 of 708). The pill and connector
     lines sit on it, and the copy and services line up with it (client
     2026-10-30; the live site used 22 / 54 / 84% of different boxes). */
  --n: .2403;
  --top: calc(var(--n) * 100%);
  /* Height of the layer graphic beside the copy (desktop: 620px wide) */
  --stack-graphic-h: 517px;

  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 640px;
}

.pmd-stack-layers__stage[data-active="1"] { --n: .4836; }
.pmd-stack-layers__stage[data-active="2"] { --n: .7587; }

.pmd-stack-layers__stage[data-accent="fuchsia"] { --accent: var(--pmd-fuchsia); }
.pmd-stack-layers__stage[data-accent="teal"] { --accent: var(--pmd-teal); }
.pmd-stack-layers__stage[data-accent="lime"] { --accent: var(--pmd-lime); }

.pmd-stack-layers__glow {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 0;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  filter: blur(90px);
  opacity: .35;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Graphic: the three layer images cross-fade */
.pmd-stack-layers__graphic {
  position: relative;
  z-index: 1;
  width: 620px;
  max-width: 92%;
  aspect-ratio: 620 / 517;
}

.pmd-stack-layers__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity .6s var(--pmd-ease);
}

.pmd-stack-layers__img.is-active {
  opacity: 1;
}

.pmd-stack-layers__pill {
  position: absolute;
  top: var(--top);
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 30px;
  border: 1px solid var(--pmd-dark-glass-border);
  border-radius: 999px;
  background: var(--pmd-dark-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: var(--pmd-fs-xl);
  font-weight: 500;
  white-space: nowrap;
  color: var(--pmd-white);
  transform: translate(-50%, -50%);
  transition: top .6s var(--pmd-ease);
}

.pmd-stack-layers__dot,
.pmd-stack-layers__service-dot {
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  transition: background .8s var(--pmd-ease), box-shadow .8s var(--pmd-ease);
}

.pmd-stack-layers__dot {
  width: 8px;
  height: 8px;
  box-shadow: 0 0 14px var(--accent);
}

/* Hover/click zones: thirds of the graphic */
.pmd-stack-layers__zone {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 4;
  height: 33.33%;
  cursor: pointer;
}

.pmd-stack-layers__zone--0 { top: 0; }
.pmd-stack-layers__zone--1 { top: 33.33%; }
.pmd-stack-layers__zone--2 { top: 66.66%; height: 33.34%; }

.pmd-stack-layers__zone:focus-visible {
  outline-offset: -3px;
  border-radius: 12px;
}

/* Connector lines either side of the pill, across the active layer to its
   side corners (positioned in the graphic, like the pill) */
.pmd-stack-layers__line {
  position: absolute;
  top: var(--top);
  z-index: 2;
  width: 220px;
  max-width: 26%;
  height: 1px;
  background: var(--pmd-dark-line);
  transform: translateY(-50%);
  transition: top .6s var(--pmd-ease);
}

.pmd-stack-layers__line--left { right: 50%; margin-right: 100px; }
.pmd-stack-layers__line--right { left: 50%; margin-left: 100px; }

/* Copy (left) and services (right) */
.pmd-stack-layers__cards,
.pmd-stack-layers__services {
  position: absolute;
  /* The graphic is centred in the stage: its square's centre, in stage terms */
  top: calc(50% + (var(--n) - .5) * var(--stack-graphic-h));
  z-index: 3;
  transition: opacity .5s var(--pmd-ease), top .6s var(--pmd-ease);
}

.pmd-stack-layers__stage.is-fading .pmd-stack-layers__cards,
.pmd-stack-layers__stage.is-fading .pmd-stack-layers__services {
  opacity: 0;
}

.pmd-stack-layers__cards {
  left: 0;
  width: 300px;
  max-width: 40%;
  padding: 30px 30px 30px 0;
  transform: translateY(-50%);
}

.pmd-stack-layers__card-title {
  margin-bottom: 14px;
  font-size: var(--pmd-fs-card-title);
  font-weight: 600;
  line-height: 28px;
  color: var(--pmd-white);
}

.pmd-stack-layers__card-body {
  font-size: var(--pmd-fs-md);
  line-height: 22px;
  color: var(--pmd-text-faint);
}

.pmd-stack-layers__services {
  right: 0;
  padding-left: 32px;
  border-left: 1px solid var(--pmd-dark-line);
  transform: translateY(-50%); /* centred on the active square, like the copy */
}

.pmd-stack-layers__service-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  list-style: none;
}

.pmd-stack-layers__service {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--pmd-fs-md);
  line-height: 1.4;
  white-space: nowrap;
  color: var(--pmd-text-soft);
}

.pmd-stack-layers__service-dot {
  width: 6px;
  height: 6px;
  box-shadow: 0 0 8px var(--accent);
}

.pmd-stack-layers__note {
  max-width: 260px;
  margin-top: 24px;
  font-size: var(--pmd-fs-sm);
  line-height: 1.5;
  color: var(--pmd-text-faint);
}

@media (max-width: 1024px) {
  .pmd-stack-layers__stage {
    flex-direction: column;
    min-height: 0;
  }

  .pmd-stack-layers__line {
    display: none;
  }

  .pmd-stack-layers__graphic {
    width: 520px;
  }

  .pmd-stack-layers__cards {
    position: static;
    width: 100%;
    max-width: 400px;
    padding: 0;
    margin-bottom: 24px;
    text-align: center;
    transform: none;
    order: -1;
  }

  .pmd-stack-layers__services {
    position: static;
    min-height: 190px;
    margin-top: 24px;
    padding-left: 0;
    border-left: 0;
    transform: none;
  }

  .pmd-stack-layers__service-list {
    align-items: center;
  }

  .pmd-stack-layers__service {
    white-space: normal;
    text-align: center;
  }

  .pmd-stack-layers__note {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .pmd-stack-layers__graphic {
    width: 100%;
  }

  .pmd-stack-layers__pill {
    padding: 10px 20px;
    font-size: var(--pmd-fs-md);
  }
}

/* ---------- Scroll-driven (interaction "scroll") ----------
   The track is three screens tall; the stage stays pinned for the scroll
   distance beyond one screen, which module.js splits across the layers. */

.pmd-stack-layers__track {
  --track-height: 300vh;

  height: var(--track-height);
}

@supports (height: 100svh) {
  .pmd-stack-layers__track { --track-height: 300svh; }
}

.pmd-stack-layers--scroll .pmd-stack-layers__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 0;
}

@supports (height: 100svh) {
  .pmd-stack-layers--scroll .pmd-stack-layers__stage { height: 100svh; }
}

/* The section's background photo pins together with the stage, so it never
   slides behind the pinned layers. It sits in a layer covering the section
   (the sticky photo's containing block), is one screen plus the distance
   from the section top to the track (--stack-bg-offset, set by module.js)
   tall, and sticks at minus that distance: the moment the stage pins. The
   section has no bottom padding, so both are released at the track's end. */
.pmd-stack-layers--scroll {
  --stack-screen: 100vh;

  padding-bottom: 0;
}

@supports (height: 100svh) {
  .pmd-stack-layers--scroll { --stack-screen: 100svh; }
}

.pmd-stack-layers__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pmd-stack-layers__bg-img {
  position: sticky;
  top: calc(var(--stack-bg-offset, 0px) * -1);
  display: block;
  width: 100%;
  height: calc(var(--stack-screen) + var(--stack-bg-offset, 0px));
  object-fit: cover;
}

/* Stacked layout: sized to fit one screen while pinned */
@media (max-width: 1024px) {
  .pmd-stack-layers--scroll .pmd-stack-layers__stage {
    justify-content: center;
    gap: 12px;
  }

  .pmd-stack-layers--scroll .pmd-stack-layers__graphic {
    width: min(100%, 420px, 46vh);
  }

  .pmd-stack-layers--scroll .pmd-stack-layers__cards {
    margin-bottom: 8px;
  }

  .pmd-stack-layers--scroll .pmd-stack-layers__services {
    min-height: 0;
    margin-top: 8px;
  }
}
