/*
 * Millwards cinematic + spatial interaction layer
 *
 * Integration hooks (the JS also documents the complete markup contract):
 *   [data-experience-hero]  Positioned hero section
 *   [data-hero-scene]       Decorative canvas host inside the hero
 *   [data-tilt]             Standalone cards that receive pointer depth
 *   [data-cinematic-replay] Optional button that replays the intro
 *
 * Everything remains decorative. Core content and controls must stay outside
 * the canvas hosts so the page is fully usable without WebGL or JavaScript.
 */

:root {
  --mw-cinematic-ink: #071a38;
  --mw-cinematic-blue: #174a9b;
  --mw-cinematic-coral: #ed7056;
  --mw-cinematic-lime: #cbd83f;
  --mw-cinematic-cream: #fff8ec;
}

html.mw-intro-open,
html.mw-intro-open body {
  overflow: hidden;
  overscroll-behavior: none;
}

/* Hero WebGL layer ------------------------------------------------------- */

[data-experience-hero] {
  position: relative;
  isolation: isolate;
}

[data-experience-hero] > :not([data-hero-scene]) {
  position: relative;
  z-index: 2;
}

[data-hero-scene] {
  position: absolute;
  z-index: 0;
  inset: -12% -6% -18%;
  overflow: hidden;
  contain: strict;
  pointer-events: none;
  opacity: 0;
  transition: opacity 900ms cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 13%, #000 82%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 13%, #000 82%, transparent 100%);
}

.mw-experience-webgl [data-hero-scene].is-ready,
.mw-experience-static [data-hero-scene],
[data-hero-scene].is-static {
  opacity: 0.46;
}

[data-hero-scene] canvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: saturate(1.06) contrast(1.02);
}

/* A composited fallback with the same palette, used for reduced motion,
   save-data mode, and browsers that cannot create a reliable GL context. */
