/* /assets/css/main.css - Main stylesheet with proper organization */

/* Import CSS custom properties and base styles */
@import url('variables.css');

/* ===== CSS RESET AND BASE STYLES ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-primary, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  font-size: var(--text-base, 1rem);
  line-height: 1.6;
  color: var(--gray-900, #1a1a1a);
  background-color: var(--white, #ffffff);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Remove default margins */
h1, h2, h3, h4, h5, h6,
p, blockquote, pre,
dl, dd, ol, ul,
figure, hr,
fieldset, legend {
  margin: 0;
}

/* Remove list styles */
ol, ul {
  list-style: none;
  padding: 0;
}

/* Make images easier to work with */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Links */
a {
  color: var(--primary-color, #1e3a8a);
  text-decoration: underline;
  transition: color var(--transition-fast, 150ms ease);
}

a:hover {
  color: var(--primary-dark, #1e40af);
  text-decoration: none;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-secondary, 'Segoe UI', system-ui, sans-serif);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-4, 1rem);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
h4 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: var(--space-4, 1rem);
}

/* Focus styles for accessibility */
:focus-visible {
  outline: 2px solid var(--primary-color, #1e3a8a);
  outline-offset: 2px;
}

/* ===== LAYOUT COMPONENTS ===== */
.container {
  max-width: var(--container-max-width, 1200px);
  margin: 0 auto;
  padding: 0 var(--container-padding, 1rem);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-6, 1.5rem);
  }
}

/* Grid system */
.grid {
  display: grid;
  gap: var(--space-6, 1.5rem);
}

.grid-1 { grid-template-columns: 1fr; }

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ===== HEADER COMPONENT (ANTI-FLICKER) ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--white, #ffffff);
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
  z-index: var(--z-fixed, 1030);
  
  /* Single transition to prevent flickering */
  transition: background-color var(--transition-normal, 300ms ease),
              box-shadow var(--transition-normal, 300ms ease);
  
  /* Hardware acceleration for smooth performance */
  transform: translateZ(0);
  will-change: background-color, box-shadow;
}

.header.scrolled {
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
  backdrop-filter: blur(10px);
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4, 1rem) 0;
  position: relative;
  min-height: var(--header-height, 80px);
}

.nav-brand {
  font-family: var(--font-secondary, 'Segoe UI', system-ui, sans-serif);
  font-size: var(--text-xl, 1.25rem);
  font-weight: 700;
  color: var(--primary-color, #1e3a8a);
  text-decoration: none;
  transition: color var(--transition-fast, 150ms ease);
  z-index: calc(var(--z-fixed, 1030) + 1);
}

.nav-brand:hover {
  color: var(--primary-dark, #1e40af);
  text-decoration: none;
}

/* Mobile Navigation Toggle */
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-1, 0.25rem);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2, 0.5rem);
  z-index: calc(var(--z-fixed, 1030) + 1);
  transition: transform var(--transition-fast, 150ms ease);
  min-height: 44px;
  min-width: 44px;
}

.nav-toggle:hover {
  transform: scale(1.05);
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--primary-color, #1e3a8a);
  outline-offset: 2px;
}

