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

/* --- CUSTOM PROPERTIES --- */
:root {
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Colors */
  --bg-primary: #050508;
  --bg-secondary: #0b0c10;
  --bg-tertiary: #12131c;
  
  --color-primary: #E63946;
  --color-primary-rgb: 230, 57, 70;
  --color-secondary: #cbd5e1;
  --color-secondary-rgb: 203, 213, 225;
  --color-accent: #64748b;
  --color-accent-rgb: 100, 116, 139;
  
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Gradients */
  --grad-primary: linear-gradient(135deg, #e50914 0%, #99060d 100%);
  --grad-accent: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  --grad-dark: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  --grad-glow: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(var(--color-primary-rgb), 0.15) 0%, rgba(var(--color-secondary-rgb), 0.03) 30%, transparent 60%);

  /* Border and Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --border-light: rgba(255, 255, 255, 0.05);
  --border-glow: rgba(var(--color-primary-rgb), 0.3);

  /* Unified Cubic Beziers (Premium physical easing curves) */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);       /* apple-like fluid decel */
  --ease-out-spring: cubic-bezier(0.34, 1.56, 0.64, 1);  /* spring overshoot bounce */
  --ease-out-back: cubic-bezier(0.175, 0.885, 0.32, 1.1); /* subtle overshoot */
  --ease-in-out-cubic: cubic-bezier(0.65, 0, 0.35, 1);  /* balanced transition */

  /* Transitions */
  --trans-spring: 0.5s var(--ease-out-spring);
  --trans-spring-subtle: 0.35s var(--ease-out-back);
  --trans-fast: 0.2s var(--ease-out-expo);
  --trans-normal: 0.4s var(--ease-out-expo);
  --trans-slow: 0.75s var(--ease-out-expo);
}

/* --- LIGHT MODE VARIABLES & STYLE OVERRIDES --- */
body.light-mode {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  
  --color-primary: #0096C7;            /* premium Pacific Cyan */
  --color-primary-rgb: 0, 150, 199;
  
  --color-secondary: #475569;
  --color-secondary-rgb: 71, 85, 105;
  --color-accent: #94a3b8;
  --color-accent-rgb: 148, 163, 184;
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #627185;
  
  /* Gradients */
  --grad-primary: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);  /* premium cyan gradient */
  
  --border-light: rgba(15, 23, 42, 0.08);
  --border-glow: rgba(var(--color-primary-rgb), 0.25);
  
  --grad-glow: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(var(--color-primary-rgb), 0.07) 0%, rgba(var(--color-secondary-rgb), 0.01) 40%, transparent 75%);
}

body.light-mode .glass-card {
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.05);
}

body.light-mode .glass-card::before {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.05) 0%, rgba(15, 23, 42, 0.01) 100%);
}

body.light-mode .custom-cursor {
  mix-blend-mode: normal;
  border-color: var(--color-primary);
}

body.light-mode .custom-cursor.hovered {
  background-color: rgba(var(--color-primary-rgb), 0.08);
  border-color: var(--color-primary);
}

body.light-mode .custom-cursor-dot {
  background-color: var(--color-primary);
}

body.light-mode .bg-grid-mesh {
  background-image: 
    linear-gradient(rgba(15, 23, 42, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
}

body.light-mode .bg-glow-orb {
  background: radial-gradient(circle, rgba(230, 57, 70, 0.02) 0%, transparent 70%);
}

/* --- RESET & BASE --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) var(--bg-primary);
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-secondary);
  border: 2px solid var(--bg-primary);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

h1 {
  letter-spacing: -0.035em;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--trans-fast);
}

/* --- REVEAL ON SCROLL --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--trans-slow), transform var(--trans-slow);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* --- UTILITY CLASSES --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.section {
  padding: clamp(4rem, 8vw, 8rem) 0;
  position: relative;
  overflow: hidden;
}

.section-header {
  text-align: center;
  margin-bottom: clamp(3rem, 6vw, 5rem);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.section-subtitle {
  color: var(--color-secondary);
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: block;
}

.section-title {
  font-size: clamp(2rem, 5vw, 2.5rem);
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Glassmorphic Card */
.glass-card {
  position: relative;
  background: rgba(18, 19, 28, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-md);
  padding: 2.5rem;
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: var(--trans-normal), border-color var(--trans-fast), box-shadow var(--trans-fast);
  transform-style: preserve-3d;
  will-change: transform;
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  padding: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.01) 100%);
  -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;
  pointer-events: none;
  transition: var(--trans-normal);
}

