/* ========================================
   KHAMSA.ORG - GLOBAL STYLES
   Mediterranean Color Palette
   ======================================== */

:root {
  /* Primary Colors - Mediterranean Palette */
  --lapis-deep: #1E3A8A;        /* Deep Lapis Blue (primary) */
  --lapis-bright: #2563EB;      /* Bright Lapis Blue */
  --lapis-light: #3B82F6;       /* Light Lapis Blue */
  --sand-gold: #D97706;         /* Sand Gold (accents) */
  --sand-gold-light: #F59E0B;   /* Light Gold */
  --ivory: #FFFBEB;             /* Ivory (backgrounds) */
  --ivory-warm: #FEF3C7;        /* Warm Ivory */

  /* Neutral Colors */
  --stone-dark: #1F2937;        /* Dark text */
  --stone-medium: #6B7280;      /* Medium gray */
  --stone-light: #F3F4F6;       /* Light gray */
  --white: #FFFFFF;

  /* Semantic Colors */
  --text-primary: var(--stone-dark);
  --text-secondary: var(--stone-medium);
  --bg-primary: var(--white);
  --bg-secondary: var(--ivory);
  --accent-primary: var(--lapis-deep);
  --accent-secondary: var(--sand-gold);

  /* Spacing System (8px base) */
  --space-xs: 0.5rem;   /* 8px */
  --space-sm: 1rem;     /* 16px */
  --space-md: 1.5rem;   /* 24px */
  --space-lg: 2rem;     /* 32px */
  --space-xl: 3rem;     /* 48px */
  --space-2xl: 4rem;    /* 64px */
  --space-3xl: 6rem;    /* 96px */

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-arabic: 'Amiri', 'Traditional Arabic', serif;

  /* Layout */
  --max-width: 1280px;
  --max-width-narrow: 800px;
  --header-height: 80px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;

  /* 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);
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
}

/* Arabic & Hebrew Text Support */
body[dir="rtl"] {
  font-family: var(--font-arabic), var(--font-sans);
  direction: rtl;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--lapis-deep);
  margin-bottom: var(--space-md);
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

h4 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
}

p {
  margin-bottom: var(--space-md);
  max-width: 70ch;
}

a {
  color: var(--lapis-bright);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--sand-gold);
  text-decoration: underline;
}

strong {
  font-weight: 600;
  color: var(--lapis-deep);
}

/* ========================================
   HEADER & NAVIGATION
   ======================================== */

.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(30, 58, 138, 0.1);
  height: var(--header-height);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--lapis-deep);
  text-decoration: none;
}

.logo:hover {
  text-decoration: none;
}

.logo svg {
  width: 40px;
  height: auto;
}

.nav-menu {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
}

.nav-menu a {
  font-weight: 500;
  color: var(--text-primary);
  position: relative;
  padding: var(--space-xs) 0;
}

.nav-menu a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--sand-gold);
  transition: width var(--transition-base);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
  width: 100%;
}

.nav-menu a:hover {
  color: var(--lapis-deep);
  text-decoration: none;
}

/* Language Switcher */
.lang-switcher {
  display: flex;
  gap: var(--space-xs);
  margin-left: var(--space-lg);
}

.lang-btn {
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--stone-light);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.lang-btn:hover,
.lang-btn.active {
  background: var(--lapis-deep);
  color: var(--white);
  border-color: var(--lapis-deep);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
}

.mobile-menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--lapis-deep);
  transition: all var(--transition-base);
}

/* ========================================
   HERO SECTION
   ======================================== */

.hero {
  position: relative;
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ivory) 0%, var(--ivory-warm) 100%);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 30L0 0' stroke='%231E3A8A' stroke-width='0.5' opacity='0.05'/%3E%3C/svg%3E");
  opacity: 0.3;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  padding: var(--space-2xl) var(--space-md);
  text-align: center;
}

.hero-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: var(--lapis-deep);
  margin-bottom: var(--space-md);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
}

.hero-subtitle {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-cta {
  display: inline-flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  display: inline-block;
  padding: var(--space-sm) var(--space-lg);
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-base);
  border: 2px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--lapis-deep);
  color: var(--white);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: var(--lapis-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--lapis-deep);
  border-color: var(--lapis-deep);
}

.btn-secondary:hover {
  background: var(--lapis-deep);
  color: var(--white);
  text-decoration: none;
}

/* ========================================
   FIVE PILLARS SECTION
   ======================================== */

.five-pillars {
  padding: var(--space-3xl) var(--space-md);
  background: var(--white);
}

.section-title {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.pillars-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.pillar-card {
  background: var(--bg-secondary);
  padding: var(--space-xl);
  border-radius: 12px;
  border: 2px solid transparent;
  transition: all var(--transition-base);
  cursor: pointer;
  text-align: center;
}

.pillar-card:hover {
  transform: translateY(-8px);
  border-color: var(--sand-gold);
  box-shadow: var(--shadow-xl);
}

.pillar-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
}

.pillar-card h3 {
  color: var(--lapis-deep);
  margin-bottom: var(--space-sm);
}

.pillar-card p {
  color: var(--text-secondary);
  margin: 0;
}

/* ========================================
   CONTENT SECTIONS
   ======================================== */

.content-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-3xl) var(--space-md);
}

.content-narrow {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
}

.section-header {
  margin-bottom: var(--space-2xl);
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
  background: var(--lapis-deep);
  color: var(--white);
  padding: var(--space-2xl) var(--space-md) var(--space-lg);
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.footer-section h4 {
  color: var(--sand-gold);
  margin-bottom: var(--space-md);
}

.footer-section a {
  color: var(--ivory);
  display: block;
  margin-bottom: var(--space-xs);
}

.footer-section a:hover {
  color: var(--sand-gold);
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  color: var(--ivory-warm);
  font-size: 0.875rem;
}

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.text-center {
  text-align: center;
}

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
  :root {
    --header-height: 64px;
  }

  .nav-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background: var(--white);
    flex-direction: column;
    padding: var(--space-lg);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  .nav-menu.active {
    transform: translateX(0);
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .lang-switcher {
    margin-left: auto;
    margin-right: var(--space-md);
  }

  .pillars-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: calc(100vh - var(--header-height));
  }
}

@media (max-width: 480px) {
  .hero-cta {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    text-align: center;
  }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Lazy Loading Images */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity var(--transition-base);
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* 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;
    scroll-behavior: auto !important;
  }
}

/* Print Styles */
@media print {
  .header,
  .footer,
  .nav-menu,
  .mobile-menu-toggle,
  .lang-switcher {
    display: none;
  }
}
