/* ===================================
   VARIABLES & DESIGN SYSTEM
   =================================== */
:root {
  /* Colors - Premium Tech Palette */
  --color-primary: #0ea5e9;        /* Sky blue */
  --color-primary-light: #38bdf8;   /* Light sky */
  --color-primary-dark: #0284c7;    /* Dark blue */
  --color-secondary: #0284c7;       /* Secondary same as dark */
  --color-accent: #06b6d4;          /* Cyan accent */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  
  /* Dark Theme Colors */
  --color-bg-primary: #0f172a;
  --color-bg-secondary: #1e293b;
  --color-bg-tertiary: #334155;
  --color-surface: rgba(255, 255, 255, 0.05);
  --color-surface-hover: rgba(255, 255, 255, 0.08);
  
  /* Text Colors */
  --color-text-primary: #f8fafc;
  --color-text-secondary: #cbd5e1;
  --color-text-muted: #94a3b8;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --gradient-hero: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #312e81 100%);
  
  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;
  --spacing-3xl: 6rem;
  
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;
  
  /* 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.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.4);
  
  /* 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-in-out;
  --transition-base: 250ms ease-in-out;
  --transition-slow: 400ms ease-in-out;
  
  /* Layout */
  --container-max: 1200px;
  --header-height: 80px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-primary);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===================================
   TYPOGRAPHY
   =================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text-primary);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

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

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

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

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

section {
  padding: var(--spacing-3xl) 0;
  position: relative;
}

/* ===================================
   HEADER & NAVIGATION
   =================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  transition: all var(--transition-base);
}

.header.scrolled {
  background: rgba(15, 23, 42, 0.95);
  box-shadow: var(--shadow-lg);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.nav__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.nav__menu {
  display: flex;
  gap: var(--spacing-lg);
  list-style: none;
}

.nav__link {
  color: var(--color-text-secondary);
  font-weight: 500;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
}

.nav__link:hover {
  color: var(--color-text-primary);
  background: var(--color-surface);
}

.nav__link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
}

/* Language Toggle */
.nav__lang-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
}

.nav__lang-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Mobile Menu Toggle */
.nav__toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text-primary);
  font-size: var(--text-2xl);
  cursor: pointer;
}

/* ===================================
   HERO SECTION
   =================================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  background: var(--gradient-hero);
  position: relative;
  overflow: hidden;
  padding-top: var(--header-height);
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero__greeting {
  color: var(--color-accent);
  font-size: var(--text-lg);
  font-weight: 500;
  margin-bottom: var(--spacing-sm);
  animation: fadeInUp 0.6s ease-out;
}

.hero__title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  margin-bottom: var(--spacing-md);
  animation: fadeInUp 0.6s ease-out 0.1s backwards;
}

.hero__title-highlight {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__subtitle {
  font-size: var(--text-2xl);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
  animation: fadeInUp 0.6s ease-out 0.2s backwards;
}

.hero__typing {
  display: inline-block;
  border-right: 2px solid var(--color-primary);
  animation: blink 1s step-end infinite;
}

.hero__description {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-xl);
  max-width: 600px;
  animation: fadeInUp 0.6s ease-out 0.3s backwards;
}

.hero__cta {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
  animation: fadeInUp 0.6s ease-out 0.4s backwards;
}

/* ===================================
   BUTTONS
   =================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-weight: 600;
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-100%);
  transition: transform var(--transition-base);
  z-index: -1;
}

.btn:hover::before {
  transform: translateX(0);
}

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

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

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

.btn--secondary:hover {
  background: var(--color-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ===================================
   SECTION HEADERS
   =================================== */
.section__header {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
}

.section__subtitle {
  color: var(--color-primary-light);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--spacing-sm);
}

.section__title {
  font-size: var(--text-4xl);
  margin-bottom: var(--spacing-md);
}

.section__description {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* ===================================
   CARDS
   =================================== */
.card {
  background: var(--color-bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: var(--spacing-lg);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

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

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-xl);
}

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

.card__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-md);
  font-size: var(--text-2xl);
}

.card__title {
  font-size: var(--text-xl);
  margin-bottom: var(--spacing-sm);
}

.card__description {
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-md);
}

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

.project-card {
  background: var(--color-bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
}

.project-card:hover {
  transform: translateY(-8px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-xl);
}

.project-card__image {
  width: 100%;
  height: 200px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-4xl);
  position: relative;
  overflow: hidden;
}

.project-card__image::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(0, 0, 0, 0.2) 100%);
}

.project-card__content {
  padding: var(--spacing-lg);
}

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

.tag {
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
}

.tag--primary {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--color-primary);
  color: var(--color-primary-light);
}

/* ===================================
   SKILLS SECTION
   =================================== */
.skills__categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-lg);
  margin-top: var(--spacing-2xl);
}

