/* Raink Design portal — core styles */

:root {
  --cut: 96px;
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: #06060d;
  color: #fff;
  font-family: var(--font-sans);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}

/* ---------------------------------------------------------------- backdrop */

.liquid-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(55% 55% at 18% 22%, rgba(58, 36, 96, 0.85) 0%, rgba(6, 6, 13, 0) 62%),
    radial-gradient(48% 48% at 82% 16%, rgba(14, 56, 68, 0.75) 0%, rgba(6, 6, 13, 0) 60%),
    radial-gradient(62% 62% at 62% 88%, rgba(74, 28, 60, 0.75) 0%, rgba(6, 6, 13, 0) 66%),
    #06060d;
  animation: fallbackDrift 30s ease-in-out infinite alternate;
}

@keyframes fallbackDrift {
  0% {
    transform: scale(1) translate3d(0, 0, 0);
  }
  100% {
    transform: scale(1.14) translate3d(-2%, 1.5%, 0);
  }
}

.liquid-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.8s var(--ease-soft);
}

.has-bg .liquid-canvas {
  opacity: 1;
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* ------------------------------------------------------------------ hint */

.hint {
  position: absolute;
  bottom: clamp(16px, 3.2vh, 32px);
  left: 50%;
  z-index: 10;
  margin: 0;
  transform: translateX(-50%);
  font-size: 9px;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  pointer-events: none;
  transition: opacity 0.9s var(--ease-soft);
  opacity: 0;
  white-space: nowrap;
}

.is-loaded .hint {
  animation: fadeIn 1.2s var(--ease-soft) 1.35s both, hintPulse 4.5s ease-in-out 2.55s infinite;
}

.has-active .hint {
  animation: none;
  opacity: 0;
}

@keyframes hintPulse {
  0%,
  100% {
    color: rgba(255, 255, 255, 0.28);
  }
  50% {
    color: rgba(255, 255, 255, 0.55);
  }
}

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

/* ----------------------------------------------------------------- portal */

.portal {
  position: absolute;
  inset: 0;
  z-index: 4;
  background-color: transparent;
}

/* ---------------------------------------------------------------- intro */

.intro .portal {
  clip-path: circle(0% at 50% 50%);
}

.intro.is-loaded .portal {
  animation: portalReveal 1.6s var(--ease-soft) forwards;
}

@keyframes portalReveal {
  from {
    clip-path: circle(0% at 50% 50%);
  }
  to {
    clip-path: circle(150% at 50% 50%);
  }
}

.intro-layer {
  position: absolute;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
}

.intro-layer__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(58% 58% at 50% 50%, #0e0c1c 0%, #06060d 64%),
    #06060d;
  -webkit-mask-image: radial-gradient(
    circle at 50% 50%,
    rgba(0, 0, 0, 0) var(--veil-r, 0px),
    rgba(0, 0, 0, 0.45) calc(var(--veil-r, 0px) + 15vmax),
    #000 calc(var(--veil-r, 0px) + 36vmax)
  );
  mask-image: radial-gradient(
    circle at 50% 50%,
    rgba(0, 0, 0, 0) var(--veil-r, 0px),
    rgba(0, 0, 0, 0.45) calc(var(--veil-r, 0px) + 15vmax),
    #000 calc(var(--veil-r, 0px) + 36vmax)
  );
}

/* Persistent centre light: appears, diffuses, breathes, then diffuses again. */
.intro-layer__core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 260px;
  height: 260px;
  margin: -130px 0 0 -130px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(220, 208, 255, 0.7) 16%,
    rgba(150, 135, 255, 0.22) 44%,
    rgba(150, 135, 255, 0) 72%
  );
  opacity: 0;
  transform: scale(0.2);
  animation: introCore 3.4s linear 0.1s both;
}

