/* ============================================================
   TitaniaSoft — Custom CSS
   ONLY what Tailwind CSS cannot do: CSS variables, keyframes,
   animated gradients, glowing effects, custom cursor, preloader.
   Everything else → Tailwind utility classes in the HTML.
   ============================================================ */

/* ─── FONTS ─────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700;800&display=swap');

/* ─── CSS CUSTOM PROPERTIES ─────────────────────────────────── */
:root {
  /* Blue theme */
  --primary:       #3b82f6;
  --primary-light: #60a5fa;
  --primary-glow:  rgba(59, 130, 246, 0.3);
  --accent:        #38bdf8;
  --accent-glow:   rgba(56, 189, 248, 0.25);
  --cyan:          #22d3ee;
  --cyan-glow:     rgba(34, 211, 238, 0.2);
  --emerald:       #10b981;
  --rose:          #f43f5e;

  --bg:            #030712;
  --bg-2:          #0a0f1e;
  --surface:       #0f172a;
  --surface-2:     #1e293b;
  --border:        rgba(59, 130, 246, 0.15);
  --border-light:  rgba(255, 255, 255, 0.06);

  --text:          #e2e8f0;
  --text-muted:    #94a3b8;
  --text-faint:    #475569;

  --font-heading:  'Space Grotesk', sans-serif;
  --font-body:     'Inter', sans-serif;

  --grad-primary:  linear-gradient(135deg, #3b82f6, #38bdf8);
  --grad-hero:     radial-gradient(ellipse 80% 60% at 50% -20%, rgba(59,130,246,0.3) 0%, transparent 70%);
  --grad-mesh:
    radial-gradient(at 20% 30%, rgba(59, 130, 246, 0.12) 0px, transparent 50%),
    radial-gradient(at 80% 10%, rgba(56, 189, 248, 0.08) 0px, transparent 50%),
    radial-gradient(at 60% 80%, rgba(34, 211, 238, 0.06) 0px, transparent 50%);

  --ease:          cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);

  --radius-sm:     0.5rem;
  --radius:        0.75rem;
  --radius-lg:     1rem;
  --shadow-card:   0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow:   0 0 40px rgba(59,130,246,0.25);
}

/* ─── LIGHT MODE ────────────────────────────────────────────── */
[data-theme="light"] {
  --primary-glow:  rgba(59, 130, 246, 0.15);
  --accent-glow:   rgba(56, 189, 248, 0.15);
  --cyan-glow:     rgba(34, 211, 238, 0.1);

  --bg:            #f8fafc;
  --bg-2:          #f1f5f9;
  --surface:       #ffffff;
  --surface-2:     #e2e8f0;
  --border:        rgba(59, 130, 246, 0.18);
  --border-light:  rgba(0, 0, 0, 0.06);

  --text:          #0f172a;
  --text-muted:    #475569;
  --text-faint:    #94a3b8;

  --grad-hero:     radial-gradient(ellipse 80% 60% at 50% -20%, rgba(59,130,246,0.12) 0%, transparent 70%);
  --grad-mesh:
    radial-gradient(at 20% 30%, rgba(59, 130, 246, 0.06) 0px, transparent 50%),
    radial-gradient(at 80% 10%, rgba(56, 189, 248, 0.04) 0px, transparent 50%),
    radial-gradient(at 60% 80%, rgba(34, 211, 238, 0.03) 0px, transparent 50%);
}

/* ─── GOOGLE DARK MODE ──────────────────────────────────────── */
[data-theme="google"] {
  --primary-glow:  rgba(59, 130, 246, 0.1);
  --accent-glow:   rgba(56, 189, 248, 0.1);
  --cyan-glow:     rgba(34, 211, 238, 0.08);

  --bg:            #121212;
  --bg-2:          #1a1a1a;
  --surface:       #222222;
  --surface-2:     #2c2c2c;
  --border:        rgba(255, 255, 255, 0.1);
  --border-light:  rgba(255, 255, 255, 0.05);

  --text:          #f3f4f6;
  --text-muted:    #9ca3af;
  --text-faint:    #6b7280;

  --grad-hero:     radial-gradient(ellipse 80% 60% at 50% -20%, rgba(59,130,246,0.08) 0%, transparent 70%);
  --grad-mesh:     none;
}

