/* =============================================================================
   layout.css — nav, footer, and the generic .section scaffold
   Logical properties throughout so RTL (default) / LTR mirror automatically.
   Breakpoint: 768px (mobile menu).
   ========================================================================== */

/* =====================================================================
   NAV
   ===================================================================== */
.nav-wrap {
  position: fixed;
  inset-block-start: var(--space-3);
  inset-inline: 0;
  z-index: var(--z-nav);
  display: flex;
  justify-content: center;
  padding-inline: var(--space-5);
  pointer-events: none; /* let the gutter pass clicks; nav itself re-enables */
}

.nav {
  pointer-events: auto;
  /* hug the content (no big empty gaps); nav-wrap centers it */
  width: auto;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding-block: var(--space-2);
  padding-inline: var(--space-4) var(--space-3);
  /* faint single-hue purple wash over the glass + tinted border (client: one
     brand colour, tonal — no purple→pink mix) */
  background-image: linear-gradient(
    100deg,
    color-mix(in srgb, var(--brand-primary) 12%, transparent),
    transparent 45%,
    color-mix(in srgb, var(--brand-primary) 9%, transparent)
  );
  border-color: color-mix(in srgb, var(--brand-primary) 20%, var(--glass-border));
}

/* brand at the start, menu centered, actions at the end */
.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);   /* wider gap so the logomark's purple square doesn't touch the wordmark */
  color: var(--text-primary);
  flex: 0 0 auto;
}
.nav__brand:hover { color: var(--text-primary); }

.nav__brand-mark {
  display: inline-flex;
  inline-size: 30px;
  block-size: 30px;
  flex: 0 0 auto;
}
.nav__brand-mark .logomark { inline-size: 100%; block-size: 100%; overflow: visible; }

/* static, stable mark in the header (no per-square breathing — it read as
   "jittery/broken" on the small nav logo). Hover pop on the whole mark stays. */
.nav__brand-mark .logomark__sq {
  transform-box: fill-box;
  transform-origin: center;
}
/* a little extra life on hover: the whole mark gives a soft pop */
.nav__brand:hover .nav__brand-mark { transform: scale(1.06) rotate(-3deg); transition: transform var(--dur) var(--ease-cinematic); }

.nav__brand-text {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
}
.nav__brand-ar {
  font-weight: 700;
  font-size: 0.98rem;
  /* the brand Arabic face has DEEP descenders (the final م of "برايم") — too
     little line-height let that tail touch the "P" of "Prime" below, so give
     the line plenty of room */
  line-height: 1.5;
  word-spacing: .2em;                /* clear gap between "مدارس" and "برايم" */
  color: var(--brand-primary);       /* purple — mirrors the wordmark */
}
.nav__brand-en {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 0.66rem;
  line-height: 1.1;
  letter-spacing: 0.06em;
  margin-block-start: .18em;         /* clearance under the Arabic descenders */
  color: var(--brand-secondary);     /* pink — mirrors the wordmark */
}

/* menu centered between brand and actions */
.nav__menu {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-inline: 0;
}
.nav__menu a {
  display: inline-block;
  padding: 6px var(--space-3);
  border-radius: 999px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  position: relative;
  transition: color var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}
.nav__menu a::after {
  content: "";
  position: absolute;
  inset-block-end: 1px;
  /* centre the bar in BOTH directions: span the link (inset-inline:0) then let
     auto margins centre the fixed-width bar. No translateX — that was physical
     while inset-inline flips in RTL, so the two fought and the bar drifted to
     one side in Arabic. Auto-margin centring is fully logical/dir-agnostic. */
  inset-inline: 0;
  margin-inline: auto;
  block-size: 2.5px;
  inline-size: 28%;               /* ALWAYS visible (not only on hover) */
  border-radius: 999px;
  background: var(--gradient-brand);
  transition: inline-size var(--dur) var(--ease-cinematic);
}
.nav__menu a:hover {
  color: var(--brand-primary);
  background: color-mix(in srgb, var(--brand-primary) 8%, transparent);
}
.nav__menu a:hover::after,
.nav__menu a[aria-current="page"]::after { inline-size: 62%; }

/* actions cluster at the end */
.nav__actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
}

