/* ============================================================
   ANIMATIONS — Keyframes, scroll-reveal, blob, transitions
   ============================================================ */

/* ── Keyframes ───────────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes blobDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -20px) scale(1.05); }
  66%       { transform: translate(-20px, 15px) scale(0.98); }
}

@keyframes blobDrift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(-25px, 20px) scale(0.97); }
  66%       { transform: translate(20px, -15px) scale(1.04); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Hero entrance (staggered, runs once on load) ────────── */
.hero__eyebrow {
  animation: fadeInDown 0.6s ease both;
  animation-delay: 0.1s;
}

.hero__headline {
  animation: fadeInUp 0.8s ease both;
  animation-delay: 0.2s;
}

.hero__sub {
  animation: fadeInUp 0.8s ease both;
  animation-delay: 0.35s;
}

.hero__ctas {
  animation: fadeInUp 0.8s ease both;
  animation-delay: 0.5s;
}

.hero__graphic {
  animation: fadeIn 1.2s ease both;
  animation-delay: 0.4s;
}

/* ── Decorative blobs (hero background) ──────────────────── */
.hero__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  pointer-events: none;
  will-change: transform;
}

.hero__blob--primary {
  width: 600px;
  height: 600px;
  background: var(--color-primary);
  top: -200px;
  right: -100px;
  animation: blobDrift 14s ease-in-out infinite;
}

.hero__blob--accent {
  width: 400px;
  height: 400px;
  background: var(--color-accent);
  bottom: -100px;
  left: -50px;
  animation: blobDrift2 18s ease-in-out infinite;
}

.hero__blob--mid {
  width: 300px;
  height: 300px;
  background: var(--color-primary);
  top: 50%;
  left: 40%;
  opacity: 0.06;
  animation: blobDrift 20s ease-in-out infinite;
  animation-delay: -8s;
}

/* Page-level subtle blobs */
.page-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.07;
  pointer-events: none;
}

.page-blob--1 {
  width: 400px;
  height: 400px;
  background: var(--color-primary);
  top: -100px;
  right: -100px;
}

/* ── Scroll-reveal ───────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.7s var(--transition-slow),
    transform 0.7s var(--transition-slow);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Delay variants */
.reveal--delay-1 { transition-delay: 0.1s; }
.reveal--delay-2 { transition-delay: 0.2s; }
.reveal--delay-3 { transition-delay: 0.3s; }
.reveal--delay-4 { transition-delay: 0.4s; }

/* Direction variants */
.reveal--right {
  transform: translateX(40px);
}
.reveal--right.is-visible {
  transform: translateX(0);
}

.reveal--left {
  transform: translateX(-40px);
}
.reveal--left.is-visible {
  transform: translateX(0);
}

/* ── Decorative geometric graphic (hero right column) ────── */
.hero-graphic {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin-inline: auto;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-graphic__ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid;
  animation: spin linear infinite;
}

.hero-graphic__ring--1 {
  width: 100%;
  height: 100%;
  border-color: rgba(57, 155, 225, 0.15);
  animation-duration: 40s;
}

.hero-graphic__ring--2 {
  width: 75%;
  height: 75%;
  border-color: rgba(0, 212, 255, 0.12);
  animation-duration: 25s;
  animation-direction: reverse;
}

.hero-graphic__ring--3 {
  width: 50%;
  height: 50%;
  border-color: rgba(57, 155, 225, 0.2);
  animation-duration: 15s;
}

.hero-graphic__dot {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
}

.hero-graphic__dot--lg {
  width: 120px;
  height: 120px;
  opacity: 0.15;
  filter: blur(20px);
}

.hero-graphic__dot--sm {
  width: 8px;
  height: 8px;
  top: 15%;
  left: 50%;
  box-shadow: 0 0 12px var(--color-primary);
}

.hero-graphic__dot--sm2 {
  width: 6px;
  height: 6px;
  bottom: 20%;
  right: 15%;
  background: var(--color-accent);
  box-shadow: 0 0 10px var(--color-accent);
}

.hero-graphic__center {
  position: relative;
  z-index: 1;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(57, 155, 225, 0.2), rgba(0, 212, 255, 0.15));
  border: 1px solid rgba(57, 155, 225, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  backdrop-filter: blur(8px);
}

/* ── Hover link underline effect ─────────────────────────── */
.link-underline {
  position: relative;
  display: inline-block;
}

.link-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.link-underline:hover::after {
  transform: scaleX(1);
}

