/*
 * Masa Doors — Header & Footer
 * masa-hf.css
 * Design tokens: #0B1D3A navy | #A5AACD slate | #F2F5FC bg
 */

/* ═══════════════════════════════════════════════════════════════════════
   GLOBAL RESET FOR HEADER SPACE
═══════════════════════════════════════════════════════════════════════ */

:root {
  --mh-h: 72px;          /* header height desktop */
  --mh-h-mob: 60px;      /* header height mobile  */
  --mh-bg: #0B1D3A;
  --mh-gold: #A5AACD;        /* primary accent — slate */
  --mh-gold-hover: #8990b8;  /* darker slate for hover states */
  --mh-slate: #A5AACD;
  --mh-white: #F2F5FC;
  --mh-text: rgba(242,245,252,0.82);
  --mh-trans: 0.22s cubic-bezier(.4,0,.2,1);
}

/* Push page content below the fixed header */
body {
  padding-top: var(--mh-h) !important;
}

body.mh-no-scroll {
  overflow: hidden;
}

@media (max-width: 768px) {
  body {
    padding-top: var(--mh-h-mob) !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   HEADER BASE
═══════════════════════════════════════════════════════════════════════ */

.masa-header {
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  width: 100%;
  height: var(--mh-h);
  background: var(--mh-bg);
  z-index: 9999;
  transition: box-shadow var(--mh-trans), background var(--mh-trans);
  border-bottom: 1px solid rgba(165,170,205,0.12);
}

.masa-header.mh-scrolled {
  box-shadow: 0 4px 24px rgba(0,0,0,0.28);
  background: rgba(11,29,58,0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Inner wrap */
.mh-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
}

/* ── Logo wrapper ── */
.mh-logo-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Custom logo uploaded via customizer */
.mh-logo-wrap .custom-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: opacity var(--mh-trans);
}

.mh-logo-wrap .custom-logo-link:hover {
  opacity: 0.85;
}

.mh-logo-wrap .custom-logo {
  max-height: 48px;
  width: auto;
  display: block;
}

/* Text/SVG fallback logo (shown when no custom logo is uploaded) */
.mh-logo-fallback {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.mh-logo-icon {
  display: flex;
  width: 36px;
  height: 40px;
  flex-shrink: 0;
  transition: transform var(--mh-trans);
}

.mh-logo-fallback:hover .mh-logo-icon {
  transform: translateY(-2px);
}

.mh-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.mh-logo-name {
  font-family: 'Tajawal', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--mh-white);
  letter-spacing: 0;
}

.mh-logo-sub {
  font-family: 'Tajawal', sans-serif;
  font-size: 0.68rem;
  font-weight: 300;
  color: var(--mh-gold);
  letter-spacing: 0;
}

/* ── Desktop Nav (wp_nav_menu output) ── */
.mh-nav {
  flex: 1;
  display: flex;
  justify-content: center;
  margin: 0;
}

/* Reset WordPress default nav wrapper styles */
.mh-nav .mh-menu,
.mh-nav ul.mh-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.mh-nav .mh-menu > li {
  margin: 0;
  padding: 0;
}

.mh-nav .mh-menu > li > a {
  display: block;
  padding: 0.45rem 0.9rem;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--mh-text);
  text-decoration: none;
  border-radius: 4px;
  position: relative;
  transition: color var(--mh-trans);
}

/* Gold underline indicator */
.mh-nav .mh-menu > li > a::after {
  content: '';
  position: absolute;
  bottom: 2px;
  inset-inline-start: 0.9rem;
  inset-inline-end: 0.9rem;
  height: 2px;
  background: var(--mh-gold);
  border-radius: 2px;
  transform: scaleX(0);
  transition: transform var(--mh-trans);
  transform-origin: center;
}

.mh-nav .mh-menu > li > a:hover {
  color: var(--mh-white);
}

.mh-nav .mh-menu > li > a:hover::after {
  transform: scaleX(1);
}

/* Active / current page */
.mh-nav .mh-menu > li.current-menu-item > a,
.mh-nav .mh-menu > li.current-menu-ancestor > a,
.mh-nav .mh-menu > li.current_page_item > a,
.mh-nav .mh-menu > li.current_page_ancestor > a {
  color: var(--mh-white);
  font-weight: 700;
}

.mh-nav .mh-menu > li.current-menu-item > a::after,
.mh-nav .mh-menu > li.current-menu-ancestor > a::after,
.mh-nav .mh-menu > li.current_page_item > a::after,
.mh-nav .mh-menu > li.current_page_ancestor > a::after {
  transform: scaleX(1);
}

/* ── Chevron icon (shared desktop + mobile) ── */
.mh-chev {
  display: inline-flex;
  align-items: center;
  margin-inline-start: 0.28rem;
  vertical-align: middle;
  line-height: 1;
  pointer-events: none;
}

.mh-chev-svg {
  transition: transform var(--mh-trans);
  display: block;
}

/* Rotate chevron when submenu is open */
.mh-nav .mh-menu li.menu-item-has-children:hover > a .mh-chev-svg,
.mh-nav .mh-menu li.menu-item-has-children:focus-within > a .mh-chev-svg {
  transform: rotate(180deg);
}

.mh-drawer .mh-menu li.mh-sub-open > a .mh-chev-svg {
  transform: rotate(180deg);
}

/* ── Dropdown submenu — Desktop ── */
.mh-nav .mh-menu li {
  position: relative;
}

/* Submenu panel */
.mh-nav .mh-menu li > ul.sub-menu {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-start: 0;
  min-width: 190px;
  background: rgba(11,29,58,0.98);
  border: 1px solid rgba(165,170,205,0.18);
  border-radius: 8px;
  box-shadow: 0 10px 36px rgba(0,0,0,0.32);
  padding: 0.4rem 0;
  list-style: none;
  margin: 0;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.mh-nav .mh-menu li:hover > ul.sub-menu,
.mh-nav .mh-menu li:focus-within > ul.sub-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Submenu items */
.mh-nav .mh-menu li > ul.sub-menu > li > a {
  display: block;
  padding: 0.55rem 1.1rem;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.88rem;
  font-weight: 400;
  color: rgba(242,245,252,0.72);
  text-decoration: none;
  position: relative;
  transition: color var(--mh-trans), background var(--mh-trans), padding-inline-start var(--mh-trans);
  border-radius: 0;
}

.mh-nav .mh-menu li > ul.sub-menu > li > a::after {
  display: none; /* remove the underline bar from top-level */
}

.mh-nav .mh-menu li > ul.sub-menu > li:not(:last-child) > a {
  border-bottom: 1px solid rgba(165,170,205,0.08);
}

.mh-nav .mh-menu li > ul.sub-menu > li > a:hover {
  color: var(--mh-white);
  background: rgba(165,170,205,0.1);
  padding-inline-start: 1.4rem;
}

/* Active submenu item */
.mh-nav .mh-menu li > ul.sub-menu > li.current-menu-item > a {
  color: var(--mh-gold);
  font-weight: 600;
}

/* ── CTA button ── */
.mh-cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.52rem 1.3rem;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--mh-gold);
  text-decoration: none;
  border: 1.5px solid var(--mh-gold);
  border-radius: 6px;
  letter-spacing: 0;
  transition: background var(--mh-trans), color var(--mh-trans);
}

