:root {
  color-scheme: dark;
  --bg: #08050f;
  --pointer-x: 50%;
  --pointer-y: 44%;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  isolation: isolate;
  background:
    radial-gradient(
      circle at var(--pointer-x) var(--pointer-y),
      rgba(102, 54, 169, 0.3),
      transparent 34rem
    ),
    radial-gradient(circle at 12% 20%, rgba(74, 70, 198, 0.2), transparent 30rem),
    radial-gradient(circle at 88% 78%, rgba(214, 76, 171, 0.14), transparent 32rem),
    var(--bg);
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.34) 0 0.7px, transparent 1px),
    radial-gradient(circle, rgba(196, 160, 255, 0.26) 0 0.6px, transparent 1px);
  background-position: 0 0, 31px 47px;
  background-size: 73px 83px, 97px 89px;
  content: "";
  opacity: 0.26;
  pointer-events: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

#connections {
  position: fixed;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 1;
  pointer-events: none;
  transition: opacity 90ms linear;
}

#connections.is-scrolling {
  opacity: 0;
}

.aurora {
  position: fixed;
  z-index: 0;
  width: 58vmax;
  height: 58vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.14;
  pointer-events: none;
}

.aurora-a {
  top: -30vmax;
  left: -24vmax;
  background: #7558ff;
  animation: aurora-a 22s ease-in-out infinite alternate;
}

.aurora-b {
  right: -28vmax;
  bottom: -34vmax;
  background: #ee73c3;
  animation: aurora-b 27s ease-in-out infinite alternate;
}

.home-orb {
  position: fixed;
  z-index: 20;
  top: max(22px, env(safe-area-inset-top));
  left: 26px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(224, 213, 255, 0.18);
  border-radius: 50%;
  background: rgba(11, 7, 21, 0.55);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(15px);
}

.home-core {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f8edff;
  box-shadow:
    0 0 11px 3px rgba(198, 157, 255, 0.9),
    0 0 22px 7px rgba(126, 91, 255, 0.28);
}

main {
  position: relative;
  z-index: 2;
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  contain: layout paint style;
  isolation: isolate;
}

.stage::before {
  position: absolute;
  width: min(82vw, 850px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(156, 109, 255, 0.13),
    rgba(126, 76, 211, 0.03) 48%,
    transparent 70%
  );
  content: "";
  filter: blur(12px);
  animation: breathe 6s ease-in-out infinite;
}

.stage-rings {
  position: absolute;
  width: min(78vw, 780px);
  aspect-ratio: 1;
  border: 1px solid rgba(181, 139, 255, 0.12);
  border-radius: 50%;
  box-shadow:
    inset 0 0 80px rgba(137, 86, 229, 0.04),
    0 0 70px rgba(137, 86, 229, 0.05);
  animation: ring-turn 38s linear infinite;
}

.stage-rings::before,
.stage-rings::after {
  position: absolute;
  border: 1px solid rgba(224, 201, 255, 0.08);
  border-radius: 50%;
  content: "";
}

.stage-rings::before {
  inset: 12%;
  border-style: dashed;
}

.stage-rings::after {
  inset: 29%;
  border-color: rgba(154, 255, 218, 0.1);
}

.featured {
  position: relative;
  z-index: 5;
  width: clamp(180px, 24vw, 310px);
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(230, 216, 255, 0.28);
  border-radius: 50%;
  outline: none;
  background: var(--bg);
  box-shadow:
    0 0 80px rgba(155, 108, 255, 0.32),
    0 38px 90px rgba(0, 0, 0, 0.48),
    inset 0 0 30px rgba(220, 194, 255, 0.08);
  cursor: pointer;
  animation: featured-float 6s ease-in-out infinite;
  transition:
    border-color 250ms ease,
    box-shadow 250ms ease;
}

.featured:hover,
.featured:focus-visible {
  border-color: rgba(233, 213, 255, 0.62);
  box-shadow:
    0 0 110px rgba(176, 126, 255, 0.48),
    0 42px 100px rgba(0, 0, 0, 0.52);
}

.featured.is-changing .sprite {
  animation: featured-change 620ms cubic-bezier(0.16, 0.86, 0.22, 1);
}

.sprite,
.glyph {
  background-repeat: no-repeat;
  background-size: 300% 200%;
}

.sprite {
  width: 100%;
  height: 100%;
  display: block;
}

