/* =========================================================
   BASE & ATMOSPHERE
   ========================================================= */

    /* ---------------- BACKGROUND ---------------- */

    .world {
      position: fixed;
      z-index: -10;
      inset: 0;
      overflow: hidden;
      pointer-events: none;
    }

    .world::before {
      content: "";
      position: absolute;
      inset: -25%;
      opacity: .52;
      background:
        repeating-radial-gradient(
          ellipse at 70% 120%,
          transparent 0 34px,
          rgba(89, 221, 255, .32) 36px,
          transparent 39px 64px
        );
      transform: perspective(700px) rotateX(64deg) translateY(22%);
      animation: water 12s linear infinite;
    }

    .world::after {
      content: "";
      position: absolute;
      inset: 0;
      opacity: .2;
      mix-blend-mode: screen;
      background-image:
        linear-gradient(rgba(255,255,255,.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.15) 1px, transparent 1px);
      background-size: 70px 70px;
      mask-image: linear-gradient(to bottom, transparent, #000);
      transform: perspective(600px) rotateX(58deg) scale(1.5) translateY(28%);
    }

    .moon {
      position: absolute;
      top: 8%;
      right: 8%;
      width: min(38vw, 520px);
      aspect-ratio: 1;
      opacity: .52;
      border-radius: 50%;
      background:
        radial-gradient(circle at 43% 42%, #dffbff 0 3%, transparent 4%),
        radial-gradient(circle at 60% 62%, rgba(4,55,105,.45) 0 5%, transparent 6%),
        radial-gradient(circle, #52dcff, #087dff 45%, transparent 68%);
      filter: blur(.3px);
      box-shadow: 0 0 110px rgba(0, 174, 255, .34);
      animation: moonFloat 7s ease-in-out infinite;
    }

    .slash {
      position: absolute;
      width: 23vw;
      height: 140vh;
      top: -20vh;
      right: 29vw;
      opacity: .08;
      background: white;
      transform: rotate(18deg) skewX(-12deg);
    }

    .bubble {
      position: absolute;
      width: var(--size);
      height: var(--size);
      left: var(--left);
      bottom: -10%;
      opacity: .65;
      border: 1.5px solid rgba(166, 238, 255, .85);
      border-radius: 48% 52% 58% 42%;
      box-shadow: 0 0 12px rgba(84, 232, 255, 0.45);
      animation: bubble var(--duration) linear infinite;
      animation-delay: var(--delay);
    }


/* =========================================================
   ANIMATIONS & RESPONSIVE GLOBAL
   ========================================================= */

    /* ---------------- ANIMATIONS ---------------- */

    .content-change {
      animation: contentChange 430ms var(--ease);
    }

    @keyframes contentChange {
      0% {
        opacity: 0;
        transform: translateX(45px) skewX(-4deg);
        filter: blur(7px);
      }
      100% {
        opacity: 1;
        transform: translateX(0) skewX(0);
        filter: blur(0);
      }
    }

    @keyframes wipeAcross {
      0% {
        transform: translateX(-135%) skewX(-16deg);
      }
      52% {
        transform: translateX(0) skewX(-16deg);
      }
      100% {
        transform: translateX(135%) skewX(-16deg);
      }
    }

    @keyframes selectorPulse {
      50% {
        transform: translateY(-50%) translateX(-5px) scale(.82);
      }
    }

    @keyframes water {
      to {
        transform: perspective(700px) rotateX(64deg) translateY(32%);
      }
    }

    @keyframes previewWater {
      to {
        transform: rotate(-4deg) translateY(60px);
      }
    }

    @keyframes moonFloat {
      50% {
        transform: translateY(13px) scale(1.025);
      }
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    @keyframes bubble {
      from {
        transform: translateY(0) rotate(0) scale(.7);
      }
      to {
        transform: translateY(-125vh) rotate(210deg) scale(1.2);
      }
    }

    /* ---------------- RESPONSIVE ---------------- */

    @media (max-width: 980px) {
      .archive-stage {
        grid-template-columns: 1fr;
        margin-top: 25px;
      }

      .command-area {
        padding: 20px 5vw 0;
      }

      .project-list {
        max-width: none;
      }

      .preview {
        min-height: 500px;
        margin: 0 3vw;
      }

      .classic-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media (max-width: 640px) {
      .topbar {
        height: 60px;
        padding: 0 14px;
      }

      .topbar.is-scrolled {
        height: 56px;
      }

      .brand-title {
        display: none;
      }

      .mode-switch button {
        padding: 8px 9px;
        font-size: 8px;
      }

      .reload-layout {
        padding: 105px 12px 35px;
      }

      .intro {
        margin-left: 15px;
      }

      .intro h1 {
        font-size: clamp(3.5rem, 19vw, 5.6rem);
      }

      .intro-note {
        margin-left: 10px;
      }

      .command-area {
        padding-left: 0;
      }

      .command-heading {
        margin-left: 45px;
      }

      .project-button {
        grid-template-columns: 42px 1fr auto;
        min-height: 65px;
        padding-right: 13px;
      }

      .project-button:hover,
      .project-button.selected {
        transform: translateX(12px) rotate(-1deg) scale(1.025);
      }

      .project-number {
        width: 39px;
        height: 37px;
      }

      .preview {
        min-height: 455px;
        margin: 0;
      }

      .preview::before {
        inset: 3.6% 0;
      }

      .preview-shape {
        inset: 4% 0;
      }

      .preview-content {
        left: 7%;
        right: 7%;
        bottom: 10%;
      }

      .preview-content h2 {
        font-size: 2.75rem;
      }

      .preview-symbol {
        font-size: 8rem;
      }

      .open-project {
        right: 9px;
        bottom: -1px;
        width: 82px;
        height: 82px;
      }

      .detail-art {
        inset: 0;
        opacity: .3;
        clip-path: none;
      }

      .detail-inner {
        width: calc(100% - 28px);
        padding-top: 110px;
      }

      .detail-title {
        font-size: clamp(3.5rem, 20vw, 6rem);
      }

      .detail-card {
        padding: 22px 18px 42px;
      }

      .detail-info {
        grid-template-columns: 1fr;
      }

      .detail-actions {
        flex-direction: column;
      }

      .classic-grid {
        grid-template-columns: 1fr;
      }

      .classic-heading h1 {
        font-size: clamp(2.2rem, 12vw, 3.8rem);
      }
    }

    @media (prefers-reduced-motion: reduce) {
      *,
      *::before,
      *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
      }
    }


/* =========================================================
   P3R MENU ENTRANCE TRANSITION (POST-WATER DROP)
   ========================================================= */

.p3r-enter-slash {
  position: fixed;
  inset: -60%;
  z-index: 9998;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    130deg,
    transparent 42%,
    rgba(84, 232, 255, 0.4) 47%,
    rgba(255, 255, 255, 0.95) 49.5%,
    #54e8ff 50.5%,
    rgba(0, 168, 255, 0.6) 52%,
    transparent 57%
  );
  transform: rotate(-25deg) translateX(-130%);
  filter: drop-shadow(0 0 30px #54e8ff);
}

body.site-ready .p3r-enter-slash {
  animation: p3rMenuSlashSweep 0.52s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

body.is-entering {
  overflow: hidden;
}

body.is-entering .world {
  opacity: 0;
}

body.is-entering .topbar,
body.is-entering .intro,
body.is-entering .project-button,
body.is-entering .preview,
body.is-entering .scroll-cue,
body.is-entering .p3r-stat-banner-wrap {
  opacity: 0;
  visibility: hidden;
}

body.site-ready .world {
  animation: siteWorldReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.site-ready .topbar {
  visibility: visible;
  animation: p3rTopbarDrop 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.site-ready .intro {
  visibility: visible;
  animation: p3rTitleSlide 0.46s 0.06s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.site-ready .project-list > :nth-child(1) {
  visibility: visible;
  animation: p3rBtnStagger 0.40s 0.10s cubic-bezier(0.16, 1, 0.3, 1) both;
}
body.site-ready .project-list > :nth-child(2) {
  visibility: visible;
  animation: p3rBtnStagger 0.40s 0.14s cubic-bezier(0.16, 1, 0.3, 1) both;
}
body.site-ready .project-list > :nth-child(3) {
  visibility: visible;
  animation: p3rBtnStagger 0.40s 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
}
body.site-ready .project-list > :nth-child(4) {
  visibility: visible;
  animation: p3rBtnStagger 0.40s 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}
body.site-ready .project-list > :nth-child(5) {
  visibility: visible;
  animation: p3rBtnStagger 0.40s 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}
body.site-ready .project-list > :nth-child(6) {
  visibility: visible;
  animation: p3rBtnStagger 0.40s 0.30s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.site-ready .preview {
  visibility: visible;
  animation: p3rPreviewSwoop 0.52s 0.20s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.site-ready .p3r-stat-banner-wrap {
  visibility: visible;
  animation: p3rStatBannerPop 0.44s 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.site-ready .scroll-cue {
  visibility: visible;
  animation: p3rScrollCuePop 0.42s 0.34s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Once animated, clear animations so hover transforms aren't overridden */
body.site-animated .topbar,
body.site-animated .intro,
body.site-animated .project-button,
body.site-animated .preview,
body.site-animated .p3r-stat-banner-wrap,
body.site-animated .scroll-cue {
  animation: none !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.water-intro {
  position: fixed;
  z-index: 9999;
  inset: 0;
  overflow: hidden;
  visibility: visible;
  opacity: 1;
  background: #010713;
  pointer-events: auto;
  transition:
    opacity .85s cubic-bezier(.4,0,.2,1),
    visibility 0s .85s;
}

.water-intro.finished {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.intro-white {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 60% 30%,
      rgba(41, 206, 255, .2) 0%,
      transparent 32rem
    ),
    linear-gradient(145deg, #010713, #031a3a 58%, #062e5c);
}

.water-layer {
  position: absolute;
  right: -12%;
  bottom: -4%;
  left: -12%;
  height: 116%;
  color: #21aeee;
  transform: translateY(0);
  transform-origin: bottom;
  will-change: transform;
}

.water-wave {
  position: absolute;
  top: 0;
  left: -25%;
  display: block;
  width: 150%;
  height: 180px;
  overflow: visible;
  fill: currentColor;
  filter: drop-shadow(0 -2px 0 rgba(255,255,255,.13));
  animation: waterWaveHorizontal 2.8s linear infinite;
}

.water-fill {
  position: absolute;
  top: 172px;
  right: 0;
  bottom: 0;
  left: 0;
  background: currentColor;
}

.water-layer-back {
  z-index: 2;
  color: #7acbee;
  opacity: .94;
  animation:
    waterLevelDown 2.35s .58s cubic-bezier(.72,.02,.22,1) forwards;
}

.water-layer-back .water-wave {
  height: 156px;
  animation-duration: 4.1s;
}

.water-layer-middle {
  z-index: 3;
  color: #42b9e9;
  opacity: .94;
  animation:
    waterLevelDown 2.3s .71s cubic-bezier(.72,.02,.22,1) forwards;
}

.water-layer-middle .water-wave {
  left: -30%;
  width: 160%;
  height: 168px;
  animation-name: waterWaveHorizontalReverse;
  animation-duration: 3.25s;
}

.water-layer-front {
  z-index: 4;
  color: #069fe1;
  animation:
    waterLevelDown 2.25s .84s cubic-bezier(.72,.02,.22,1) forwards;
}

.water-layer-front .water-wave {
  height: 184px;
  animation-duration: 2.7s;
}

.water-layer-front .water-fill {
  background:
    radial-gradient(
      ellipse at 35% 4%,
      rgba(255,255,255,.08),
      transparent 23%
    ),
    linear-gradient(
      180deg,
      #069fe1 0%,
      #008bd6 48%,
      #0066bb 100%
    );
}

.water-bubbles {
  position: absolute;
  inset: 100px 0 0;
  overflow: hidden;
}

.water-bubbles i {
  position: absolute;
  left: var(--x);
  bottom: -50px;
  width: var(--size);
  height: var(--size);
  opacity: 0;
  border: 2px solid rgba(230,251,255,.58);
  border-radius: 46% 54% 58% 42%;
  animation: waterBubbleRise 3.6s var(--delay) linear infinite;
}

.water-intro-label {
  position: absolute;
  z-index: 10;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 15px;
  opacity: 0;
  color: #ffffff;
  text-shadow: 0 4px 20px rgba(0, 0, 0, .8), 0 0 35px rgba(84, 232, 255, .3);
  transform: translate(-50%,-50%) rotate(-2deg);
  animation: waterLabelAppear 1.65s .12s cubic-bezier(.16,.85,.23,1) both;
}

.water-intro-label > span {
  display: grid;
  place-items: center;
  width: 72px;
  height: 64px;
  color: white;
  background: #031a3a;
  border: 1px solid rgba(84, 232, 255, .6);
  font-family: Inter,sans-serif;
  font-size: 28px;
  font-weight: 900;
  clip-path: polygon(7% 0,100% 9%,87% 100%,0 84%);
  box-shadow: 9px 8px 0 #009dff, 0 0 25px rgba(0, 157, 255, .4);
  overflow: hidden;
}

.water-intro-label > span img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  clip-path: polygon(7% 0,100% 9%,87% 100%,0 84%);
  display: block;
}

.water-intro-label strong {
  display: block;
  font-family: Inter,sans-serif;
  font-size: clamp(15px,2.4vw,27px);
  font-weight: 900;
  line-height: .9;
  letter-spacing: -.04em;
  white-space: nowrap;
  color: #ffffff;
}

.water-intro-label small {
  display: block;
  margin-top: 8px;
  color: #54e8ff;
  font-family: Inter,sans-serif;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .28em;
  text-shadow: 0 0 10px rgba(84, 232, 255, .6);
}

.skip-water-intro {
  position: absolute;
  z-index: 15;
  right: 25px;
  bottom: 22px;
  padding: 9px 17px;
  cursor: pointer;
  color: rgba(255,255,255,.84);
  background: rgba(2,34,71,.36);
  border: 1px solid rgba(255,255,255,.55);
  font-family: Inter,sans-serif;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .16em;
  transition: 180ms ease;
}

.skip-water-intro:hover {
  color: #062657;
  background: white;
  transform: translateY(-2px);
}

@keyframes waterLevelDown {
  0% {
    transform: translateY(0);
  }

  16% {
    transform: translateY(-2.5%);
  }

  33% {
    transform: translateY(12%);
  }

  61% {
    transform: translateY(52%);
  }

  78% {
    transform: translateY(69%);
  }

  88% {
    transform: translateY(66%);
  }

  100% {
    transform: translateY(112%);
  }
}

@keyframes waterWaveHorizontal {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-20%);
  }
}

@keyframes waterWaveHorizontalReverse {
  from {
    transform: translateX(-18%);
  }

  to {
    transform: translateX(2%);
  }
}

@keyframes waterBubbleRise {
  0% {
    opacity: 0;
    transform: translate3d(0,40px,0) scale(.5);
  }

  16% {
    opacity: .7;
  }

  80% {
    opacity: .42;
  }

  100% {
    opacity: 0;
    transform: translate3d(35px,-105vh,0) rotate(140deg) scale(1.25);
  }
}

@keyframes waterLabelAppear {
  0% {
    opacity: 0;
    filter: blur(8px);
    transform: translate(-50%,-43%) rotate(-6deg) scale(.83);
  }

  24%,
  66% {
    opacity: 1;
    filter: blur(0);
    transform: translate(-50%,-50%) rotate(-2deg) scale(1);
  }

  100% {
    opacity: 0;
    filter: blur(3px);
    transform: translate(-50%,-62%) rotate(1deg) scale(1.04);
  }
}

@keyframes siteWorldReveal {
  from {
    opacity: 0;
    filter: saturate(.65) blur(12px);
    transform: scale(1.07);
  }

  to {
    opacity: 1;
    filter: saturate(1) blur(0);
    transform: scale(1);
  }
}

@keyframes p3rTopbarDrop {
  0% {
    opacity: 0;
    transform: translateY(-30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes p3rTitleSlide {
  0% {
    opacity: 0;
    transform: translateX(-40px) rotate(-4deg);
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
  }
}

@keyframes p3rBtnStagger {
  0% {
    opacity: 0;
    transform: translateY(24px) translateX(-18px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) translateX(0);
  }
}

@keyframes p3rPreviewSwoop {
  0% {
    opacity: 0;
    transform: translateX(50px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes p3rStatBannerPop {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes p3rScrollCuePop {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


/* =========================================================
   KEYFRAMES
   ========================================================= */

@keyframes p3rCircleExpand {
  0% {
    transform: translate(-50%, 50%) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, 50%) scale(1.06);
    opacity: 1;
  }
}

@keyframes p3rDetailWipeIn {
  0% {
    clip-path: circle(0% at 0% 100%);
  }
  100% {
    clip-path: circle(150% at 0% 100%);
  }
}

@keyframes p3rArcPulse {
  0% {
    opacity: 0;
    transform: translate(-50%, 50%) scale(0.02);
  }
  25% {
    opacity: 1;
  }
  75% {
    opacity: 1;
    transform: translate(-50%, 50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 50%) scale(1.06);
  }
}

@keyframes p3rShardBurst {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg) scale(0.2);
  }
  20% {
    opacity: 1;
  }
  75% {
    opacity: 0.95;
    transform: translate(var(--s-dist-x), calc(-1 * var(--s-dist-y))) rotate(var(--s-rot)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--s-dist-x) * 1.1), calc(-1 * var(--s-dist-y) * 1.1)) rotate(calc(var(--s-rot) * 1.25)) scale(0.85);
  }
}

@keyframes p3rShardExit {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg) scale(0.3);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--s-dist-x), calc(-1 * var(--s-dist-y))) rotate(var(--s-rot)) scale(0.8);
  }
}

@keyframes p3rBubbleRise {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.6);
  }
  35% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: translateY(-55vh) scale(1.2);
  }
}

@keyframes p3rLabelSlide {
  0% {
    opacity: 0;
    transform: translate(-40px, 40px) rotate(-6deg) scale(0.85);
  }
  28% {
    opacity: 1;
    transform: translate(0, 0) rotate(-3deg) scale(1.02);
  }
  58% {
    opacity: 1;
    transform: translate(0, 0) rotate(-3deg) scale(1);
  }
  72% {
    opacity: 0;
    transform: translate(15px, -15px) rotate(-1deg) scale(1.04);
  }
  100% {
    opacity: 0;
    transform: translate(20px, -20px) rotate(0deg) scale(1.06);
  }
}

@keyframes p3rOverlayFade {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes p3rDetailWipeOut {
  0% {
    clip-path: circle(150% at 0% 100%);
    opacity: 1;
  }
  99% {
    clip-path: circle(0% at 0% 100%);
    opacity: 1;
  }
  100% {
    clip-path: circle(0% at 0% 100%);
    opacity: 0;
  }
}

@keyframes p3rCloseArcShrink {
  0% {
    opacity: 1;
    transform: translate(-50%, 50%) scale(1.08);
  }
  85% {
    opacity: 1;
    transform: translate(-50%, 50%) scale(0.04);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 50%) scale(0);
  }
}