@keyframes introCore {
  0% {
    opacity: 0;
    transform: scale(0.2);
    animation-timing-function: cubic-bezier(0.16, 0.84, 0.3, 1);
  }
  6% {
    opacity: 1;
    transform: scale(0.95);
    animation-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  12% {
    opacity: 0.92;
    transform: scale(1.12);
    animation-timing-function: cubic-bezier(0.5, 0, 0.75, 0.6);
  }
  50% {
    opacity: 0.98;
    transform: scale(0.86);
    animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
  }
  56% {
    opacity: 1;
    transform: scale(0.82);
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.4, 1);
  }
  66% {
    opacity: 0.9;
    transform: scale(2);
    animation-timing-function: linear;
  }
  100% {
    opacity: 0;
    transform: scale(3.6);
  }
}

.intro-layer__burst {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300px;
  height: 300px;
  margin: -150px 0 0 -150px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.85) 0%,
    rgba(200, 186, 255, 0.35) 30%,
    rgba(150, 135, 255, 0) 68%
  );
  opacity: 0;
  transform: scale(0.4);
  animation: introBurst 1.8s linear both;
}

.intro-layer__burst--a {
  animation-delay: 0.24s;
}

.intro-layer__burst--b {
  animation-delay: 2s;
}

@keyframes introBurst {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  16% {
    opacity: 0.9;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(5.4);
  }
}

.intro-layer__wave {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42vmin;
  height: 42vmin;
  margin: -21vmin 0 0 -21vmin;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow:
    0 0 90px rgba(180, 160, 255, 0.25),
    inset 0 0 90px rgba(180, 160, 255, 0.18);
  opacity: 0;
  transform: scale(0.2);
  animation: introWave 1.7s linear both;
}

.intro-layer__wave--a {
  animation-delay: 0.32s;
}

.intro-layer__wave--b {
  animation-delay: 2s;
}

@keyframes introWave {
  0% {
    opacity: 0;
    transform: scale(0.2);
  }
  12% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: scale(4.6);
  }
}

.module {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  color: inherit;
  text-decoration: none;
  clip-path: polygon(var(--cut) 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%);
  transform: translate3d(0, 0, 0) scale(1);
  transition: transform 1.1s var(--ease-out);
  will-change: transform;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  opacity: 0;
}

.module--first {
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%);
}

.is-stacked .module {
  clip-path: polygon(0 var(--cut), 100% 0, 100% calc(100% - var(--cut)), 0 100%);
}

.is-stacked .module--first {
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), 0 100%);
}

.module.is-active {
  z-index: 6;
  transform: translate3d(0, 0, 0) scale(1.024);
}

.is-loaded .module {
  animation: moduleIn 1.5s var(--ease-out) both;
  animation-delay: calc(150ms + var(--i, 0) * 110ms);
}

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

.module--soon {
  cursor: default;
}

/* --------------------------------------------------------- glass surfaces */

/* Clear pane: almost no blur in the middle, so the liquid reads like a window. */
.module__glass {
  position: absolute;
  inset: 0;
  z-index: 1;
  -webkit-backdrop-filter: blur(2px) saturate(108%) brightness(1.01);
  backdrop-filter: blur(2px) saturate(108%) brightness(1.01);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.022) 0%,
    rgba(255, 255, 255, 0) 46%,
    rgba(255, 255, 255, 0.012) 100%
  );
}

/* One overall frosted rim around the window, not one per module. */
.frame-frost {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  -webkit-backdrop-filter: blur(12px) saturate(125%);
  backdrop-filter: blur(12px) saturate(125%);
  -webkit-mask-image:
    linear-gradient(
      to right,
      #000 0,
      rgba(0, 0, 0, 0.7) 8px,
      rgba(0, 0, 0, 0) 28px,
      rgba(0, 0, 0, 0) calc(100% - 28px),
      rgba(0, 0, 0, 0.7) calc(100% - 8px),
      #000 100%
    ),
    linear-gradient(
      to bottom,
      #000 0,
      rgba(0, 0, 0, 0.7) 8px,
      rgba(0, 0, 0, 0) 28px,
      rgba(0, 0, 0, 0) calc(100% - 28px),
      rgba(0, 0, 0, 0.7) calc(100% - 8px),
      #000 100%
    );
  mask-image:
    linear-gradient(
      to right,
      #000 0,
      rgba(0, 0, 0, 0.7) 8px,
      rgba(0, 0, 0, 0) 28px,
      rgba(0, 0, 0, 0) calc(100% - 28px),
      rgba(0, 0, 0, 0.7) calc(100% - 8px),
      #000 100%
    ),
    linear-gradient(
      to bottom,
      #000 0,
      rgba(0, 0, 0, 0.7) 8px,
      rgba(0, 0, 0, 0) 28px,
      rgba(0, 0, 0, 0) calc(100% - 28px),
      rgba(0, 0, 0, 0.7) calc(100% - 8px),
      #000 100%
    );
}

