/* Index page motion layer (assets/js/ux-motion.js). All states are scoped to
   html.ux-motion, which the script only sets when reduced motion is off, so
   without JS everything stays visible and static.
   Reveals and magnetic buttons use the individual `translate` property so
   they stack with the existing hover `transform`s instead of overriding them. */

/* --- scroll reveals --- */
.ux-motion .ux-reveal {
  opacity: 0;
  translate: 0 36px;
  scale: 0.97;
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1) var(--ux-delay, 0ms),
    translate 0.8s cubic-bezier(0.22, 1, 0.36, 1) var(--ux-delay, 0ms),
    scale 0.8s cubic-bezier(0.22, 1, 0.36, 1) var(--ux-delay, 0ms),
    transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    border-color 0.4s ease,
    box-shadow 0.4s ease;
}

.ux-motion .ux-reveal.ux-in {
  opacity: 1;
  translate: 0 0;
  scale: 1;
}

/* --- project cards: tilt + spotlight --- */
.ux-motion .project-card {
  position: relative;
  transform-style: preserve-3d;
}

.ux-motion .project-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(420px circle at var(--ux-mx, 50%) var(--ux-my, 0%), rgba(56, 189, 248, 0.16), transparent 60%);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 2;
}

.ux-motion .project-card.ux-tilting {
  transform: perspective(900px) rotateX(var(--ux-rx, 0deg)) rotateY(var(--ux-ry, 0deg)) translateY(-6px);
  transition:
    opacity 0.7s ease,
    translate 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    scale 0.8s ease,
    transform 0.12s linear,
    border-color 0.4s ease,
    box-shadow 0.4s ease;
}

.ux-motion .project-card.ux-tilting::after { opacity: 1; }

.ux-motion .project-card.ux-tilting .project-card-logo {
  transform: translateZ(40px) scale(1.06);
}

/* --- feature cards: self-drawing outline + icon pop --- */
/* --- hero stats: live dot --- */
.hero-live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.4em;
  border-radius: 50%;
  background: #10b981;
  vertical-align: 1px;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: uxLivePulse 1.8s ease-out infinite;
}

@keyframes uxLivePulse {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  80%  { box-shadow: 0 0 0 9px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* --- magnetic buttons --- */
.ux-magnetic {
  translate: var(--ux-tx, 0px) var(--ux-ty, 0px);
  transition: all 0.3s ease, translate 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- timeline: progress line --- */
.ux-line .timeline-track {
  background: rgba(148, 163, 184, 0.14);
}

.ux-track-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #10B981, #3B82F6, #e5e7eb);
  clip-path: inset(0 0 calc(100% - var(--ux-p, 0%)) 0);
}

/* glowing head at the end of the filled line (on the track, so the clip doesn't cut it) */
.ux-line .timeline-track::after {
  content: "";
  position: absolute;
  left: 50%;
  top: var(--ux-p, 0%);
  width: 12px;
  height: 12px;
  translate: -50% -50%;
  border-radius: 50%;
  background: #e0f2fe;
  box-shadow: 0 0 12px 4px rgba(56, 189, 248, 0.7), 0 0 32px 10px rgba(59, 130, 246, 0.35);
}

.ux-line .tl-item .tl-card {
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.6s ease, border-color 0.6s ease;
}

.ux-line .tl-item.ux-lit .tl-card {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35), 0 0 40px rgba(56, 189, 248, 0.1);
}

.ux-line .tl-item.ux-lit .tl-date {
  color: #7dd3fc;
  transition: color 0.6s ease;
}

@media (prefers-reduced-motion: reduce) {
  .hero-live-dot { animation: none; }
}

/* ================= scroll layer ================= */

/* reading progress under the header */
.ux-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 1001;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, #10b981, #38bdf8, #6366f1, #a855f7);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
  pointer-events: none;
}

/* hero exit: headline grows and blurs away as it scrolls off (--ux-hero 0..1) */
.ux-motion .hero-headline {
  transform: scale(calc(1 + var(--ux-hero, 0) * 0.18));
  transform-origin: 0 100%;
  filter: blur(calc(var(--ux-hero, 0) * 8px));
  letter-spacing: calc(-0.03em + var(--ux-hero, 0) * 0.06em);
}

/* stats fade in place (moving them up made them collide with the live
   chips / event card above) */
.ux-motion .hero-stats {
  opacity: calc(1 - var(--ux-hero, 0) * 1.4);
}

/* --- marquee band --- */
.ux-marquee {
  position: relative;
  overflow: hidden;
  padding: 2.5rem 0;
  margin: 1rem 0;
  transform: skewY(-2deg);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  user-select: none;
  pointer-events: none;
}

.ux-marquee-row {
  display: flex;
  width: max-content;
  will-change: transform;
}