/* ── Light mode — hero visibility boost ─────────────────── */
[data-theme="light"] .hero__blob     { opacity: 0.20; }
[data-theme="light"] .hero__blob--mid { opacity: 0.12; }
[data-theme="light"] .page-blob      { opacity: 0.06; }

/* Mesh grid background visible only in light mode */
[data-theme="light"] .hero {
  background-image:
    linear-gradient(rgba(57, 155, 225, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 155, 225, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* Aurora stronger in light mode */
[data-theme="light"] .hero__aurora::before {
  background: radial-gradient(ellipse at 30% 40%,
    rgba(57, 155, 225, 0.18) 0%,
    rgba(57, 155, 225, 0.06) 40%,
    transparent 70%);
}
[data-theme="light"] .hero__aurora::after {
  background: radial-gradient(ellipse at 70% 60%,
    rgba(0, 212, 255, 0.14) 0%,
    rgba(0, 212, 255, 0.05) 40%,
    transparent 70%);
}

/* Hero-graphic rings visible in light mode */
[data-theme="light"] .hero-graphic__ring--1 { border-color: rgba(57, 155, 225, 0.30); }
[data-theme="light"] .hero-graphic__ring--2 { border-color: rgba(0, 212, 255, 0.22); }
[data-theme="light"] .hero-graphic__ring--3 { border-color: rgba(57, 155, 225, 0.38); }

/* Geo-floats more visible in light mode */
[data-theme="light"] .geo-float--square  { border-color: rgba(57, 155, 225, 0.40); }
[data-theme="light"] .geo-float--diamond { border-color: rgba(0, 212, 255, 0.40); }
[data-theme="light"] .geo-float--ring    { border-color: rgba(57, 155, 225, 0.30); }

/* Smooth theme transition on bg/color (but not on layout) */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── Page transition (optional fade-in on load) ──────────── */
body {
  animation: fadeIn 0.4s ease both;
}

/* ── Gamified hero bolt ──────────────────────────────────── */
@keyframes boltGlow {
  0%, 100% {
    filter: drop-shadow(0 0 6px rgba(57, 155, 225, 0.7))
            drop-shadow(0 0 12px rgba(0, 212, 255, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 16px rgba(57, 155, 225, 1))
            drop-shadow(0 0 32px rgba(0, 212, 255, 0.8));
  }
}

@keyframes boltPulseRing {
  0%   { transform: scale(0.85); opacity: 0.7; }
  50%  { transform: scale(1.18); opacity: 0.2; }
  100% { transform: scale(0.85); opacity: 0.7; }
}

.hero-graphic__center { font-size: 0; display: flex; align-items: center; justify-content: center; }

.bolt-svg {
  position: relative;
  z-index: 2;
  animation: boltGlow 2.4s ease-in-out infinite;
}

.code-tag-icon {
  position: relative;
  z-index: 2;
  display: inline-block;
  font-size: 1.45rem;
  font-weight: 800;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: boltGlow 2.4s ease-in-out infinite;
  user-select: none;
}

.bolt-ring {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: var(--color-primary);
  border-right-color: var(--color-accent);
  animation: boltPulseRing 2.4s ease-in-out infinite;
}

.bolt-ring::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid rgba(57, 155, 225, 0.2);
  animation: boltPulseRing 2.4s ease-in-out infinite reverse;
  animation-delay: -1.2s;
}

/* ── Dot grid section texture ───────────────────────────── */
.section--dotgrid {
  position: relative;
}

.section--dotgrid::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(57, 155, 225, 0.18) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}

.section--dotgrid > .container {
  position: relative;
  z-index: 1;
}

[data-theme="light"] .section--dotgrid::before {
  background-image: radial-gradient(circle, rgba(57, 155, 225, 0.14) 1px, transparent 1px);
  opacity: 0.3;
}

/* ── Aurora/glow mesh (hero enrichment) ─────────────────── */
@keyframes auroraShift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(20px, -30px) scale(1.08); }
  66%       { transform: translate(-15px, 20px) scale(0.96); }
}