.mh-cta:hover,
.mh-cta.mh-active {
  background: var(--mh-gold);
  border-color: var(--mh-gold);
  color: var(--mh-bg);
}

/* ── Hamburger toggle ── */
.mh-toggle:hover,
.mh-toggle:focus-visible {
  background: rgba(165,170,205,0.1);
  outline: none;
}

.mh-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 4px;
  -webkit-tap-highlight-color: transparent;
  margin-inline-start: auto;
  flex-shrink: 0;
}

.mh-bar {
  display: block;
  height: 2px;
  background: var(--mh-white);
  border-radius: 2px;
  transition: width var(--mh-trans), transform var(--mh-trans), opacity var(--mh-trans);
}

.mh-bar:nth-child(1) { width: 24px; }
.mh-bar:nth-child(2) { width: 18px; }
.mh-bar:nth-child(3) { width: 24px; }

/* Open state */
.mh-toggle.mh-open .mh-bar:nth-child(1) {
  width: 22px;
  transform: translateY(7px) rotate(45deg);
}
.mh-toggle.mh-open .mh-bar:nth-child(2) {
  opacity: 0;
  width: 0;
}
.mh-toggle.mh-open .mh-bar:nth-child(3) {
  width: 22px;
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile drawer ── */
.mh-drawer {
  position: fixed;
  top: var(--mh-h);
  inset-inline-start: 0;
  width: 100%;
  background: var(--mh-bg);
  border-top: 1px solid rgba(165,170,205,0.15);
  padding: 1.5rem 2rem 2rem;
  transform: translateY(-110%);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1), opacity 0.25s ease;
  pointer-events: none;
  z-index: 9998;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

.mh-drawer.mh-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.mh-drawer-nav {
  display: block;
}

/* Reset WordPress menu styles in drawer */
.mh-drawer .mh-menu,
.mh-drawer ul.mh-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mh-drawer .mh-menu > li {
  margin: 0;
  padding: 0;
}

.mh-drawer .mh-menu > li > a {
  display: block;
  padding: 0.85rem 0;
  font-family: 'Tajawal', sans-serif;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--mh-text);
  text-decoration: none;
  border-bottom: 1px solid rgba(165,170,205,0.1);
  transition: color var(--mh-trans), padding-inline-end var(--mh-trans);
}

