/* ==========================================
   MODERN PORTFOLIO & BLOG - CSS
   Clean, responsive design with modern aesthetics
   ========================================== */

/* ==================== CSS VARIABLES ==================== */
:root {
  /* Colors - Teal & Blue Palette (Matching Old Blog) */
  --primary-color: #55d6aa;
  --primary-dark: #3db896;
  --primary-light: #6ee0b8;
  --secondary-color: #57ad68;
  --accent-color: #14b8a6;
  
  /* Backgrounds */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #e8f5f1;
  --bg-dark: #263238;
  --bg-card: #ffffff;
  
  /* Text Colors */
  --text-primary: #263238;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-light: #ffffff;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #55d6aa 0%, #57ad68 100%);
  --gradient-secondary: linear-gradient(135deg, #14b8a6 0%, #55d6aa 100%);
  --gradient-hero: linear-gradient(135deg, rgba(85, 214, 170, 0.1) 0%, rgba(87, 173, 104, 0.1) 100%);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;
  --spacing-3xl: 6rem;
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
  
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --bg-primary: #1a1f2e;
  --bg-secondary: #263238;
  --bg-tertiary: #2d3e47;
  --bg-card: #263238;
  --bg-dark: #0f1419;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  
  /* Teal colors stay vibrant in dark mode */
  --primary-color: #55d6aa;
  --primary-dark: #3db896;
  --primary-light: #6ee0b8;
}

/* Auto dark mode (respects system preference if no manual selection) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #1a1f2e;
    --bg-secondary: #263238;
    --bg-tertiary: #2d3e47;
    --bg-card: #263238;
    --bg-dark: #0f1419;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
h4 { font-size: 1.25rem; }

p {
  margin-bottom: var(--spacing-md);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==================== NAVIGATION ==================== */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

[data-theme="dark"] .site-nav {
  background: rgba(26, 31, 46, 0.95);
}

.site-nav.scrolled {
  box-shadow: var(--shadow-md);
  background: rgba(255, 255, 255, 0.98);
}

[data-theme="dark"] .site-nav.scrolled {
  background: rgba(26, 31, 46, 0.98);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--spacing-sm) var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-heading);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: var(--spacing-lg);
  align-items: center;
}

.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition-base);
  position: relative;
}

.nav-links a:hover {
  color: var(--primary-color);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width var(--transition-base);
}

.nav-links a:hover::after {
  width: 100%;
}

.btn-old-version {
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  color: var(--text-primary) !important;
  transition: all var(--transition-base);
}

.btn-old-version:hover {
  background: var(--primary-color);
  color: white !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-old-version::after {
  display: none;
}

/* Theme Toggle Button */
.theme-toggle {
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-left: var(--spacing-md);
}

.theme-toggle:hover {
  background: var(--primary-color);
  color: white;
  transform: scale(1.1) rotate(15deg);
  box-shadow: var(--shadow-md);
}

.theme-toggle i {
  transition: transform var(--transition-base);
}

.theme-toggle:hover i {
  transform: rotate(180deg);
}

/* Hide/show theme icons based on current theme */
[data-theme="light"] .theme-toggle .fa-sun,
[data-theme="dark"] .theme-toggle .fa-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .fa-moon,
[data-theme="dark"] .theme-toggle .fa-sun {
  display: block;
}

/* Default state (no theme set) - show moon icon */
:root:not([data-theme]) .theme-toggle .fa-sun {
  display: none;
}

:root:not([data-theme]) .theme-toggle .fa-moon {
  display: block;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-primary);
  cursor: pointer;
}

/* ==================== HERO SECTION ==================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: var(--spacing-2xl) var(--spacing-lg);
  background: var(--gradient-hero);
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 800px;
  animation: fadeInUp 1s ease;
}

.hero-image {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  margin: 0 auto var(--spacing-lg);
  object-fit: cover;
  border: 4px solid white;
  box-shadow: var(--shadow-xl);
  animation: float 3s ease-in-out infinite;
}

.hero h1 {
  margin-bottom: var(--spacing-sm);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 1.5rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}

.description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--spacing-xl);
  line-height: 1.8;
}

.hero-cta {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  margin-bottom: var(--spacing-xl);
  flex-wrap: wrap;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  cursor: pointer;
  border: none;
  font-size: 1rem;
  font-family: var(--font-primary);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.btn-outline {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

/* ==================== SOCIAL LINKS ==================== */
.social-links {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
}

.social-link {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1.25rem;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

.social-link:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  background: var(--gradient-primary);
  color: white;
}

/* ==================== SECTIONS ==================== */
.section {
  padding: var(--spacing-3xl) var(--spacing-lg);
  max-width: 1400px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.section-title {
  margin-bottom: var(--spacing-md);
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
}

.section-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ==================== PROJECTS GRID ==================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--spacing-xl);
  margin-top: var(--spacing-2xl);
}

