/* =========================================
   ROOT VARIABLES & GLOBAL STYLES
   ========================================= */
:root {
  --black: #000000;
  --white: #ffffff; /* Fallback shade for gradients */
  --grey: #2b2b2b;
  --muted: #666;
  --gold: #ffd700;
  --border-radius: 8px;
  --shadow-light: 0 2px 6px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.15);
  --transition: all 0.3s ease;
  --overlay-color: 247, 239, 230;   /* RGB of your overlay color */
  --overlay-opacity: 0.6;           /* Change this between 0 (invisible) and 1 (opaque) */
}

body {
  font-family: 'Cairo', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #000; /* Default black text for readability */
  margin: 0;
  padding: 0;
  direction: inherit; /* Follow HTML dir for LTR/RTL */
  overflow-x: hidden; /* Prevent horizontal scroll issues on mobile */
}

/* Force primary text to black across key elements (consolidated overrides) */
body,
body.index-page,
body.current-page,
body.past-page,
body.gallery-page,
body.team-page,
header,
section,
.intro-box,
.current-box, 
footer,
nav,
nav ul li a,
.footer-contact,
.footer-box,
.footer-social,
#newsletter-msg,
#page-title {
  color: #000 !important;
}

/* Ensure nav and footer links/icons are thematic and visible */
nav ul li a,
.footer-social a.social-icon {
  color: var(--black) !important;
}

.footer-social a.social-icon:hover {
  color: var(--grey) !important;
}

.footer-contact {
  color: #000000 !important;
}

/* =========================================
   BACKGROUNDS & OVERLAYS
   ========================================= */
body {
  background-image: url("background3.jpg");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  background-attachment: fixed;
}

/* Specific page backgrounds with semi-transparent overlays */
body.index-page,
body.current-page,
body.past-page,
body.gallery-page,
body.team-page,
body.privacy-page {
  background-image:
    linear-gradient(
      rgba(var(--overlay-color), var(--overlay-opacity)),
      rgba(var(--overlay-color), var(--overlay-opacity))
    ),
    url("background3.jpg");
  background-repeat: no-repeat, no-repeat;
  background-position: center center, center center;
  background-size: cover, cover;
  background-attachment: fixed, fixed;
  background-color: rgb(var(--overlay-color)); /* fallback if image fails */
}

/* Light white tint overlay for all pages */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.668);
  z-index: -1;
}

/* Increase contrast for content boxes */
section,
.intro-box,
.current-box,
.footer-box {
  background-color: rgba(255, 255, 255, 0.95);
  color: inherit;
}




/* Ensure footer icons visible on dark backgrounds */
.footer-social a.social-icon {
  color: inherit;
  opacity: 0.95;
}

/* =========================================
   NAVIGATION BAR (Enhanced Design - FIXED for Stickiness, Mobile, and Consistency)
   ========================================= */
nav {
  text-align: center;
  margin-top: 0;
  position: sticky; /* Primary: Sticky for better performance; uncomment below for always-fixed */
  position: fixed; 
  /* Fallback: sticky; */
  top: 0;
  left: 0; /* Ensure full-width positioning */
  width: 100%; /* Full width to prevent shrinkage */
  z-index: 1300; /* Higher than other elements for overlap prevention */
  background: #000000;
  backdrop-filter: blur(10px); /* Modern frosted effect */
  border-bottom: 0.1px solid rgba(0, 0, 0, 0.12);
  padding: 1.5rem 1rem; /* Consistent padding */
  box-shadow: var(--shadow-light);
  transition: var(--transition);
  /* FIXED: Force LTR for layout stability, center overall content */
  direction: ltr !important;
  display: flex;
  align-items: center;
  justify-content: center; /* Center the ul in nav */
  flex-wrap: wrap; /* Allow wrapping on very small screens */
  height: 96px !important; /* increased slightly */
  min-height: 96px;
  overflow: hidden; /* Hide any overflow */
  position: relative; /* For absolute logo */
}

