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

/* Import modern font stack with variable fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap');

/* Enhanced base styles with modern design principles */
@layer base {
  html {
    scroll-behavior: smooth;
    scroll-padding-top: 6rem;
    font-size: clamp(14px, 1vw, 16px);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  
  body {
    font-feature-settings: 'rlig' 1, 'calt' 1, 'kern' 1, 'liga' 1, 'cv02' 1, 'cv03' 1, 'cv04' 1;
    font-family: 'Inter', 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    line-height: 1.6;
    font-optical-sizing: auto;
    font-variation-settings: 'slnt' 0;
    letter-spacing: -0.011em;
  }

  * {
    box-sizing: border-box;
  }

  /* Enhanced focus styles for accessibility */
  *:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 8px;
  }

  *:focus:not(:focus-visible) {
    outline: none;
  }

  *:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 8px;
  }

  /* Smooth transitions for theme changes with better performance */
  * {
    transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
                border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
                color 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Enhanced selection styles */
  ::selection {
    background-color: rgba(59, 130, 246, 0.2);
    color: inherit;
  }

  ::-moz-selection {
    background-color: rgba(59, 130, 246, 0.2);
    color: inherit;
  }

  /* Modern CSS custom properties with semantic naming */
  :root {
    /* Spacing scale - mobile-first */
    --space-0: 0;
    --space-px: 1px;
    --space-0_5: 0.125rem;
    --space-1: 0.25rem;
    --space-1_5: 0.375rem;
    --space-2: 0.5rem;
    --space-2_5: 0.625rem;
    --space-3: 0.75rem;
    --space-3_5: 0.875rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-7: 1.75rem;
    --space-8: 2rem;
    --space-9: 2.25rem;
    --space-10: 2.5rem;
    --space-11: 2.75rem;
    --space-12: 3rem;
    --space-14: 3.5rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;
    --space-28: 7rem;
    --space-32: 8rem;
    --space-36: 9rem;
    --space-40: 10rem;
    --space-44: 11rem;
    --space-48: 12rem;
    --space-52: 13rem;
    --space-56: 14rem;
    --space-60: 15rem;
    --space-64: 16rem;
    --space-72: 18rem;
    --space-80: 20rem;
    --space-96: 24rem;
    
    /* Radius scale */
    --radius-none: 0;
    --radius-sm: 0.125rem;
    --radius-base: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-3xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Shadow scale with modern depth */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
    
    /* Typography scale */
    --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;
    --text-7xl: 4.5rem;
    --text-8xl: 6rem;
    --text-9xl: 8rem;
    
    /* Line heights */
    --leading-none: 1;
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;
    
    /* Container sizes */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    --container-2xl: 1536px;
    
    /* Z-index scale */
    --z-0: 0;
    --z-10: 10;
    --z-20: 20;
    --z-30: 30;
    --z-40: 40;
    --z-50: 50;
    --z-auto: auto;
    
    /* Animation durations */
    --duration-75: 75ms;
    --duration-100: 100ms;
    --duration-150: 150ms;
    --duration-200: 200ms;
    --duration-300: 300ms;
    --duration-500: 500ms;
    --duration-700: 700ms;
    --duration-1000: 1000ms;
    
    /* Easing functions */
    --ease-linear: linear;
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  /* Responsive typography with fluid scaling */
  h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
    font-variation-settings: 'wght' 700;
  }
  
  h1 {
    font-size: clamp(2rem, 5vw, 3.75rem);
    font-weight: 800;
    letter-spacing: -0.04em;
  }
  
  h2 {
    font-size: clamp(1.75rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.03em;
  }
  
  h3 {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 600;
    letter-spacing: -0.025em;
  }
  
  h4 {
    font-size: clamp(1.25rem, 2.5vw, 1.875rem);
    font-weight: 600;
    letter-spacing: -0.02em;
  }
  
  h5 {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    font-weight: 600;
    letter-spacing: -0.015em;
  }
  
  h6 {
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    font-weight: 600;
    letter-spacing: -0.01em;
  }
  
  p {
    font-size: clamp(0.875rem, 1.2vw, 1.125rem);
    line-height: 1.7;
    letter-spacing: -0.005em;
  }
  
  /* Enhanced button base styles */
  button, [role="button"] {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Enhanced input base styles */
  input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
  }
  
  /* Image optimization */
  img {
    max-width: 100%;
    height: auto;
    display: block;
  }
  
  /* SVG optimization */
  svg {
    display: block;
    vertical-align: middle;
  }
}

@layer components {
  /* Modern utility classes */
  .container-fluid {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: clamp(1rem, 5vw, 2rem);
    padding-right: clamp(1rem, 5vw, 2rem);
  }
  
  .container-narrow {
    width: 100%;
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
  
  /* Enhanced line clamp utilities */
  .line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .line-clamp-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Modern animations with better performance */
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translate3d(0, 2rem, 0);
    }
    to {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }
  }

  @keyframes fadeInDown {
    from {
      opacity: 0;
      transform: translate3d(0, -2rem, 0);
    }
    to {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  @keyframes slideInLeft {
    from {
      opacity: 0;
      transform: translate3d(-2rem, 0, 0);
    }
    to {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }
  }

  @keyframes slideInRight {
    from {
      opacity: 0;
      transform: translate3d(2rem, 0, 0);
    }
    to {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }
  }

  @keyframes slideInUp {
    from {
      opacity: 0;
      transform: translate3d(0, 2rem, 0);
    }
    to {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }
  }

  @keyframes bounceGentle {
    0%, 100% {
      transform: translate3d(0, 0, 0);
    }
    50% {
      transform: translate3d(0, -0.5rem, 0);
    }
  }

  @keyframes gradient {
    0%, 100% {
      background-position: 0% 50%;
    }
    50% {
      background-position: 100% 50%;
    }
  }

  @keyframes pulse {
    0%, 100% {
      opacity: 1;
    }
    50% {
      opacity: 0.8;
    }
  }

  @keyframes scale {
    0%, 100% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.05);
    }
  }

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

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

  @keyframes glow {
    0%, 100% {
      box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
    }
    50% {
      box-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
    }
  }

  @keyframes spin-slow {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }

  /* Visual Builder specific animations */
  @keyframes slideInFromRight {
    from {
      transform: translateX(100%);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }

  @keyframes bounceIn {
    0% {
      transform: scale(0.3);
      opacity: 0;
    }
    50% {
      transform: scale(1.05);
    }
    70% {
      transform: scale(0.9);
    }
    100% {
      transform: scale(1);
      opacity: 1;
    }
  }

  @keyframes wiggle {
    0%, 7% {
      transform: rotateZ(0);
    }
    15% {
      transform: rotateZ(-15deg);
    }
    20% {
      transform: rotateZ(10deg);
    }
    25% {
      transform: rotateZ(-10deg);
    }
    30% {
      transform: rotateZ(6deg);
    }
    35% {
      transform: rotateZ(-4deg);
    }
    40%, 100% {
      transform: rotateZ(0);
    }
  }

  @keyframes breathe {
    0%, 100% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.05);
    }
  }

  /* Animation utility classes */
  .animate-fade-in-up {
    animation: fadeInUp 0.6s var(--ease-out) both;
  }

  .animate-fade-in-down {
    animation: fadeInDown 0.6s var(--ease-out) both;
  }

  .animate-fade-in {
    animation: fadeIn 0.5s var(--ease-out) both;
  }

  .animate-slide-in-left {
    animation: slideInLeft 0.5s var(--ease-out) both;
  }

  .animate-slide-in-right {
    animation: slideInRight 0.5s var(--ease-out) both;
  }

  .animate-slide-in-up {
    animation: slideInUp 0.5s var(--ease-out) both;
  }

  .animate-bounce-gentle {
    animation: bounceGentle 2s infinite;
  }

  .animate-gradient {
    animation: gradient 6s ease infinite;
    background-size: 200% 200%;
  }

  .animate-pulse-slow {
    animation: pulse 3s infinite;
  }

  .animate-scale {
    animation: scale 2s infinite;
  }

  .animate-shimmer {
    animation: shimmer 2s infinite;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    background-size: 200% 100%;
  }

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

  .animate-glow {
    animation: glow 2s infinite;
  }

  .animate-spin-slow {
    animation: spin-slow 3s linear infinite;
  }

  .animate-slide-in-right {
    animation: slideInFromRight 0.5s ease-out;
  }

  .animate-bounce-in {
    animation: bounceIn 0.6s ease-out;
  }

  .animate-wiggle {
    animation: wiggle 1s ease-in-out;
  }

  .animate-breathe {
    animation: breathe 2s ease-in-out infinite;
  }

  /* Enhanced hover effects */
  .hover\:scale-102:hover {
    transform: scale(1.02);
  }

  .hover\:scale-105:hover {
    transform: scale(1.05);
  }

  .hover\:scale-110:hover {
    transform: scale(1.1);
  }

  .hover\:lift:hover {
    transform: translateY(-0.25rem);
    box-shadow: var(--shadow-lg);
  }

  .hover\:lift-lg:hover {
    transform: translateY(-0.5rem);
    box-shadow: var(--shadow-xl);
  }

  /* Mobile-first responsive utilities */
  @media (max-width: 640px) {
    /* Enhanced touch targets */
    button, a, input, select, textarea, [role="button"] {
      min-height: 44px;
      min-width: 44px;
    }
    
    /* Mobile typography adjustments */
    h1 { font-size: 2rem; line-height: 1.1; }
    h2 { font-size: 1.75rem; line-height: 1.2; }
    h3 { font-size: 1.5rem; line-height: 1.25; }
    h4 { font-size: 1.25rem; line-height: 1.3; }
    
    /* Mobile spacing utilities */
    .mobile-px { padding-left: var(--space-4); padding-right: var(--space-4); }
    .mobile-py { padding-top: var(--space-4); padding-bottom: var(--space-4); }
    .mobile-gap { gap: var(--space-4); }
    .mobile-space-y > * + * { margin-top: var(--space-4); }
    
    /* Mobile navigation improvements */
    .mobile-nav-item {
      padding: var(--space-4);
      border-radius: var(--radius-lg);
      transition: all var(--duration-200) var(--ease-out);
    }
    
    .mobile-nav-item:active {
      transform: scale(0.98);
      transition-duration: var(--duration-75);
    }
    
    /* Mobile form improvements */
    input, textarea, select {
      font-size: 16px; /* Prevents zoom on iOS */
      padding: var(--space-3) var(--space-4);
      border-radius: var(--radius-lg);
    }
  }

  /* Tablet optimizations */
  @media (min-width: 641px) and (max-width: 1024px) {
    .tablet-grid-2 { grid-template-columns: repeat(2, 1fr); }
    .tablet-grid-3 { grid-template-columns: repeat(3, 1fr); }
    .tablet-gap { gap: var(--space-6); }
    .tablet-px { padding-left: var(--space-6); padding-right: var(--space-6); }
  }

  /* Desktop optimizations */
  @media (min-width: 1025px) {
    .desktop-grid-2 { grid-template-columns: repeat(2, 1fr); }
    .desktop-grid-3 { grid-template-columns: repeat(3, 1fr); }
    .desktop-grid-4 { grid-template-columns: repeat(4, 1fr); }
    .desktop-gap { gap: var(--space-8); }
    .desktop-px { padding-left: var(--space-8); padding-right: var(--space-8); }
  }

  /* Modern backdrop blur utilities */
  .backdrop-blur-xs {
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .backdrop-blur-sm {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .backdrop-blur {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .backdrop-blur-md {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .backdrop-blur-lg {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .backdrop-blur-xl {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }

  .backdrop-blur-2xl {
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
  }

  .backdrop-blur-3xl {
    backdrop-filter: blur(64px);
    -webkit-backdrop-filter: blur(64px);
  }

  /* Modern glass morphism effects */
  .glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  }

  .glass-dark {
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  }

  /* Enhanced navbar glass effect */
  .navbar-glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  .dark .navbar-glass {
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* Modern button styles */
  .btn-primary {
    @apply inline-flex items-center justify-center px-6 py-3 text-sm font-semibold text-white bg-blue-600 rounded-xl shadow-lg hover:bg-blue-700 hover:shadow-xl hover:scale-105 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-all duration-200 active:scale-95;
  }

  .btn-secondary {
    @apply inline-flex items-center justify-center px-6 py-3 text-sm font-semibold text-gray-700 bg-white border border-gray-300 rounded-xl shadow-sm hover:bg-gray-50 hover:shadow-md hover:scale-105 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-all duration-200 active:scale-95;
  }

  .btn-ghost {
    @apply inline-flex items-center justify-center px-6 py-3 text-sm font-semibold text-gray-700 rounded-xl hover:bg-gray-100 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-all duration-200 active:scale-95;
  }

  /* Modern card styles */
  .card {
    @apply bg-white rounded-2xl shadow-sm border border-gray-200 overflow-hidden;
  }

  .card-interactive {
    @apply card hover:shadow-lg hover:scale-102 transition-all duration-300 cursor-pointer;
  }

  .card-glass {
    @apply glass rounded-2xl overflow-hidden;
  }

  /* Enhanced scrollbar styles */
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
  }

  ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    transition: background var(--duration-200) var(--ease-out);
  }

  ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
  }

  .dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
  }

  .dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
  }

  /* Modern skeleton loading */
  .skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
  }

  .dark .skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    background-size: 200% 100%;
  }

  /* Modern gradient text utilities */
  .text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: gradient 6s ease infinite;
  }

  .text-gradient-blue {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .text-gradient-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  /* Enhanced focus ring utilities */
  .focus-ring:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: var(--radius-lg);
  }

  .focus-ring-inset:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
    border-radius: var(--radius-lg);
  }

  /* Modern progress bar */
  .progress-bar {
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
    border-radius: var(--radius-full);
    transition: width var(--duration-300) var(--ease-out);
  }

  /* Enhanced mobile menu styles */
  .mobile-menu-backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .mobile-menu-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-left: 1px solid rgba(255, 255, 255, 0.2);
  }

  .dark .mobile-menu-panel {
    background: rgba(0, 0, 0, 0.95);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* Modern logo effects */
  .logo-gradient {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .logo-shadow {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
  }

  /* Fluid spacing utilities */
  .space-y-fluid > * + * {
    margin-top: clamp(var(--space-4), 3vw, var(--space-8));
  }

  .space-x-fluid > * + * {
    margin-left: clamp(var(--space-4), 3vw, var(--space-8));
  }

  /* Container query utilities */
  @container (min-width: 768px) {
    .container-md\:grid-cols-2 {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @container (min-width: 1024px) {
    .container-lg\:grid-cols-3 {
      grid-template-columns: repeat(3, 1fr);
    }
  }
}

/* Enhanced markdown content styles */
.markdown-content {
  @apply prose prose-lg max-w-none;
  line-height: 1.7;
  color: inherit;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  color: inherit;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2em;
  margin-bottom: 0.5em;
  scroll-margin-top: 6rem;
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child {
  margin-top: 0;
}

.markdown-content h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.markdown-content h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.markdown-content h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.markdown-content p {
  margin-bottom: 1.5em;
  font-size: clamp(1rem, 1.2vw, 1.125rem);
  line-height: 1.7;
}

.markdown-content pre {
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin: var(--space-6) 0;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.dark .markdown-content pre {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.markdown-content code {
  background: rgba(0, 0, 0, 0.05);
  padding: 0.125em 0.375em;
  border-radius: var(--radius-md);
  font-size: 0.875em;
  font-weight: 500;
  color: inherit;
}

.dark .markdown-content code {
  background: rgba(255, 255, 255, 0.1);
}

.markdown-content blockquote {
  border-left: 4px solid #3b82f6;
  padding-left: var(--space-6);
  margin: var(--space-8) 0;
  font-style: italic;
  font-size: 1.125em;
  line-height: 1.6;
  color: inherit;
  background: rgba(59, 130, 246, 0.05);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
  padding-right: var(--space-6);
}

.markdown-content img {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  margin: var(--space-8) 0;
  width: 100%;
  height: auto;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-8) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.dark .markdown-content table {
  border-color: rgba(255, 255, 255, 0.1);
}

.markdown-content th,
.markdown-content td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.dark .markdown-content th,
.dark .markdown-content td {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.markdown-content th {
  background: rgba(0, 0, 0, 0.05);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dark .markdown-content th {
  background: rgba(255, 255, 255, 0.05);
}

.markdown-content ul,
.markdown-content ol {
  margin: var(--space-6) 0;
  padding-left: var(--space-6);
}

.markdown-content li {
  margin: var(--space-2) 0;
  line-height: 1.6;
}

.markdown-content a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: all var(--duration-200) var(--ease-out);
}

.markdown-content a:hover {
  border-bottom-color: #3b82f6;
  color: #1d4ed8;
}

/* Print styles */
@media print {
  .no-print, button, .search-bar, .theme-switcher, .table-of-contents, .reading-progress {
    display: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
    color: black;
    background: white;
  }

  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .card {
    border: 2px solid;
  }

  button, a {
    border: 2px solid;
  }
}

/* Auto dark mode support */
@media (prefers-color-scheme: dark) {
  .auto-dark {
    color-scheme: dark;
  }
} 