/* Animated Audit / Build / Grow artwork (see service-art.js). The still image below
   is the fallback; the art covers it once the script has run. */
.service-hero__media.has-art {
  position: relative;
}

.has-art .service-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
}

.service-art svg {
  display: block;
  width: 100%;
  height: 100%;
}

.service-art__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(closest-side at 50% 55%, rgb(230 0 18 / 0.26), transparent 70%);
}

.service-art svg :where(*) {
  transform-box: fill-box;
  animation-duration: 9s;
  animation-iteration-count: infinite;
  animation-delay: var(--d, 0s);
  animation-play-state: running;
}

/* Home page panel: only the lit pillar moves. */
.pillars__panel[data-active='false'] .service-art svg :where(*) {
  animation-play-state: paused;
}

.sa-scan {
  animation-name: sa-scan;
  animation-timing-function: ease-in-out;
}
@keyframes sa-scan {
  0%, 100% { transform: translate(0, 0); }
  35% { transform: translate(-50px, -330px); }
  65% { transform: translate(60px, -180px); }
}

.sa-row {
  animation-name: sa-row;
  animation-duration: 6s;
}
@keyframes sa-row {
  0%, 100% { opacity: 0.35; }
  15%, 65% { opacity: 1; }
}

.sa-pulse {
  animation-name: sa-pulse;
  animation-duration: 2.4s;
  transform-origin: center;
}
@keyframes sa-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.025); }
}

.sa-slide {
  animation-name: sa-slide;
  animation-duration: 8s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sa-slide {
  0% { opacity: 0; transform: translateX(var(--x)); }
  25%, 80% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateX(var(--x)); }
}

.sa-drop {
  animation-name: sa-drop;
  animation-duration: 8s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sa-drop {
  0% { opacity: 0; transform: translateY(-50px); }
  15%, 85% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: none; }
}