.skill-category {
  background: var(--color-bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: var(--spacing-lg);
}

.skill-category__title {
  font-size: var(--text-xl);
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.skill-category__icon {
  font-size: var(--text-2xl);
}

.skill-category__items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.skill-badge {
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.skill-badge:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

/* ===================================
   CONTACT SECTION
   =================================== */
.contact__content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-2xl);
  margin-top: var(--spacing-2xl);
}

.contact__info {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.contact__item {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
}

.contact__item-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  font-size: var(--text-xl);
  flex-shrink: 0;
}

.contact__form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.form__group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.form__label {
  font-weight: 500;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.form__input,
.form__textarea {
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  transition: all var(--transition-fast);
}

.form__input:focus,
.form__textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form__textarea {
  resize: vertical;
  min-height: 150px;
}

/* ===================================
   FOOTER
   =================================== */
.footer {
  background: var(--color-bg-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: var(--spacing-2xl) 0 var(--spacing-lg);
}

.footer__content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
}

.footer__section-title {
  font-size: var(--text-lg);
  margin-bottom: var(--spacing-md);
}

.footer__links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.footer__link {
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

.footer__link:hover {
  color: var(--color-primary-light);
}

.footer__socials {
  display: flex;
  gap: var(--spacing-md);
}

.social-link {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

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

.footer__bottom {
  text-align: center;
  padding-top: var(--spacing-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

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

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

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

/* Scroll Reveal Animation */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease-out;
}

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

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 768px) {
  :root {
    --spacing-3xl: 4rem;
    --spacing-2xl: 3rem;
  }
  
  .nav__menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(12px);
    flex-direction: column;
    padding: var(--spacing-lg);
    transform: translateY(-100%);
    opacity: 0;
    transition: all var(--transition-base);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .nav__menu.active {
    transform: translateY(0);
    opacity: 1;
  }
  
  .nav__toggle {
    display: block;
  }
  
  .hero__title {
    font-size: var(--text-4xl);
  }
  
  .hero__subtitle {
    font-size: var(--text-xl);
  }
  
  .projects__grid {
    grid-template-columns: 1fr;
  }
  
  .contact__content {
    grid-template-columns: 1fr;
  }
  
  .footer__content {
    grid-template-columns: 1fr;
  }
}

/* ===================================
   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;
}
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

/* ===================================
   PROJECT MODAL
   =================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.modal.show {
    display: flex; /* Changed from block to flex for centering */
    align-items: center; /* Center vertically */
    justify-content: center; /* Center horizontally */
    opacity: 1;
}

.modal__content {
    background-color: var(--color-bg-secondary);
    margin: auto;
    padding: var(--spacing-xl); /* Increased padding for better breathing room */
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 90%;
    max-width: 800px;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: translateY(20px);
    transition: transform var(--transition-base);
    max-height: 90vh; /* Limit height for viewport */
    overflow-y: auto; /* Scrollable content if nice */
}

.modal.show .modal__content {
    transform: translateY(0);
}

.modal__close {
    color: var(--color-text-muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color var(--transition-fast);
    line-height: 1; /* Fix vertical alignment */
}

.modal__close:hover,
.modal__close:focus {
    color: var(--color-text-primary);
    text-decoration: none;
}

.modal__header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md); /* Use gap instead of margin for better layout control */
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Subtle separator */
    padding-bottom: var(--spacing-md);
}

.modal__icon {
    font-size: var(--text-4xl); /* Larger icon */
    background: var(--color-bg-tertiary); /* Background circle for icon */
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
}

.modal__title {
    font-size: var(--text-2xl); /* Larger title */
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text; /* Standard property */
    margin: 0; /* Removing default margin */
}

.modal__body {
    color: var(--color-text-secondary);
    line-height: 1.7; /* Better readability */
}

.modal__section {
    margin-bottom: var(--spacing-lg);
}

.modal__section h4 {
    color: var(--color-primary-light);
    margin-bottom: var(--spacing-xs); /* Tighter spacing for headers */
    font-size: var(--text-lg);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem; /* Smaller, uppercase looks better */
    font-weight: 700;
}

.modal__tags {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap; 
}

.modal__results {
    list-style-type: none; /* Custom bullets */
    padding-left: 0;
}

.modal__results li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.modal__results li::before {
    content: "✅"; /* Checkmark bullet */
    position: absolute;
    left: 0;
    font-size: 1rem;
    line-height: 1.7;
}

/* Scrollbar for modal content if it gets long */
.modal__content::-webkit-scrollbar {
    width: 8px;
}
.modal__content::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}
.modal__content::-webkit-scrollbar-thumb {
    background-color: var(--color-text-muted);
    border-radius: 4px;
}

.modal__image-container {
    width: 100%;
    margin-bottom: var(--spacing-lg);
    background: white; /* Architecture diagrams are usually white background */
    border-radius: var(--radius-md);
    overflow: hidden;
    padding: var(--spacing-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal__image {
    width: 100%;
    height: auto;
    display: block;
    max-height: 400px; /* Prevent it from taking over the screen */
    object-fit: contain;
}