body.team-page nav { /* FIXED: Ensure same height on teams page */
  height: 86px !important;
  min-height: 86px !important;
}

nav:hover {
  box-shadow: var(--shadow-medium);
}

/* FIXED: Scroll hide/show effect (if you have JS for this) */
.nav-hidden {
  transform: translateY(-100%); /* Slide up to hide on scroll down */
}

.nav-visible {
  transform: translateY(0); /* Show on scroll up/top */
}

/* FIXED: Logo - Absolute on visual left, bigger size */
.logo-link {
  position: absolute; /* Absolute to not affect centering */
  right: 1rem; /* move logo to physical right */
  top: 50%;
  transform: translateY(-50%);
  z-index: 11;
  display: block;
  padding: 0.25rem; /* Small padding for touch/click area */
  border-radius: var(--border-radius);
  transition: var(--transition);
  background: transparent; /* Inherit nav background */
  text-decoration: none; /* Ensure no underline */
}

.logo-link:hover {
  transform: translateY(-50%) scale(1.05); /* Subtle hover effect */
  box-shadow: var(--shadow-light);
}

.logo-img {
  height: 100px; /* FIXED: Bigger for visibility */
  width: auto; /* Maintain aspect ratio - prevents distortion */
  max-width: 120px; /* Prevent overflow on small screens */
  display: block;
  transition: var(--transition);
  object-fit: contain; /* Ensures clean scaling without cropping/distortion */
}

/* FIXED: Mobile refinements for logo - Bigger but scaled */
@media (max-width: 600px) {
  .logo-img {
    height: 50px; /* FIXED: Scaled but visible on mobile */
    max-width: 100px;
  }
  
  .logo-link {
    right: 0.75rem; /* Tighter margin on mobile */
    padding: 0.2rem;
  }
}

/* FIXED: Ensure logo stays on physical right in RTL */
[dir="rtl"] .logo-link {
  right: 1rem !important; /* Force physical right */
}

/* FIXED: Menu - Centered with space reserved for logo */
nav ul {
  display: flex;
  justify-content: center; /* FIXED: True centering in available space */
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2rem; /* Even spacing between links */
  flex: 1; /* Fill space */
  flex-wrap: wrap; /* Prevent wrapping */
  overflow-x: auto; /* Allow horizontal scroll if needed */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  /* FIXED: Reserve space for logo on right (prevents overlap, enables centering) */
  margin-right: 140px; /* physical right margin for logo space */
  max-width: calc(100% - 140px); /* Limit width to center properly */
  direction: inherit; /* Link text follows page dir */
  min-width: 0; /* Allow flex shrinking on mobile without breaking */
  list-style: none;
}

nav ul li {
  position: relative;
  flex-shrink: 0; /* Prevent shrinking */
}

nav ul li a {
  display: inline-block;
  padding: 0.5rem 1rem; /* FIXED: Larger for better touch targets (min 44px effective) */
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  border-radius: var(--border-radius);
  transition: var(--transition);
  position: relative; /* For underline effect */
  white-space: nowrap; /* Never break link text */
  direction: inherit; /* Text direction per page lang */
  min-height: 44px; /* Accessibility: Minimum touch target height */
  display: flex;
  align-items: center; /* Vertically center text in taller links */
}

nav ul li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  transition: var(--transition);
  transform: translateX(-50%);
}

nav ul li a:hover,
nav ul li a:focus {
  color: var(--grey);
  transform: translateY(-1px); /* Subtle lift */
  outline: none;
}

nav ul li a:hover::after,
nav ul li a:focus::after {
  width: 100%; /* Expand underline on hover */
}