/* ─── BASE RESET ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.75;
  overflow-x: hidden;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}
body.is-loading { overflow: hidden; }
html.lenis { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto; }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-heading); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ─── GRADIENT TEXT ──────────────────────────────────────────── */
.grad-text {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ─── PRELOADER ──────────────────────────────────────────────── */
#preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2rem;
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}
#preloader.hidden { opacity: 0; pointer-events: none; }
.preloader-logo { width: 72px; height: 72px; }
.preloader-bar-track { width: 180px; height: 2px; background: var(--border); border-radius: 9999px; overflow: hidden; }
.preloader-bar {
  height: 100%; width: 0%; background: var(--grad-primary); border-radius: 9999px;
  animation: preload-progress 1.4s var(--ease) forwards;
}
@keyframes preload-progress { 0%{width:0%} 40%{width:65%} 70%{width:85%} 90%{width:95%} 100%{width:100%} }
.preloader-text {
  font-family: var(--font-heading); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.28em; text-transform: uppercase; color: var(--text-muted);
  animation: pulse-text 1.4s ease infinite;
}
@keyframes pulse-text { 0%,100%{opacity:0.35} 50%{opacity:1} }

/* ─── CUSTOM CURSOR (REMOVED) ──────────────────────────────────────────── */

/* ─── NAVBAR SCROLL STATE ────────────────────────────────────── */
#navbar.scrolled {
  background: rgba(3, 7, 18, 0.88);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 32px rgba(0,0,0,0.4);
}
[data-theme="light"] #navbar.scrolled {
  background: rgba(248, 250, 252, 0.92);
  box-shadow: 0 1px 24px rgba(0,0,0,0.08);
}

/* ─── THEME TOGGLE ───────────────────────────────────────────── */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ─── ANIMATED GRADIENT BORDER BUTTON ────────────────────────── */
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.btn-glow-border { position: relative; overflow: hidden; }
.btn-glow-border::before {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: conic-gradient(from var(--angle, 0deg), transparent 20%, var(--primary) 40%, var(--accent) 60%, transparent 80%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 0.3s;
}
.btn-glow-border:hover::before { opacity: 1; animation: spin-border 2.5s linear infinite; }
@keyframes spin-border { to { --angle: 360deg; } }

/* ─── CARD GLOW (mouse-tracking radial) ──────────────────────── */
.card-glow { position: relative; overflow: hidden; }
.card-glow::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), var(--primary-glow), transparent 60%);
  opacity: 0; transition: opacity 0.4s; pointer-events: none; z-index: 0;
}
.card-glow:hover::before { opacity: 1; }
.card-glow > * { position: relative; z-index: 1; }

/* ─── 3D CARD TILT ───────────────────────────────────────────── */
.card-3d {
  transform-style: preserve-3d;
  transform: perspective(1200px);
  transition: transform 0.15s ease-out;
}

/* ─── GLOW BORDER (Moving Border on cards) ───────────────────── */
.glow-border { position: relative; }
.glow-border::before {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: conic-gradient(from var(--angle, 0deg), transparent 10%, var(--primary) 30%, var(--accent) 50%, var(--cyan) 70%, transparent 90%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spin-border 4s linear infinite;
}

/* ─── INFINITE MARQUEE ───────────────────────────────────────── */
.marquee-wrap {
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 12%, black 88%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 12%, black 88%, transparent);
}
.marquee-track { display: flex; width: max-content; animation: marquee-scroll 32s linear infinite; }
.marquee-wrap.reverse .marquee-track { animation-direction: reverse; }
.marquee-track:hover { animation-play-state: paused; }
@keyframes marquee-scroll { from{transform:translateX(0)} to{transform:translateX(-50%)} }

/* ─── SPOTLIGHT (mouse-follow radial) ────────────────────────── */
.spotlight {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 30%), var(--primary-glow), transparent 40%);
  opacity: 0; transition: opacity 0.4s;
}
.has-spotlight:hover .spotlight, .has-spotlight.has-mouse .spotlight { opacity: 1; }

/* ─── HERO BACKGROUNDS ──────────────────────────────────────── */
.hero-bg  { position: absolute; inset: 0; background: var(--grad-hero); z-index: 0; pointer-events: none; }
.hero-mesh { position: absolute; inset: 0; background: var(--grad-mesh); z-index: 0; pointer-events: none; }
.hero-dots {
  position: absolute; inset: 0; z-index: 0; opacity: 0.35; pointer-events: none;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse 70% 80% at 50% 50%, black 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 50%, black 20%, transparent 80%);
}

