@tailwind base;
@tailwind components;
@tailwind utilities;

/* ========== CSS VARIABLES / DESIGN TOKENS ========== */
:root {
  /* Colors - Light Mode */
  --background: #fafafa;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --card-foreground: #0a0a0a;
  --muted: #f0f0f0;
  --muted-foreground: #6b6b6b;
  --border: #e5e5e5;
  --ring: #0a0a0a;

  /* Accent - Enterprise Blue-Violet */
  --accent: #6366f1;
  --accent-foreground: #ffffff;
  --accent-glow: rgba(99, 102, 241, 0.15);

  /* Status */
  --success: #22c55e;
  --error: #ef4444;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(168,85,247,0.08) 100%);
  --gradient-text: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 40px rgba(99,102,241,0.15);

  /* Glassmorphism */
  --glass-bg: rgba(255,255,255,0.6);
  --glass-border: rgba(255,255,255,0.3);
  --glass-blur: 16px;

  /* Section padding */
  --section-py: 6rem;
}

.dark {
  --background: #09090b;
  --foreground: #fafafa;
  --card: #18181b;
  --card-foreground: #fafafa;
  --muted: #27272a;
  --muted-foreground: #a1a1aa;
  --border: #27272a;
  --ring: #fafafa;

  --accent-glow: rgba(99, 102, 241, 0.25);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 60px rgba(99,102,241,0.2);

  --glass-bg: rgba(24,24,27,0.6);
  --glass-border: rgba(255,255,255,0.08);

  --gradient-subtle: linear-gradient(135deg, rgba(99,102,241,0.12) 0%, rgba(168,85,247,0.12) 100%);
}

/* ========== BASE STYLES ========== */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--muted-foreground) transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-geist-sans), ui-sans-serif, system-ui, sans-serif;
  overflow-x: hidden;
}

::selection {
  background: var(--accent);
  color: var(--accent-foreground);
}

/* ========== UTILITY CLASSES ========== */
.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

.gradient-border {
  position: relative;
}
.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: var(--gradient-primary);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  pointer-events: none;
}

.section-padding {
  padding-top: var(--section-py);
  padding-bottom: var(--section-py);
}

/* Noise texture overlay for premium feel */
.noise::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* Grid pattern background */
.grid-pattern {
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* Animated gradient orbs */
@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33% { transform: translateY(-20px) rotate(5deg); }
  66% { transform: translateY(10px) rotate(-3deg); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

.animate-float {
  animation: float 8s ease-in-out infinite;
}

.animate-pulse-glow {
  animation: pulse-glow 4s ease-in-out infinite;
}

/* Timeline connector line */
.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--accent), transparent);
  transform: translateX(-50%);
}

@media (max-width: 768px) {
  .timeline-line {
    left: 1.5rem;
  }
  :root {
    --section-py: 4rem;
  }
}

/* ========== #14 SMOOTH THEME TRANSITION ========== */
body,
body * {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.15s ease, box-shadow 0.3s ease;
}
/* Exclude animated elements from theme transition to avoid conflicts */
[data-framer-motion], .animate-spin, .animate-pulse {
  transition: none !important;
}

/* ========== #11 BADGE SHIMMER ========== */
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.badge-shimmer {
  background-size: 200% auto;
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(99, 102, 241, 0.08) 40%,
    rgba(99, 102, 241, 0.15) 50%,
    rgba(99, 102, 241, 0.08) 60%,
    transparent 100%
  );
  animation: shimmer 3s linear infinite;
}

/* ========== #13 SCROLL INDICATOR GLOW ========== */
@keyframes ring-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.3); }
  50% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
}
.scroll-indicator-ring {
  animation: ring-pulse 2s ease-in-out infinite;
}

/* ========== #10 SECTION WAVE DIVIDER ========== */
.section-divider {
  position: relative;
  margin-top: -1px;
}
.section-divider svg {
  display: block;
  width: 100%;
  height: 48px;
}
@media (min-width: 768px) {
  .section-divider svg {
    height: 72px;
  }
}

/* ========== #7 PROJECT CARD TILT ========== */
.project-card {
  transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}
.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.08), 0 8px 16px rgba(0,0,0,0.06);
}
