/* Main CSS - Base styles and CSS custom properties */

:root {
  /* Color Palette */
  --primary-blue: #2E5BBA;
  --accent-red: #E63946;
  --text-white: #FFFFFF;
  --text-light-gray: #F8F9FA;
  --background-dark: #2C3E50;
  --card-background: #FFFFFF;
  --overlay-dark: rgba(0, 0, 0, 0.7);
  --shadow-color: rgba(0, 0, 0, 0.3);
  
  /* Typography */
  --font-primary: 'Arial', sans-serif;
  --font-size-logo: 24px;
  --font-size-nav: 16px;
  --font-size-title: 18px;
  --font-size-footer: 14px;
  --font-weight-normal: 400;
  --font-weight-bold: 700;
  --line-height-normal: 1.6;
  --line-height-tight: 1.2;
  
  /* Layout Breakpoints */
  --mobile: 768px;
  --tablet: 1024px;
  --desktop: 1200px;
  
  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-xxl: 4rem;
  
  /* Container Widths */
  --container-max-width: 1200px;
  --container-padding: var(--spacing-lg);
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* CSS Reset and Base Styles */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: var(--line-height-normal);
  scroll-behavior: smooth;
  /* Improve text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-normal);
  color: var(--text-white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  
  /* Enhanced textured background (requirement 1.1) */
  background-color: var(--background-dark);
  background-image: 
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%23ffffff' fill-opacity='0.05' d='M1 3h1v1H1V3zm2-2h1v1H3V1z'%3E%3C/path%3E%3C/svg%3E"),
    linear-gradient(to bottom, rgba(44, 62, 80, 0.95), rgba(44, 62, 80, 0.98));
  background-attachment: fixed;
  position: relative;
}

/* Add subtle texture overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.15' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: -1;
}

/* Container Layout */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* Main Layout Grid */
.main-content {
  flex: 1;
  padding: var(--spacing-lg) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  /* Prevent content jumping during page load */
  min-height: 60vh;
  contain: layout paint;
}

/* Add subtle vignette effect to enhance readability */
.main-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center, transparent 70%, rgba(0, 0, 0, 0.2) 100%);
  pointer-events: none;
  z-index: -1;
}

/* Grid Layout System */
.grid {
  display: grid;
  gap: var(--spacing-md);
  width: 100%;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--spacing-sm);
}

p {
  margin-bottom: var(--spacing-sm);
}

/* Links */
a {
  color: inherit;
  text-decoration: none;
  transition: all var(--transition-normal);
  position: relative;
}

a:hover {
  opacity: 0.9;
  color: var(--text-white);
}

a:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.3);
}

a:focus:not(:focus-visible) {
  outline: none;
  text-shadow: none;
}

a:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(46, 91, 186, 0.3);
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  /* Performance optimizations */
  will-change: transform;
  backface-visibility: hidden;
  -webkit-font-smoothing: subpixel-antialiased;
}

/* Lists */
ul, ol {
  list-style: none;
  padding: 0;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  /* Ensure screen readers can access this content */
  clip-path: inset(50%);
}

/* Spacing Utilities */
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }
.mt-5 { margin-top: var(--spacing-xl); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }
.mb-5 { margin-bottom: var(--spacing-xl); }