/* White links on black nav */
nav { color: #fff; }                            /* base text color inside nav */
nav ul li a { color: #fff !important; }         /* override previous !important */
nav ul li a:visited { color: #fff !important; } /* visited state */
nav ul li a:hover { color: #ffd700 !important; }   /* hover state */
nav ul li a:focus { color: #fff !important; }   /* hover/focus state */
nav ul li a:active { color: #fff !important; }  /* active press state */

/* FIXED: Mobile refinements for nav - Consistent sizing, better centering */
@media (max-width: 600px) {
  .page-title { font-size: 1.2rem; margin: 1.25rem auto; }          /* smaller hero title */
  section, .intro-box { padding: 1.25rem; margin: 2rem 0.75rem; }    /* tighter content spacing */
  nav {
    height: 76px !important; /* slightly taller on mobile */
    min-height: 76px !important;
    padding: 1rem 0.75rem;
  }
  body.team-page nav { /* FIXED: Enforce on teams page too */
    height: 76px !important;
    min-height: 76px !important;
  }
  
  nav ul { 
    gap: 1rem; /* Slightly larger gap for touch */
    margin-right: 110px; /* FIXED: Smaller logo space on mobile for better centering */
    max-width: calc(100% - 110px);
  }
  nav ul li a,
  .lang-toggle {
    padding: 0.75rem 1rem; /* FIXED: Even larger for easy tapping (≥44px) */
    font-size: 1rem; /* Readable on small screens */
    min-height: 44px;
  }
  
  /* On very small screens, reduce further but keep functional */
  @media (max-width: 400px) {
    nav {
      height: 71px !important; /* maintain proportion on smallest phones */
      min-height: 71px !important;
      padding: 0.75rem 0.5rem;
    }
    body.team-page nav {
      height: 71px !important;
      min-height: 71px !important;
    }
    nav ul { 
      gap: 0.75rem;
      margin-right: 90px; /* FIXED: Even smaller space on right */
      max-width: calc(100% - 90px);
    }
    nav ul li a {
      padding: 0.5rem 0.75rem; /* Still tappable */
      font-size: 0.95rem;
      min-height: 44px;
    }
    .logo-img {
      height: 40px;
      max-width: 80px;
    }
  }
}

/* set Arabic / English fonts */
html[lang="ar"] body { font-family: 'Cairo', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
html[lang="en"] body { font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }

/* =========================================
   LANGUAGE TOGGLE & TO-TOP BUTTON
   ========================================= */
/* LANGUAGE TOGGLE — now styled as a footer control (not fixed) */
/* remove previous fixed positioning; keep compact button appearance */
.lang-toggle {
  position: static;       /* flow inside footer */
  display: inline-block;
  margin: 0.5rem 0 0 0;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.12);
  background: var(--white, #fff);
  cursor: pointer;
  box-shadow: var(--shadow-light);
  transition: var(--transition);
}

/* ensure a footer-specific layout so button sits nicely */
.footer-box .lang-toggle {
  align-self: center;
}

/* remove the old fixed top-right toggle rule if present (override) */
.lang-toggle[style] { /* no-op override to avoid inline styles from persistently fixing it */ }

#to-top {
  position: fixed;
  bottom: 20px;
  right: 16px; /* Physical right */
  z-index: 1200;
  display: none;
  background: var(--black);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  box-shadow: var(--shadow-medium);
  font-size: 16px; /* Fixed invalid 'px' */
  transition: var(--transition);
}

#to-top:hover {
  background: var(--gold); /* FIXED: Use gold for hover (was incomplete) */
  transform: scale(1.05);
}

/* =========================================
   HEADER & CONTENT SECTIONS
   ========================================= */
header {
  padding: 2rem;
  text-align: center;
  max-width: 900px; /* Constrain and center */
  margin-inline: auto;
}

section {
  padding: 2rem;
  margin: 4rem 1rem 2rem 1rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-medium);
  direction: inherit;
  text-align: start; /* Aligns to logical start (LTR: left, RTL: right) */
  max-width: 900px; /* Constrain and center */
  margin-inline: auto;
}

.intro-box {
  background-color: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid #ddd !important;
  border-radius: 10px !important;
  padding: 2rem !important;
  margin: 3rem auto !important;
  max-width: 800px !important;
  box-shadow: var(--shadow-medium) !important;
  font-size: 1.2rem !important;
  line-height: 2rem !important;
  direction: inherit !important;
  text-align: start !important;
}

.current-box p {
  background-color: rgb(255, 255, 255);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  display: inline-block;
} 

.um-pic img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 16px; /* Optional: adds a soft corner */
  object-fit: cover;
}
.um-pic {
  max-width: 600px; /* Controls image width */
  margin: 0 auto;    /* Centers the image */
  padding: 1rem 0;   /* Adds spacing above/below */
}
#page-title {
  display: inline-block;
  background-color: #ffffff;
  border: 2px solid #ffffff;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 2.8rem;
  font-weight: bold;
  font-family: 'Amiri', serif;
  margin: 2rem auto;
  text-align: center;
  box-shadow: var(--shadow-medium);
}

/* Video Wrapper */
.video-wrapper {
  max-width: 100%;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1rem auto;
  position: relative;
  overflow: hidden;
  background: transparent;
  max-width: 780px; /* Tighter cap for video */
}

.video-wrapper iframe,
.video-wrapper video {
  width: 100%;
  height: 100%;
  display: block;  border: 0;
}

@media (min-height: 800px) {
  .video-wrapper {
    max-height: 70vh;
  }
}

/* =========================================
   FOOTER (continued)
   ========================================= */
.footer-box {
  background-color: rgba(255, 255, 255, 0.97);
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  padding: 1rem;
  margin: 2rem auto;
  max-width: 600px;
  text-align: center;
  box-shadow: var(--shadow-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  max-width: 900px; /* Constrain and center */
  margin-inline: auto;
}

/* Hide any decorative pseudo-elements */
.footer-box::before,
.footer-box::after,
.footer-social::before,
.footer-social::after {
  display: none !important;
  content: none !important;
  background: none !important;
  width: 0 !important;
  height: 0 !important;
  pointer-events: none !important;
}

.footer-social {
  padding-inline: 0 !important;
  position: relative;
  z-index: 0;
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  margin: 0;
  direction: ltr !important; /* Force LTR for icons */
  unicode-bidi: isolate-override;
}

.footer-contact {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  font-size: 0.9rem;
  margin: 0;
  direction: ltr !important; /* Keep icon left visually */
  unicode-bidi: isolate-override;
}

.footer-contact i,
.footer-social i {
  display: inline-block;
  unicode-bidi: isolate;
}

.footer-social a.social-icon {
  margin: 0 0.5rem;
  font-size: 1.2rem;
  text-decoration: none;
  transition: var(--transition);
}

/* Newsletter Styles (Consolidated) */
#newsletter-msg {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-weight: 700;
}

.newsletter-icon,
#newsletter-msg .fa,
#newsletter-msg .fab,
#newsletter-msg .fas,
#newsletter-msg svg.newsletter-icon {
  color: var(--white) !important;
  fill: currentColor !important;
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: middle;
}

/* Newsletter Submit Button Icon */
#newsletter-submit .btn-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  margin-inline-end: 0.5rem; /* Logical spacing for RTL/LTR */
  color: #ffffff;
  fill: currentColor;
}

