/* ==========================================================================
   Header (from index-v3 header.nav): logo on the left, the pill nav exactly
   centred on the page, the language toggle on the right (a 1fr auto 1fr
   grid); full-screen menu below 1140px. "Become a Partner" is a menu link. Nav links and the language toggle are
   used repeatedly, so they change state instantly, without transitions.
   ========================================================================== */
.sentinel { position: absolute; inset-block-start: 0; inset-inline: 0; block-size: 80px; pointer-events: none; }

/* Over the hero the bar is transparent and the pill nav sits on a navy glass
   (it crosses both the navy panel and the photo); once scrolled (.is-solid)
   it becomes the solid navy bar. Colours run through these properties so the
   menu can reuse them. */
.nav {
  --focus: var(--cyan);
  --nav-fg: var(--white);
  --nav-link: var(--silver);
  --nav-muted: var(--text-muted-dark);
  --nav-glass: var(--navy-scrim);
  --nav-line: var(--line-dark);
  --nav-hover: var(--line-dark-soft);
  --lang-on-bg: var(--white);
  --lang-on-fg: var(--navy-800);
  position: fixed; inset-block-start: 0; inset-inline: 0; z-index: var(--z-nav);
  color: var(--nav-fg);
  transition: background-color var(--dur-hover) ease, box-shadow var(--dur-hover) ease;
}
.nav.is-solid { background: var(--navy-800); box-shadow: 0 10px 30px -18px var(--navy-900); }
/* Equal side columns keep the menu on the page's centre line */
.nav__inner {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  block-size: var(--nav-h);
}
.nav__inner > nav { grid-column: 2; }

/* The logo on its own, transparent background, no container */
.brand { display: inline-flex; justify-self: start; grid-column: 1; border-radius: var(--radius-sm); }
.brand img { inline-size: 96px; block-size: 96px; object-fit: contain; display: block; }
@media (max-width: 1024px) {
  .brand img { inline-size: 80px; block-size: 80px; }
}
@media (max-width: 767px) {
  .brand img { inline-size: 64px; block-size: 64px; }
  /* Phones: a little more room from the screen edges */
  .nav__inner { padding-inline: .35rem; }
}

