:root { --ease: cubic-bezier(.76, 0, .24, 1); --a1: #F08A5D; --a3: #F9ED69; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #07070a;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

/* ambient glow behind the cards: two layers that cross-fade (opacity only, GPU) */
.amb { position: fixed; inset: 0; transition: opacity 1.6s var(--ease); will-change: opacity; }

#stage {
  position: fixed;
  inset: 0;
  touch-action: none;
  cursor: grab;
}
#stage:active { cursor: grabbing; }

/* ---------- slide ---------- */
.slide {
  position: absolute;
  inset: 0;
  overflow: hidden;
  will-change: transform;
  transform-origin: 50% 50%;
  contain: layout paint;
  box-shadow: 0 40px 100px rgba(0,0,0,.55);
}
.slide::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.28), inset 0 1.5px 0 rgba(255,255,255,.6);
  pointer-events: none;
  z-index: 10;
}

.base { position: absolute; inset: 0; }
.tex {
  position: absolute;
  inset: -10%;
  will-change: transform;
  backface-visibility: hidden;
}
/* spinning layer: a square just big enough to cover the screen at any angle */
.tex.spin {
  inset: auto;
  left: 50%; top: 50%;
  width: 125vmax; height: 125vmax;
  margin: -62.5vmax 0 0 -62.5vmax;
  animation: spin 120s linear infinite;
}
.tex.drift { animation: drift 16s ease-in-out infinite alternate; }
/* pan layers get one pattern period of spare edge so nothing shows through */
.tex.pan   { inset: calc(-10% - 220px); animation: pan var(--pd, 6s) linear infinite; }
.tex.breathe { animation: breathe 7s ease-in-out infinite alternate; }

@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes drift   { from { transform: scale(1) rotate(0deg); } to { transform: scale(1.15) rotate(5deg); } }
@keyframes pan     { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(var(--px, 0px), var(--py, 0px), 0); } }
@keyframes breathe { from { transform: scale(1); } to { transform: scale(1.2); } }

/* synthwave floor: the grid moves by transform, not by repainting */
.floor {
  position: absolute;
  left: -60%; right: -60%;
  top: 52%;
  height: 120%;
  transform-origin: 50% 0;
  transform: perspective(420px) rotateX(72deg);
  overflow: hidden;
}
.floor .grid {
  position: absolute;
  left: 0; right: 0; top: -110px;
  height: calc(100% + 110px);
  background-size: 110px 110px;
  will-change: transform;
  animation: floor 1.2s linear infinite;
}
@keyframes floor { to { transform: translate3d(0, 110px, 0); } }
.horizon {
  position: absolute;
  left: 0; right: 0; top: 52%;
  height: 22%;
  pointer-events: none;
}
.sun {
  position: absolute;
  left: 50%; top: 52%;
  width: 46vmin; height: 46vmin;
  transform: translate(-50%, -62%);
  border-radius: 50%;
  --m: linear-gradient(to bottom, #000 0 52%, transparent 52% 56%, #000 56% 64%, transparent 64% 69%, #000 69% 76%, transparent 76% 82%, #000 82% 88%, transparent 88% 95%, #000 95%);
  -webkit-mask-image: var(--m);
          mask-image: var(--m);
}

/* aurora: soft radial gradients instead of blur filters */
.blob {
  position: absolute;
  width: 80vmax; height: 80vmax;
  border-radius: 50%;
  will-change: transform;
  animation: float 14s ease-in-out infinite alternate;
}
.blob:nth-child(2) { animation-duration: 18s; animation-delay: -6s; }
.blob:nth-child(3) { animation-duration: 11s; animation-delay: -3s; }
.blob:nth-child(4) { animation-duration: 20s; animation-delay: -9s; }
@keyframes float {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(18vw, -12vh, 0) scale(1.2); }
  100% { transform: translate3d(-14vw, 14vh, 0) scale(.85); }
}

