/* ===================================
   CLOUDGAP CUSTOM STYLES
   Phase 2: Structural Foundation
   ================================= */

/* CSS Custom Properties (Design System) */
:root {
  /* Colors - Maximum 3 Color Palette */
  --primary-blue: #1a73e8;
  --dark-gray: #1a1a1a;
  --light-gray: #f8f9fa;
  --white: #ffffff;
  
  /* Typography - Maximum 2 Font Families */
  --font-primary: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'Source Code Pro', 'Monaco', 'Cascadia Code', monospace;
  
  /* Typography Scale (8pt Grid System) */
  --text-xs: 12px;    /* 12px - Small text */
  --text-sm: 14px;    /* 14px - Captions, metadata */
  --text-base: 16px;  /* 16px - Body text */
  --text-lg: 18px;    /* 18px - Large body text */
  --text-xl: 20px;    /* 20px - H4, Card titles */
  --text-2xl: 24px;   /* 24px - H3, Subsection headers */
  --text-3xl: 30px;   /* 30px - Large headings */
  --text-4xl: 36px;   /* 36px - H2, Section headers */
  --text-5xl: 48px;   /* 48px - H1, Hero headlines */
  --text-6xl: 60px;   /* 60px - Extra large hero text */
  
  /* Font Weights */
  --font-normal: 400;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* Spacing Scale (8pt Grid System) */
  --space-1: 8px;     /* 8px */
  --space-2: 16px;    /* 16px */
  --space-3: 24px;    /* 24px */
  --space-4: 32px;    /* 32px */
  --space-6: 48px;    /* 48px */
  --space-8: 64px;    /* 64px */
  --space-12: 96px;   /* 96px */
  --space-16: 128px;  /* 128px */
  --space-20: 160px;  /* 160px */
  
  /* Container & Layout */
  --container-max-width: 1200px;
  --container-padding: 1rem;
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* 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);
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 200ms ease-in-out;
  --transition-slow: 300ms ease-in-out;
}

/* ===================================
   BASE STYLES & RESETS
   ================================= */

/* Ensure consistent box-sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Base body styles */
body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: 1.6;
  color: var(--dark-gray);
  background-color: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Heading styles following typography hierarchy */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary);
  font-weight: var(--font-bold);
  line-height: 1.2;
  margin: 0;
  color: var(--dark-gray);
}

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

/* Paragraph and text styles */
p {
  margin: 0 0 var(--space-2) 0;
  line-height: 1.6;
}

/* Link styles */
a {
  color: var(--primary-blue);
  text-decoration: none;
  transition: color var(--transition-normal);
}

a:hover {
  color: #1557b0; /* Darker blue on hover */
}

a:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* List styles */
ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Image optimization */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ===================================
   UTILITY CLASSES
   ================================= */

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Focus styles for accessibility */
.focus-ring:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ===================================
   COMPONENT BASE STYLES
   ================================= */

/* Button base styles (enhanced by Tailwind classes) */
.btn-base {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-primary);
  font-weight: var(--font-semibold);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  min-height: 44px; /* Accessibility: minimum touch target */
}

/* Card base styles */
.card-base {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition-normal);
}

.card-base:hover {
  box-shadow: var(--shadow-lg);
}

/* Form input base styles */
.input-base {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-3);
  transition: border-color var(--transition-normal);
  background-color: var(--white);
}

.input-base:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

/* ===================================
   RESPONSIVE BREAKPOINTS
   ================================= */

/* Mobile-first responsive breakpoints aligned with Tailwind */

/* Small devices (landscape phones, 640px and up) */
@media (min-width: 640px) {
  :root {
    --container-padding: 1.5rem;
  }
  
  h1 { font-size: calc(var(--text-5xl) * 1.1); }
  h2 { font-size: calc(var(--text-4xl) * 1.1); }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  :root {
    --container-padding: 2rem;
  }
  
  h1 { font-size: calc(var(--text-5xl) * 1.2); }
  h2 { font-size: calc(var(--text-4xl) * 1.2); }
}

/* Large devices (desktops, 1024px and up) */
@media (min-width: 1024px) {
  :root {
    --container-padding: 2.5rem;
  }
  
  h1 { font-size: var(--text-6xl); }
  h2 { font-size: calc(var(--text-4xl) * 1.3); }
}

/* Extra large devices (large desktops, 1280px and up) */
@media (min-width: 1280px) {
  :root {
    --container-padding: 3rem;
  }
}

/* ===================================
   ACCESSIBILITY ENHANCEMENTS
   ================================= */

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --primary-blue: #0d47a1;
    --dark-gray: #000000;
    --light-gray: #f5f5f5;
  }
}

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

/* Focus visible for better keyboard navigation */
@supports selector(:focus-visible) {
  :focus:not(:focus-visible) {
    outline: none;
  }
  
  :focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
  }
}

/* ===================================
   CUSTOM COMPONENT OVERRIDES
   ================================= */

/* Mobile menu animation styles */
.mobile-menu-enter {
  transform: translateY(-10px);
  opacity: 0;
}

.mobile-menu-enter-active {
  transform: translateY(0);
  opacity: 1;
  transition: all var(--transition-normal);
}

.mobile-menu-exit {
  transform: translateY(0);
  opacity: 1;
}

.mobile-menu-exit-active {
  transform: translateY(-10px);
  opacity: 0;
  transition: all var(--transition-normal);
}

/* Form validation styles */
.input-error {
  border-color: #ef4444;
  background-color: #fef2f2;
}

.input-success {
  border-color: #10b981;
  background-color: #f0fdf4;
}

/* Loading state styles */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--light-gray);
  border-top: 2px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Print styles */
@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a, a:visited {
    text-decoration: underline;
  }
  
  .no-print {
    display: none !important;
  }
  
  .print-break-before {
    page-break-before: always;
  }
}

/* ===================================
   END OF CUSTOM STYLES
   ================================= */