/**
 * MaiMovement Design System - Main CSS Entry Point
 * Organized CSS architecture following ITCSS methodology
 */

/* === 1. SETTINGS - Design tokens and variables === */
@import './base/design-tokens.css';

/* === 2. TOOLS - Mixins and functions === */
/* Add Tailwind base for reset and normalization */
@tailwind base;

/* === 3. GENERIC - Reset and normalize === */
/* Tailwind handles this */

/* === 4. ELEMENTS - Base element styles === */
@layer base {
  /* Enhanced typography defaults */
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--color-gray-900);
    line-height: var(--leading-normal);
    font-size: var(--text-base);
    background-color: var(--color-gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Enhanced heading defaults */
  h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-semibold);
    color: var(--color-gray-900);
    line-height: var(--leading-tight);
  }

  /* Enhanced link defaults */
  a {
    color: var(--color-primary-600);
    text-decoration: none;
    transition: color var(--transition-fast);
  }

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

  /* Focus styles for accessibility */
  :focus {
    outline: 2px solid var(--color-primary-600);
    outline-offset: 2px;
  }

  /* Better button reset */
  button {
    cursor: pointer;
  }

  /* Better input defaults */
  input, textarea, select {
    font-family: inherit;
  }
}

/* === 5. OBJECTS - Layout patterns === */
@layer components {
  /* Layout containers */
  .layout-container {
    max-width: var(--container-6xl);
    margin: 0 auto;
    padding: 0 var(--space-4);
  }

  .layout-section {
    padding: var(--space-8) 0;
  }

  .layout-section--tight {
    padding: var(--space-4) 0;
  }

  .layout-section--spacious {
    padding: var(--space-12) 0;
  }

  /* Grid system */
  .grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-6);
  }

  .grid-responsive {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  @media (min-width: 768px) {
    .grid-responsive {
      grid-template-columns: repeat(2, 1fr);
    }
  }

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

  /* Flex utilities */
  .flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .flex-start {
    display: flex;
    justify-content: flex-start;
    align-items: center;
  }

  /* Stack layout */
  .stack {
    display: flex;
    flex-direction: column;
  }

  .stack > * + * {
    margin-top: var(--space-4);
  }

  .stack--tight > * + * {
    margin-top: var(--space-2);
  }

  .stack--loose > * + * {
    margin-top: var(--space-6);
  }

  /* Typography classes */
  .text-heading-1 {
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
  }

  .text-heading-2 {
    font-size: var(--text-3xl);
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
  }

  .text-heading-3 {
    font-size: var(--text-2xl);
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
  }

  .text-heading-4 {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
  }

  .text-display-1 {
    font-size: var(--text-6xl);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
  }

  .text-display-2 {
    font-size: var(--text-5xl);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
  }

  .text-body {
    font-size: var(--text-base);
    line-height: var(--leading-normal);
  }

  .text-body-sm {
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
  }

  .text-body-lg {
    font-size: var(--text-lg);
    line-height: var(--leading-normal);
  }

  /* Color utilities */
  .text-primary-600 { color: var(--color-primary-600); }
  .text-primary-700 { color: var(--color-primary-700); }
  .text-success-600 { color: var(--color-success-600); }
  .text-info-600 { color: var(--color-info-600); }
  .text-gray-300 { color: var(--color-gray-300); }
  .text-gray-500 { color: var(--color-gray-500); }
  .text-gray-700 { color: var(--color-gray-700); }
  .text-gray-900 { color: var(--color-gray-900); }
}

/* === 6. COMPONENTS - UI components === */
@import './components/atoms.css';

/* === 7. UTILITIES - Helper classes === */
@tailwind components;
@tailwind utilities;

/* === 8. CUSTOM UTILITIES === */
@layer utilities {
  /* Text utilities */
  .text-balance {
    text-wrap: balance;
  }

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

  /* Focus utilities */
  .focus-ring {
    @apply focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500;
  }

  /* Animation utilities */
  .animate-fade-in {
    animation: fadeIn 0.3s ease-in;
  }

  .animate-slide-up {
    animation: slideUp 0.3s ease-out;
  }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(10px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

/* === PRINT STYLES === */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.4;
  }
}