.stack::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url(../img/logos/Updat3d.Digital-Logo-001.svg.svg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0px 0px 25px rgba(0, 0, 0, 1));
  -webkit-filter: drop-shadow(0px 0px 25px rgb(0, 0, 0));
}
:root {
  --bg: #000;
  --fg: #fff;
}

html,
body {
  height: 100%;
  overflow: hidden; /* prevent page scrolling, helps on mobile drag */
}

/* Disable text selection and focus outlines for a clean visual experience */
* {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}
.dots-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: auto; /* allow interaction on canvas */
  touch-action: none;   /* prevent panning/zooming gestures over the canvas */
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
}

@supports (height: 100svh) {
  .page {
    min-height: 100svh;
  }
}

.logo {
  display: block;
  height: auto;
  max-width: min(70vw, 640px);
  max-height: 30vh;
  filter: brightness(0) invert(1);
  -webkit-filter: brightness(0) invert(1);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.stack {
  display: grid;
  grid-template-columns: 1fr;
  opacity: 0.9;
  position: relative;
}

.stack .slice {
  grid-row-start: 1;
  grid-column-start: 1;
  --stack-height: calc(100% / var(--stacks) - 1px);
  --inverse-index: calc(calc(var(--stacks) - 1) - var(--index));
  --clip-top: calc(var(--stack-height) * var(--index));
  --clip-bottom: calc(var(--stack-height) * var(--inverse-index));
  clip-path: inset(var(--clip-top) 0 var(--clip-bottom) 0);
  -webkit-clip-path: inset(var(--clip-top) 0 var(--clip-bottom) 0);
  filter: brightness(0) invert(1);
  -webkit-filter: brightness(0) invert(1);
  /* Default sync flag for JS pulse (toggled in @keyframes glitch) */
  --glitch-pulse: 0;
  animation: stack 340ms cubic-bezier(.46,.29,0,1.24) 1 backwards calc(var(--index) * 120ms);
  position: relative;
  z-index: 1;
}
/* Hover: simply set full opacity */
.stack:hover {
  opacity: 0.93;
}

.stack .slice:nth-child(odd) { --glitch-translate: 8px; }
.stack .slice:nth-child(even) { --glitch-translate: -8px; }
@keyframes stack {
  0% {
    opacity: 0;
    transform: none;
    filter: brightness(0) invert(1) drop-shadow(-1px 1px 0 red) drop-shadow(1px -1px 0 blue);
  }
  60% {
    opacity: 1;
    transform: none;
  }
  80% {
    transform: none;
    opacity: 1;
    filter: brightness(0) invert(1) drop-shadow(1px -1px 0 red) drop-shadow(-1px 1px 0 blue);
  }
  100% {
    opacity: 1;
    filter: brightness(0) invert(1);
  }
}

@keyframes glitch {
  0% {
    filter: brightness(0) invert(1) drop-shadow(-2px 3px 0 red) drop-shadow(2px -3px 0 blue);
    transform: translate(var(--glitch-translate));
    --glitch-pulse: 0;
  }
  2% {
    filter: brightness(0) invert(1) drop-shadow(2px -3px 0 red) drop-shadow(-2px 3px 0 blue);
    /* Briefly raise sync flag at the visual glitch peak */
    --glitch-pulse: 1;
  }
  4%, 100% {
    filter: brightness(0) invert(1);
    transform: none;
    --glitch-pulse: 0;
  }
}