.mh-drawer .mh-menu > li > a:hover {
  color: var(--mh-white);
  padding-inline-end: 0.5rem;
}

/* Active in mobile */
.mh-drawer .mh-menu > li.current-menu-item > a,
.mh-drawer .mh-menu > li.current-menu-ancestor > a,
.mh-drawer .mh-menu > li.current_page_item > a {
  color: var(--mh-gold);
  font-weight: 700;
}

/* Mobile submenu */
.mh-drawer .mh-menu li {
  position: relative;
}

/* Parent link: secondary color + pointer */
.mh-drawer .mh-menu li.menu-item-has-children > a {
  cursor: pointer;
  color: var(--mh-gold);
}

.mh-drawer .mh-menu li.menu-item-has-children > a:hover {
  color: var(--mh-white);
}

/* When submenu is open — keep accent color */
.mh-drawer .mh-menu li.mh-sub-open > a {
  color: var(--mh-gold);
  font-weight: 600;
}

/* Mobile submenu list */
.mh-drawer .mh-menu li > ul.sub-menu {
  width: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
  background: rgba(165,170,205,0.05);
  border-bottom: 1px solid rgba(165,170,205,0.1);
  border-radius: 0 0 6px 6px;
}

.mh-drawer .mh-menu li > ul.sub-menu > li > a {
  display: block;
  padding: 0.7rem 0 0.7rem 1.5rem;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.92rem;
  font-weight: 400;
  color: rgba(242,245,252,0.65);
  text-decoration: none;
  border-bottom: 1px solid rgba(165,170,205,0.07);
  transition: color var(--mh-trans), padding-inline-end var(--mh-trans);
}

.mh-drawer .mh-menu li > ul.sub-menu > li > a:hover {
  color: var(--mh-white);
  padding-inline-end: 0.5rem;
}

.mh-drawer .mh-menu li > ul.sub-menu > li.current-menu-item > a {
  color: var(--mh-gold);
  font-weight: 600;
}

.mh-drawer-cta {
  display: inline-flex !important;
  margin-top: 1.4rem;
  padding: 0.65rem 2rem !important;
  background: var(--mh-gold);
  color: var(--mh-bg) !important;
  border-radius: 6px;
  font-weight: 700 !important;
  border-bottom: none !important;
  font-size: 0.95rem !important;
}

.mh-drawer-cta:hover {
  background: var(--mh-gold-hover) !important;
  padding-inline-end: 2rem !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE — HEADER
═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .mh-nav,
  .mh-cta {
    display: none;
  }
  .mh-toggle {
    display: flex;
  }
  .masa-header {
    height: var(--mh-h-mob);
  }
  .mh-drawer {
    top: var(--mh-h-mob);
  }
}