/* ─── BACKGROUND BEAMS ──────────────────────────────────────── */
.bg-beams { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bg-beam { position: absolute; border-radius: 50%; filter: blur(80px); animation: beam-drift linear infinite; }
.bg-beam-1 { width: 600px; height: 400px; background: var(--primary-glow); top: -10%; left: -5%; animation-duration: 18s; }
.bg-beam-2 { width: 500px; height: 350px; background: var(--accent-glow); top: 20%; right: -10%; animation-duration: 22s; animation-delay: -8s; }
.bg-beam-3 { width: 400px; height: 300px; background: var(--cyan-glow); bottom: -5%; left: 30%; animation-duration: 26s; animation-delay: -14s; }
@keyframes beam-drift { 0%{transform:translate(0,0) scale(1)} 33%{transform:translate(3%,-2%) scale(1.05)} 66%{transform:translate(-2%,3%) scale(0.97)} 100%{transform:translate(0,0) scale(1)} }

/* ─── ANIMATED FLOW LINES ────────────────────────────────────── */
.flow-line { stroke-dasharray: 6 4; animation: flow-pulse 1.2s linear infinite; }
@keyframes flow-pulse { 0%{stroke-dashoffset:0} 100%{stroke-dashoffset:-40} }
.agent-ping-ring { animation: agent-ping 1.8s ease-out infinite; }
@keyframes agent-ping { 0%{r:6;opacity:0.8} 100%{r:18;opacity:0} }

/* ─── WORD CYCLE (FlipWords) ─────────────────────────────────── */
.word-cycle-wrap { display: inline-flex; overflow: hidden; height: 1.25em; vertical-align: bottom; position: relative; }
.word-cycle-item { position: absolute; left: 0; top: 0; white-space: nowrap; transform: translateY(100%); opacity: 0; }
.word-cycle-item.active  { animation: word-up-in 0.5s var(--ease-spring) forwards; }
.word-cycle-item.leaving { animation: word-up-out 0.4s ease forwards; }
@keyframes word-up-in  { from{transform:translateY(100%);opacity:0} to{transform:translateY(0);opacity:1} }
@keyframes word-up-out { from{transform:translateY(0);opacity:1} to{transform:translateY(-110%);opacity:0} }

/* ─── HERO FLOATING PARTICLES ────────────────────────────────── */
@keyframes float-particle { 0%,100%{transform:translate(0,0)} 25%{transform:translate(10px,-15px)} 50%{transform:translate(-5px,-25px)} 75%{transform:translate(-12px,-10px)} }
.hero-particle {
  position: absolute; border-radius: 50%; background: var(--primary); pointer-events: none;
  animation: float-particle linear infinite;
}

/* ─── SCROLL REVEAL ──────────────────────────────────────────── */
/* Data-reveal animations are now handled via GSAP ScrollTrigger in main.js */

/* ─── SCROLL TO TOP ──────────────────────────────────────────── */
#scroll-top {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 50;
  width: 44px; height: 44px; background: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; transform: translateY(20px); transition: opacity 0.3s, transform 0.3s;
  border: none; color: white; box-shadow: 0 0 20px var(--primary-glow);
}
#scroll-top.visible { opacity: 1; transform: translateY(0); }
#scroll-top:hover { background: var(--accent); transform: translateY(-2px); }

/* ─── HERO TITLE REVEAL ──────────────────────────────────────── */
.hero-title-line { display: block; overflow: hidden; }
/* Removed `.hero-title-inner` rules — the HTML uses `#hero-title` directly. */

/* ─── HERO SCROLL HINT ───────────────────────────────────────── */
.scroll-line {
  width: 1px; height: 50px;
  background: linear-gradient(to bottom, var(--primary), transparent);
  animation: scroll-line-anim 1.5s ease infinite;
}
@keyframes scroll-line-anim {
  0%{transform:scaleY(0);transform-origin:top} 50%{transform:scaleY(1);transform-origin:top}
  51%{transform-origin:bottom} 100%{transform:scaleY(0);transform-origin:bottom}
}

/* ─── MOBILE NAV SLIDE ───────────────────────────────────────── */
.nav-mobile {
  position: fixed; inset: 0; z-index: 99; background: var(--bg-2);
  display: flex; flex-direction: column; padding: 6rem 2rem 2rem; gap: 0.25rem;
  transform: translateX(100%); transition: transform 0.4s var(--ease);
  overflow-y: auto;
}
.nav-mobile.open { transform: translateX(0); }

/* ─── TESTIMONIAL MARQUEE ITEM ───────────────────────────────── */
.testimonial-marquee-item {
  min-width: 380px; max-width: 380px; flex-shrink: 0;
}
@media (max-width: 480px) { .testimonial-marquee-item { min-width: 300px; max-width: 300px; } }

/* ─── PORTFOLIO THUMBNAIL BACKGROUNDS ───────────────────────── */
.proj-thumb {
  position: relative; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.proj-thumb-label {
  position: absolute; inset: 0;
  background: rgba(3, 7, 18, 0.78);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.375rem; opacity: 0; transition: opacity 0.3s var(--ease);
}
.group:hover .proj-thumb-label { opacity: 1; }

/* ─── FORM FOCUS RING ────────────────────────────────────────── */
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ─── TECH STACK PILLS ───────────────────────────────────────── */
.tech-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
}
.tech-pill:hover {
  color: var(--text);
  border-color: var(--primary);
  background: var(--primary-glow);
}

/* ─── FAQ ACCORDION ──────────────────────────────────────────── */
.faq-item .faq-answer { transition: max-height 0.3s ease, opacity 0.3s ease; }
.faq-item .faq-icon.rotate-180 { transform: rotate(180deg); }

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