.hero__aurora {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.hero__aurora::before {
  content: '';
  position: absolute;
  top: -30%; left: -10%;
  width: 70%; height: 80%;
  background: radial-gradient(ellipse at 30% 40%,
    rgba(57, 155, 225, 0.08) 0%,
    rgba(57, 155, 225, 0.03) 40%,
    transparent 70%);
  filter: blur(40px);
  animation: auroraShift 16s ease-in-out infinite;
}

.hero__aurora::after {
  content: '';
  position: absolute;
  bottom: -20%; right: -5%;
  width: 60%; height: 70%;
  background: radial-gradient(ellipse at 70% 60%,
    rgba(0, 212, 255, 0.07) 0%,
    rgba(0, 212, 255, 0.02) 40%,
    transparent 70%);
  filter: blur(50px);
  animation: auroraShift 22s ease-in-out infinite reverse;
  animation-delay: -6s;
}

[data-theme="light"] .hero__aurora::before {
  background: radial-gradient(ellipse at 30% 40%, rgba(57, 155, 225, 0.04) 0%, transparent 60%);
}
[data-theme="light"] .hero__aurora::after {
  background: radial-gradient(ellipse at 70% 60%, rgba(0, 212, 255, 0.03) 0%, transparent 60%);
}

/* ── Noise/grain overlay ─────────────────────────────────── */
.noise-overlay {
  position: relative;
  isolation: isolate;
}

.noise-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
  opacity: 0.025;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
}

[data-theme="light"] .noise-overlay::after {
  opacity: 0.015;
  mix-blend-mode: multiply;
}

/* ── Geometric corner lines ──────────────────────────────── */
.corner-deco {
  position: relative;
}

.corner-deco::before,
.corner-deco::after {
  content: '';
  position: absolute;
  width: 32px;
  height: 32px;
  pointer-events: none;
  opacity: 0.4;
  z-index: 2;
}

.corner-deco::before {
  top: 16px; left: 16px;
  border-top: 1.5px solid var(--color-primary);
  border-left: 1.5px solid var(--color-primary);
  border-radius: 2px 0 0 0;
}

.corner-deco::after {
  bottom: 16px; right: 16px;
  border-bottom: 1.5px solid var(--color-accent);
  border-right: 1.5px solid var(--color-accent);
  border-radius: 0 0 2px 0;
}

[data-theme="light"] .corner-deco::before,
[data-theme="light"] .corner-deco::after { opacity: 0.25; }

/* ── Floating geometric shapes ───────────────────────────── */
@keyframes geoFloat {
  0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-140px) rotate(180deg); }
}

@keyframes geoFloatDiamond {
  0%   { opacity: 0; transform: translateY(0) rotate(45deg); }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-140px) rotate(225deg); }
}

.geo-float-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.geo-float {
  position: absolute;
  border: 1px solid;
  animation: geoFloat linear infinite;
}

.geo-float--square {
  width: 10px; height: 10px;
  border-color: rgba(57, 155, 225, 0.35);
  border-radius: 2px;
}

.geo-float--diamond {
  width: 9px; height: 9px;
  border-color: rgba(0, 212, 255, 0.35);
  animation-name: geoFloatDiamond;
}

.geo-float--ring {
  width: 14px; height: 14px;
  border-radius: 50%;
  border-color: rgba(57, 155, 225, 0.25);
}

.geo-float--a { top: 25%; left: 8%;  animation-duration: 14s; animation-delay: 0s; }
.geo-float--b { top: 55%; right: 9%; animation-duration: 18s; animation-delay: -5s; }
.geo-float--c { top: 72%; left: 18%; animation-duration: 22s; animation-delay: -9s; }

[data-theme="light"] .geo-float--square  { border-color: rgba(57, 155, 225, 0.2); }
[data-theme="light"] .geo-float--diamond { border-color: rgba(0, 212, 255, 0.2); }
[data-theme="light"] .geo-float--ring    { border-color: rgba(57, 155, 225, 0.15); }

/* ── Hero graphic 3D perspective ─────────────────────────── */
.hero-graphic__scene {
  perspective: 600px;
  perspective-origin: 50% 45%;
  width: 100%;
  max-width: 440px;
  margin-inline: auto;
}

.hero-graphic__scene .hero-graphic {
  transform: rotateX(14deg);
  transform-style: preserve-3d;
  max-width: none;
  margin-inline: 0;
}

/* ── Second page-blob variant ────────────────────────────── */
.page-blob--2 {
  width: 280px;
  height: 280px;
  background: var(--color-accent);
  bottom: -60px;
  left: -50px;
}

[data-theme="light"] .page-blob--2 { opacity: 0.03; }

/* ── Scanline tech overlay ───────────────────────────────── */
.scanlines {
  position: relative;
  overflow: hidden;
}

.scanlines::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.012) 3px,
    rgba(255, 255, 255, 0.012) 4px
  );
  pointer-events: none;
  z-index: 3;
  border-radius: inherit;
}