/* ---------- HAMBURGER TOGGLE ---------- */
.nav__toggle {
  display: none; /* shown < 768px */
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  inline-size: 44px;
  block-size: 44px;
  padding: 0 11px;
  border-radius: 14px;
  flex: 0 0 auto;
}
.nav__toggle span {
  display: block;
  block-size: 2px;
  inline-size: 100%;
  border-radius: 2px;
  background: var(--text-primary);
  transition: transform var(--dur) var(--ease-cinematic),
              opacity var(--dur-fast) var(--ease-out);
  transform-origin: center;
}
/* hamburger -> X */
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =====================================================================
   NAV — MOBILE (< 768px): menu becomes a glass dropdown
   ===================================================================== */
@media (max-width: 768px) {
  .nav-wrap { inset-block-start: var(--space-3); }

  .nav {
    width: 100%;
    gap: var(--space-3);
    padding-inline: var(--space-4);
  }

  .nav__toggle { display: inline-flex; order: 3; }
  .nav__actions { order: 2; margin-inline-start: auto; }

  /* dropdown panel */
  .nav__menu {
    position: absolute;
    inset-block-start: calc(100% + var(--space-3));
    inset-inline: 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
    margin-inline: 0;
    padding: var(--space-4);
    border-radius: var(--radius-lg);

    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);

    /* hidden state */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.98);
    transform-origin: top center;
    transition:
      opacity var(--dur) var(--ease-out),
      transform var(--dur) var(--ease-cinematic),
      visibility 0s linear var(--dur);
  }

  /* JS sets aria-expanded on the toggle; CSS reacts via :has() with fallback. */
  .nav:has(.nav__toggle[aria-expanded="true"]) .nav__menu,
  .nav__menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition-delay: 0s;
  }

  .nav__menu a {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 1.05rem;
  }
  .nav__menu a::after { content: none; }
  .nav__menu a:hover {
    background: color-mix(in srgb, var(--brand-primary) 12%, transparent);
  }
}

@media (max-width: 768px) {
  @supports not (selector(:has(*))) {
    /* without :has(), JS toggles .is-open on .nav__menu (handled above) */
    .nav__menu { display: flex; }
  }
}

/* =====================================================================
   GENERIC SECTION SCAFFOLD
   ===================================================================== */
.section {
  position: relative;
  padding-block: clamp(1.75rem, 3.5vw, 3.25rem);
}

@media (max-width: 768px) {
  .section { padding-block: var(--space-5); }
}

/* section header block */
.section__head {
  max-width: 62ch;
  margin-inline: auto;
  margin-block-end: var(--space-4);
  text-align: center;
}

/* small brand-colored label with a logo-block accent */
.section__kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-block-end: var(--space-3);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-primary);
  background: color-mix(in srgb, var(--brand-primary) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand-primary) 22%, transparent);
}
/* the bullet accent (logo block) before the label text */
.section__kicker::before {
  content: "";
  inline-size: 10px;
  block-size: 10px;
  border-radius: var(--radius-block);
  background: var(--brand-primary);
  box-shadow: none;   /* client: no glow under the kicker square */
}
/* Arabic sits low in its line box → nudge the kicker square down to centre it.
   0.24em ≈ measured ink-centre offset (font metrics: the brand face's ascent
   sits ~0.27em above the line-box centre vs the visible ink). */
:where(html[lang="ar"], .lang-ar) .section__kicker::before { transform: translateY(0.24em); }
/* Arabic isn't uppercased; keep tracking modest */
.lang-ar .section__kicker,
html[lang="ar"] .section__kicker { text-transform: none; letter-spacing: 0.02em; }

.section__title {
  margin-block-end: 1.25rem;   /* more clearance to the content/cards below */
}
/* the brand Arabic face renders inter-word spaces tight AND has deep descenders
   — give heading words room, and enough line-height that the descenders don't
   crowd the cards beneath titles like "خمس قيم تبني الإنسان" */
.lang-ar .section__title { word-spacing: .12em; line-height: 1.4; }

.section__lead {
  max-width: 60ch;
  margin-inline: auto;
  color: var(--text-muted);
  font-size: clamp(1rem, 0.95rem + 0.4vw, 1.18rem);
}

/* =====================================================================
   FOOTER
   ===================================================================== */
/* =====================================================================
   FOOTER — branded dark close (consistent in both themes), 3-column.
   Light text is hard-set because the background is always the deep brand
   gradient, so it reads the same in light & dark.
   ===================================================================== */
