/* Background D motion. CSS only. An explicit exception for this pattern:
   hex parallax, one shimmer pass, and pulsing cells on the honeycomb grid.
   Off under prefers-reduced-motion and when the motion token is off.
   The hero pause control does not target these animations.
   Browsers without scroll-driven animations keep the layer static. */

.cms-page {
  container-name: cms-motion;
}

.cms-motion-parallax,
.cms-motion-full {
  min-height: 100vh;
}

.cms-motion-parallax .cms-bg-pattern,
.cms-motion-full .cms-bg-pattern {
  inset: -160px 0 0 0;
  opacity: 1;
  background-image: none;
}

.cms-bg-pattern-fill,
.cms-bg-shim,
.cms-bg-cells,
.cms-bg-grain {
  position: absolute;
  display: block;
  pointer-events: none;
}

.cms-bg-pattern-fill,
.cms-bg-shim,
.cms-bg-grain {
  inset: 0;
  width: 100%;
  height: 100%;
}

.cms-bg-pattern-fill {
  background-repeat: repeat;
  background-position: 50% 0;
  opacity: var(--cms-pattern-opacity, var(--pattern-opacity, 0.35));
}

.cms-pattern-honeycomb .cms-bg-pattern-fill {
  background-size: 38.11px 66px;
  background-position: 50% 0;
}

.cms-pattern-grid .cms-bg-pattern-fill {
  background-size: 24px 24px;
}

.cms-pattern-grain .cms-bg-pattern-fill {
  background-size: 120px 120px;
}

.cms-pattern-dots .cms-bg-pattern-fill {
  background-size: 16px 16px;
}

/* Cells sit above the glow mask, in their own layer, locked to the hexd box. */
.cms-bg-cells {
  top: -160px;
  right: 0;
  bottom: 0;
  left: 0;
  mask-image: none;
  -webkit-mask-image: none;
}

.cms-bg-cells-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cms-bg-grain {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
  opacity: 0.045;
}

.cms-bg-shim {
  background-color: var(--shimmer-color);
  opacity: 0;
  --cms-shim-tile: var(--cms-pattern-image);
  -webkit-mask-image: var(--cms-shim-tile), linear-gradient(105deg, transparent 42%, #000 50%, transparent 58%);
  mask-image: var(--cms-shim-tile), linear-gradient(105deg, transparent 42%, #000 50%, transparent 58%);
  -webkit-mask-size: 38.11px 66px, 300% 100%;
  mask-size: 38.11px 66px, 300% 100%;
  -webkit-mask-repeat: repeat, no-repeat;
  mask-repeat: repeat, no-repeat;
  -webkit-mask-position: 50% 0, 100% 0;
  mask-position: 50% 0, 100% 0;
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.cms-pattern-honeycomb .cms-bg-shim {
  --cms-shim-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='38.11' height='66'%3E%3Cpath d='M19.05 0L38.11 11L38.11 33L19.05 44L0 33L0 11ZM19.05 44L19.05 66' fill='none' stroke='%23000' stroke-width='1'/%3E%3C/svg%3E");
}

.cms-pattern-grid .cms-bg-shim {
  -webkit-mask-size: 24px 24px, 300% 100%;
  mask-size: 24px 24px, 300% 100%;
}

.cms-pattern-grain .cms-bg-shim {
  -webkit-mask-size: 120px 120px, 300% 100%;
  mask-size: 120px 120px, 300% 100%;
}

.cms-pattern-dots .cms-bg-shim {
  -webkit-mask-size: 16px 16px, 300% 100%;
  mask-size: 16px 16px, 300% 100%;
}

.cms-pulse-cell {
  fill: var(--brand-primary);
  fill-opacity: 0.32;
  stroke: none;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    .cms-motion-parallax .cms-bg-pattern,
    .cms-motion-full .cms-bg-pattern,
    .cms-motion-full .cms-bg-cells {
      animation-name: hexpar;
      animation-duration: auto;
      animation-timing-function: linear;
      animation-fill-mode: both;
      animation-timeline: scroll(root);
      animation-range: 0 900px;
    }
  }

  .cms-motion-full .cms-bg-shim {
    animation-name: shim;
    animation-duration: 2000ms;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    animation-delay: 300ms;
    animation-iteration-count: 1;
    animation-fill-mode: both;
  }

  .cms-motion-full .cms-pulse-cell {
    animation-name: pulse;
    animation-duration: 6s;
    animation-timing-function: ease-in-out;
    animation-delay: var(--dl, 0s);
    animation-iteration-count: infinite;
    animation-fill-mode: both;
  }
}

@keyframes hexpar {
  to {
    transform: translateY(160px);
  }
}

@keyframes shim {
  0% {
    opacity: 1;
    -webkit-mask-position: 50% 0, 100% 0;
    mask-position: 50% 0, 100% 0;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    -webkit-mask-position: 50% 0, 0 0;
    mask-position: 50% 0, 0 0;
  }
}

@keyframes pulse {
  0%,
  100% {
    fill-opacity: 0.18;
  }
  50% {
    fill-opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cms-bg-pattern,
  .cms-bg-cells,
  .cms-bg-shim,
  .cms-pulse-cell {
    animation: none !important;
    transform: none !important;
  }

  .cms-bg-shim {
    opacity: 0 !important;
  }

  .cms-pulse-cell {
    fill-opacity: 0.32;
  }
}

@container cms-motion style(--motion: off) {
  .cms-bg-pattern,
  .cms-bg-cells,
  .cms-bg-shim,
  .cms-pulse-cell {
    animation: none !important;
    transform: none !important;
  }

  .cms-bg-shim {
    opacity: 0 !important;
  }

  .cms-pulse-cell {
    fill-opacity: 0.32;
  }
}