.nav__pill {
  display: none; padding: 5px; gap: .15rem;
  border-radius: var(--radius-pill);
  background: var(--nav-glass); border: 1px solid var(--nav-line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.nav.is-solid .nav__pill { background: transparent; border-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.nav__pill a {
  display: block; padding: .5rem .9rem; border-radius: var(--radius-pill);
  font-size: .9rem; font-weight: 600; color: var(--nav-link);
}
.nav__pill a.is-active { color: var(--navy-900); background: var(--cyan); }
@media (hover: hover) and (pointer: fine) {
  .nav__pill a:not(.is-active):hover { color: var(--nav-fg); background: var(--nav-hover); }
}

.nav__end { display: flex; align-items: center; gap: .6rem; justify-self: end; grid-column: 3; }

/* Language toggle: two links between the EN and AR pages */
.lang {
  display: inline-flex; padding: 3px; border-radius: var(--radius-pill);
  background: var(--nav-glass); border: 1px solid var(--nav-line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.lang a {
  display: grid; place-items: center; min-inline-size: 44px; min-block-size: 34px; padding: .32rem .65rem;
  border-radius: var(--radius-pill);
  font-size: .78rem; font-weight: 700; color: var(--nav-link);
}
.lang a:lang(ar) { font-size: .9rem; line-height: 1.3; }
.lang a[aria-current="page"] { background: var(--lang-on-bg); color: var(--lang-on-fg); }
@media (hover: hover) and (pointer: fine) {
  .lang a:not([aria-current]):hover { color: var(--nav-fg); }
}

/* Menu button: two thin lines, no circle, that turn into an X (44px tap area) */
.nav-toggle {
  position: relative; display: inline-block; inline-size: 44px; block-size: 44px;
  margin-inline-end: -10px; /* the lines, not the tap area, line up with the page edge */
  background: none; border: 0; border-radius: var(--radius-sm); color: var(--nav-fg);
}
.nav-toggle span::before, .nav-toggle span::after {
  content: ""; position: absolute; inset-inline-start: 10px; inset-block-start: calc(50% - 1px);
  inline-size: 24px; block-size: 2px; border-radius: 2px; background: currentColor;
  transition: transform 250ms var(--ease-out);
}
.nav-toggle span::before { transform: translateY(-4px); }
.nav-toggle span::after { transform: translateY(4px); }
.nav-toggle[aria-expanded="true"] span::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { transform: rotate(-45deg); }

/* Full-screen menu: navy-900, fades in while the links slide up one after
   another. Only the links and the language toggle; the logo and the close
   button are the header's, which stays above the panel. */
.overlay {
  --focus: var(--cyan);
  --fg: var(--white);
  --nav-link: var(--silver);
  /* The language toggle at the bottom reads the bar's colours */
  --nav-fg: var(--white);
  --nav-glass: var(--navy-scrim);
  --nav-line: var(--line-dark);
  --lang-on-bg: var(--white);
  --lang-on-fg: var(--navy-800);
  --menu-pad: 24px;
  position: fixed; inset: 0; z-index: var(--z-menu);
  display: flex; flex-direction: column;
  padding: calc(var(--nav-h) + 1.5rem) var(--menu-pad) calc(1.5rem + env(safe-area-inset-bottom));
  background: var(--navy-900); color: var(--white);
  overflow-y: auto; overscroll-behavior: contain;
  opacity: 0; visibility: hidden;
  transition: opacity 250ms ease, visibility 0s 250ms;
}
/* Visible at once on open, so focus can move in straight away */
.overlay.is-open { opacity: 1; visibility: visible; transition: opacity 250ms ease; }
/* While the menu is open the bar takes the panel's colour and shows only the logo and the X */
body.menu-open .nav.is-solid { background: transparent; box-shadow: none; }
body.menu-open .nav__end .lang { visibility: hidden; }

.overlay__nav { flex: 1 0 auto; }
.overlay__nav li {
  opacity: 0; transform: translateY(14px);
  transition: opacity 200ms ease, transform 200ms ease;
}
.overlay.is-open .overlay__nav li {
  opacity: 1; transform: none;
  transition: opacity 300ms ease calc(80ms + var(--i, 0) * 40ms), transform 400ms var(--ease-out) calc(80ms + var(--i, 0) * 40ms);
}
/* 24px links, 16px apart (the padding keeps each one a 44px+ target) */
.overlay__nav a {
  display: flex; align-items: center; gap: .6rem; padding-block: .5rem;
  font-family: var(--font-head); font-size: 1.5rem; font-weight: 600; line-height: 1.2; letter-spacing: -.02em;
  color: var(--white);
}
/* Only the current page: cyan text and the small diamond */
.overlay__nav a.is-active { color: var(--cyan); }
.overlay__nav a.is-active::before { content: ""; flex: none; inline-size: 7px; block-size: 7px; background: var(--cyan); transform: rotate(45deg); }

.overlay__foot { flex: none; display: flex; padding-block-start: 1.5rem; }

@media (max-width: 479px) {
  .nav__end .lang { display: none; }
}
/* Touch: nav links and the language toggle are at least 44px tall */
@media (pointer: coarse) {
  .nav__pill a { display: flex; align-items: center; min-block-size: 44px; }
  .lang a { min-block-size: 44px; }
}
/* Short screens (landscape phones): the panel scrolls */
@media (max-height: 480px) {
  .overlay { padding-block-start: calc(var(--nav-h) + .5rem); }
}
@media (min-width: 1024px) {
  .nav__pill { display: flex; }
  .nav-toggle, .overlay { display: none; }
}
/* Reduced motion: the panel only fades; the links don't move */
@media (prefers-reduced-motion: reduce) {
  .nav, .nav-toggle span::before, .nav-toggle span::after { transition: none; }
  .overlay__nav li, .overlay.is-open .overlay__nav li { transform: none; transition: opacity 200ms ease; }
}

/* --- WordPress: the Site Logo block inside the brand slot ------------------ */
.brand .wp-block-site-logo, .brand .custom-logo-link { display: inline-flex; margin: 0; }
.brand img, .brand .custom-logo { inline-size: 96px; block-size: 96px; object-fit: contain; display: block; }
@media (max-width: 1024px) { .brand img, .brand .custom-logo { inline-size: 80px; block-size: 80px; } }
@media (max-width: 767px) { .brand img, .brand .custom-logo { inline-size: 64px; block-size: 64px; } }
.nav__pill a:lang(ar), .overlay__nav a:lang(ar) { font-family: var(--font-ar-head); }
/* The admin bar pushes the fixed header down for logged-in editors */
.admin-bar .nav { inset-block-start: var(--wp-admin--admin-bar--height, 32px); }
.admin-bar .overlay { padding-block-start: calc(var(--nav-h) + var(--wp-admin--admin-bar--height, 32px) + 1.5rem); }
/* Editor preview: the header sits in the flow, not fixed */
.alh-editor-block .nav { position: relative; background: var(--navy-800); }
.alh-editor-block .overlay, .alh-editor-block .sentinel, .alh-editor-block .skip { display: none; }