.project-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-2xl);
}

.project-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--gradient-primary);
}

.project-content {
  padding: var(--spacing-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-title {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-sm);
}

.project-description {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-md);
}

.project-tag {
  padding: 0.25rem 0.75rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
}

.project-links {
  display: flex;
  gap: var(--spacing-md);
  margin-top: auto;
}

.project-link {
  flex: 1;
  text-align: center;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all var(--transition-base);
}

.project-link:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

/* ==================== FOOTER ==================== */
.site-footer {
  background: var(--bg-dark);
  color: var(--text-light);
  padding: var(--spacing-xl) var(--spacing-lg);
  text-align: center;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-light);
  opacity: 0.8;
  transition: opacity var(--transition-base);
}

.footer-links a:hover {
  opacity: 1;
}

.footer-copyright {
  opacity: 0.6;
  font-size: 0.875rem;
}

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

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-xl);
    transform: translateX(100%);
    transition: transform var(--transition-base);
  }
  
  [data-theme="dark"] .nav-links {
    background: var(--bg-card);
  }
  
  .nav-links.active {
    transform: translateX(0);
  }
  
  .theme-toggle {
    margin-left: 0;
    margin-top: var(--spacing-sm);
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .hero {
    padding-top: 100px;
  }
  
  .hero-cta {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .projects-grid {
    grid-template-columns: 1fr;
  }
  
  .section {
    padding: var(--spacing-2xl) var(--spacing-md);
  }
}

/* ==================== CONTAINER ==================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

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

/* ==================== PAGE LOADING ANIMATION ==================== */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  text-align: center;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.loader-text {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 1.1rem;
}

/* ==================== CURSOR TRAILER ==================== */
.cursor-trailer {
  position: fixed;
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99998;
  opacity: 0.5;
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease, width 0.2s ease, height 0.2s ease, opacity 0.2s ease;
  mix-blend-mode: difference;
}

.cursor-trailer.active {
  width: 40px;
  height: 40px;
  opacity: 0.3;
}

@media (max-width: 768px) {
  .cursor-trailer {
    display: none;
  }
}

/* ==================== ENHANCED PROJECT CARDS ==================== */
.project-card {
  position: relative;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.project-card:hover::before {
  transform: scaleX(1);
}

.project-image-container {
  position: relative;
  overflow: hidden;
}

.project-image-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.3) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-card:hover .project-image-container::after {
  opacity: 1;
}

.project-card:hover .project-image {
  transform: scale(1.05);
}

.project-image {
  transition: transform 0.5s ease;
}

/* ==================== SKILL BADGES ANIMATION ==================== */
.skill-tag {
  transition: all 0.3s ease;
  cursor: default;
}

.skill-tag:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px) scale(1.05);
}

/* ==================== GLASSMORPHISM EFFECTS ==================== */
.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ==================== FLOATING LABELS ==================== */
.floating-badge {
  position: fixed;
  bottom: 100px;
  right: 30px;
  background: var(--gradient-primary);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  animation: bounce 2s infinite;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.floating-badge:hover {
  transform: scale(1.05);
}

/* ==================== REVEAL ANIMATIONS ==================== */
.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-left.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-right.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-scale.active {
  opacity: 1;
  transform: scale(1);
}

/* ==================== TOOLTIPS ==================== */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-dark);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1000;
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  bottom: calc(100% + 10px);
}

/* ==================== SHIMMER LOADING ==================== */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 25%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmerEffect 1.5s infinite;
}

@keyframes shimmerEffect {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==================== NOTIFICATION TOAST ==================== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-dark);
  color: white;
  padding: 1rem 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 99999;
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  border-left: 4px solid var(--primary-color);
}

.toast.error {
  border-left: 4px solid #ef4444;
}

/* ==================== STAGGER ANIMATION ==================== */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
}

.stagger-children.active > *:nth-child(1) { animation: staggerIn 0.5s ease 0.1s forwards; }
.stagger-children.active > *:nth-child(2) { animation: staggerIn 0.5s ease 0.2s forwards; }
.stagger-children.active > *:nth-child(3) { animation: staggerIn 0.5s ease 0.3s forwards; }
.stagger-children.active > *:nth-child(4) { animation: staggerIn 0.5s ease 0.4s forwards; }
.stagger-children.active > *:nth-child(5) { animation: staggerIn 0.5s ease 0.5s forwards; }
.stagger-children.active > *:nth-child(6) { animation: staggerIn 0.5s ease 0.6s forwards; }
.stagger-children.active > *:nth-child(7) { animation: staggerIn 0.5s ease 0.7s forwards; }
.stagger-children.active > *:nth-child(8) { animation: staggerIn 0.5s ease 0.8s forwards; }

@keyframes staggerIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