.sheet-actions {
  background-image: url("/pictograms-actions-v1.png");
}

.sheet-concepts {
  background-image: url("/pictograms-concepts-v1.png");
}

.sheet-states {
  background-image: url("/pictograms-states-v1.png");
}

.cell-0 {
  background-position: 0% 0%;
}

.cell-1 {
  background-position: 50% 0%;
}

.cell-2 {
  background-position: 100% 0%;
}

.cell-3 {
  background-position: 0% 100%;
}

.cell-4 {
  background-position: 50% 100%;
}

.cell-5 {
  background-position: 100% 100%;
}

.satellite-ring {
  position: absolute;
  z-index: 4;
  width: min(74vw, 735px);
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
}

.glyph {
  position: relative;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(228, 214, 255, 0.17);
  border-radius: 50%;
  outline: none;
  background-color: var(--bg);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.36),
    0 0 28px rgba(130, 85, 221, 0.08);
  cursor: pointer;
  transition:
    transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
    border-color 280ms ease,
    box-shadow 280ms ease,
    filter 280ms ease;
}

.glyph:hover,
.glyph:focus-visible,
.glyph[aria-pressed="true"] {
  z-index: 5;
  border-color: rgba(226, 199, 255, 0.72);
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.42),
    0 0 44px rgba(165, 112, 255, 0.32);
  filter: saturate(1.12) brightness(1.08);
  transform: translateY(-8px) scale(1.08);
}

.satellite {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(68px, 9.5vw, 116px);
  aspect-ratio: 1;
  pointer-events: auto;
  transform:
    translate(-50%, -50%)
    rotate(var(--angle))
    translateY(clamp(-300px, -31vw, -190px))
    rotate(var(--counter-angle));
  animation: satellite-float 5s ease-in-out infinite;
  animation-delay: var(--delay);
  will-change: translate;
}

.satellite:nth-child(1) {
  --angle: 0deg;
  --counter-angle: 0deg;
  --delay: 0s;
}

.satellite:nth-child(2) {
  --angle: 60deg;
  --counter-angle: -60deg;
  --delay: -0.7s;
}

.satellite:nth-child(3) {
  --angle: 120deg;
  --counter-angle: -120deg;
  --delay: -1.4s;
}

.satellite:nth-child(4) {
  --angle: 180deg;
  --counter-angle: -180deg;
  --delay: -2.1s;
}

.satellite:nth-child(5) {
  --angle: 240deg;
  --counter-angle: -240deg;
  --delay: -2.8s;
}

.satellite:nth-child(6) {
  --angle: 300deg;
  --counter-angle: -300deg;
  --delay: -3.5s;
}

.satellite:hover,
.satellite:focus-visible,
.satellite[aria-pressed="true"] {
  transform:
    translate(-50%, -50%)
    rotate(var(--angle))
    translateY(clamp(-300px, -31vw, -190px))
    rotate(var(--counter-angle))
    scale(1.12);
}

.scroll-signal {
  position: absolute;
  bottom: 28px;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(233, 216, 255, 0.72);
  box-shadow: 0 0 16px rgba(179, 129, 255, 0.85);
  transform: translateX(-50%);
  animation: scroll-signal 2.2s ease-in-out infinite;
}

.gallery {
  min-height: 100vh;
  padding: clamp(90px, 10vw, 150px) 0 180px;
}

@supports (content-visibility: auto) {
  .gallery {
    content-visibility: auto;
    contain-intrinsic-size: auto 110vh;
  }
}

.glyph-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(16px, 2.6vw, 34px);
}

.tile {
  width: 100%;
  aspect-ratio: 1;
  opacity: 0;
  transform: translateY(36px) scale(0.94);
}

.tile.is-visible {
  animation: tile-in 800ms cubic-bezier(0.16, 0.86, 0.22, 1) forwards;
}

.tile:nth-child(2).is-visible {
  animation-delay: 55ms;
}

.tile:nth-child(3).is-visible {
  animation-delay: 110ms;
}

.tile:nth-child(4).is-visible {
  animation-delay: 165ms;
}

.tile:nth-child(5).is-visible {
  animation-delay: 220ms;
}

.tile:nth-child(6).is-visible {
  animation-delay: 275ms;
}

.tile:nth-child(7).is-visible {
  animation-delay: 330ms;
}

.tile:nth-child(8).is-visible {
  animation-delay: 385ms;
}

.tile:nth-child(9).is-visible {
  animation-delay: 440ms;
}

