:root {
  color-scheme: light;
  background: white;
  scroll-behavior: smooth;
}

body { margin: 0; }

.canvas {
  container-type: inline-size;
  overflow-x: clip;
}

.frame {
  --art-width: min(100cqw, var(--design-width));
  --u: calc(var(--art-width) / var(--ref-width));
  --grid-offset: calc((100cqw - var(--art-width)) / 2);
  position: relative;
  width: var(--art-width);
  height: calc(7200 * var(--u));
  margin-inline: auto;
  isolation: isolate;
}


/* Continue the grid and footer beyond the centered desktop artwork. */
.frame::before,
.frame-cases::after {
  content: '';
  position: absolute;
  z-index: -1;
  left: calc(-1 * var(--grid-offset));
  width: 100cqw;
  background: url('assets/grid-sharp-wide.webp') var(--grid-offset) 0 /
    calc(2880 * var(--u)) calc(900 * var(--u)) repeat;
}

.frame::before {
  top: 0;
  bottom: 0;
}

.frame-cases::after {
  top: 0;
  height: calc(6300 * var(--u));
  background-image: url('assets/grid-soft-wide.webp');
}

.region, .layer, .link {
  position: absolute;
  top: calc(var(--y, 0) * var(--u));
  left: calc(var(--x, 0) * var(--u));
}

.region {
  width: 100%;
  height: calc(var(--height) * var(--u));
}

.layer, .link { width: calc(var(--width) * var(--u)); }

.layer {
  display: block;
  height: auto;
  pointer-events: none;
}

.footer-base {
  top: 0;
  left: calc(-1 * var(--grid-offset));
  width: 100cqw;
  height: calc(215 * var(--u));
  background: #000;
}

.link {
  z-index: 1;
  display: block;
  height: calc(var(--height) * var(--u));
}

.link:focus-visible {
  outline: 3px solid #aa006a;
  outline-offset: 3px;
  border-radius: 2px;
}

.reading {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: pre-line;
}

@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
}

@media (prefers-reduced-motion: no-preference) {
  .intro-visual {
    animation: intro-in 700ms cubic-bezier(.2, .75, .25, 1) both;
  }

  @keyframes intro-in {
    from { opacity: .15; transform: translateY(calc(24 * var(--u))); }
    to { opacity: 1; transform: translateY(0); }
  }

  [data-case-piece] {
    transition: opacity 480ms ease-out, transform 560ms cubic-bezier(.2, .75, .25, 1);
  }

  .case-pending {
    opacity: 0;
    transform: translateY(calc(18 * var(--u)));
  }
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  .pm-motion {
    pointer-events: auto;
    transform-origin: 53% 55%;
    transition: transform 230ms ease-out, filter 230ms ease-out;
  }

  .pm-motion:hover {
    transform: translateY(calc(-9 * var(--u))) rotate(-5deg) scale(1.035);
    filter: drop-shadow(0 calc(4 * var(--u)) calc(6 * var(--u)) #f5a8da94);
  }
}