#newsletter-submit .btn-text {
  vertical-align: middle;
}

/* =========================================
   GALLERY & TEAM SECTIONS
   ========================================= */
.gallery-section {
  padding: 20px;
  background-color: #f9f9f9;
  text-align: center;
}

.gallery-section h2 {
  font-size: 2rem;
  margin-bottom: 15px;
}

.gallery-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  direction: ltr !important; /* Preserve order */
}

.gallery-item {
  max-width: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gallery-item img {
  width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-light);
  transition: transform 0.3s ease;
}

.gallery-item img:hover {
  transform: scale(1.05);
}

.caption {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.team-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 2rem;
  max-width: 900px;
  margin: auto;
}

.team-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1.5rem;
  align-items: start;
  background-color: #f9f9f9;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: var(--shadow-light);
}

.team-info {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.team-card img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #ccc;
  box-shadow: var(--shadow-light);
  margin: 0;
  transition: transform 0.3s ease;
}

.team-card img:hover {
  transform: scale(1.05);
}

.team-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.3rem;
}

.team-card .role {
  font-weight: bold;
  color: var(--muted);
  margin: 0 0 0.5rem 0;
}

.team-card p {
  font-size: 1rem;
  color: #444;
  line-height: 1.6;
  margin: 0;
}

/* HAMBURGER / MENU TOGGLE */
.menu-toggle {
  display: none;               /* shown on small screens via media query */
  background: transparent;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  padding: 6px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 12px; /* physical left for hamburger */
  top: 50%;
  transform: translateY(-50%);
  z-index: 1201;               /* above the nav content */
  box-shadow: none;
}

