#fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
}

#fx-canvas.fx-ready {
  opacity: 1;
}

/* Keeps text contrast above the WebGL layer: darkest where slide copy sits (left and center). */
.fx-scrim {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 62% 70% at 34% 46%, color-mix(in srgb, var(--bg, #070B14) 62%, transparent), transparent 78%),
    linear-gradient(90deg, color-mix(in srgb, var(--bg, #070B14) 55%, transparent) 0%, transparent 62%),
    linear-gradient(0deg, color-mix(in srgb, var(--bg, #070B14) 40%, transparent) 0%, transparent 30%);
}

@media (max-width: 700px) {
  .fx-scrim {
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg, #070B14) 72%, transparent) 0%, color-mix(in srgb, var(--bg, #070B14) 50%, transparent) 70%, transparent 100%);
  }
}

:where(#stage) {
  position: relative;
  z-index: 1;
}

.fx-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.fx-word {
  display: inline-block;
  white-space: nowrap;
}

.fx-char {
  display: inline-block;
}

:where(.fx-spot) {
  position: relative;
}

.fx-spot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: var(--spot, 0);
  transition: opacity 0.35s ease;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--ai, #4CD4FF) 15%, transparent), transparent 70%);
  mix-blend-mode: screen;
}

:root[data-theme="light"] .fx-spot::after {
  mix-blend-mode: multiply;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--ai, #0B6E8A) 14%, transparent), transparent 70%);
}

:root:not([data-motion="reduced"]) .fx-shine {
  --shine-hi: #fff;
  background-image: linear-gradient(100deg,
    currentColor 0%, currentColor 42%,
    color-mix(in srgb, currentColor, var(--shine-hi) 75%) 50%,
    currentColor 58%, currentColor 100%);
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fx-shine 6s cubic-bezier(0.45, 0, 0.25, 1) 1.2s infinite;
}

:root[data-theme="light"] .fx-shine {
  --shine-hi: var(--ai, #0B6E8A);
}

@keyframes fx-shine {
  0% { background-position: 100% 0; }
  40%, 100% { background-position: 0% 0; }
}

:root[data-motion="reduced"] .fx-spot::after {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) .fx-spot::after { display: none; }
  :root:not([data-motion="full"]) .fx-shine { animation: none; background-image: none; -webkit-text-fill-color: currentColor; }
  #fx-canvas { transition: none; }
}

:root:not([data-motion="reduced"]) .fx-shine.fx-shine-hold {
  animation: none;
}

:root:not([data-motion="reduced"]) .fx-shine.fx-shine-go {
  animation: fx-shine 6s cubic-bezier(0.45, 0, 0.25, 1) 0s infinite;
}

:root.fx-embed .fx-shine {
  animation: none;
}

.fx-veil {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: #03060C;
  transition: opacity 0.3s ease;
}

:root.fx-opening #fx-canvas {
  opacity: 1;
  transition: none;
}

:root.fx-opening .fx-scrim,
:root.fx-opening #chrome {
  opacity: 0;
}

:root.fx-open-text .fx-scrim {
  opacity: 1;
  transition: opacity 0.9s ease;
}

:root.fx-open-text #chrome {
  opacity: 1;
  transition: opacity 0.7s ease 0.35s;
}

:root.fx-opening .slide.is-active :is(.hero-title-left > *, .hero-title-left [data-reveal]) {
  opacity: 0;
  transform: translateY(16px);
}

:root.fx-open-text .slide.is-active :is(.hero-title-left > *, .hero-title-left [data-reveal]) {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease, transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(min(var(--fx-i, 0), 7) * 65ms);
}

:root.fx-opening .slide.is-active .hero-logo-panel {
  position: relative;
  -webkit-mask-image: linear-gradient(135deg, #000 42%, transparent 58%);
  mask-image: linear-gradient(135deg, #000 42%, transparent 58%);
  -webkit-mask-size: 500% 100%;
  mask-size: 500% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0;
  mask-position: 100% 0;
}

:root.fx-opening .slide.is-active .hero-logo-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(135deg, transparent 38%, rgba(255, 244, 220, 0.7) 45%, transparent 52%) no-repeat;
  background-size: 500% 100%;
  background-position: 100% 0;
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent);
  mask-image: radial-gradient(closest-side, #000 55%, transparent);
  mix-blend-mode: screen;
}

:root.fx-open-logo .slide.is-active .hero-logo-panel {
  animation: fx-logo-wipe 0.95s cubic-bezier(0.55, 0, 0.25, 1) forwards;
}

:root.fx-open-logo .slide.is-active .hero-logo-panel::after {
  animation: fx-logo-glint 0.95s cubic-bezier(0.55, 0, 0.25, 1) forwards;
}

@keyframes fx-logo-wipe {
  to { -webkit-mask-position: 0 0; mask-position: 0 0; }
}

@keyframes fx-logo-glint {
  0% { background-position: 100% 0; opacity: 0; }
  20% { opacity: 1; }
  75% { opacity: 1; }
  100% { background-position: 0 0; opacity: 0; }
}

.fx-grain {
  position: fixed;
  inset: -64px;
  z-index: 260;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='128' height='128' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
  will-change: transform;
  animation: fx-grain 0.9s steps(1, end) infinite;
}

:root[data-theme="light"] .fx-grain {
  opacity: 0.025;
}

:root[data-motion="reduced"] .fx-grain,
:root.fx-embed .fx-grain {
  display: none;
}

@keyframes fx-grain {
  0% { transform: translate(0, 0); }
  12% { transform: translate(-37px, 21px); }
  25% { transform: translate(18px, -42px); }
  37% { transform: translate(-51px, -13px); }
  50% { transform: translate(29px, 47px); }
  62% { transform: translate(-9px, -58px); }
  75% { transform: translate(55px, 8px); }
  87% { transform: translate(-24px, 36px); }
}

@media (hover: hover) and (pointer: fine) {
  :where(.card, .swot-quad, .org-card) {
    position: relative;
  }

  :root:not([data-motion="reduced"]) :is(.card, .swot-quad, .org-card)::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(-45deg, transparent 60%, var(--fx-glare, rgba(255, 255, 255, 0.13)) 70%, transparent 80%) no-repeat;
    background-size: 250% 250%;
    background-position: -100% -100%;
  }

  :root:not([data-motion="reduced"]) :is(.card, .swot-quad, .org-card):hover::before {
    background-position: 100% 100%;
    transition: background-position 0.65s ease;
  }

  :root[data-theme="light"] :is(.card, .swot-quad, .org-card) {
    --fx-glare: color-mix(in srgb, var(--ai, #0B6E8A) 16%, transparent);
  }

  :root:not([data-motion="reduced"]) :is(#btn-prev, #btn-next) {
    transition: translate 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) .fx-grain { display: none; }
  :root:not([data-motion="full"]) :is(.card, .swot-quad, .org-card)::before { display: none; }
}