.tile:nth-child(10).is-visible {
  animation-delay: 495ms;
}

.tile:nth-child(11).is-visible {
  animation-delay: 550ms;
}

.tile:nth-child(12).is-visible {
  animation-delay: 605ms;
}

.tile:nth-child(3n + 2) {
  margin-top: clamp(18px, 4vw, 48px);
}

.tile:nth-child(4n) {
  margin-top: clamp(-20px, -2vw, -8px);
}

.orb-dock {
  position: fixed;
  z-index: 20;
  right: 22px;
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  gap: 9px;
  padding: 8px;
  border: 1px solid rgba(225, 213, 255, 0.14);
  border-radius: 999px;
  background: rgba(10, 6, 18, 0.58);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.orb-dock a {
  width: 38px;
  height: 38px;
  overflow: hidden;
  border: 1px solid rgba(229, 214, 255, 0.12);
  border-radius: 50%;
  outline: none;
  background: var(--bg);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.orb-dock a:hover,
.orb-dock a:focus-visible {
  border-color: rgba(226, 199, 255, 0.58);
  box-shadow: 0 0 24px rgba(160, 109, 255, 0.32);
  transform: translateY(-4px) scale(1.08);
}

noscript {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
}

noscript img {
  width: min(92vw, 900px);
  height: auto;
}

@keyframes aurora-a {
  to {
    transform: translate3d(18vmax, 12vmax, 0) scale(1.12);
  }
}

@keyframes aurora-b {
  to {
    transform: translate3d(-16vmax, -10vmax, 0) scale(0.9);
  }
}

@keyframes ring-turn {
  to {
    transform: rotate(360deg);
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.68;
    transform: scale(0.95);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

@keyframes featured-float {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-18px) rotate(1deg);
  }
}

@keyframes satellite-float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -13px;
  }
}

@keyframes featured-change {
  0% {
    opacity: 0.38;
    transform: scale(0.76) rotate(-7deg);
  }
  64% {
    opacity: 1;
    transform: scale(1.07) rotate(2deg);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes scroll-signal {
  0%,
  100% {
    opacity: 0.22;
    transform: translate(-50%, -12px);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, 8px);
  }
}

@keyframes tile-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 760px) {
  .aurora {
    display: none;
  }

  .home-orb,
  .orb-dock {
    background: rgba(10, 6, 18, 0.88);
    backdrop-filter: none;
  }

  main {
    width: min(100% - 22px, 620px);
  }

  .stage-rings {
    width: min(96vw, 590px);
  }

  .satellite-ring {
    width: min(92vw, 560px);
  }

  .featured {
    width: clamp(148px, 43vw, 205px);
    box-shadow:
      0 0 54px rgba(155, 108, 255, 0.25),
      0 28px 64px rgba(0, 0, 0, 0.42),
      inset 0 0 24px rgba(220, 194, 255, 0.07);
  }

  .satellite {
    width: clamp(58px, 17vw, 82px);
    transform:
      translate(-50%, -50%)
      rotate(var(--angle))
      translateY(clamp(-225px, -39vw, -145px))
      rotate(var(--counter-angle));
  }

  .satellite:hover,
  .satellite:focus-visible,
  .satellite[aria-pressed="true"] {
    transform:
      translate(-50%, -50%)
      rotate(var(--angle))
      translateY(clamp(-225px, -39vw, -145px))
      rotate(var(--counter-angle))
      scale(1.08);
  }

  .glyph-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .tile:nth-child(3n + 2) {
    margin-top: 26px;
  }

  .tile:nth-child(4n) {
    margin-top: 0;
  }

  .orb-dock {
    right: 50%;
    transform: translateX(50%);
  }
}

.stage.is-offscreen::before,
.stage.is-offscreen .stage-rings,
.stage.is-offscreen .featured,
.stage.is-offscreen .satellite,
.stage.is-offscreen .scroll-signal {
  animation-play-state: paused;
}

@media (max-width: 420px) {
  .glyph-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tile:nth-child(3n + 2),
  .tile:nth-child(4n) {
    margin-top: 0;
  }

  .tile:nth-child(even) {
    margin-top: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .aurora,
  .stage::before,
  .stage-rings,
  .featured,
  .satellite,
  .scroll-signal,
  .tile.is-visible {
    animation: none;
  }

  .tile {
    opacity: 1;
    transform: none;
  }
}