/* three bars inside the button */
.menu-toggle .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  margin: 3px 0;
  border-radius: 2px;
  transition: transform .24s ease, opacity .18s ease;
}

/* animate to "X" when nav open */
nav.open .menu-toggle .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
nav.open .menu-toggle .bar:nth-child(2) { opacity: 0; transform: scaleX(0.8); }
nav.open .menu-toggle .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* MOBILE: show hamburger and dropdown panel */
@media (max-width: 900px) {
  /* show the hamburger */
  .menu-toggle { display: flex; }

  /* hide any mobile-select if present */
  .mobile-nav { display: none !important; }

  /* default: hide the horizontal list */
  nav#main-menu ul { display: none !important; }

  /* when menu is opened, show a vertical dropdown panel */
  nav#main-menu.open ul {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.96);
    padding: 12px;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    z-index: 1200;
  }

  nav#main-menu.open ul li {
    width: 100%;
  }

  nav#main-menu.open ul li a {
    display: block;
    padding: 12px 14px;
    color: #fff !important;
    font-size: 1rem;
    border-radius: 8px;
    white-space: normal;
  }

  /* keep the logo visible and not overlapped by the panel */
  .logo-link { z-index: 1210; }
}

/* When the mobile menu is opened allow the dropdown to escape the nav box and be visible */
nav#main-menu.open {
  overflow: visible !important; /* allow the panel to show outside the nav */
  z-index: 1300;                /* ensure it sits above other content */
}

/* move the panel a touch lower so it doesn't sit flush against the nav */
nav#main-menu.open ul {
  top: calc(100% + 6px); /* small gap under the bar */
  left: 0;
  right: 0;
  /* keep previously defined styles (background, padding, etc.) */
}

/* Sidebar Integration (from previous context; preserved) */
.menu-toggle {
  display: none; /* Hidden by default; shown on mobile */
}

.sidebar {
  transform: translateX(0); /* Visible by default */
}

@media (max-width: 900px) {
  .menu-toggle {
    display: block;
  }
  
  .sidebar {
    transform: translateX(-110%); /* Hide off-screen */
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  body {
    padding-inline-start: 0;
    padding-inline-end: 0;
  }
}

/* 1) Constrain main content width and center it */
header,
.intro-box,
section,
.current-box,
.footer-box {
  max-width: 900px;           /* cap overall content width */
  margin-inline: auto;        /* center in both RTL and LTR */
}

/* 2) Constrain the video specifically, keep it responsive */
.video-wrapper {
  width: 100%;                /* responsive within the cap */
  max-width: 780px;           /* tighter cap for the video area */
  aspect-ratio: 16 / 9;       /* maintain 16:9 */
  margin: 1rem auto;          /* center the block */
  overflow: hidden;           /* clean edges if any overflow */
}

/* 3) The iframe fills the wrapper’s box */
.video-wrapper iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* 4) Optional: lower the cap on short viewports */
@media (min-height: 800px) {
  .video-wrapper { max-height: 70vh; } /* already in your CSS, keep it */
}

/* 1) Lock the navbar height */
nav {
  height: 86px;              /* tad taller */
  padding: 1.5rem 1rem;      /* Adjusted for bigger bar */
  overflow: hidden;          /* hide any overflow */
}

