/*
 * Theme variables
 * These variables capture the colours inspired by the Al Salam logo and
 * provide a consistent palette across the site. Adjust as needed.
 */
:root {
  --primary-color: #2b6e4f; /* deep green from the logo */
  --secondary-color: #005B96; /* blue tone for accents */
  --accent-color: #c72b34; /* red tone from the puzzle piece */
  --light-bg: #f7f7f7; /* light background for sections */
  --dark-text: #333;
  --muted-text: #666;
  --border-radius: 6px;
  --transition-fast: 0.2s;
  --max-width: 1200px;
  font-size: 16px;
}

/* Basic resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  /* Use Tajawal for Arabic and fall back to Segoe UI for Latin characters */
  font-family: 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;
  color: var(--dark-text);
  background-color: white;
  line-height: 1.6;
  scroll-behavior: smooth;
}

/* Container to center content */
.container {
  width: 90%;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* Header / Navigation */
header {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid #ddd;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  backdrop-filter: blur(8px);
}
.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}
.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--primary-color);
  font-weight: 700;
  font-size: 1.25rem;
}
.logo img {
  height: 40px;
  margin-right: 0.5rem;
}
.navbar ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.navbar a {
  text-decoration: none;
  color: var(--dark-text);
  font-weight: 500;
  transition: color var(--transition-fast);
  padding: 0.25rem 0;
}
.navbar a:hover,
.navbar a.active {
  color: var(--primary-color);
}

/* Language switcher */
.lang-switcher {
  display: flex;
  gap: 0.25rem;
}
.lang-switcher button {
  border: none;
  background-color: transparent;
  cursor: pointer;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: var(--border-radius);
  color: var(--dark-text);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.lang-switcher a {
  display: inline-block;
  text-decoration: none;
  border: none;
  background-color: transparent;
  color: var(--dark-text);
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: var(--border-radius);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.lang-switcher a:hover {
  background-color: var(--primary-color);
  color: white;
}
.lang-switcher button:hover,
.lang-switcher button.active {
  background-color: var(--primary-color);
  color: white;
}

/* Mobile navigation toggle */
.menu-toggle {
  display: none; /* hidden on large screens */
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.25rem;
}
.menu-toggle .bar {
  width: 22px;
  height: 3px;
  background-color: var(--dark-text);
  border-radius: 2px;
  transition: transform var(--transition-fast) ease;
}
.menu-toggle.active .bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.menu-toggle.active .bar:nth-child(2) {
  opacity: 0;
}
.menu-toggle.active .bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Responsive navigation */
@media (max-width: 768px) {
  .navbar {
    display: none;
    flex-direction: column;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.97);
    margin-top: 0.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 1rem;
  }
  .navbar.open {
    display: flex;
  }
  .navbar ul {
    flex-direction: column;
    gap: 0.75rem;
  }
  .menu-toggle {
    display: flex;
  }
  .nav-container {
    flex-wrap: nowrap;
  }
}

/* Team section */
.team-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.team-member {
  flex: 1 1 30%;
  background-color: var(--light-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid #e0e0e0;
  text-align: center;
}
.team-member h3 {
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
}
.team-member p {
  color: var(--muted-text);
  font-size: 0.95rem;
}
.team-image img {
  max-width: 100%;
  border-radius: var(--border-radius);
  margin-top: 1rem;
}

/* Success stories section */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.story-item {
  background-color: var(--light-bg);
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid #e0e0e0;
}
.story-item p {
  color: var(--muted-text);
  font-size: 0.95rem;
}

/* Hero section */
.hero {
  position: relative;
  height: 80vh;
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
  /* Use compressed WebP version of the hero background to improve performance */
  background-image: url("images/hero-background.webp");
  background-size: cover;
  background-position: center;
}
.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 0;
}
.hero-content {
  position: relative;
  z-index: 1;
}
.hero .tagline {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.2;
}
.hero .subtitle {
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
  font-weight: 400;
}
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: var(--accent-color);
  color: white;
  border-radius: var(--border-radius);
  text-decoration: none;
  font-weight: 600;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}
.btn:hover {
  /* Provide a simple darker shade for the hover state.  CSS doesn't support the
     darken() function natively, so we specify a manual hex colour. */
  background-color: #a6212b;
  transform: translateY(-2px);
}

/* Sections */
section {
  padding: 5rem 0;
  position: relative;
}
.section-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 2rem;
  font-weight: 700;
  color: var(--primary-color);
}
.section-content {
  margin-bottom: 2rem;
}

/* Section intro text used in team, stories and blog sections */
.section-intro {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 2rem;
  color: var(--muted-text);
  font-size: 1rem;
}

/* Mission/Vision/Goal cards */
.mission-vision-goals {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: space-between;
}
.mv-card {
  flex: 1 1 30%;
  background-color: var(--light-bg);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}
.mv-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--secondary-color);
}

/* Services */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.service-item {
  background-color: var(--light-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid #e0e0e0;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.service-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
}
.service-item h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}
.service-item p {
  font-size: 0.95rem;
  color: var(--muted-text);
}

/* Features */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.feature-item {
  background-color: var(--light-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid #e0e0e0;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.feature-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.05);
}
.feature-item h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}
.feature-item p {
  font-size: 0.95rem;
  color: var(--muted-text);
}

/* Achievements */
.achievements-list {
  list-style: none;
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}
.achievements-list li {
  background-color: var(--light-bg);
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid #e0e0e0;
  position: relative;
}
.achievements-list li::before {
  content: '✓';
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-weight: 700;
  color: var(--secondary-color);
}
.achievements-list p {
  margin-left: 1.5rem;
  color: var(--muted-text);
  font-size: 0.95rem;
}

/* Contact */
.contact-content {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}
.contact-info, .contact-form {
  flex: 1 1 300px;
  background-color: var(--light-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid #e0e0e0;
}
.contact-info h3, .contact-form h3 {
  margin-bottom: 1rem;
  color: var(--primary-color);
  font-size: 1.3rem;
}
.contact-info ul {
  list-style: none;
  margin-top: 0.5rem;
}
.contact-info li {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--muted-text);
}
.contact-info a {
  color: var(--secondary-color);
  text-decoration: none;
}
.contact-form form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.form-group {
  display: flex;
  flex-direction: column;
}
.form-group label {
  margin-bottom: 0.25rem;
  font-weight: 500;
}
.form-group input,
.form-group textarea {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: var(--border-radius);
  font-size: 0.95rem;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}
.submit-btn {
  align-self: flex-start;
  background-color: var(--secondary-color);
  color: white;
  border: none;
  padding: 0.65rem 1.5rem;
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}
.submit-btn:hover {
  background-color: #004b78;
}

/* Footer */
footer {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem 0;
  text-align: center;
  font-size: 0.9rem;
}
footer .footer-container {
  width: 90%;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* Language visibility */
.lang {
  display: none;
}
body.en .lang.en {
  display: inline;
}
body.ar .lang.ar {
  display: inline;
}

/* Direction adjustments */
body.ar {
  direction: rtl;
  font-family: 'Tajawal', sans-serif;
}
body.en {
  direction: ltr;
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .mission-vision-goals {
    flex-direction: column;
  }
  .nav-container {
    flex-wrap: wrap;
    justify-content: space-between;
  }
  .navbar ul {
    flex-wrap: wrap;
    gap: 1rem;
  }
}