.nav-toggle span {
  width: 24px;
  height: 3px;
  background: var(--gray-700, #374151);
  border-radius: 2px;
  transition: all var(--transition-fast, 150ms ease);
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Navigation Menu */
.nav-menu {
  position: fixed;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100vh;
  background: var(--white, #ffffff);
  z-index: var(--z-modal, 1050);
  transition: left var(--transition-normal, 300ms ease);
  padding: calc(var(--header-height, 80px) + var(--space-4, 1rem)) var(--space-6, 1.5rem) var(--space-6, 1.5rem);
  overflow-y: auto;
}

.nav-menu.active {
  left: 0;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-6, 1.5rem);
}

.nav-link {
  font-size: var(--text-lg, 1.125rem);
  font-weight: 500;
  color: var(--gray-700, #374151);
  text-decoration: none;
  padding: var(--space-3, 0.75rem) 0;
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
  transition: all var(--transition-fast, 150ms ease);
  position: relative;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary-color, #1e3a8a);
  text-decoration: none;
  transform: translateX(8px);
}

/* Desktop Navigation */
@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }
  
  .nav-menu {
    position: static;
    width: auto;
    height: auto;
    background: transparent;
    padding: 0;
    overflow: visible;
    left: 0;
  }
  
  .nav-list {
    flex-direction: row;
    gap: var(--space-8, 2rem);
  }
  
  .nav-link {
    font-size: var(--text-base, 1rem);
    border-bottom: none;
    padding: var(--space-2, 0.5rem) 0;
    min-height: auto;
    position: relative;
  }
  
  .nav-link:hover,
  .nav-link.active {
    transform: none;
  }
  
  .nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color, #1e3a8a);
    transition: width var(--transition-fast, 150ms ease);
  }
  
  .nav-link:hover::after,
  .nav-link.active::after {
    width: 100%;
  }
}

/* ===== MAIN CONTENT LAYOUT ===== */
.main-content {
  margin-top: var(--header-height, 80px);
  flex: 1;
  padding: 0;
}

