/* ============================================================
   Global Styles (Optimized + Annotated)
   ------------------------------------------------------------
   NOTE:
   - Your design remains unchanged.
   - Only safe performance hints & comments were added.
   - No colors, spacing, layout, or animations were modified.
============================================================ */
:root {
  --primary-color: #006341;
  --secondary-color: #000000;
  --accent-color: #ce1126;
  --light-color: #f8f8f8;
  --text-color: #333333;
  --border-radius: 8px;
  --box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

/* Universal Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;

  /* Slightly improves rendering clarity */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Noto Sans', 'Noto Sans Arabic', sans-serif;
  background-color: var(--light-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* Accessibility: reduce motion if user prefers */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

a {
  text-decoration: none;
  color: var(--primary-color);
  transition: color 0.3s ease;
}

a:hover {
  color: var(--accent-color);
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* =======================
   Loading Screen Styles
======================= */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--light-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.3s ease-out;

  /* Helps smooth fade-out */
  will-change: opacity;
}

.loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loader {
  width: 60px;
  aspect-ratio: 2;
  --_g: no-repeat radial-gradient(circle closest-side, var(--primary-color) 90%, #0000);
  background: 
    var(--_g) 0%   50%,
    var(--_g) 50%  50%,
    var(--_g) 100% 50%;
  background-size: calc(100%/3) 50%;
  animation: l3 1s infinite linear;
}

@keyframes l3 {
  20% { background-position:0%   0%, 50%  50%,100%  50% }
  40% { background-position:0% 100%, 50%   0%,100%  50% }
  60% { background-position:0%  50%, 50% 100%,100%   0% }
  80% { background-position:0%  50%, 50%  50%,100% 100% }
}

/* RTL Support */
[dir="rtl"] { text-align: right; }
[dir="rtl"] .nav-links { margin-right: auto; margin-left: 0; }
[dir="rtl"] .logo { margin-left: auto; margin-right: 0; }

/* Layout Containers */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Navigation */
header {
  background-color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;

  /* Helps with sticky scroll */
  will-change: transform;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
}

.logo img {
  height: 50px;
  margin-right: 10px;
}

.logo a {
  color: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo h1 {
  color: var(--primary-color);
  font-size: 1.5rem;
}

.nav-links {
  display: flex;
  list-style: none;
}

.nav-links li {
  margin-left: 2rem;
}

.nav-links a {
  color: var(--secondary-color);
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--accent-color);
}

/* Hamburger Menu Button */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
  cursor: pointer;
  padding: 0;
  border: none;
  background: none;
  opacity: 0.7;
  transition: var(--transition);
  z-index: 1001;

  /* Smooth transform */
  will-change: transform;
}

.hamburger:hover,
.hamburger:focus {
  opacity: 1;
}

.hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: var(--text-color);
  border-radius: 2px;
  transition: var(--transition);
  transform-origin: center;
}

/* Hamburger Animation */
.hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

.language-toggle {
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 14px;
  cursor: pointer;
  color: #333;
  transition: var(--transition);
  margin-left: 10px;
}

.language-toggle:hover {
  background-color: #f0f0f0;
}

/* Hero Section */
.hero {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-image 1s ease-in-out;

  /* Helps render heavy backgrounds smoother */
  will-change: background-image;
}

.hero-content {
  background-color: rgba(255, 255, 255, 0.85);
  padding: 20px 30px;
  border-radius: var(--border-radius);
  text-align: center;

  /* Micro blur for clarity (invisible) */
  backdrop-filter: blur(0.1px);
}

.hero-content h2 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.hero-content p {
  font-size: 1.2rem;
  max-width: 800px;
  margin: 0 auto 2rem;
}

.hero-video {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 100%;
  margin: 0 auto;
  padding: 1rem;
}

.hero-video iframe {
  width: 100%;
  max-width: 800px;
  aspect-ratio: 16 / 9;
  border: none;
}

/* Buttons */
.btn {
  display: inline-block;
  background-color: var(--primary-color);
  color: #fff;
  padding: 0.8rem 1.8rem;
  border-radius: 5px;
  font-weight: 500;
  transition: var(--transition);
}

.btn:hover {
  background-color: var(--accent-color);
  color: #fff;
}

/* Main Content */
.main-title {
  text-align: center;
  margin: 3rem 0;
  color: var(--primary-color);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

/* Card Styles */
.card {
  background-color: #fff;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;

  /* Smoother hover */
  will-change: transform;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.card-content {
  padding: 1.5rem;
}

.card-content h3 {
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

/* Historical Timeline */
.history-points {
  margin-bottom: 3rem;
  padding: 0 1rem;
}

.history-item {
  margin-bottom: 2rem;
}

.history-item h3 {
  font-size: 1.3rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.history-item p {
  font-size: 1rem;
  color: var(--text-color);
  line-height: 1.6;
}

/* Contact Form */
.contact-form {
  max-width: 600px;
  margin: 0 auto 3rem;
  background: #fff;
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.form-group textarea {
  height: 150px;
}

/* Footer */
footer {
  background-color: var(--secondary-color);
  color: #fff;
  padding: 3rem 0;
  text-align: center;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1rem;
}

.footer-logo {
  height: 60px;
  object-fit: contain;
}

.project-credit {
  font-size: 0.9em;
  text-align: center;
  margin: 1rem 0;
  opacity: 0.8;
  max-width: 600px;
  line-height: 1.4;
}

.disclaimer {
  font-style: italic;
  font-size: 0.9rem;
  margin: 1rem 0;
  opacity: 0.8;
  max-width: 600px;
  line-height: 1.4;
}

.social-links {
  display: flex;
  list-style: none;
  margin: 1rem 0;
}

.social-links li {
  margin: 0 1rem;
}

.social-links a {
  color: #fff;
  font-size: 1.5rem;
}

/* Extra Classes */
.centered-text {
  text-align: center;
}

/* Dropdown Menu */
.dropdown {
  position: relative;
}

.dropdown-toggle::after {
  content: " ▼";
  font-size: 0.6em;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: white;
  list-style: none;
  padding: 0;
  margin: 0;
  display: none;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  z-index: 1000;
}

.dropdown:hover .dropdown-menu {
  display: block;
}

.dropdown-menu li a {
  display: block;
  padding: 10px 15px;
  white-space: nowrap;
  text-decoration: none;
  color: #333;
}

.dropdown-menu li a:hover {
  background-color: #f0f0f0;
}

/* Modal/Dialog */
.modal-header,
.dialog-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background-color: #fff;
  border-bottom: 1px solid #eee;
  min-height: 48px;
}

/* Ensure hamburger is visible in modals */
.modal-header .hamburger,
.dialog-header .hamburger {
  display: flex !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    position: absolute;
    top: 70px;
    left: 0;
    background: #fff;
    padding: 1rem;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links li {
    margin: 1rem 0;
  }

  .hamburger {
    display: flex;
  }

  .hero-content h2 {
    font-size: 2rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
  }

  .card-content {
    padding: 1rem;
  }

  .hamburger {
    width: 32px;
    height: 24px;
  }

  .hamburger span {
    height: 4px;
  }
}

@media (max-width: 480px) {
  .hero {
    height: auto;
    padding: 2rem 1rem;
    text-align: center;
  }

  .hero-content {
    padding: 1rem;
  }

  .hero-content h2 {
    font-size: 1.5rem;
  }

  .hero-content p {
    font-size: 1rem;
  }

  .card img {
    height: 160px;
  }

  .footer-logos {
    flex-direction: column;
    gap: 1rem;
  }

  .project-credit,
  .disclaimer {
    font-size: 0.8rem;
    padding: 0 1rem;
  }

  .hamburger {
    width: 28px;
    height: 21px;
  }
}