@media (max-width: 480px) {
  .mh-wrap {
    padding: 0 1.25rem;
  }
  .mh-logo-sub {
    display: none;
  }
  .mh-logo-name {
    font-size: 1.2rem;
  }
  .mh-logo-icon {
    width: 30px;
    height: 34px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   FOOTER BASE
═══════════════════════════════════════════════════════════════════════ */

.masa-footer {
  font-family: 'Tajawal', sans-serif;
  background: #0a1829;
  color: rgba(242,245,252,0.7);
  direction: rtl;
}

.mf-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Top section ── */
.mf-top {
  padding: 4rem 0 3rem;
  border-top: 2px solid var(--mh-gold);
}

.mf-top .mf-wrap {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

/* ── Footer logo ── */
.mf-logo-wrap {
  display: inline-flex;
  margin-bottom: 1.1rem;
}

/* Custom logo uploaded via customizer */
.mf-logo-wrap .custom-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: opacity var(--mh-trans);
}

.mf-logo-wrap .custom-logo-link:hover {
  opacity: 0.8;
}

.mf-logo-wrap .custom-logo {
  height: 60px;
  width: auto;
  max-width: 180px;
  display: block;
}

/* Text/SVG fallback */
.mf-logo-fallback {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.mf-logo-icon {
  display: flex;
  width: 34px;
  height: 38px;
  flex-shrink: 0;
}

.mf-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.mf-logo-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #F2F5FC;
}

.mf-logo-sub {
  font-size: 0.65rem;
  font-weight: 300;
  color: var(--mh-gold);
  letter-spacing: 0;
}

.mf-tagline {
  font-size: 0.88rem;
  font-weight: 300;
  line-height: 1.8;
  color: rgba(242,245,252,0.6);
  margin: 0 0 1.5rem;
}

/* ── Social icons ── */
.mf-social {
  display: flex;
  gap: 0.75rem;
}

.mf-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid rgba(165,170,205,0.3);
  color: rgba(242,245,252,0.6);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.mf-social-link svg {
  width: 16px;
  height: 16px;
}

.mf-social-link:hover {
  border-color: var(--mh-gold);
  color: var(--mh-gold);
  background: rgba(165,170,205,0.1);
}

/* ── Headings ── */
.mf-heading {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--mh-gold);
  margin: 0 0 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(165,170,205,0.2);
}

/* ── Links list ── */
.mf-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mf-links li a {
  font-size: 0.9rem;
  font-weight: 400;
  color: rgba(242,245,252,0.65);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.2s, gap 0.2s;
}

.mf-links li a::before {
  content: '←';
  font-size: 0.75rem;
  color: var(--mh-gold);
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 0.2s, transform 0.2s;
}

.mf-links li a:hover {
  color: #F2F5FC;
  gap: 0.65rem;
}

.mf-links li a:hover::before {
  opacity: 1;
  transform: translateX(0);
}

/* ── Contact list ── */
.mf-contact {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.mf-contact li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  font-size: 0.875rem;
  color: rgba(242,245,252,0.65);
  line-height: 1.5;
}

.mf-contact-icon {
  display: flex;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--mh-gold);
  opacity: 0.75;
}

.mf-contact-icon svg {
  width: 15px;
  height: 15px;
}

.mf-contact a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.mf-contact a:hover {
  color: var(--mh-gold);
}

/* ── Bottom bar ── */
.mf-bottom {
  border-top: 1px solid rgba(165,170,205,0.1);
  padding: 1.25rem 0;
}

.mf-bottom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.mf-copy,
.mf-built {
  font-size: 0.78rem;
  color: rgba(242,245,252,0.35);
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE — FOOTER
═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .mf-top .mf-wrap {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
  .mf-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .mf-top .mf-wrap {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .mf-top {
    padding: 2.5rem 0 2rem;
  }
  .mf-bottom-inner {
    flex-direction: column;
    text-align: center;
  }
  .mf-wrap {
    padding: 0 1.25rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   ELEMENTOR COMPATIBILITY
   Pages using elementor_header_footer template
═══════════════════════════════════════════════════════════════════════ */

/* Ensure Elementor stretched sections still go edge-to-edge */
.elementor-section-stretched {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  width: 100vw !important;
  margin-right: calc(-1 * (100vw - 100%) / 2) !important;
  margin-left:  calc(-1 * (100vw - 100%) / 2) !important;
}

/* Hello Elementor site-content reset */
.site-content,
#primary,
.site-main {
  padding-top: 0 !important;
  margin-top: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Ensure existing footer from Hello Elementor is hidden */
#site-footer.site-footer.dynamic-footer:not(.masa-footer) {
  display: none !important;
}
