/* ============================================================
   Nexion — Effects: gradients, orbs, grid, reveal, marquee,
   typing caret, cursor glow, theme transition, reduced motion
   ============================================================ */

/* ---- Gradient text ---- */
.gradient-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---- Ambient glow orbs ----
   radial-gradient falloff instead of filter:blur — visually the
   same soft blob, dramatically cheaper to composite. */
.orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  z-index: 0;
}

.orb-1 {
  width: 620px;
  height: 620px;
  top: -180px;
  left: -160px;
  background: radial-gradient(circle, var(--glow) 0%, transparent 65%);
  animation: orb-drift-a 70s ease-in-out infinite alternate;
}

.orb-2 {
  width: 540px;
  height: 540px;
  bottom: -200px;
  right: -140px;
  background: radial-gradient(circle, var(--glow-2) 0%, transparent 65%);
  animation: orb-drift-b 85s ease-in-out infinite alternate;
}

.orb-3 {
  width: 420px;
  height: 420px;
  top: 30%;
  right: 12%;
  background: radial-gradient(circle, var(--glow-3) 0%, transparent 65%);
  animation: orb-drift-a 95s ease-in-out infinite alternate-reverse;
}

@keyframes orb-drift-a {
  from {
    transform: translate(0, 0) scale(1);
  }

  to {
    transform: translate(80px, 60px) scale(1.15);
  }
}

@keyframes orb-drift-b {
  from {
    transform: translate(0, 0) scale(1.1);
  }

  to {
    transform: translate(-70px, -50px) scale(0.95);
  }
}

/* ---- Blueprint grid texture ---- */
.grid-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 25%, transparent 78%);
}

/* ---- Scroll reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

.reveal.left {
  transform: translateX(-36px);
}

.reveal.right {
  transform: translateX(36px);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

/* ---- Marquee (pure CSS, duplicated track) ---- */
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent);
}

.marquee-track {
  display: flex;
  gap: 0.9rem;
  width: max-content;
  padding-block: 0.45rem;
  animation: marquee-scroll 36s linear infinite;
}

.marquee.reverse .marquee-track {
  animation-direction: reverse;
}

.marquee:hover .marquee-track {
  animation-play-state: paused;
}

@keyframes marquee-scroll {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

/* ---- Typing caret ---- */
.type-caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 3px;
  vertical-align: text-bottom;
  background: var(--accent-bright);
  animation: caret-blink 1s steps(1) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

/* ---- Cursor glow (desktop ambience, JS-driven) ---- */
.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 520px;
  height: 520px;
  margin: -260px 0 0 -260px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(circle, var(--glow) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.6s;
  will-change: transform;
}

.cursor-glow.on {
  opacity: 0.35;
}

@media (pointer: coarse) {
  .cursor-glow {
    display: none;
  }
}

/* ---- Smooth theme switch (applied briefly by JS) ---- */
html.theme-anim body,
html.theme-anim body * {
  transition: background-color 0.3s, color 0.3s, border-color 0.3s !important;
}

/* ---- Glowing timeline (About) ---- */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2), var(--accent-3));
  box-shadow: 0 0 12px var(--glow);
}

.timeline-item {
  position: relative;
  padding-bottom: 2.5rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -2rem;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  box-shadow: 0 0 14px var(--glow);
}

.timeline-year {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--accent-bright);
  letter-spacing: 0.08em;
}

.timeline-item h3 {
  margin: 0.3rem 0 0.4rem;
}

.timeline-item p {
  color: var(--text-muted);
  font-size: var(--fs-small);
  max-width: 560px;
}

/* ---- Reduced motion: belt-and-suspenders on top of JS gates ---- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .orb,
  .badge::before,
  .marquee-track,
  .type-caret {
    animation: none !important;
  }

  .marquee {
    -webkit-mask-image: none;
    mask-image: none;
  }

  .marquee-track {
    flex-wrap: wrap;
    width: 100%;
    justify-content: center;
  }

  /* hide the duplicated aria-hidden copy when the track wraps statically */
  .marquee-track [aria-hidden="true"] {
    display: none;
  }

  .cursor-glow {
    display: none !important;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