[data-theme="light"] .scanlines::after {
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.006) 3px,
    rgba(0, 0, 0, 0.006) 4px
  );
}

/* ── Particle canvas (hero background) ──────────────────── */
#heroCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

[data-theme="light"] #heroCanvas { opacity: 0.30; }

/* ── Typewriter cursor ───────────────────────────────────── */
.typewriter-cursor {
  display: inline-block;
  color: var(--color-primary);
  font-weight: 300;
  margin-left: 2px;
  animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Page intro overlay ──────────────────────────────────── */
#page-intro {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#page-intro.is-done {
  opacity: 0;
  visibility: hidden;
}

.page-intro__logo {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: introLogoIn 0.4s ease both;
}

@keyframes introLogoIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Logo strip (homepage tech marquee) ─────────────────── */
.logo-strip {
  width: 100%;
  overflow: hidden;
  padding-block: 1rem;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 10%, black 90%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, black 10%, black 90%, transparent 100%);
}

.logo-strip__track {
  display: flex;
  align-items: center;
  gap: 0;
  width: max-content;
  animation: tickerScroll 36s linear infinite;
  will-change: transform;
}

.logo-strip__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 1.4rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color var(--transition-fast);
  border-right: 1px solid var(--border-subtle);
}

.logo-strip__item img {
  opacity: 0.65;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.logo-strip:hover .logo-strip__track { animation-play-state: paused; }
.logo-strip__item:hover { color: var(--text-primary); }
.logo-strip__item:hover img { opacity: 1; }

@keyframes tickerScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

[data-theme="light"] .logo-strip__item { color: var(--text-secondary); }

/* ── Tech-item hover animation (services page) ───────────── */
.tech-item {
  transition: transform var(--transition-base), box-shadow var(--transition-base),
              border-color var(--transition-base);
}

.tech-item:hover {
  transform: translateY(-4px) scale(1.04);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(57, 155, 225, 0.2), 0 8px 20px rgba(57, 155, 225, 0.12);
}

.tech-item:hover .tech-item__logo {
  filter: drop-shadow(0 0 6px rgba(57, 155, 225, 0.5));
  transform: scale(1.1);
  transition: transform var(--transition-base), filter var(--transition-base);
}

/* ── Logo glitch effect ──────────────────────────────────── */
.logo-glitch-wrapper {
  position: relative;
  display: inline-block;
}

.logo-glitch-wrapper.is-glitching .logo-text {
  animation: glitchText 0.5s steps(2) both;
}

.logo-glitch-wrapper.is-glitching::before,
.logo-glitch-wrapper.is-glitching::after {
  content: 'Solvyx';
  position: absolute;
  top: 0; left: 0;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  pointer-events: none;
}

.logo-glitch-wrapper.is-glitching::before {
  animation: glitchBefore 0.5s steps(2) both;
  clip-path: polygon(0 20%, 100% 20%, 100% 40%, 0 40%);
}

.logo-glitch-wrapper.is-glitching::after {
  animation: glitchAfter 0.5s steps(2) both;
  clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%);
}

@keyframes glitchText {
  0%   { transform: translate(0); }
  20%  { transform: translate(-2px, 1px); filter: hue-rotate(30deg); }
  40%  { transform: translate(2px, -1px); }
  60%  { transform: translate(-1px, 2px); }
  80%  { transform: translate(1px, -2px); filter: hue-rotate(-20deg); }
  100% { transform: translate(0); filter: none; }
}

@keyframes glitchBefore {
  0%   { transform: translate(0); opacity: 1; }
  30%  { transform: translate(-3px, 0); opacity: 0.8; }
  60%  { transform: translate(3px, 0); opacity: 0; }
  100% { transform: translate(0); opacity: 0; }
}

@keyframes glitchAfter {
  0%   { transform: translate(0); opacity: 1; }
  30%  { transform: translate(3px, 0); opacity: 0.8; }
  60%  { transform: translate(-3px, 0); opacity: 0; }
  100% { transform: translate(0); opacity: 0; }
}

/* ── Reduce motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

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

  .geo-float { display: none; }
  #heroCanvas { display: none; }
  .logo-strip__track { animation: none; }
  .tech-item:hover { transform: none; }
  #page-intro { display: none; }
  .hero__aurora::before,
  .hero__aurora::after { animation: none; }
  .hero-graphic__scene .hero-graphic { transform: none; }
}