.ux-marquee-seg {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.ux-marquee-row span,
.ux-marquee-row i {
  font-size: clamp(2.6rem, 7vw, 5.6rem);
  font-weight: 900;
  font-style: normal;
  line-height: 1.15;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 0 0.35em;
}

.ux-marquee-row span {
  background: linear-gradient(100deg, #38bdf8, #6366f1, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ux-marquee-row span.is-outline {
  background: none;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(148, 163, 184, 0.55);
}

.ux-marquee-row i {
  font-size: clamp(1.4rem, 3vw, 2.4rem);
  color: #10b981;
  padding: 0 0.2em;
}

.ux-marquee-row + .ux-marquee-row span { font-size: clamp(2rem, 5vw, 4rem); }
.ux-marquee-row + .ux-marquee-row span:not(.is-outline) {
  background-image: linear-gradient(100deg, #10b981, #38bdf8);
}

/* without the motion layer the band is just a static strip */
html:not(.ux-motion) .ux-marquee-row { transform: translateX(-10%); }

/* --- word-by-word heading reveal --- */
.ux-words .ux-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 0.12em;
  margin-bottom: -0.12em;
}

.ux-words .ux-word > ux-wi {
  display: inline-block;
  translate: 0 110%;
  rotate: 8deg;
  transform-origin: 0 100%;
  transition:
    translate 0.75s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--ux-wi, 0) * 90ms),
    rotate 0.75s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--ux-wi, 0) * 90ms);
}

.ux-words.ux-in .ux-word > ux-wi {
  translate: 0 0;
  rotate: 0deg;
}

/* --- info row: banners fly in from the sides --- */
/* team avatars pop in once their banner is visible */

/* light theme tweaks */
html[data-theme="light"] .ux-marquee-row span.is-outline { -webkit-text-stroke-color: rgba(15, 23, 42, 0.35); }
html[data-theme="light"] .ux-marquee-row span { background-image: linear-gradient(100deg, #0284c7, #4f46e5, #9333ea); }

/* ================= subpages ================= */

/* page titles get the index treatment: big, tight, words rise in */
.ux-page-title {
  font-size: clamp(2.4rem, 5.5vw, 4.2rem) !important;
  font-weight: 800 !important;
  line-height: 1.06 !important;
  letter-spacing: -0.035em !important;
}

.ux-page-eyebrow { margin-bottom: 1.1rem; }

/* inline gradient/icon parts of a title stay intact inside the word masks */
.ux-words .ux-word > ux-wi > span,
.ux-words .ux-word > ux-wi > i { display: inline-block; }

/* initials fallback for broken avatars on the team profile pages */
.sb-avatar .nx-initials {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-size: 3rem;
  font-weight: 800;
  color: #e0f2fe;
  background: linear-gradient(135deg, #1e3a8a, #6d28d9);
}

/* ================= index intro ================= */
html.ux-intro-pending body { visibility: hidden; }

.ux-intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #020617;
  cursor: pointer;
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.95s cubic-bezier(0.76, 0, 0.24, 1);
}

.ux-intro.is-leaving { clip-path: inset(0 0 100% 0); }

.ux-intro-center { display: grid; justify-items: center; gap: 1.4rem; }

.ux-intro-logo {
  width: 180px;
  height: auto;
  animation: ux-intro-logo 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes ux-intro-logo {
  from { opacity: 0; scale: 0.4; rotate: -25deg; filter: blur(8px); }
  to { opacity: 1; scale: 1; rotate: 0deg; filter: blur(0); }
}

.ux-intro-word {
  display: flex;
  overflow: hidden;
  font-size: clamp(2.6rem, 9vw, 6rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.ux-intro-word span {
  display: inline-block;
  background: linear-gradient(100deg, #38bdf8, #6366f1, #a855f7);
  background-size: 1200% 100%;
  background-position: calc(var(--ci) * 9%) 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  translate: 0 110%;
  animation: ux-intro-char 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(0.25s + var(--ci) * 45ms);
}

@keyframes ux-intro-char { to { translate: 0 0; } }

.ux-intro.is-leaving .ux-intro-center { scale: 0.92; opacity: 0; transition: scale 0.7s ease, opacity 0.5s ease; }

.ux-intro-count {
  position: absolute;
  right: clamp(1.2rem, 4vw, 3rem);
  bottom: clamp(1.4rem, 5vw, 3rem);
  display: grid;
  justify-items: end;
  gap: 0.3rem;
  color: #94a3b8;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.ux-intro-count b {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.05em;
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
}

.ux-intro-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(148, 163, 184, 0.15);
}

.ux-intro-bar i {
  display: block;
  height: 100%;
  transform: scaleX(var(--ip, 0));
  transform-origin: 0 50%;
  background: linear-gradient(90deg, #10b981, #38bdf8, #6366f1, #a855f7);
}

/* hero content rises in as the curtain lifts */
.ux-intro-reveal .hero-inner > * {
  animation: ux-intro-rise 1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ux-intro-reveal .hero-inner > :nth-child(2) { animation-delay: 0.08s; }
.ux-intro-reveal .hero-inner > :nth-child(3) { animation-delay: 0.16s; }
.ux-intro-reveal .hero-inner > :nth-child(4) { animation-delay: 0.24s; }

@keyframes ux-intro-rise {
  from { opacity: 0; translate: 0 60px; }
  to { opacity: 1; translate: 0 0; }
}

html[data-theme="light"] .ux-intro { background: #eef2f7; }
html[data-theme="light"] .ux-intro-count b { color: #0f172a; }
html[data-theme="light"] .ux-intro-count { color: #475569; }

/* ================= hero live status bar (index) ================= */
.hero-live {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.hero-live-label {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #4ade80;
}

.hero-live-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.8rem 0.3rem 0.3rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  background: color-mix(in srgb, var(--c) 10%, rgba(15, 23, 42, 0.6));
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.hero-live-chip:hover { border-color: var(--c); transform: translateY(-2px); }

.hero-live-chip img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.hero-live-chip b {
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}