.sa-rise {
  animation-name: sa-rise;
  transform-origin: bottom;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sa-rise {
  0% { transform: scaleY(0); }
  30%, 90% { transform: scaleY(1); }
  100% { transform: scaleY(1); opacity: 0; }
}

.sa-draw {
  stroke-dasharray: 1;
  animation-name: sa-draw;
  animation-timing-function: ease-in-out;
}
@keyframes sa-draw {
  0%, 20% { stroke-dashoffset: 1; }
  55%, 90% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

.sa-head,
.sa-dot {
  animation-name: sa-after-draw;
}
@keyframes sa-after-draw {
  0%, 50% { opacity: 0; }
  58%, 90% { opacity: 1; }
  100% { opacity: 0; }
}
.sa-dot { transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
  .service-art svg :where(*) { animation: none !important; }
}

/* Home page: scroll-driven Audit / Build / Grow (see pin() in service-art.js). */
@media (min-width: 901px) {
  .pillars-track {
    height: calc(var(--n, 3) * 100svh);
  }

  .pillars-track > .pillars {
    position: sticky;
    top: var(--header-h, 0px);
    min-height: calc(100svh - var(--header-h, 0px));
    padding-block: 0;
  }

  .pillars-track .pillars__preview {
    max-height: calc(100svh - var(--header-h, 0px) - 4rem);
  }

  .pillars-track .pillars__progress {
    display: none;
  }

  .pillars-track .pillars__item[data-active='true'] .index {
    color: var(--c-accent);
  }

  .pillars-pin__bar {
    position: absolute;
    right: 0;
    top: 15%;
    bottom: 15%;
    width: 2px;
    background: var(--c-line, #333);
  }

  .pillars-pin__bar i {
    display: block;
    height: 100%;
    background: var(--c-accent, #e60012);
    transform: scaleY(0);
    transform-origin: top;
    will-change: transform;
  }
}

/* Home panel: let the artwork breathe. The site's own overlay darkens the whole panel; here it only
   darkens the lower third behind the words, and the artwork is lifted so its lines read clearly. */
.pillars__photo.has-art::after {
  background: linear-gradient(transparent 0 52%, rgb(0 0 0 / 0.78) 78%, rgb(0 0 0 / 0.94));
}

.pillars__photo.has-art .service-art svg {
  filter: brightness(1.35) contrast(1.08);
}

.pillars__photo.has-art .service-art__glow {
  background: radial-gradient(closest-side at 50% 38%, rgb(230 0 18 / 0.3), transparent 75%);
}

/* "Every decision passes three tests": the scroll-driven triangle (see approach() in service-art.js).
   Built on the site's tokens. The site's own figure stays in the page, hidden, as the fallback. */
.approach[data-apx] .approach__figure,
.approach[data-apx] .approach__hint {
  display: none;
}

.apx {
  position: relative;
  margin-top: var(--space-block, 4rem);
}

.apx__pin {
  position: sticky;
  top: var(--apx-top, 88px);
  height: var(--apx-h, 640px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
}

/* A soft glow of the accent behind the triangle that follows the pointer. */
.apx__glow {
  --gx: 50%;
  --gy: 50%;
  position: absolute;
  inset: -8% -4%;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(closest-side at var(--gx) var(--gy), color-mix(in srgb, var(--c-accent, #e60012) 13%, transparent), transparent 72%);
  opacity: 0;
  transition: opacity 1.2s ease;
}

.apx[data-started='true'] .apx__glow {
  opacity: 1;
}

/* Three steps: each fills as its side is drawn, and jumps to it when pressed. */
.apx__steps {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 0.5rem;
  width: min(100%, 320px);
}

.apx__step {
  position: relative;
  flex: 1;
  height: 22px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.apx__step::before,
.apx__step i {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: var(--c-line, #333);
}

.apx__step i {
  background: var(--c-accent, #e60012);
  transform: scaleX(0);
  transform-origin: left;
}

.apx__step[data-on='true']::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 8px;
  margin-top: -4px;
  background: color-mix(in srgb, var(--c-accent, #e60012) 22%, transparent);
  filter: blur(6px);
}

.apx__step:focus-visible,
.apx__lens:focus-visible {
  outline: 2px solid var(--c-accent, #e60012);
  outline-offset: 6px;
}

.apx__grid {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: clamp(1.5rem, 3vw, 3rem);
}

.apx__stage {
  grid-area: 1 / 2;
  width: min(40vw, 460px, calc((var(--apx-h, 640px) - 250px) * 1.113));
  perspective: 900px;
}

.apx__tilt {
  position: relative;
  transform-origin: 50% 60%;
  will-change: transform;
}

.apx__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.apx__fill {
  fill: color-mix(in srgb, var(--c-accent, #e60012) 11%, transparent);
  transition: fill 0.9s ease;
}

.apx[data-closed='true'] .apx__fill {
  fill: color-mix(in srgb, var(--c-accent, #e60012) 20%, transparent);
}

.apx__track,
.apx__side {
  fill: none;
  stroke-linecap: square;
}

.apx__track {
  stroke: var(--c-line, #333);
  stroke-width: 5px;
}

.apx__side {
  stroke: var(--c-text, #eee);
  stroke-width: 5px;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke 0.4s ease, stroke-width 0.4s ease, filter 0.5s ease;
}

.apx__side[data-state='on'] {
  stroke: var(--c-accent, #e60012);
  stroke-width: 9px;
  filter: drop-shadow(0 0 7px var(--c-accent, #e60012));
}

/* Commerce is the bottom line: its side stays in the accent once drawn. */
.apx__side--commerce[data-state='done'],
.apx__side--commerce[data-state='closed'] {
  stroke: var(--c-accent, #e60012);
}

.apx[data-closed='true'] .apx__side--commerce {
  stroke-width: 7px;
  filter: drop-shadow(0 0 9px var(--c-accent, #e60012));
}

.apx__hit {
  fill: none;
  stroke: transparent;
  stroke-width: 56px;
  pointer-events: stroke;
  cursor: pointer;
}

.apx__dot {
  fill: var(--c-bg, #000);
  stroke: var(--c-text, #eee);
  stroke-width: 4px;
  transition: fill 0.4s ease, stroke 0.4s ease, filter 0.4s ease;
}

.apx__vertex[data-lit='true'] .apx__dot {
  fill: var(--c-accent, #e60012);
  stroke: var(--c-accent, #e60012);
  filter: drop-shadow(0 0 10px var(--c-accent, #e60012));
}

.apx__ping {
  fill: none;
  stroke: var(--c-accent, #e60012);
  stroke-width: 3px;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.apx__vertex.is-ping .apx__ping {
  animation: apx-ping 0.95s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes apx-ping {
  0% { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0; transform: scale(3.4); }
}

/* The comet: a bright head, a trail of where it has just been, and a halo that breathes. */
.apx__head {
  transition: opacity 0.5s ease;
}

.apx__head[data-hidden='true'] {
  opacity: 0;
}

.apx__halo {
  fill: var(--c-accent, #e60012);
  opacity: 0.25;
  transform-box: fill-box;
  transform-origin: center;
  animation: apx-halo 1.8s ease-in-out infinite;
}

@keyframes apx-halo {
  0%, 100% { transform: scale(0.8); opacity: 0.18; }
  50% { transform: scale(1.3); opacity: 0.32; }
}

.apx__trail {
  fill: var(--c-accent, #e60012);
}

.apx__core {
  fill: var(--c-text, #fff);
  filter: drop-shadow(0 0 6px var(--c-accent, #e60012)) drop-shadow(0 0 14px var(--c-accent, #e60012));
}

/* The question in the middle swaps as the comet moves from side to side. */
.apx__centre {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 56%;
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.apx__q {
  font-size: clamp(1.5rem, 2.5vw, 2.5rem);
  line-height: 0.95;
  text-wrap: balance;
}

.apx__centre > * {
  transition: opacity 0.25s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.apx__centre > :nth-child(2) { transition-delay: 0.05s; }
.apx__centre > :nth-child(3) { transition-delay: 0.1s; }

.apx__centre.is-out > * {
  opacity: 0;
  transform: translateY(-12px);
  transition-duration: 0.18s;
  transition-delay: 0s;
}

.apx__centre.is-pre > * {
  opacity: 0;
  transform: translateY(14px);
  transition: none;
}

/* The three lenses around the triangle, as on the poster. Only the one being drawn is lit. */
.apx__lens {
  position: relative;
  max-width: 22rem;
  padding-bottom: 1rem;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.5s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.apx__lens--bx {
  grid-area: 1 / 1;
  justify-self: end;
  text-align: right;
}

.apx__lens--cx {
  grid-area: 1 / 3;
  justify-self: start;
}

.apx__lens--commerce {
  grid-area: 2 / 2;
  justify-self: center;
  margin-top: 0.75rem;
  text-align: center;
}

.apx__lens[data-state='past'] { opacity: 0.55; }
.apx__lens[data-state='on'],
.apx__lens[data-state='all'] { opacity: 1; }

.apx__lens--bx[data-state='on'] { transform: translateX(-10px); }
.apx__lens--cx[data-state='on'] { transform: translateX(10px); }
.apx__lens--commerce[data-state='on'] { transform: translateY(6px); }

@media (hover: hover) and (pointer: fine) {
  .apx__lens:hover { opacity: 1; }
}

.apx__lens-title {
  margin-top: 0.25rem;
  font-size: var(--fs-d4, 2.5rem);
  line-height: 0.95;
}

.apx__lens-value {
  margin-top: 0.5rem;
}

.apx__lens-body {
  margin-top: 0.75rem;
  font-size: 1rem;
  text-wrap: pretty;
}

/* A hairline under each lens fills as its side is drawn. */
.apx__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--c-line, #333);
}

.apx__bar i {
  display: block;
  height: 100%;
  background: var(--c-accent, #e60012);
  transform: scaleX(var(--f, 0));
  transform-origin: left;
}

.apx__lens--bx .apx__bar i { transform-origin: right; }
.apx__lens--commerce .apx__bar i { transform-origin: 50% 50%; }

.apx__hint {
  position: relative;
  z-index: 2;
  font-size: var(--fs-small, 0.875rem);
  color: var(--c-text-dim, #6e6e6e);
  transition: opacity 0.5s ease;
}

.apx[data-started='true'] .apx__hint {
  opacity: 0;
}

/* Tablet and phone: the triangle above, and only the lens being drawn beneath it. The steps, triangle and
   text stay together as one group, centred in the pinned screen. */
@media (max-width: 900px) {
  .apx__pin {
    grid-template-rows: auto auto auto;
    align-content: center;
    row-gap: 1.25rem;
  }

  .apx__grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    row-gap: 1.25rem;
    justify-items: center;
  }

  .apx__stage {
    grid-area: 1 / 1;
    width: min(76vw, 320px, calc((var(--apx-h, 640px) - 360px) * 1.113));
  }

  .apx__lens,
  .apx__lens--bx,
  .apx__lens--cx,
  .apx__lens--commerce {
    grid-area: 2 / 1;
    justify-self: stretch;
    max-width: none;
    margin-top: 0;
    text-align: left;
  }

  /* One lens at a time: the others stay in the page (for screen readers) but are not seen. */
  .apx__lens[data-state] {
    opacity: 0;
    pointer-events: none;
    transform: none;
  }

  .apx__lens[data-state='on'],
  .apx[data-closed='true'] .apx__lens--commerce {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .apx__q {
    font-size: clamp(1rem, 4.6vw, 1.4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .apx__halo { animation: none; }
}

/* Home panel: the checkpoint columns only suit the wide banner; the panel shows the page and the magnifier. */
.pillars__photo .sa-row {
  display: none;
}

/* Hero that follows the menu (see hero() in service-art.js). */
.hero__device {
  position: relative;
}

.hero-glow {
  --gx: 50%;
  --gy: 50%;
  position: absolute;
  inset: -12% -10%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background: radial-gradient(closest-side at var(--gx) var(--gy), rgb(230 0 18 / 0.55), transparent 70%);
  transition: opacity 0.6s ease;
}

.hero__device[data-menu] .hero-glow {
  opacity: 0.9;
}

.hero__device .phone {
  will-change: transform;
}

.hero__device.hero-ping .phone__device {
  animation: hero-ping 1s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes hero-ping {
  0% { box-shadow: 0 0 0 0 rgb(230 0 18 / 0.7), 0 0 40px 4px rgb(230 0 18 / 0.5); }
  100% { box-shadow: 0 0 0 36px rgb(230 0 18 / 0), 0 0 0 0 rgb(230 0 18 / 0); }
}

.hero-spark {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 70;
  border-radius: 50%;
  pointer-events: none;
  background: #fff;
  box-shadow: 0 0 10px 3px rgb(230 0 18 / 0.9), 0 0 26px 8px rgb(230 0 18 / 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .hero__device.hero-ping .phone__device { animation: none; }
}
