/* Theme Configuration - Dark mode by default */
:root {
  /* Dark Theme - Default */
  --color-primary: #F1F5F9;    /* Light text on dark */
  --color-secondary: #60A5FA;  /* Lighter blue */
  --color-accent: #34D399;     /* Lighter green */
  --color-neutral: #94A3B8;    /* Lighter gray */
  --color-background: #0F172A; /* Dark background */
  --color-surface: #1E293B;    /* Dark surface */
  --color-navbar: #0A1628;     /* Darker navbar for distinction */
  --color-footer: #0F172A;     /* Dark footer */
  
  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  /* Spacing Scale */
  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 1rem;      /* 16px */
  --spacing-lg: 1.5rem;    /* 24px */
  --spacing-xl: 2rem;      /* 32px */
  --spacing-2xl: 4rem;     /* 64px */
  
  /* Border Radius */
  --radius-sm: 0.25rem;    /* 4px */
  --radius-md: 0.5rem;     /* 8px */
  --radius-lg: 0.75rem;    /* 12px */
  
  /* Shadows - Softer for better visual comfort */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.15), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.2), 0 10px 10px -5px rgb(0 0 0 / 0.1);
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 300ms ease-in-out;
  --transition-slow: 500ms ease-in-out;
}

/* Light theme when toggled */
[data-theme="light"] {
  --color-primary: #334155;    /* Softer slate - easier on eyes */
  --color-secondary: #3B82F6;  /* Friendly blue - not too harsh */
  --color-accent: #10B981;     /* Fresh emerald - approachable */
  --color-neutral: #64748B;    /* Balanced gray - readable but not stark */
  --color-background: #FAFBFC; /* Warm off-white */
  --color-surface: #FFFFFF;    /* Clean white for cards */
  --color-navbar: #F8FAFC;     /* Light navbar with slight distinction */
  --color-footer: #1F2937;     /* Dark footer for light mode */
  
  /* Light theme shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 10px 10px -5px rgb(0 0 0 / 0.03);
}

/* Theme toggle button styles */
.theme-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--color-neutral);
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.theme-toggle::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--color-surface);
  border-radius: 50%;
  transition: transform var(--transition-fast);
}

[data-theme="light"] .theme-toggle::before {
  transform: translateX(20px);
}

.theme-toggle:hover {
  background: var(--color-secondary);
}