/* gloss layers: plain blending only */
.grain {
  position: absolute;
  inset: 0;
  opacity: .07;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.4 -.2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.gloss {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(168deg, rgba(255,255,255,.34) 0%, rgba(255,255,255,.09) 26%, rgba(255,255,255,0) 44%),
    radial-gradient(130% 95% at 50% 45%, transparent 55%, rgba(0,0,0,.3) 100%);
}
.sheen {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 100%;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.05) 42%, rgba(255,255,255,.28) 50%, rgba(255,255,255,.05) 58%, transparent 70%);
  transform: translate3d(-110%, 0, 0);
  will-change: transform;
}
.slide.in .sheen { animation: sheen 1.8s var(--ease) .3s both, sheenLoop 10s var(--ease) 4s infinite; }
@keyframes sheen     { from { transform: translate3d(-110%, 0, 0); } to { transform: translate3d(110%, 0, 0); } }
@keyframes sheenLoop { 0% { transform: translate3d(-110%, 0, 0); } 22%, 100% { transform: translate3d(110%, 0, 0); } }

/* ---------- glass + hello ---------- */
.center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  perspective: 1100px;
  z-index: 5;
  pointer-events: none;
}
.tilt {
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .6s cubic-bezier(.2,.8,.2,1);
  will-change: transform;
}
.glass {
  position: relative;
  padding: clamp(18px, 3.2vw, 46px) clamp(30px, 6vw, 92px) clamp(24px, 3.8vw, 56px);
  border-radius: clamp(28px, 4vw, 56px);
  border: 1px solid rgba(255,255,255,.55);
  -webkit-backdrop-filter: blur(14px);
          backdrop-filter: blur(14px);
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,.85),
    inset 0 -1px 0 rgba(255,255,255,.18),
    0 30px 70px -20px rgba(0,0,0,.45);
  opacity: 0;
  overflow: hidden;
}
.glass.light { background: linear-gradient(150deg, rgba(255,255,255,.66), rgba(255,255,255,.22)); }
.glass.dark  { background: linear-gradient(150deg, rgba(18,18,28,.58), rgba(18,18,28,.26)); border-color: rgba(255,255,255,.32); }
.glare {
  position: absolute;
  left: -50%; top: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.4), rgba(255,255,255,0) 22%);
  transform: translate3d(var(--gx, -20%), var(--gy, -30%), 0);
  transition: transform .6s cubic-bezier(.2,.8,.2,1);
  will-change: transform;
  pointer-events: none;
}
.glass::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,0));
  border-radius: inherit;
  border-bottom-left-radius: 50% 18%;
  border-bottom-right-radius: 50% 18%;
  pointer-events: none;
}
.slide.in .glass { animation: glassIn 1.2s cubic-bezier(.16,1,.3,1) .15s both; }
@keyframes glassIn {
  from { opacity: 0; transform: scale(.82) translate3d(0, 30px, 0); }
  to   { opacity: 1; transform: none; }
}

.word { position: relative; line-height: 1.12; white-space: nowrap; }
.hello {
  position: relative;
  z-index: 1;
  margin: 0;
  font: inherit;
}
/* depth from a soft shadow layer behind the letters, not a filter */
.shadow {
  position: absolute;
  inset: 0;
  z-index: 0;
  color: rgba(0,0,0,.16);
  transform: translate3d(0, .06em, 0);
  opacity: 0;
  transition: opacity 1s ease .9s;
}
.glass.dark .shadow { color: color-mix(in srgb, var(--ink1) 30%, transparent); transform: none; text-shadow: 0 0 .25em var(--ink1); }
.slide.in .shadow { opacity: 1; }

.l {
  display: inline-block;
  padding: 0 .05em .06em;
  margin: 0 -.05em;
  background-image:
    linear-gradient(105deg, rgba(255,255,255,0) 40%, rgba(255,255,255,.95) 50%, rgba(255,255,255,0) 60%),
    linear-gradient(180deg, var(--ink1) 8%, var(--ink2) 92%);
  background-size: 300% 100%, 100% 100%;
  background-position: 150% 0, 0 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  opacity: 0;
  transform-origin: 50% 80%;
}
.slide.in .l { animation: letterIn 1.1s cubic-bezier(.16,1,.3,1) calc(.45s + var(--i) * 80ms) both; }
.slide.settled .l { opacity: 1; animation: none; }
.slide.settled.shimmer .l { animation: shine 1.3s ease-in-out calc(var(--i) * 90ms) both; }
@keyframes letterIn {
  from { opacity: 0; transform: translate3d(0, 45%, 0) rotateX(-85deg) scale(.7); }
  to   { opacity: 1; transform: none; }
}
@keyframes shine {
  from { background-position: 150% 0, 0 0; }
  to   { background-position: -50% 0, 0 0; }
}

