/* ── text-effects.css ───────────────────────────────────────── */
/* Advanced Creative Typography & Micro-Interaction Suite        */
/* Additive only — seamlessly layers over existing base/motion   */
/* ─────────────────────────────────────────────────────────── */

/* ── 1. Gradient Text Shimmer Sweep ──────────────────────────
   A pure text-clipped light sweep that glints through the actual
   letter glyphs when triggered on scroll. No rectangular pseudo-
   element bleed.
   ─────────────────────────────────────────────────────────── */
.shimmer-text {
  background-size: 250% 100% !important;
  background-clip: text !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  will-change: background-position;
}

.shimmer-text.shimmer-active {
  background-image: linear-gradient(
    115deg,
    var(--color-primary, #6366f1) 0%,
    var(--color-secondary, #8b5cf6) 28%,
    #ffffff 50%,
    var(--color-primary, #6366f1) 72%,
    var(--color-secondary, #8b5cf6) 100%
  ) !important;
  animation: text-glint-sweep 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.15s 1 forwards;
}

@keyframes text-glint-sweep {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* ── 2. Chapter Label Typography ─────────────────────────────
   Tabular numbers and monospace feel during scramble decode
   prevents layout jitter and gives a high-tech terminal vibe.
   ─────────────────────────────────────────────────────────── */
.chapter-label {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

.chapter-label.scrambling {
  letter-spacing: 0.22em;
  color: rgba(99, 102, 241, 0.85);
  text-shadow: 0 0 10px rgba(99, 102, 241, 0.35);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

/* ── 3. Hero Outline Kinetic Letter Character Morph ───────────
   Zero glow. Clean architectural wireframe stroke that morphs
   into solid white on hover with mechanical spring physics.
   ─────────────────────────────────────────────────────────── */
.title-clip {
  /* Retain clip during initial reveal; release on hover or once revealed */
  overflow: hidden;
}

.title-clip.clip-revealed,
.title-clip:hover,
.title-clip:focus-within {
  overflow: visible !important;
}

.title-word--outline {
  text-shadow: none !important;
  overflow: visible !important;
}

.title-word--outline .char-span {
  display: inline-block;
  position: relative;
  will-change: transform, color, -webkit-text-fill-color, -webkit-text-stroke-color;
  text-shadow: none !important;
  cursor: pointer;
  transform-origin: 50% 85%;
  transition: color 0.18s ease, -webkit-text-fill-color 0.18s ease, -webkit-text-stroke-color 0.18s ease;
}

.title-word--outline .char-span:hover {
  z-index: 10;
}

/* ── Prevent Accidental Mobile Touch Selection & Context Popups ── */
.hero-title,
.title-clip,
.title-word,
.title-word--outline,
.title-word--outline .char-span,
.hero-role-badge,
.hero-cta-group,
.btn-hero-primary,
.btn-hero-secondary {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

.title-word--outline .char-span.space {
  display: inline-block;
  width: 0.28em;
  cursor: default;
}

/* ── 4. Apple-Style Scroll-Driven Reading Scrub ───────────────
   Paragraph words smoothly illuminate from muted slate to radiant
   white as the user scrolls through the narrative flow.
   ─────────────────────────────────────────────────────────── */
.reading-scrub {
  display: block;
}

.scrub-word {
  display: inline-block;
  opacity: 0.22;
  color: #94a3b8;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              text-shadow 0.32s ease;
  will-change: opacity, color;
}

.scrub-word.active {
  opacity: 1;
  color: #ffffff;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.22);
}

/* ── 5. Interactive Magnetic Spotlight on Outlined Headings ───
   Follows cursor coordinates and fills outlined text glyphs
   with an ethereal luminous beam.
   ─────────────────────────────────────────────────────────── */
.spotlight-outline-text {
  position: relative;
  cursor: default;
  transition: filter 0.4s ease;
  will-change: background-image, filter;
}

.spotlight-outline-text.has-spotlight {
  background-image: radial-gradient(
    circle 130px at var(--spotlight-x, -999px) var(--spotlight-y, -999px),
    rgba(255, 255, 255, 0.98) 0%,
    rgba(99, 102, 241, 0.85) 35%,
    rgba(139, 92, 246, 0.35) 65%,
    transparent 100%
  ) !important;
  background-clip: text !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  filter: drop-shadow(0 0 16px rgba(99, 102, 241, 0.4));
}

/* ── 6. Magnetic Rolling Character Hover (Buttons & Badges) ────
   Dual-layer translateY stagger roll for premium tactile feedback.
   ─────────────────────────────────────────────────────────── */
.roll-track {
  position: relative;
  display: inline-flex;
  overflow: hidden;
  line-height: 1.2;
  vertical-align: middle;
}

.roll-primary,
.roll-secondary {
  display: inline-flex;
  white-space: pre;
}

.roll-secondary {
  position: absolute;
  top: 100%;
  left: 0;
  color: inherit;
}

.roll-char {
  display: inline-block;
  transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transition-delay: calc(var(--char-idx, 0) * 16ms);
  will-change: transform;
}

/* Roll on hover of button / anchor / parent card */
:is(a, button, .group, .group\/cert, .group\/btn):hover .roll-primary .roll-char {
  transform: translateY(-100%);
}

:is(a, button, .group, .group\/cert, .group\/btn):hover .roll-secondary .roll-char {
  transform: translateY(-100%);
}

/* ── 7. Modern Silky Navigation Overlay & Link Hover ──────────
   Layered architectural reveal, sibling focus dimming, and
   fluid magnetic slide physics.
   ─────────────────────────────────────────────────────────── */
.nav-overlay {
  background: radial-gradient(
    ellipse at 78% 45%,
    rgba(99, 102, 241, 0.12) 0%,
    rgba(15, 12, 28, 0.88) 45%,
    rgba(3, 3, 3, 0.96) 85%
  ) !important;
  will-change: opacity, backdrop-filter;
}

.nav-links {
  perspective: 1200px;
}

.nav-link-mask {
  perspective: 800px;
}

.nav-link-item {
  position: relative;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity, filter;
}

/* Sibling Focus Mode: when hovering ANY link in the menu, dim and soften siblings */
.nav-links:hover .nav-link-item:not(:hover) {
  opacity: 0.22 !important;
  filter: blur(1.5px);
  transform: scale(0.975);
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 0.75rem;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.35s ease,
              text-shadow 0.45s ease;
  will-change: transform, text-shadow, color;
  text-decoration: none;
  cursor: pointer;
}

.nav-link:hover {
  color: #ffffff !important;
  transform: translateX(-18px);
  text-shadow: 0 0 28px rgba(99, 102, 241, 0.55),
               0 0 60px rgba(139, 92, 246, 0.3);
}

@media (max-width: 768px) {
  .nav-link:hover {
    transform: translateX(14px);
  }
}

.nav-link-num {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.38em;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.35);
  transition: color 0.35s ease, transform 0.35s ease, opacity 0.35s ease;
  user-select: none;
  font-weight: 500;
}

.nav-link:hover .nav-link-num {
  color: #818cf8;
  opacity: 1;
  transform: translateY(-2px);
  text-shadow: 0 0 12px rgba(129, 140, 248, 0.6);
}

.nav-link-title {
  display: inline-block;
  transition: letter-spacing 0.35s ease, color 0.35s ease;
}

.nav-link:hover .nav-link-title {
  letter-spacing: -0.015em;
  color: #ffffff;
}

.nav-link-arrow {
  display: inline-block;
  font-size: 0.5em;
  color: #818cf8;
  opacity: 0;
  transform: translate(-12px, 3px) scale(0.6);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  margin-left: 0.25rem;
}

.nav-link:hover .nav-link-arrow {
  opacity: 1;
  transform: translate(0, 0) scale(1);
  text-shadow: 0 0 10px rgba(129, 140, 248, 0.7);
}

/* ── Hero Mobile Architectural Layout & Breathing Room ─────────
   Transforms the hero on mobile viewports so it feels airy,
   editorial, and gracefully distributed without awkward line-collisions
   or cramped vertical compression.
   ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-sequence {
    min-height: 100svh !important;
    height: auto !important;
  }

  .hero-sticky-container {
    min-height: 100svh !important;
    height: auto !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
  }

  .hero-layout {
    min-height: 100svh !important;
    height: auto !important;
    padding-top: clamp(80px, 12svh, 104px) !important;
    padding-bottom: clamp(76px, 12svh, 96px) !important;
    padding-left: 6vw !important;
    padding-right: 6vw !important;
    justify-content: center !important;
  }

  .hero-headline-block {
    width: 100% !important;
  }

  .hero-title .title-clip {
    line-height: 1.02 !important;
    margin-bottom: 0.12em !important;
    padding-bottom: 0.08em !important;
  }

  .hero-title .title-word {
    font-size: clamp(2.15rem, 9.8vw, 3.4rem) !important;
    letter-spacing: -0.025em !important;
    line-height: 1.02 !important;
    word-break: normal !important;
  }

  .title-word--outline {
    -webkit-text-stroke-width: 1.5px !important;
  }

  .hero-role-badge {
    margin-top: clamp(18px, 2.8vh, 26px) !important;
  }

  .hero-cta-group {
    margin-top: clamp(26px, 4vh, 38px) !important;
    width: 100% !important;
    max-width: 350px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.72rem !important;
  }

  .hero-cta-group .btn-hero-primary,
  .hero-cta-group .btn-hero-secondary {
    width: 100% !important;
    justify-content: center !important;
    padding: 0.8rem 1.6rem !important;
    font-size: 0.86rem !important;
  }
}

@media (max-width: 480px) {
  .hero-layout {
    padding-top: clamp(76px, 11svh, 92px) !important;
    padding-bottom: clamp(72px, 11svh, 90px) !important;
    padding-left: 6.5vw !important;
    padding-right: 6.5vw !important;
  }

  .hero-title .title-clip {
    line-height: 1.06 !important;
    margin-bottom: 0.15em !important;
    padding-bottom: 0.1em !important;
  }

  .hero-title .title-word {
    font-size: clamp(1.95rem, 10.5vw, 2.85rem) !important;
    letter-spacing: -0.02em !important;
    line-height: 1.06 !important;
  }

  .title-word--outline {
    -webkit-text-stroke-width: 1.25px !important;
  }

  .hero-role-badge {
    margin-top: 16px !important;
  }

  .hero-cta-group {
    margin-top: 22px !important;
    gap: 0.65rem !important;
  }

  .hero-cta-group .btn-hero-primary,
  .hero-cta-group .btn-hero-secondary {
    padding: 0.74rem 1.4rem !important;
    font-size: 0.82rem !important;
  }
}

/* ── 8. Reduced Motion Support ────────────────────────────────
   Completely disable animations when user requests reduced motion
   ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .shimmer-text.shimmer-active {
    animation: none !important;
  }
  .title-word--outline .char-span {
    transition: none !important;
    transform: none !important;
  }
  .scrub-word {
    opacity: 1 !important;
    color: inherit !important;
    transition: none !important;
  }
  .spotlight-outline-text.has-spotlight {
    background-image: none !important;
    filter: none !important;
  }
  .roll-char {
    transition: none !important;
    transform: none !important;
  }
  .nav-links:hover .nav-link-item:not(:hover) {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
  .nav-link,
  .nav-link:hover {
    transform: none !important;
    transition: none !important;
  }
  .nav-link-arrow {
    transition: none !important;
  }
}