@media (hover: hover) {
  .glass-card:hover {
    border-color: rgba(var(--color-primary-rgb), 0.35);
    box-shadow: 0 15px 35px -15px rgba(var(--color-primary-rgb), 0.3);
  }

  .glass-card:hover::before {
    background: var(--grad-primary);
  }
}

/* Interactive Spotlight Glow Effect on Cards */
.spotlight-card {
  position: relative;
}

.spotlight-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-md);
  background: var(--grad-glow);
  opacity: 0;
  transition: opacity var(--trans-normal);
  pointer-events: none;
  z-index: 1;
}

.spotlight-card:hover::after {
  opacity: 1;
}

.spotlight-card > * {
  position: relative;
  z-index: 2;
  transform: translateZ(20px);
}

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.85rem 2rem;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--trans-normal);
  border: none;
}

.btn-primary {
  background: var(--grad-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(var(--color-primary-rgb), 0.3);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  pointer-events: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

@media (hover: hover) {
  .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(var(--color-primary-rgb), 0.5);
    transform: translateY(-2px);
  }
  
  .btn-primary:hover::after {
    left: 100%;
    transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-secondary);
    transform: translateY(-2px);
  }
}

/* --- SCROLL PROGRESS --- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--grad-primary);
  z-index: 99999;
  box-shadow: 0 0 8px rgba(var(--color-primary-rgb), 0.5);
  pointer-events: none;
  transition: width 0.25s var(--ease-out-expo);
}

/* --- CUSTOM CURSOR --- */
.custom-cursor {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--color-primary);
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  transform: translate3d(-50%, -50%, 0);
  pointer-events: none;
  z-index: 10000;
  mix-blend-mode: difference;
  will-change: transform, width, height, border-color, background-color;
  transition: 
    width 0.35s var(--ease-out-spring), 
    height 0.35s var(--ease-out-spring), 
    border-radius 0.35s var(--ease-out-spring),
    border-color 0.35s var(--ease-out-expo), 
    background-color 0.35s var(--ease-out-expo),
    opacity 0.3s var(--ease-out-expo);
}

.custom-cursor-dot {
  width: 6px;
  height: 6px;
  background-color: var(--color-secondary);
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  transform: translate3d(-50%, -50%, 0);
  pointer-events: none;
  z-index: 10000;
  will-change: transform;
}

.custom-cursor.hovered {
  width: 45px;
  height: 45px;
  background-color: rgba(var(--color-primary-rgb), 0.15);
  border-color: var(--color-accent);
}

.custom-cursor.snapped {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  background-color: rgba(var(--color-secondary-rgb), 0.1);
  border-color: var(--color-secondary);
  border-width: 2px;
}

/* Background Grids */
.bg-grid-mesh {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at 50% 50%, black 50%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, black 50%, transparent 90%);
  pointer-events: none;
}

.bg-glow-orb {
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.015) 0%, transparent 70%);
  border-radius: var(--radius-full);
  filter: blur(80px);
  pointer-events: none;
  animation: float-glow 22s ease-in-out infinite alternate;
}

@keyframes float-glow {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -60px) scale(1.12); }
  100% { transform: translate(0, 0) scale(1); }
}

/* --- DECORATIVE WATERMARKS --- */
.bg-text-watermark {
  position: absolute;
  font-family: var(--font-heading);
  font-size: clamp(6rem, 15vw, 12rem);
  font-weight: 850;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.015);
  text-stroke: 1px rgba(255, 255, 255, 0.015);
  pointer-events: none;
  user-select: none;
  z-index: 0;
  white-space: nowrap;
  letter-spacing: -0.03em;
}

/* --- MEDIA QUERIES --- */
@media (max-width: 1200px) {
  .nav-menu {
    gap: 1.25rem;
  }
}

@media (max-width: 1024px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .container {
    padding: 0 1.25rem; /* slightly tighter margin for compact phones */
  }
  .section {
    padding: 3.5rem 0;
  }
  .glass-card {
    padding: 1.5rem;
  }
  .custom-cursor, .custom-cursor-dot {
    display: none; /* Hide on mobile touch devices */
  }
}

/* --- SMOOTH THEME TRANSITION SYSTEM --- */
body,
header,
footer,
.timeline-content-inner,
.project-card,
.project-browser-header,
.filter-btn,
.contact-detail-card,
.hero-floating-badge,
.tab-btn,
.social-circle,
.scroll-top-btn,
.logo,
.nav-link {
  transition: 
    background-color 0.5s var(--ease-out-expo), 
    color 0.5s var(--ease-out-expo), 
    border-color 0.5s var(--ease-out-expo), 
    box-shadow 0.5s var(--ease-out-expo), 
    text-stroke 0.5s var(--ease-out-expo),
    -webkit-text-stroke 0.5s var(--ease-out-expo);
}