.module__light {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(
      108% 88% at 50% 50%,
      rgba(255, 255, 255, 0) 38%,
      rgba(255, 255, 255, 0.08) 76%,
      rgba(255, 255, 255, 0.16) 100%
    ),
    linear-gradient(
      158deg,
      rgba(255, 255, 255, 0.07) 0%,
      rgba(255, 255, 255, 0.01) 46%,
      rgba(var(--accent), 0.1) 100%
    );
  transition: opacity 0.8s var(--ease-soft);
}

.module.is-active .module__light {
  opacity: 1;
}

.module__shade {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(62% 48% at 50% 50%, rgba(6, 6, 16, 0.12), rgba(6, 6, 16, 0) 78%),
    linear-gradient(180deg, rgba(6, 6, 14, 0.04) 0%, rgba(6, 6, 14, 0) 30%, rgba(6, 6, 14, 0.08) 100%);
}

/* ---------------------------------------------------------------- content */

.module__content {
  position: relative;
  z-index: 7;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 7vh 4vw;
  text-align: center;
}

.is-loaded .module__content {
  animation: contentIn 1.7s var(--ease-out) both;
  animation-delay: calc(400ms + var(--i, 0) * 110ms);
}

@keyframes contentIn {
  from {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.module__title {
  margin: 0;
  font-size: clamp(1.8rem, 3.5vw, 3.5rem);
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -0.022em;
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 2px 40px rgba(6, 6, 20, 0.38);
  transition: transform 1s var(--ease-out), color 0.6s var(--ease-soft);
  white-space: nowrap;
}

.module.is-active .module__title {
  transform: translateY(-2px);
  color: #fff;
  text-shadow: 0 0 60px rgba(255, 255, 255, 0.32), 0 2px 40px rgba(6, 6, 20, 0.38);
}

.module__desc {
  margin: 0;
  min-height: 3.6em;
  max-width: 26ch;
  font-size: clamp(0.76rem, 0.9vw, 0.92rem);
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.78);
  opacity: 0;
  transform: translate3d(0, 8px, 0);
  transition: opacity 0.6s var(--ease-soft), transform 0.7s var(--ease-out);
}

.module.is-active .module__desc {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.module.is-blocked {
  animation: blockedPulse 0.55s var(--ease-soft);
}

@keyframes blockedPulse {
  0%,
  100% {
    opacity: 1;
  }
  40% {
    opacity: 0.72;
  }
}

.module:focus-visible .module__content {
  outline: 1px solid rgba(255, 255, 255, 0.6);
  outline-offset: -10px;
  border-radius: 4px;
}

/* ------------------------------------------------------------- responsive */

.is-stacked .module__content {
  padding: 4vh 7vw;
  gap: 12px;
}

.is-stacked .module__title {
  font-size: clamp(1.55rem, 7.4vw, 2.5rem);
}

.is-stacked .module__desc {
  min-height: 3.2em;
  max-width: 30ch;
}

@media (max-width: 820px) {
  .hint {
    bottom: 12px;
    font-size: 8px;
    letter-spacing: 0.42em;
  }
}

.noscript {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-content: center;
  z-index: 20;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.75);
  background: #06060d;
}

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

  .module {
    opacity: 1;
  }

  .module__content {
    opacity: 1;
    transform: none;
  }

  .intro-layer {
    display: none;
  }

  .intro .portal,
  .intro.is-loaded .portal {
    clip-path: none;
    animation: none;
  }

  .hint {
    opacity: 1;
    animation: none !important;
  }
}
