/**
 * Cross-Browser Stylesheet
 * Process with Autoprefixer for vendor prefixes
 */

/* ===========================
   CSS Variables (IE11 fallback below)
   =========================== */
:root {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  
  --text-color: #333;
  --text-light: #666;
  --bg-color: #fff;
  --bg-light: #f8f9fa;
  
  --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Courier New', Courier, monospace;
  
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 2rem;
  --spacing-lg: 3rem;
  --spacing-xl: 4rem;
  
  --border-radius: 4px;
  --transition: all 0.3s ease;
}

/* ===========================
   Base Styles
   =========================== */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  color: var(--text-color);
  background-color: var(--bg-color);
  
  /* IE11 fallback (no CSS variables) */
  color: #333;
  background-color: #fff;
}

/* ===========================
   Typography
   =========================== */
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: 1rem;
}

a {
  color: var(--primary-color);
  color: #007bff; /* IE11 fallback */
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  text-decoration: underline;
}

/* ===========================
   Layout - Header
   =========================== */
header {
  background: var(--bg-light);
  background: #f8f9fa; /* IE11 fallback */
  padding: 1rem 0;
  border-bottom: 1px solid #dee2e6;
}

nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
}

/* IE11 flexbox fallback */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  nav ul {
    display: -ms-flexbox;
    -ms-flex-wrap: wrap;
    -ms-flex-pack: center;
  }
  nav li {
    margin: 0 1rem;
  }
}

nav a {
  color: var(--text-color);
  color: #333; /* IE11 fallback */
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  border-radius: 4px; /* IE11 fallback */
  transition: background 0.3s ease;
}

nav a:hover {
  background: rgba(0, 123, 255, 0.1);
  text-decoration: none;
}

/* ===========================
   Layout - Main Content
   =========================== */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

section {
  margin-bottom: 4rem;
}

/* ===========================
   Forms
   =========================== */
form {
  max-width: 600px;
  margin: 2rem 0;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #ced4da;
  border-radius: var(--border-radius);
  border-radius: 4px; /* IE11 fallback */
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
  border-color: #007bff; /* IE11 fallback */
}

button[type="submit"],
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  background: #007bff; /* IE11 fallback */
  color: white;
  border: none;
  border-radius: var(--border-radius);
  border-radius: 4px; /* IE11 fallback */
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s ease;
}

button[type="submit"]:hover,
.btn:hover {
  background: #0056b3;
}

button[type="submit"]:active,
.btn:active {
  transform: translateY(1px);
}

/* ===========================
   Footer
   =========================== */
footer {
  background: var(--bg-light);
  background: #f8f9fa; /* IE11 fallback */
  padding: 2rem 0;
  text-align: center;
  border-top: 1px solid #dee2e6;
  margin-top: 4rem;
}

/* ===========================
   Grid System (Simple)
   =========================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -1rem;
}

.col {
  flex: 1;
  padding: 0 1rem;
  min-width: 0; /* Prevent flex overflow */
}

/* IE11 flexbox fallback */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  .row {
    display: -ms-flexbox;
    -ms-flex-wrap: wrap;
  }
  .col {
    -ms-flex: 1;
  }
}

/* Column variations */
.col-half { flex: 0 0 50%; max-width: 50%; }
.col-third { flex: 0 0 33.333%; max-width: 33.333%; }
.col-quarter { flex: 0 0 25%; max-width: 25%; }

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

.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mb-3 { margin-bottom: 3rem; }

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }

.hidden { display: none; }

.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;
}

/* ===========================
   Responsive Media Queries
   =========================== */

/* Tablets and below */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
  
  nav ul {
    flex-direction: column;
    gap: 1rem;
  }
  
  .col-half,
  .col-third,
  .col-quarter {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  main {
    padding: 1rem;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
  
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  
  button[type="submit"],
  .btn {
    width: 100%;
  }
}

/* Large screens */
@media (min-width: 1440px) {
  .container {
    max-width: 1400px;
  }
}

/* ===========================
   Print Styles
   =========================== */
@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a, a:visited {
    text-decoration: underline;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
  
  nav, footer {
    display: none;
  }
  
  h2, h3 {
    page-break-after: avoid;
  }
}

/* ===========================
   Animations (Optional)
   =========================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

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