/* 2) Prevent links from wrapping (desktop & mobile) */
nav ul {
  flex-wrap: nowrap;         /* keep items on one line */
  overflow-x: auto;          /* allow horizontal scroll if needed */
  justify-content: center;   /* FIXED: Center alignment */
  gap: 2rem;                 /* spacing */
}

/* 3) Tidy up links for all viewports */
nav ul li a {
  padding: 0.5rem 1rem;      /* leaner touch targets */
  white-space: nowrap;       /* never break link text */
  font-size: 1.1rem;         /* consistent sizing */
}

/* 4) Optional: further shrink on small phones */
 @media (max-width: 400px) {
  nav {
    height: 71px;            /* maintain proportion on smallest phones */
  }
  nav ul {
    gap: 0.5rem;
  }
  nav ul li a {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
  }
 }

 /* Tie in with headline/current-box mobile fixes */
 #page-title { 
   font-size: 1.8rem !important; /* From earlier update */
 }
 
 .current-box {
   font-size: 1rem;
   padding: 1.5rem 1rem;
 }
 
 .current-box p {
   font-size: 1rem;
   padding: 0.5rem 0.8rem;
 }
 

/* Ensure team-page consistency (from earlier fixes) */
body.team-page nav { 
  height: 86px !important; /* Desktop */
  min-height: 86px !important;
}
@media (max-width: 600px) {
  body.team-page nav { 
    height: 76px !important; /* slightly taller on mobile */
    min-height: 76px !important;
  }
}
@media (max-width: 400px) {
  body.team-page nav { 
    height: 71px !important; /* maintain proportion on smallest phones */
    min-height: 71px !important;
  }
}

/* make box-sizing predictable so widths/calcs don't overflow */
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

/* Prevent media from growing wider than their containers */
img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
  display: block;
}

/* always hide legacy mobile-select (we use hamburger) */
.mobile-nav { display: none !important; }

/* Mobile adjustments to avoid any horizontal overflow */
@media (max-width: 900px) {
  /* reduce reserved logo space so nav fits on very narrow screens */
  nav#main-menu ul {
    margin-right: 12px !important;      /* significantly smaller reserve */
    max-width: calc(100% - 24px) !important;
    padding-inline: 8px;                /* small padding to avoid touching edges */
    overflow: visible;                  /* allow wrapped items but avoid scroll */
  }

  /* ensure the dropdown panel and other absolute elements cannot force page width */
  nav#main-menu.open,
  nav#main-menu.open ul,
  nav#main-menu {
    left: 0;
    right: 0;
    width: 100%;
  }

  /* ensure no child uses min-width greater than viewport */
  nav#main-menu ul li,
  nav#main-menu ul li a {
    min-width: 0;
    word-break: break-word;             /* allow long labels to wrap */
  }

  /* reduce large paddings that might add to width on tiny screens */
  header, section, .intro-box, .current-box, .footer-box {
    padding-inline: 0.75rem;
    margin-inline: 0.75rem;
  }
}

/* EXTRA SAFETY: prevent any accidental horizontal scroll on the root */
html, body { overflow-x: hidden; }

/* PRIVACY PAGE — make it visually consistent with other pages */
body.privacy-page {
  /* ...existing background rules kept via shared selector ... */
  direction: inherit;
}

/* strengthen privacy card, match intro-box and ensure it's above overlay */
.privacy-container {
  position: relative;
  z-index: 2;                /* above body::before overlay (which is -1) */
  max-width: 920px;
  margin: calc(86px + 1rem) auto 2.5rem; /* leave room for fixed nav and normal bottom spacing */
  padding: 2rem 1.25rem;
  background: rgba(255,255,255,0.98);
  border-radius: 12px;
  border: 1px solid #eee;
  box-shadow: var(--shadow-medium);
  color: #000;
}

/* ensure intro-box + privacy-container behave same on small screens */
@media (max-width: 600px) {
  .privacy-container { padding: 1rem; margin: calc(76px + 0.75rem) 0.75rem 1rem; }
}