.footer {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  margin-block-start: var(--space-6);
  padding-block: var(--space-6) 0;
  color: rgba(255, 255, 255, 0.78);
  background:
    radial-gradient(120% 130% at 100% 0%,
      color-mix(in srgb, var(--c-purple) 32%, transparent), transparent 55%),
    linear-gradient(180deg, var(--c-dpurple), var(--c-navy));
}
/* brand-gradient hairline along the very top edge */
.footer__accent {
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  block-size: 3px;
  background: var(--gradient-brand);
}
/* soft pink glow bleeding from a corner */
.footer__glow {
  position: absolute;
  inset-block-start: -34%;
  inset-inline-start: -8%;
  inline-size: 440px;
  block-size: 440px;
  border-radius: 50%;
  background: radial-gradient(circle,
    color-mix(in srgb, var(--c-pink) 30%, transparent), transparent 66%);
  filter: blur(24px);
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
}

.footer__inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--space-5);
  align-items: start;
  padding-block-end: var(--space-5);
}

/* brand column */
.footer__brand-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}
.footer__mark {
  display: inline-flex;
  inline-size: 40px;
  block-size: 40px;
  flex: none;
}
.footer__mark .logomark { inline-size: 100%; block-size: 100%; }
.footer__names { display: flex; flex-direction: column; line-height: 1.12; }
/* brand Arabic face has deep descenders → give the name line room so it doesn't
   crowd "Prime Schools" beneath it (same fix as the nav + loader lockups) */
.footer__name-ar { font-weight: 700; font-size: 1.05rem; line-height: 1.3; color: #fff; }
.footer__name-en {
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--c-lpurple);
  font-family: var(--font-en);
  /* explicit gap: line-height alone left the boxes touching (only half the
     line-height grows below the baseline), so the Arabic descenders crowded
     this line. A real margin clears them decisively. */
  margin-block-start: 0.4rem;
}
.footer__slogan {
  margin: var(--space-2) 0 0;
  max-width: 34ch;
  font-weight: 500;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.72);
}

/* link columns */
.footer__head {
  margin: 0 0 var(--space-3);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}
.footer__links,
.footer__social {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;              /* horizontal (client) */
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}
.footer__links a,
.footer__social a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: rgba(255, 255, 255, 0.74);
  font-weight: 500;
  transition: color var(--dur-fast) var(--ease-out);
}
.footer__links a:hover,
.footer__social a:hover { color: #fff; }

.footer__dot {
  inline-size: 9px;
  block-size: 9px;
  border-radius: var(--radius-block);
  background: var(--c-lpurple);
  flex: none;
  transition: background-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.footer__social a:hover .footer__dot {
  background: var(--c-yellow);
  box-shadow: 0 0 10px color-mix(in srgb, var(--c-yellow) 60%, transparent);
}

/* icon-only social buttons (client: icons only, horizontal row) */
.footer__social a.footer__ic {
  inline-size: 40px;
  block-size: 40px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.footer__ic svg { inline-size: 20px; block-size: 20px; display: block; }
.footer__social a.footer__ic:hover {
  background: var(--c-purple);
  color: #fff;
  transform: translateY(-2px);
}

.footer__phone {
  display: inline-block;
  margin-block-start: var(--space-3);
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  direction: ltr;
  unicode-bidi: isolate;
  transition: color var(--dur-fast) var(--ease-out);
}
.footer__phone:hover { color: var(--c-yellow); }

/* bottom bar */
.footer__bar { border-block-start: 1px solid rgba(255, 255, 255, 0.12); }
.footer__bar-inner {
  display: flex;
  align-items: center;
  /* keep content on the inline-START side — the WhatsApp launcher is fixed at
     the inline-END corner, so this guarantees no overlap in RTL or LTR. */
  justify-content: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding-block: var(--space-3);
}
/* back-to-top sits at the very start corner, copyright follows it */
.footer__totop { order: -1; }
.footer__copy {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
}
/* back-to-top — circular glass icon button */
.footer__totop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 42px;
  block-size: 42px;
  border-radius: 50%;
  color: #fff;
  background: color-mix(in srgb, var(--c-lpurple) 16%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform var(--dur) var(--ease-cinematic),
              background-color var(--dur) var(--ease-out),
              box-shadow var(--dur) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.footer__totop svg { inline-size: 20px; block-size: 20px; }
.footer__totop:hover {
  transform: translateY(-3px);
  background-image: var(--gradient-brand);
  border-color: transparent;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--c-purple) 50%, transparent);
}
.footer__totop:active { transform: translateY(-1px); }

@media (prefers-reduced-motion: reduce) {
  .footer__totop:hover, .footer__totop:active { transform: none; }
}

@media (max-width: 768px) {
  .footer { padding-block: var(--space-6) 0; }
  .footer__inner {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
  .footer__bar-inner { justify-content: center; text-align: center; }
}
