/* ===============================
   1. RESET & VARIABLES
   =============================== */
:root {
  --primary: #5040ae;
  --primary-hover: #3b2f96;
  --text-dark: #111827;
  --text-gray: #6b7280;
  --bg-light: #ffffff;
  --bg-off-white: #f9fafb;
  --border-color: #e5e7eb;
  --container-width: 1200px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--bg-light);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===============================
   2. UTILITIES
   =============================== */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .container { padding: 0 2rem; }
}

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

.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary);
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  z-index: 10000;
  transition: top 0.2s;
  text-decoration: none;
}
.skip-link:focus { top: 6px; }

/* ===============================
   3. TYPOGRAPHY
   =============================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.5em;
  color: var(--text-dark);
}

p { margin-bottom: 1em; color: var(--text-gray); }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: var(--primary-hover); text-decoration: underline; }

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--text-dark);
}

/* ===============================
   4. 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(0,0,0,0.05);
  transition: box-shadow 0.3s ease;
}

.nav { padding: 0.75rem 0; }

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

.nav-brand { display: flex; align-items: center; }
.nav-logo img { width: 150px; height: 40px; display: block; }

.nav-menu { display: flex; align-items: center; gap: 2rem; }
.nav-list { display: flex; align-items: center; gap: 1.5rem; list-style: none; }
.nav-link { color: var(--text-dark); font-weight: 500; font-size: 0.95rem; }
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--primary); }

/* Dropdown */
.nav-item { position: relative; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  padding: 0.5rem 0;
  display: none;
  z-index: 1100;
}
.nav-item.dropdown.open .dropdown-menu { display: block; animation: fadeIn 0.2s ease; }
.dropdown-link { display: block; padding: 0.6rem 1rem; color: var(--text-dark); }
.dropdown-link:hover { background: var(--bg-off-white); color: var(--primary); }

/* Mobile Hamburger */
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; }
.hamburger { width: 24px; height: 2px; background: var(--text-dark); position: relative; display: block; transition: 0.3s; }
.hamburger::before, .hamburger::after {
  content: ''; position: absolute; left: 0; width: 100%; height: 2px; background: inherit; transition: 0.3s;
}
.hamburger::before { top: -8px; }
.hamburger::after { top: 8px; }

/* Language Selector */
.language-selector select {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ===============================
   5. FOOTER
   =============================== */
.footer {
  background: #111827;
  color: #9ca3af;
  padding: 3rem 0;
  margin-top: auto;
}
.footer-title { color: #fff; font-size: 1.25rem; margin-bottom: 1rem; }
.footer-subtitle { color: #fff; font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.footer-description { font-size: 0.9rem; margin-bottom: 1.5rem; }
.footer a { color: #9ca3af; transition: color 0.2s; }
.footer a:hover { color: #fff; text-decoration: none; }

.footer-content {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-links { list-style: none; font-size: 0.9rem; }
.footer-links li { margin-bottom: 0.5rem; }

.social-links { display: flex; gap: 1rem; }
.social-link { font-size: 1.2rem; }

.footer-bottom {
  border-top: 1px solid #1f2937;
  padding-top: 1.5rem;
  font-size: 0.875rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ===============================
   6. RESPONSIVE
   =============================== */
@media (max-width: 900px) {
  .footer-content { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-menu {
    position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; flex-direction: column; align-items: flex-start;
    padding: 1.5rem; gap: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: none;
  }
  .nav-menu.active { display: flex; }
  .nav-list { flex-direction: column; width: 100%; gap: 0; }
  .nav-item { width: 100%; padding: 0.5rem 0; border-bottom: 1px solid var(--bg-off-white); }
  .dropdown-menu { position: static; border: none; box-shadow: none; padding-left: 1rem; margin-top: 0.5rem; background: var(--bg-off-white); }
  
  .footer-content { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .footer-bottom-links { display: flex; justify-content: center; gap: 1rem; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* ===========================
   Resources dropdown (header)
   =========================== */

.nav-item.dropdown {
  position: relative;
}

/* Little arrow on "Resources" */
.nav-item .dropdown-toggle::after {
  content: "▾";
  margin-left: 0.25rem;
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Base dropdown panel (desktop) */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  margin-top: 0.25rem;
  padding: 0.5rem 0;
  background: #0b1120;           /* dark like header */
  border-radius: 0.75rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 30;
}

.dropdown-menu li {
  list-style: none;
}

.dropdown-link {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  color: #e5e7eb;
  text-decoration: none;
  white-space: nowrap;
}

.dropdown-link:hover,
.dropdown-link[aria-current="page"] {
  background: rgba(148, 163, 184, 0.15);
  color: #f9fafb;
}

/* Show dropdown on hover (desktop) */
@media (min-width: 769px) {
  .nav-item.dropdown:hover > .dropdown-menu {
    display: block; /* <--- THIS WAS MISSING */
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

/* Mobile behaviour:
   - Dropdown becomes inline under parent item
   - .open class (added in JS) controls visibility
*/
@media (max-width: 768px) {
  .dropdown-menu {
    position: static;
    min-width: 0;
    margin-top: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0.5rem;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    display: none;                /* hidden by default */
  }

  .dropdown-menu.open {
    display: block;               /* shown when JS adds .open */
  }

  .dropdown-link {
    padding-left: 2.75rem;        /* indent under "Resources" */
  }
}
