/*
 * css/intro.css — first-load luxury intro overlay (js/intro.js)
 * Cinematic Torus brand reveal on the cosmic dark palette. Heavy GSAP motion
 * with a CSS-keyframe fallback; fully reduced-motion-safe (static final frame).
 */

#torus-intro {
  /* base display/cover live in the inline critical CSS so it paints frame-1 */
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  -webkit-font-smoothing: antialiased;
  will-change: opacity, transform;
}

/* Ambient nebula + drifting orbs (GPU-light, behind the stage) */
.ti-aura {
  position: absolute; inset: -20%;
  background:
    radial-gradient(38% 38% at 50% 42%, rgba(56,189,248,0.10), transparent 70%),
    radial-gradient(50% 50% at 70% 70%, rgba(129,140,248,0.08), transparent 70%);
  filter: blur(8px);
  opacity: 0.9;
}
.ti-orb {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.5;
  pointer-events: none;
}
.ti-orb-1 { width: 460px; height: 460px; left: 8%;  top: 12%;
  background: radial-gradient(circle, rgba(56,189,248,0.30), transparent 65%);
  animation: ti-drift1 14s ease-in-out infinite; }
.ti-orb-2 { width: 540px; height: 540px; right: 6%; bottom: 6%;
  background: radial-gradient(circle, rgba(124,58,237,0.26), transparent 65%);
  animation: ti-drift2 17s ease-in-out infinite; }
@keyframes ti-drift1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(40px,30px)} }
@keyframes ti-drift2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-46px,-26px)} }

/* ── Stage ───────────────────────────────────────────────────────────────── */
.ti-stage {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  gap: 26px;
  padding: 24px;
}

/* Emblem */
.ti-emblem { display: block; filter: drop-shadow(0 0 26px rgba(56,189,248,0.35)); overflow: visible; }
.ti-glow      { transform-origin: 120px 120px; }
.ti-orbit     { transform-origin: 120px 120px; }
.ti-ring      { transform-origin: 120px 120px; }
.ti-knot      { transform-origin: 120px 120px; }
.ti-knot-p    { transform-box: fill-box; }
.ti-core-dot  { filter: drop-shadow(0 0 8px rgba(186,230,253,0.9)); }

/* Wordmark */
.ti-wordmark {
  display: flex; gap: 0.42em;
  font-size: 40px; font-weight: 700; letter-spacing: 0.14em;
  line-height: 1;
}
.ti-word   { color: #f3f8ff; }
.ti-word-2 {
  background: linear-gradient(100deg, #7dd3fc, #818cf8 55%, #2dd4bf);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ti-sub {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 11px; font-weight: 600; letter-spacing: 0.5em;
  color: rgba(186,211,232,0.6);
  padding-left: 0.5em; /* optical centring of the wide letter-spacing */
}

/* Luxe progress shimmer */
.ti-bar {
  position: relative; width: 220px; height: 2px; border-radius: 2px;
  background: rgba(148,163,184,0.16); overflow: hidden; margin-top: 4px;
}
.ti-bar-fill {
  position: absolute; inset: 0; transform: scaleX(0); transform-origin: left center;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #2dd4bf);
  box-shadow: 0 0 12px rgba(56,189,248,0.6);
}

/* Skip */
.ti-skip {
  position: absolute; bottom: 26px; right: 28px; z-index: 3;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(186,211,232,0.55); background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 999px;
  padding: 7px 16px; cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  opacity: 0;
}
.ti-skip:hover { color: #fff; background: rgba(56,189,248,0.12); border-color: rgba(56,189,248,0.4); }

/* Dismiss state — the whole overlay lifts + fades, handing off to the app */
#torus-intro.ti-out { transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.4,0,0.2,1); opacity: 0; transform: scale(1.04); pointer-events: none; }

/* ── CSS fallback animation (when GSAP is unavailable) ──────────────────────
   .ti-css-anim is added by intro.js only if window.gsap is missing. */
#torus-intro.ti-css-anim .ti-ring-a { stroke-dasharray: 553; stroke-dashoffset: 553; animation: ti-draw 1s 0.15s ease forwards; }
#torus-intro.ti-css-anim .ti-ring-b { stroke-dasharray: 402; stroke-dashoffset: 402; animation: ti-draw 1s 0.35s ease forwards; }
#torus-intro.ti-css-anim .ti-knot   { opacity: 0; transform: scale(0.8); animation: ti-pop 0.7s 0.6s cubic-bezier(0.34,1.56,0.64,1) forwards; }
#torus-intro.ti-css-anim .ti-orbit  { animation: ti-spin 22s linear infinite; }
#torus-intro.ti-css-anim .ti-wordmark,
#torus-intro.ti-css-anim .ti-sub    { opacity: 0; transform: translateY(14px); animation: ti-rise 0.7s ease forwards; }
#torus-intro.ti-css-anim .ti-sub    { animation-delay: 0.95s; }
#torus-intro.ti-css-anim .ti-wordmark { animation-delay: 0.8s; }
#torus-intro.ti-css-anim .ti-bar-fill { animation: ti-fill 1.6s 0.7s cubic-bezier(0.4,0,0.2,1) forwards; }
#torus-intro.ti-css-anim .ti-skip     { animation: ti-rise 0.5s 1.2s ease forwards; }
@keyframes ti-draw { to { stroke-dashoffset: 0; } }
@keyframes ti-pop  { to { opacity: 1; transform: scale(1); } }
@keyframes ti-spin { to { transform: rotate(360deg); } }
@keyframes ti-rise { to { opacity: 1; transform: translateY(0); } }
@keyframes ti-fill { to { transform: scaleX(1); } }

/* ── Reduced motion — show a calm static final frame, no spin/draw ───────── */
@media (prefers-reduced-motion: reduce) {
  .ti-orb, .ti-aura { animation: none; }
  #torus-intro.ti-css-anim .ti-ring-a,
  #torus-intro.ti-css-anim .ti-ring-b { stroke-dashoffset: 0; animation: none; }
  #torus-intro.ti-css-anim .ti-knot,
  #torus-intro.ti-css-anim .ti-wordmark,
  #torus-intro.ti-css-anim .ti-sub,
  #torus-intro.ti-css-anim .ti-skip { opacity: 1; transform: none; animation: none; }
  #torus-intro.ti-css-anim .ti-bar-fill { transform: scaleX(1); animation: none; }
  #torus-intro.ti-css-anim .ti-orbit { animation: none; }
  #torus-intro.ti-out { transition: opacity 0.3s ease; transform: none; }
}

/* Light theme — keep the intro dark + cinematic regardless (brand moment). */
html[data-theme="light"] #torus-intro { background: radial-gradient(120% 120% at 50% 38%, #0a1024 0%, #05060f 55%, #030410 100%); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ti-emblem { width: 156px; height: 156px; }
  .ti-wordmark { font-size: 30px; }
  .ti-sub { font-size: 10px; letter-spacing: 0.38em; }
  .ti-bar { width: 180px; }
  .ti-orb-1, .ti-orb-2 { width: 300px; height: 300px; filter: blur(48px); }
}
