/* ===========================================================================
   Sisters Arabic - global header (inner pages).

   Carries the landing page's navbar aesthetic to every page that includes
   components/includes/header.php. The landing page itself (home_new.php) is
   NOT affected: it is a standalone document that ships assets/home/css/styles.css
   and never loads this file.

   SCOPING
   Every class is prefixed `sa-` and every rule is anchored to `.sa-header`.
   That matters because this stylesheet loads alongside Bootstrap 5 and the
   legacy assets/css/style.css, and three of the designer's original class
   names collide outright: `.main-nav` is the legacy Bootstrap navbar, and
   `.button` / `.brand` are generic. Renaming is what keeps the two systems
   from restyling each other.

   The design tokens are redeclared here (scoped to .sa-header) because the
   designer's :root block lives in styles.css, which inner pages do not load.
   =========================================================================== */

.sa-header {
  --sa-purple-900: #45315c;
  --sa-purple-800: #533a6b;
  --sa-purple-100: #eadff1;
  --sa-pink-500: #d86ca1;
  --sa-pink-600: #c34b83;
  --sa-gold-500: #e3aa5c;
  --sa-ink: #332841;
  --sa-white: #ffffff;
  --sa-container: 1240px;
  --sa-shadow-soft: 0 22px 58px rgba(58, 37, 83, 0.15);

  position: relative;
  z-index: 1030;          /* above Bootstrap's sticky/fixed elements */
  padding-top: 22px;
  padding-bottom: 22px;
  /* The pill is translucent and was designed against the hero's purple. Inner
     pages have no hero, so the band supplies the same backdrop - and flows
     into the dark `page-header` that inner pages render directly below. */
  background: linear-gradient(116deg, #79538b 0%, #6f4b86 45%, #533a6b 100%);
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.sa-header *,
.sa-header *::before,
.sa-header *::after { box-sizing: border-box; }

.sa-header a { text-decoration: none; }
.sa-header a:focus-visible,
.sa-header button:focus-visible {
  outline: 3px solid var(--sa-gold-500);
  outline-offset: 4px;
}

.sa-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;
}

/* --- the floating pill ---------------------------------------------------- */
.sa-header .sa-nav-wrap {
  display: grid;
  grid-template-columns: 250px 1fr auto;
  align-items: center;
  width: min(calc(100% - 48px), var(--sa-container));
  min-height: 78px;
  margin-inline: auto;
  padding: 10px 13px 10px 24px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 24px 24px 10px 24px;
  background: rgba(249, 247, 250, 0.94);
  box-shadow: 0 16px 44px rgba(58, 37, 83, 0.18);
  backdrop-filter: blur(18px);
}

.sa-header .sa-brand { display: inline-flex; align-items: center; min-height: 48px; }
.sa-header .sa-brand img { width: 226px; height: auto; }

/* --- links ---------------------------------------------------------------- */
.sa-header .sa-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 26px;
}

.sa-header .sa-nav a,
.sa-header .sa-nav .sa-dropdown-toggle,
.sa-header .sa-signin {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;                 /* icon-to-label; replaces the legacy mr-5 utility */
  min-height: 44px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--sa-ink);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

/* The pink underline sweep. Applied to top-level items only, so items inside
   the dropdown panel keep their own hover treatment. */
.sa-header .sa-nav > .sa-nav-item > a::after,
.sa-header .sa-nav > .sa-nav-item > .sa-dropdown-toggle::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 4px;
  height: 3px;
  border-radius: 999px;
  background: var(--sa-pink-500);
  transform: scaleX(0);
  transition: transform 180ms ease;
}
.sa-header .sa-nav > .sa-nav-item > a:hover::after,
.sa-header .sa-nav > .sa-nav-item > a.active::after,
.sa-header .sa-nav > .sa-nav-item > .sa-dropdown-toggle:hover::after,
.sa-header .sa-nav > .sa-nav-item[data-open="true"] > .sa-dropdown-toggle::after {
  transform: scaleX(1);
}

.sa-header .sa-signin:hover { color: var(--sa-pink-600); }
.sa-header .sa-nav-actions { display: flex; align-items: center; gap: 16px; }

/* --- CTA button ----------------------------------------------------------- */
.sa-header .sa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 0;
  border-radius: 16px 16px 6px 16px;
  padding: 0 20px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.sa-header .sa-btn:hover { transform: translateY(-2px); }
.sa-header .sa-btn-pink {
  color: var(--sa-white);
  background: var(--sa-pink-600);
  box-shadow: 0 12px 24px rgba(196, 55, 124, 0.25);
}
.sa-header .sa-btn-pink:hover { box-shadow: 0 17px 30px rgba(196, 55, 124, 0.36); }

/* --- dropdown ------------------------------------------------------------- */
.sa-header .sa-nav-item { position: relative; display: inline-flex; }

.sa-header .sa-caret {
  width: 11px; height: 11px;
  margin-left: 7px;
  fill: none; stroke: currentColor; stroke-width: 2.6;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform 180ms ease;
}
.sa-header .sa-nav-item[data-open="true"] .sa-caret { transform: rotate(180deg); }