/* Pulse animation for scroll effects */
@keyframes pulse-once {
  0% {
    box-shadow: 0 0 0 0 var(--color-accent);
  }
  50% {
    box-shadow: 0 0 0 20px rgba(52, 211, 153, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}

.animate-pulse-once {
  animation: pulse-once 1s ease-out;
  position: relative;
}

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

/* Tailwind CSS imports */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Base typography styles using CSS variables */
@layer base {
  html {
    font-family: var(--font-sans);
  }
  
  body {
    background-color: var(--color-background);
    color: var(--color-neutral);
    line-height: 1.6;
  }
  
  h1, h2, h3, h4, h5, h6 {
    color: var(--color-primary);
    font-weight: 600;
  }
  
  /* Smooth scrolling for sections with offset for sticky header */
  section[id] {
    scroll-margin-top: 4rem; /* 64px to account for sticky header */
  }
}

/* Component styles */
@layer components {
  .btn-primary {
    @apply bg-secondary text-white px-6 py-3 sm:px-8 sm:py-4 rounded-lg font-medium;
    @apply hover:bg-opacity-90 transition-all;
    background-color: var(--color-secondary);
    transition: var(--transition-normal);
    display: inline-block;
    text-decoration: none;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  @media (min-width: 640px) {
    .btn-primary {
      min-height: 3rem;
    }
  }
  
  .btn-secondary {
    @apply border-2 border-secondary text-secondary px-6 py-3 sm:px-8 sm:py-4 rounded-lg font-medium;
    @apply hover:bg-secondary hover:text-white transition-all;
    border-color: var(--color-secondary);
    color: var(--color-secondary);
    transition: var(--transition-normal);
    text-decoration: none;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }


  @media (min-width: 640px) {
    .btn-secondary {
      min-height: 3rem;
    }
  }
  
  .card {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(51, 65, 85, 0.06);
    transition: var(--transition-normal);
    padding: 1rem;
    overflow: hidden;
  }
  
  @media (min-width: 640px) {
    .card {
      padding: 1.5rem;
    }
  }

  @media (min-width: 1024px) {
    .card {
      padding: 2rem;
    }
  }
  
  .card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(59, 130, 246, 0.2);
  }

  .card.cursor-pointer:hover {
    box-shadow: 0 25px 50px -12px rgba(59, 130, 246, 0.15), 0 0 0 1px rgba(59, 130, 246, 0.1);
    transform: translateY(-6px) scale(1.03);
    border-color: rgba(59, 130, 246, 0.3);
  }

  @media (max-width: 640px) {
    .card:active {
      transform: translateY(-1px);
    }
  }
  
  
  /* Tech badges with icons and names for project cards */
  .tech-badge-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-neutral);
    border: 1px solid rgba(100, 116, 139, 0.15);
    background: transparent;
    transition: var(--transition-fast);
    min-height: 2rem;
    white-space: nowrap;
  }

  @media (min-width: 640px) {
    .tech-badge-with-icon {
      gap: 0.375rem;
      padding: 0.25rem 0.625rem;
      font-size: 0.8125rem;
      min-height: auto;
    }
  }
  
  .tech-badge-with-icon:hover {
    color: var(--color-primary);
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.05);
    transform: translateY(-1px);
  }
  
  .tech-badge-with-icon .tech-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    transition: var(--transition-fast);
  }

  @media (min-width: 640px) {
    .tech-badge-with-icon .tech-icon {
      width: 0.875rem;
      height: 0.875rem;
    }
  }
  
  .tech-badge-with-icon .tech-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: grayscale(0.3);
    transition: var(--transition-fast);
  }
  
  .tech-badge-with-icon:hover .tech-icon {
    transform: scale(1.1);
  }

  .tech-badge-with-icon:hover .tech-icon img {
    filter: grayscale(0);
  }
  
  /* Compact skill badges for core skills display */
  .skill-badge-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-primary);
    background-color: var(--color-surface);
    border: 1px solid rgba(100, 116, 139, 0.1);
    transition: var(--transition-fast);
    cursor: default;
  }

  .skill-badge-compact:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(59, 130, 246, 0.3);
    background-color: rgba(59, 130, 246, 0.05);
  }

  .skill-icon-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
  }

  .skill-icon-compact img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: grayscale(0.2);
    transition: var(--transition-fast);
  }

  .skill-badge-compact:hover .skill-icon-compact img {
    filter: grayscale(0);
    transform: scale(1.1);
  }

  /* Smaller badges for expanded view */
  .skill-badge-expanded {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    color: var(--color-neutral);
    background-color: var(--color-surface);
    border: 1px solid rgba(100, 116, 139, 0.08);
    transition: var(--transition-fast);
  }

  .skill-badge-expanded:hover {
    color: var(--color-primary);
    border-color: rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
  }

  .skill-icon-small {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
  }

  .skill-icon-small img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: grayscale(0.3);
    transition: var(--transition-fast);
  }

  .skill-badge-expanded:hover .skill-icon-small img {
    filter: grayscale(0);
  }

  /* Mobile optimizations for skill badges */
  @media (max-width: 640px) {
    .skill-badge-compact {
      padding: 0.375rem 0.625rem;
      font-size: 0.8125rem;
      gap: 0.25rem;
    }

    .skill-icon-compact {
      width: 1rem;
      height: 1rem;
    }

    .skill-badge-expanded {
      padding: 0.25rem 0.5rem;
      font-size: 0.75rem;
    }

    .skill-icon-small {
      width: 0.875rem;
      height: 0.875rem;
    }
  }
  
  /* Project Detail Page Specific Styles */
  .prose {
    color: var(--color-neutral);
    max-width: none;
  }
  
  .prose p {
    margin-bottom: 1rem;
    line-height: 1.7;
  }
  
  .prose-lg p {
    font-size: 1.125rem;
    line-height: 1.8;
  }
  
  /* Project detail section headings */
  .text-h1 {
    font-size: 2.5rem;
    line-height: 1.2;
    font-weight: 700;
  }
  
  .text-h2 {
    font-size: 2rem;
    line-height: 1.3;
    font-weight: 600;
  }
  
  @media (min-width: 640px) {
    .text-h1 {
      font-size: 3rem;
    }
    .text-h2 {
      font-size: 2.25rem;
    }
  }
  
  @media (min-width: 1024px) {
    .text-h1 {
      font-size: 3.5rem;
    }
    .text-h2 {
      font-size: 2.5rem;
    }
  }
  
  /* Project metrics grid */
  .project-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
  }
  
  .metric-card {
    background-color: var(--color-surface);
    padding: 1rem;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid rgba(51, 65, 85, 0.06);
    transition: var(--transition-normal);
  }
  
  .metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(59, 130, 246, 0.12);
  }
  
  .metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-secondary);
    display: block;
  }
  
  .metric-label {
    font-size: 0.875rem;
    color: var(--color-neutral);
    margin-top: 0.25rem;
  }
  
  /* Challenge and solution cards */
  .challenge-solution-card {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid rgba(51, 65, 85, 0.06);
    transition: var(--transition-normal);
  }
  
  .challenge-solution-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: rgba(59, 130, 246, 0.12);
  }
  
  /* Feature list items */
  .feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background-color: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid rgba(51, 65, 85, 0.06);
    transition: var(--transition-normal);
  }
  
  .feature-item:hover {
    transform: translateX(4px);
    border-color: rgba(52, 211, 153, 0.2);
    background-color: rgba(52, 211, 153, 0.02);
  }
  
  .feature-icon {
    width: 1.5rem;
    height: 1.5rem;
    background-color: var(--color-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.125rem;
  }
  
  /* Breadcrumb navigation */
  .breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-neutral);
  }
  
  .breadcrumb a {
    color: var(--color-neutral);
    text-decoration: none;
    transition: var(--transition-fast);
  }
  
  .breadcrumb a:hover {
    color: var(--color-secondary);
  }
  
  .breadcrumb-separator {
    color: rgba(148, 163, 184, 0.5);
  }
  
  /* Architecture diagram container */
  .architecture-diagram {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    border: 1px solid rgba(51, 65, 85, 0.06);
    transition: var(--transition-normal);
  }
  
  .architecture-diagram:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(59, 130, 246, 0.12);
  }
  
  .architecture-diagram img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
  }

  /* Mobile-specific architecture diagram styles */
  @media (max-width: 640px) {
    .architecture-diagram {
      padding: 0.5rem;
      overflow: hidden;
    }
    
    .architecture-diagram img {
      width: 100%;
      height: auto;
      max-width: 100%;
    }
  }
  
  /* Navigation buttons for project detail pages */
  .project-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  @media (max-width: 640px) {
    .project-nav {
      flex-direction: column;
      align-items: stretch;
    }
    
    .project-nav .btn-primary,
    .project-nav .btn-secondary {
      width: 100%;
      justify-content: center;
    }
  }
  
  /* Section spacing for project detail pages */
  .project-section {
    padding: 4rem 0;
  }
  
  @media (max-width: 768px) {
    .project-section {
      padding: 2rem 0;
    }
  }
  
  /* Animation classes */
  .animate-fade-in {
    animation: fadeIn 0.6s ease-out;
  }
  
  .animate-slide-up {
    animation: slideUp 0.8s ease-out;
  }
  
  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
  
  @keyframes slideUp {
    from {
      opacity: 0;
      transform: translateY(30px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Markdown Content Styling */
  .markdown-content h1,
  .markdown-content h2,
  .markdown-content h3,
  .markdown-content h4,
  .markdown-content h5,
  .markdown-content h6 {
    color: var(--color-primary);
    font-weight: 600;
    line-height: 1.4;
    margin-top: 3rem;
    margin-bottom: 0.75rem;
  }

  /* First header should have less top margin */
  .markdown-content h1:first-child,
  .markdown-content h2:first-child,
  .markdown-content h3:first-child,
  .markdown-content h4:first-child,
  .markdown-content h5:first-child,
  .markdown-content h6:first-child {
    margin-top: 0;
  }


  .markdown-content h1 {
    font-size: 2.25rem;
    border-bottom: 2px solid var(--color-secondary);
    padding-bottom: 0.5rem;
  }

  .markdown-content h2 {
    font-size: 1.875rem;
    border-bottom: 1px solid var(--color-neutral);
    padding-bottom: 0.25rem;
  }

  .markdown-content h3 {
    font-size: 1.5rem;
  }

  .markdown-content h4 {
    font-size: 1.25rem;
  }

  .markdown-content p {
    margin-bottom: 1.5rem;
    line-height: 1.7;
    color: var(--color-neutral);
  }

  /* Better spacing for content after headers */
  .markdown-content h1 + p,
  .markdown-content h2 + p,
  .markdown-content h3 + p,
  .markdown-content h4 + p,
  .markdown-content h5 + p,
  .markdown-content h6 + p {
    margin-top: 0.75rem;
  }

  .markdown-content ul,
  .markdown-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
    list-style: initial !important;
    list-style-position: outside !important;
  }

  .markdown-content ul {
    list-style-type: disc !important;
  }

  .markdown-content ol {
    list-style-type: decimal !important;
  }

  .markdown-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    display: list-item !important;
    list-style: inherit !important;
  }

  .markdown-content ul ul,
  .markdown-content ol ol,
  .markdown-content ul ol,
  .markdown-content ol ul {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .markdown-content ul ul {
    list-style-type: circle;
  }

  .markdown-content ul ul ul {
    list-style-type: square;
  }

  .markdown-content blockquote {
    border-left: 4px solid var(--color-secondary);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--color-neutral);
  }

  .markdown-content code {
    background-color: var(--color-surface);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--color-accent);
  }

  .markdown-content pre {
    background-color: var(--color-surface);
    padding: 1rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(100, 116, 139, 0.1);
  }

  .markdown-content pre code {
    background-color: transparent;
    padding: 0;
    color: var(--color-primary);
  }

  .markdown-content a {
    color: var(--color-secondary);
    text-decoration: underline;
    transition: color var(--transition-fast);
  }

  .markdown-content a:hover {
    color: var(--color-accent);
  }

  .markdown-content strong {
    font-weight: 600;
    color: var(--color-primary);
  }

  .markdown-content em {
    font-style: italic;
  }

  .markdown-content hr {
    border: none;
    height: 1px;
    background-color: var(--color-neutral);
    margin: 2rem 0;
  }
}