.mw-experience-static [data-hero-scene],
[data-hero-scene].is-static {
  background:
    radial-gradient(ellipse at 82% 48%, rgb(23 74 155 / 15%), transparent 38%),
    linear-gradient(rgb(23 74 155 / 4%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(23 74 155 / 4%) 1px, transparent 1px);
  background-size: auto, 46px 46px, 46px 46px;
}

.mw-experience-static [data-hero-scene]::before,
.mw-experience-static [data-hero-scene]::after,
[data-hero-scene].is-static::before,
[data-hero-scene].is-static::after {
  position: absolute;
  box-sizing: border-box;
  content: "";
  transform: perspective(900px) rotateY(-9deg);
  transform-origin: 100% 50%;
}

.mw-experience-static [data-hero-scene]::before,
[data-hero-scene].is-static::before {
  top: 17%;
  right: 8%;
  width: clamp(280px, 36vw, 500px);
  aspect-ratio: 1.15;
  border: 1px solid rgb(16 38 75 / 20%);
  border-radius: 7px;
  background:
    radial-gradient(circle at 6% 6%, rgb(237 112 86 / 40%) 0 3px, transparent 3.5px),
    radial-gradient(circle at 9% 6%, rgb(203 216 63 / 42%) 0 3px, transparent 3.5px),
    linear-gradient(rgb(16 38 75 / 14%), rgb(16 38 75 / 14%)) 50% 13% / 88% 1px no-repeat;
  box-shadow: 18px 26px 60px rgb(16 38 75 / 7%);
}

.mw-experience-static [data-hero-scene]::after,
[data-hero-scene].is-static::after {
  top: 23%;
  right: 10.7%;
  width: clamp(245px, 31vw, 435px);
  aspect-ratio: 1.15;
  border: 1px solid rgb(237 112 86 / 15%);
  border-radius: 4px;
}

/* Pointer depth ---------------------------------------------------------- */

[data-tilt].mw-tilt {
  --mw-tilt-axis-x: 0;
  --mw-tilt-axis-y: 1;
  --mw-tilt-angle: 0deg;
  position: relative;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  rotate: var(--mw-tilt-axis-x) var(--mw-tilt-axis-y) 0 var(--mw-tilt-angle);
  backface-visibility: hidden;
}

[data-tilt].mw-tilt.is-tilt-animating {
  will-change: rotate;
}

.mw-tilt-glare {
  position: absolute;
  z-index: 5;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  background:
    radial-gradient(
      circle at var(--mw-glare-x, 50%) var(--mw-glare-y, 50%),
      rgb(255 255 255 / 22%),
      rgb(255 255 255 / 5%) 19%,
      transparent 48%
    );
  content: "";
  opacity: var(--mw-glare-opacity, 0);
  pointer-events: none;
  transition: opacity 180ms ease;
  mix-blend-mode: soft-light;
}

/* Opening cinematic ----------------------------------------------------- */

.mw-cinematic[hidden] {
  display: none !important;
}

.mw-cinematic {
  position: fixed;
  z-index: 4000;
  inset: 0;
  display: grid;
  overflow: hidden;
  min-height: 100svh;
  isolation: isolate;
  place-items: center;
  background: var(--mw-cinematic-ink);
  color: var(--mw-cinematic-cream);
  opacity: 1;
}

.mw-cinematic.is-active {
  opacity: 1;
}

.mw-cinematic.is-closing {
  opacity: 0;
  transition: opacity 420ms cubic-bezier(0.65, 0, 0.35, 1);
}

.mw-cinematic__canvas,
.mw-cinematic__fallback,
.mw-cinematic__wash,
.mw-cinematic__grid,
.mw-cinematic__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.mw-cinematic__canvas {
  z-index: 0;
  display: block;
  opacity: 0;
  transition: opacity 280ms ease;
}

.mw-cinematic__fallback {
  z-index: 0;
  background:
    radial-gradient(circle at 50% 48%, rgb(23 74 155 / 76%), transparent 24%),
    radial-gradient(circle at 66% 38%, rgb(237 112 86 / 27%), transparent 26%),
    radial-gradient(circle at 38% 70%, rgb(203 216 63 / 16%), transparent 23%),
    var(--mw-cinematic-ink);
  opacity: 1;
  transition: opacity 280ms ease;
}

.mw-cinematic.has-webgl .mw-cinematic__canvas {
  opacity: 1;
}

.mw-cinematic.has-webgl .mw-cinematic__fallback {
  opacity: 0;
}

.mw-cinematic__wash {
  z-index: 1;
  background:
    radial-gradient(circle at 50% 50%, transparent 22%, rgb(3 13 31 / 58%) 100%),
    linear-gradient(to bottom, rgb(7 26 56 / 8%), rgb(7 26 56 / 48%));
}

.mw-cinematic__grid {
  z-index: 1;
  background-image:
    linear-gradient(rgb(255 255 255 / 3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 3%) 1px, transparent 1px);
  background-size: clamp(44px, 6vw, 88px) clamp(44px, 6vw, 88px);
  -webkit-mask-image: radial-gradient(circle, #000, transparent 72%);
  mask-image: radial-gradient(circle, #000, transparent 72%);
  opacity: 0;
  transform: perspective(500px) rotateX(60deg) scale(1.7) translateY(15%);
  transition: opacity 900ms ease;
}

.mw-cinematic[data-stage="1"] .mw-cinematic__grid,
.mw-cinematic[data-stage="2"] .mw-cinematic__grid,
.mw-cinematic[data-stage="3"] .mw-cinematic__grid {
  opacity: 1;
}

.mw-cinematic__frame {
  z-index: 4;
  inset: clamp(18px, 3vw, 42px);
  width: auto;
  height: auto;
  border: 1px solid rgb(255 248 236 / 18%);
  clip-path: polygon(0 0, 13% 0, 13% 1px, 87% 1px, 87% 0, 100% 0, 100% 100%, 87% 100%, 87% calc(100% - 1px), 13% calc(100% - 1px), 13% 100%, 0 100%);
  opacity: 0;
  transform: translateZ(0) scale(0.97);
  backface-visibility: hidden;
  transition: opacity 900ms ease 100ms, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.mw-cinematic[data-stage="1"] .mw-cinematic__frame,
.mw-cinematic[data-stage="2"] .mw-cinematic__frame,
.mw-cinematic[data-stage="3"] .mw-cinematic__frame {
  opacity: 1;
  transform: translateZ(0) scale(1);
}

.mw-cinematic__topbar {
  position: absolute;
  z-index: 6;
  top: clamp(29px, 4vw, 57px);
  right: clamp(30px, 4.5vw, 68px);
  left: clamp(30px, 4.5vw, 68px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  opacity: 0;
  transform: translate3d(0, -12px, 0);
  backface-visibility: hidden;
  transition: opacity 650ms ease 180ms, transform 650ms cubic-bezier(0.22, 1, 0.36, 1) 180ms;
}

.mw-cinematic[data-stage="1"] .mw-cinematic__topbar,
.mw-cinematic[data-stage="2"] .mw-cinematic__topbar,
.mw-cinematic[data-stage="3"] .mw-cinematic__topbar {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.mw-cinematic__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--mw-cinematic-cream);
  font-size: clamp(0.68rem, 1vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.17em;
  line-height: 1;
  text-transform: uppercase;
}

.mw-cinematic__mark {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid rgb(255 248 236 / 48%);
  background: rgb(255 248 236 / 7%);
  color: var(--mw-cinematic-lime);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  letter-spacing: -0.08em;
}

.mw-cinematic__signal {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: rgb(255 248 236 / 62%);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mw-cinematic__signal::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mw-cinematic-lime);
  box-shadow: 0 0 18px rgb(203 216 63 / 90%);
  content: "";
}

.mw-cinematic__copy {
  position: relative;
  z-index: 5;
  width: min(900px, calc(100% - 56px));
  padding-top: 2vh;
  text-align: center;
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  backface-visibility: hidden;
  transition: opacity 360ms ease, transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.mw-cinematic__kicker {
  margin: 0 0 clamp(18px, 2.4vw, 30px);
  color: var(--mw-cinematic-lime);
  font-size: clamp(0.67rem, 1.1vw, 0.82rem);
  font-weight: 850;
  letter-spacing: 0.2em;
  line-height: 1.4;
  text-transform: uppercase;
  opacity: 0;
  transform: translate3d(0, 16px, 0);
  backface-visibility: hidden;
  transition: opacity 700ms ease, transform 800ms cubic-bezier(0.22, 1, 0.36, 1);
}

.mw-cinematic__title {
  margin: 0;
  color: var(--mw-cinematic-cream);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.1rem, 9.2vw, 8.7rem);
  font-weight: 700;
  letter-spacing: -0.065em;
  line-height: 0.8;
  text-wrap: balance;
}

.mw-cinematic__title span {
  display: block;
  opacity: 0;
  transform: translate3d(0, 55px, 0) rotateX(18deg);
  transform-origin: 50% 100%;
  backface-visibility: hidden;
  transition: opacity 850ms ease, transform 1.05s cubic-bezier(0.16, 1, 0.3, 1);
}

.mw-cinematic__title .mw-cinematic__accent {
  color: var(--mw-cinematic-coral);
  font-style: italic;
  font-weight: 500;
  transition-delay: 130ms;
}

.mw-cinematic__sub {
  max-width: 600px;
  margin: clamp(25px, 4vw, 44px) auto 0;
  color: rgb(255 248 236 / 72%);
  font-size: clamp(0.88rem, 1.45vw, 1.05rem);
  line-height: 1.7;
  opacity: 0;
  transform: translate3d(0, 15px, 0);
  backface-visibility: hidden;
  transition: opacity 700ms ease 260ms, transform 800ms cubic-bezier(0.22, 1, 0.36, 1) 260ms;
}

.mw-cinematic[data-stage="2"] .mw-cinematic__kicker,
.mw-cinematic[data-stage="3"] .mw-cinematic__kicker,
.mw-cinematic[data-stage="2"] .mw-cinematic__title span,
.mw-cinematic[data-stage="3"] .mw-cinematic__title span,
.mw-cinematic[data-stage="2"] .mw-cinematic__sub,
.mw-cinematic[data-stage="3"] .mw-cinematic__sub {
  opacity: 1;
  transform: translate3d(0, 0, 0) rotateX(0);
}

.mw-cinematic.has-webgl[data-stage="3"] .mw-cinematic__copy {
  opacity: 0;
  transform: translate3d(0, -12px, 0) scale(0.985);
}

.mw-cinematic__progress {
  position: absolute;
  z-index: 7;
  right: clamp(30px, 4.5vw, 68px);
  bottom: clamp(30px, 4vw, 58px);
  left: clamp(30px, 4.5vw, 68px);
  height: 1px;
  overflow: hidden;
  background: rgb(255 248 236 / 17%);
  opacity: 0;
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: opacity 600ms ease 240ms;
}

.mw-cinematic[data-stage="1"] .mw-cinematic__progress,
.mw-cinematic[data-stage="2"] .mw-cinematic__progress,
.mw-cinematic[data-stage="3"] .mw-cinematic__progress {
  opacity: 1;
}

.mw-cinematic__progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--mw-cinematic-lime), var(--mw-cinematic-coral));
  box-shadow: 0 0 13px var(--mw-cinematic-coral);
  transform: scaleX(var(--mw-cinematic-progress, 0));
  transform-origin: 0 50%;
}

@media (max-width: 760px) {
  [data-hero-scene] {
    inset: -4% -32% -9%;
  }

  .mw-experience-static [data-hero-scene],
  [data-hero-scene].is-static {
    background: radial-gradient(ellipse at 66% 74%, rgb(23 74 155 / 13%), transparent 36%);
    opacity: 0.24;
  }

  .mw-experience-static [data-hero-scene]::before,
  [data-hero-scene].is-static::before {
    top: 57%;
    right: 20%;
  }

  .mw-experience-static [data-hero-scene]::after,
  [data-hero-scene].is-static::after {
    top: 60%;
    right: 23%;
  }

  .mw-cinematic__signal,
  .mw-cinematic__sub {
    display: none;
  }

  .mw-cinematic__copy {
    width: min(640px, calc(100% - 38px));
  }

  .mw-cinematic__title {
    font-size: clamp(3rem, 17vw, 5.6rem);
    line-height: 0.86;
  }

  .mw-cinematic__progress {
    bottom: 30px;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .mw-cinematic__frame {
    inset: 12px;
  }

  .mw-cinematic__topbar {
    top: 16px;
    right: 20px;
    left: 20px;
  }

  .mw-cinematic__signal,
  .mw-cinematic__sub {
    display: none;
  }

  .mw-cinematic__copy {
    width: min(760px, calc(100% - 32px));
    padding-top: 0;
  }

  .mw-cinematic__kicker {
    margin-bottom: 8px;
    font-size: 0.56rem;
  }

  .mw-cinematic__title {
    font-size: clamp(2.35rem, 16vh, 4.4rem);
    line-height: 0.86;
  }

  .mw-cinematic__progress {
    right: 20px;
    bottom: 16px;
    left: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-hero-scene] canvas {
    display: none;
  }

  [data-tilt].mw-tilt {
    rotate: none !important;
    will-change: auto;
  }

  .mw-tilt-glare {
    display: none;
  }

  .mw-cinematic {
    display: none !important;
  }

  [data-cinematic-replay] {
    display: none !important;
  }
}

@media (forced-colors: active) {
  [data-hero-scene],
  .mw-tilt-glare {
    display: none;
  }

  .mw-cinematic__mark {
    border: 1px solid ButtonText;
  }
}