.sa-header .sa-dropdown-menu {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  z-index: 40;
  display: grid;
  gap: 2px;
  min-width: 246px;
  margin: 0;
  padding: 10px;
  transform: translateX(-50%) translateY(-6px);
  border: 1px solid var(--sa-purple-100);
  border-radius: 18px 18px 6px 18px;
  background: var(--sa-white);
  box-shadow: var(--sa-shadow-soft);
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}
.sa-header .sa-nav-item[data-open="true"] .sa-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Keeps the pointer from falling through the gap between toggle and panel. */
.sa-header .sa-dropdown-menu::before {
  content: "";
  position: absolute;
  top: -14px; left: 0; right: 0;
  height: 14px;
}

.sa-header .sa-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 13px;
  border-radius: 12px;
  color: var(--sa-ink);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background 150ms ease, color 150ms ease;
}
.sa-header .sa-dropdown-menu a:hover,
.sa-header .sa-dropdown-menu a:focus-visible {
  color: var(--sa-pink-600);
  background: #f9f7fa;
}
.sa-header .sa-nav i,
.sa-header .sa-dropdown-menu a i { font-size: 1rem; line-height: 1; opacity: 0.85; }

/* --- hamburger ------------------------------------------------------------ */
.sa-header .sa-menu-button {
  display: none;
  place-items: center;
  width: 48px; height: 48px;
  border: 0; border-radius: 14px;
  background: var(--sa-purple-100);
  cursor: pointer;
}
.sa-header .sa-menu-button span:not(.sa-sr-only) {
  display: block;
  width: 22px; height: 2px; margin: 3px;
  border-radius: 999px;
  background: var(--sa-purple-900);
  transition: transform 180ms ease, opacity 180ms ease;
}

/* ===========================================================================
   Breakpoints mirror the designer's own: 900px and 620px.
   The handoff also hides .main-nav a:nth-child(4)/(5) at 1160px, which is
   tuned to the landing page's six links. This nav has three items, so that
   rule is deliberately NOT carried over - it would hide Courses.
   =========================================================================== */
@media (max-width: 1160px) {
  .sa-header .sa-nav-wrap { grid-template-columns: 220px 1fr auto; }
  .sa-header .sa-brand img { width: 200px; }
  .sa-header .sa-nav { gap: 17px; }
}

@media (max-width: 900px) {
  .sa-header .sa-nav-wrap {
    width: min(calc(100% - 32px), var(--sa-container));
    grid-template-columns: 1fr auto;
    padding: 9px 10px 9px 18px;
  }
  .sa-header .sa-menu-button { display: grid; grid-column: 2; grid-row: 1; }

  .sa-header .sa-nav {
    position: absolute;
    top: calc(100% + 10px);
    right: 16px; left: 16px;
    display: grid;
    gap: 3px;
    overflow: hidden;
    max-height: 0;
    border-radius: 20px 20px 8px 20px;
    padding: 0 15px;
    background: var(--sa-white);
    box-shadow: var(--sa-shadow-soft);
    opacity: 0;
    transition: max-height 220ms ease, opacity 180ms ease, padding 220ms ease;
  }
  .sa-header .sa-nav.open { max-height: 640px; padding-block: 14px; opacity: 1; }

  .sa-header .sa-nav-item { display: grid; }
  .sa-header .sa-nav > .sa-nav-item > a,
  .sa-header .sa-nav > .sa-nav-item > .sa-dropdown-toggle {
    display: flex;
    justify-content: center;
  }

  /* In the drawer the panel becomes an inline, always-laid-out sub-list so the
     absolute positioning above cannot push it off-screen. */
  .sa-header .sa-dropdown-menu {
    position: static;
    transform: none;
    min-width: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    display: none;
  }
  .sa-header .sa-nav-item[data-open="true"] .sa-dropdown-menu {
    display: grid;
    transform: none;
  }
  .sa-header .sa-dropdown-menu a { justify-content: center; }

  /* The designer hides .nav-actions entirely on mobile because the drawer
     repeats those links. This nav's CTA is the only way in to the portal, so
     it moves into the drawer instead of disappearing. */
  .sa-header .sa-nav-actions { display: none; }
  .sa-header .sa-nav .sa-nav-actions-mobile { display: grid; gap: 8px; margin-top: 10px; }
  .sa-header .sa-nav .sa-nav-actions-mobile .sa-btn { width: 100%; }
}

@media (min-width: 901px) {
  .sa-header .sa-nav .sa-nav-actions-mobile { display: none; }
}

@media (max-width: 620px) {
  .sa-header { padding-top: 12px; padding-bottom: 12px; }
  .sa-header .sa-nav-wrap {
    width: min(calc(100% - 24px), var(--sa-container));
    min-height: 69px;
    border-radius: 19px 19px 7px 19px;
  }
  .sa-header .sa-brand img { width: 185px; }
}

@media (prefers-reduced-motion: reduce) {
  .sa-header *,
  .sa-header *::after { transition: none !important; }
}