/* ===== HERO SECTION ===== */
.hero {
  background: linear-gradient(135deg, var(--primary-color, #1e3a8a) 0%, var(--primary-dark, #1e40af) 100%);
  color: var(--white, #ffffff);
  text-align: center;
  padding: var(--space-16, 4rem) 0;
  position: relative;
  overflow: hidden;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 800;
  margin-bottom: var(--space-6, 1.5rem);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: clamp(1.125rem, 3vw, 1.5rem);
  margin-bottom: var(--space-8, 2rem);
  opacity: 0.95;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== BUTTON COMPONENTS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3, 0.75rem) var(--space-6, 1.5rem);
  font-size: var(--text-base, 1rem);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--border-radius, 8px);
  transition: all var(--transition-fast, 150ms ease);
  cursor: pointer;
  border: 2px solid transparent;
  min-height: 44px;
}

.btn-primary {
  background: var(--primary-color, #1e3a8a);
  color: var(--white, #ffffff);
  border-color: var(--primary-color, #1e3a8a);
}

.btn-primary:hover {
  background: var(--primary-dark, #1e40af);
  border-color: var(--primary-dark, #1e40af);
  color: var(--white, #ffffff);
  transform: translateY(-2px);
  box-shadow: var(--shadow, 0 4px 6px rgba(0, 0, 0, 0.1));
}

.btn-secondary {
  background: transparent;
  color: var(--primary-color, #1e3a8a);
  border-color: var(--primary-color, #1e3a8a);
}

.btn-secondary:hover {
  background: var(--primary-color, #1e3a8a);
  color: var(--white, #ffffff);
  transform: translateY(-2px);
  box-shadow: var(--shadow, 0 4px 6px rgba(0, 0, 0, 0.1));
}

.btn-group {
  display: flex;
  gap: var(--space-4, 1rem);
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== SECTION COMPONENTS ===== */
.section {
  padding: var(--space-12, 3rem) 0;
}

@media (min-width: 768px) {
  .section {
    padding: var(--space-16, 4rem) 0;
  }
}

@media (min-width: 1024px) {
  .section {
    padding: var(--space-20, 5rem) 0;
  }
}

/* ===== CARD COMPONENTS ===== */
.card {
  background: var(--white, #ffffff);
  border-radius: var(--border-radius-lg, 12px);
  padding: var(--space-6, 1.5rem);
  box-shadow: var(--shadow, 0 4px 6px rgba(0, 0, 0, 0.1));
  transition: all var(--transition-normal, 300ms ease);
  border: 1px solid var(--gray-200, #e5e7eb);
  height: 100%;
}

.card:hover {
  box-shadow: var(--shadow-xl, 0 25px 50px rgba(0, 0, 0, 0.15));
  transform: translateY(-6px);
}

/* ===== FOOTER COMPONENT ===== */
.footer {
  background: var(--gray-900, #1a1a1a);
  color: var(--white, #ffffff);
  padding: var(--space-12, 3rem) 0 var(--space-6, 1.5rem);
}

.footer-content {
  display: grid;
  gap: var(--space-8, 2rem);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .footer-content {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.footer-section h3,
.footer-section h4 {
  color: var(--white, #ffffff);
  margin-bottom: var(--space-4, 1rem);
  font-size: var(--text-lg, 1.125rem);
}

.footer-title {
  font-size: var(--text-xl, 1.25rem);
  font-weight: 700;
  margin-bottom: var(--space-4, 1rem);
}

.footer-subtitle {
  font-size: var(--text-base, 1rem);
  font-weight: 600;
  margin-bottom: var(--space-3, 0.75rem);
}

.footer-description {
  color: var(--gray-300, #d1d5db);
  line-height: 1.6;
  margin-bottom: var(--space-6, 1.5rem);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-link {
  color: var(--gray-300, #d1d5db);
  text-decoration: none;
  transition: color var(--transition-fast, 150ms ease);
  display: block;
  padding: var(--space-2, 0.5rem) 0;
}

.footer-link:hover {
  color: var(--white, #ffffff);
  text-decoration: none;
}

.footer-social {
  display: flex;
  gap: var(--space-4, 1rem);
  flex-wrap: wrap;
}

.footer-social-link {
  color: var(--gray-300, #d1d5db);
  text-decoration: none;
  transition: color var(--transition-fast, 150ms ease);
  padding: var(--space-2, 0.5rem);
  border-radius: var(--border-radius, 8px);
  border: 1px solid var(--gray-600, #4b5563);
}

.footer-social-link:hover {
  color: var(--white, #ffffff);
  border-color: var(--primary-color, #1e3a8a);
  background: var(--primary-color, #1e3a8a);
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid var(--gray-700, #374151);
  margin-top: var(--space-8, 2rem);
  padding-top: var(--space-6, 1.5rem);
  text-align: center;
  color: var(--gray-400, #9ca3af);
  font-size: var(--text-sm, 0.875rem);
}

/* ===== RESPONSIVE DESIGN ===== */

/* Mobile-first adjustments */
@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-4, 1rem);
  }
  
  .hero {
    padding: var(--space-12, 3rem) 0;
  }
  
  .section {
    padding: var(--space-8, 2rem) 0;
  }
  
  .btn-group {
    flex-direction: column;
    align-items: stretch;
  }
  
  .btn {
    justify-content: center;
  }
}

/* Tablet styles */
@media (min-width: 768px) {
  .hero {
    padding: var(--space-24, 6rem) 0;
  }
  
  .card {
    padding: var(--space-8, 2rem);
  }
}

/* Desktop styles */
@media (min-width: 1024px) {
  .card:hover {
    transform: translateY(-6px);
  }
}

/* Large desktop */
@media (min-width: 1200px) {
  .container {
    padding: 0 var(--space-8, 2rem);
  }
}

/* ===== ACCESSIBILITY AND REDUCED MOTION ===== */
@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;
  }
  
  .nav-toggle span {
    transition: none;
  }
  
  .card,
  .btn {
    transform: none !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .card {
    border: 2px solid var(--gray-800, #1f2937);
  }
  
  .btn {
    border-width: 3px;
  }
}

/* Print styles */
@media print {
  .header,
  .nav-toggle,
  .btn,
  .no-print {
    display: none !important;
  }
  
  .main-content {
    margin-top: 0;
  }
  
  * {
    color: black !important;
    background: white !important;
    box-shadow: none !important;
  }
  
  .hero {
    background: white !important;
    color: black !important;
    padding: var(--space-8, 2rem) 0;
  }
}