/* ---------- UI (solid tints, no live blur) ---------- */
.ui { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.ui header {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: max(18px, env(safe-area-inset-top)) clamp(18px, 3vw, 36px) 0;
}
.right { display: flex; gap: 10px; align-items: center; }
.brand, .count, .pill {
  background: linear-gradient(150deg, rgba(16,16,22,.62), rgba(16,16,22,.42));
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 8px 24px rgba(0,0,0,.25);
  border-radius: 999px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px 9px 12px;
  font-weight: 600; font-size: 14px; letter-spacing: .01em;
}
.orb {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--a3) 30%, var(--a1) 70%);
  box-shadow: 0 0 12px var(--a1);
}
.count {
  padding: 9px 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 600; font-size: 14px;
  display: flex; gap: 6px; overflow: hidden;
}
.count .of { opacity: .55; }
#num, .val, .sw { display: inline-block; }

.nav {
  pointer-events: auto;
  position: absolute;
  top: 50%;
  width: 58px; height: 58px;
  margin-top: -29px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.35);
  background: linear-gradient(150deg, rgba(255,255,255,.3), rgba(255,255,255,.08));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 12px 30px rgba(0,0,0,.3);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
  -webkit-tap-highlight-color: transparent;
}
.nav:hover { transform: scale(1.08); }
.nav:active { transform: scale(.94); }
.nav svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.prev { left: clamp(12px, 2.5vw, 36px); }
.next { right: clamp(12px, 2.5vw, 36px); }

.ui footer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 clamp(18px, 3vw, 36px) max(20px, env(safe-area-inset-bottom));
}
.meta { padding: 9px 18px; display: flex; flex-direction: column; min-width: 150px; }
.label { font-size: 10px; text-transform: uppercase; letter-spacing: .16em; opacity: .6; }
.val { font-size: 15px; font-weight: 600; }

.dots { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(20px, env(safe-area-inset-bottom)); padding: 12px 16px; display: flex; gap: 8px; pointer-events: auto; }
.dot {
  width: 8px; height: 8px;
  border-radius: 99px;
  border: 0; padding: 0;
  background: rgba(255,255,255,.35);
  cursor: pointer;
  transition: width .9s var(--ease);
}
.dot.on { width: 30px; background: linear-gradient(90deg, var(--a3), var(--a1)); }

.swp { padding: 6px 8px; display: flex; overflow: hidden; }
.sw { display: flex; gap: 5px; }
.sw i {
  display: block;
  width: 20px; height: 20px;
  border-radius: 50%;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.6), inset 0 -2px 3px rgba(0,0,0,.2), 0 2px 6px rgba(0,0,0,.3);
  position: relative;
}
.sw i::after {
  content: "";
  position: absolute; left: 22%; top: 12%;
  width: 45%; height: 30%;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
}

.hint {
  position: absolute;
  left: 50%; bottom: 88px;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: .02em;
  padding: 8px 16px;
  border-radius: 99px;
  background: rgba(10,10,14,.55);
  white-space: nowrap;
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.hint.gone { opacity: 0; transform: translateX(-50%) translateY(12px); }

@media (max-width: 640px) {
  .nav, .dots { display: none; }
  .brand { font-size: 0; gap: 0; padding: 10px; }
  .meta { min-width: 0; padding: 8px 14px; }
  .val { font-size: 13px; }
  .sw i { width: 16px; height: 16px; }
  .hint { bottom: 80px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .tex, .blob, .floor .grid, .sheen { animation: none !important; }
}
