/* =========================================================================
   MathsAcademy.ma — Redesign Design System
   Brand: blue primary, orange accent, robot mascot, wave footer (preserved)
   Original UI — not a recreation of the live site.
   ========================================================================= */

:root {
  /* Brand — kept intact from current site */
  --brand-blue: #2389D1;
  --brand-blue-600: #1A78BD;
  --brand-blue-700: #135C92;
  --brand-blue-900: #0E3A5E;
  --brand-orange: #F58220;
  --brand-orange-600: #E06A0F;

  /* Surfaces — softer, more whitespace */
  --bg: #FFFFFF;
  --bg-soft: #F4F8FC;     /* page-section alt */
  --bg-sky: #E8F2FA;      /* hero / banners */
  --bg-tint: #FAFCFE;
  --surface: #FFFFFF;
  --surface-2: #F7FAFD;

  /* Ink */
  --ink-900: #0C1A2B;
  --ink-700: #233649;
  --ink-500: #5A6C80;
  --ink-400: #8294A8;
  --ink-300: #B6C2D0;

  /* Lines */
  --line: #E3ECF4;
  --line-strong: #D2DEEA;

  /* Status */
  --success: #2BA66B;
  --warn:    #E0A500;
  --danger:  #D24545;

  /* Radius */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* Shadows — soft, layered */
  --sh-xs: 0 1px 2px rgba(15, 30, 50, 0.04), 0 1px 1px rgba(15, 30, 50, 0.03);
  --sh-sm: 0 2px 6px rgba(15, 30, 50, 0.05), 0 1px 2px rgba(15, 30, 50, 0.04);
  --sh-md: 0 8px 24px rgba(15, 30, 50, 0.07), 0 2px 6px rgba(15, 30, 50, 0.04);
  --sh-lg: 0 24px 60px rgba(15, 30, 50, 0.12), 0 6px 16px rgba(15, 30, 50, 0.06);
  --sh-orange: 0 10px 24px rgba(245, 130, 32, 0.28);
  --sh-blue: 0 10px 24px rgba(35, 137, 209, 0.25);

  /* Type scale (mobile-first; desktop ramps up) */
  --t-12: 12px;
  --t-13: 13px;
  --t-14: 14px;
  --t-15: 15px;
  --t-16: 16px;
  --t-18: 18px;
  --t-20: 20px;
  --t-24: 24px;
  --t-28: 28px;
  --t-32: 32px;
  --t-40: 40px;
  --t-48: 48px;
  --t-56: 56px;
  --t-72: 72px;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --s-20: 80px;
  --s-24: 96px;

  /* Container */
  --container: 1240px;
  --container-narrow: 980px;

  /* Type families */
  --font-sans: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "Tajawal", "Noto Naskh Arabic", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: "Plus Jakarta Sans", sans-serif;
}

/* RTL */
[dir="rtl"] {
  --font-sans: var(--font-ar);
  --font-display: var(--font-ar);
}

/* =========================================================================
   Launch-time visibility utilities
   Sections built but masked until real data is available
   ========================================================================= */
.is-hidden-launch {
  display: none !important;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink-900);
  background: var(--bg);
  font-size: var(--t-16);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
[dir="rtl"] body { line-height: 1.7; }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* Container */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--s-6);
}
.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-inline: auto;
  padding-inline: var(--s-6);
}
@media (max-width: 720px) {
  .container, .container-narrow { padding-inline: var(--s-5); }
}

/* =========================================================================
   HEADER (sticky, white, refined)
   Original layout: logo | nav | locale toggle | auth — much tighter than current
   ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  height: 72px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: var(--t-18);
  color: var(--ink-900);
}
.brand-mark {
  width: 40px;
  height: 40px;
  background-image: url('assets/mascot.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: transparent;
  border-radius: 0;
  box-shadow: none;
  display: block;
  /* Hide the placeholder M letter that may be inside */
  color: transparent;
  font-size: 0;
  position: relative;
}
.brand-mark::after { display: none; }
.brand-name { display: flex; flex-direction: column; line-height: 1; }
.brand-name b { font-weight: 800; }
.brand-name small { font-size: 10px; color: var(--ink-500); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 3px; }

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  margin-inline-start: var(--s-6);
}
.site-nav a {
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: var(--t-15);
  font-weight: 500;
  color: var(--ink-700);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, color .15s;
}
.site-nav a:hover { background: var(--bg-soft); color: var(--ink-900); }
.site-nav a.is-active { color: var(--brand-blue-700); background: var(--bg-sky); }
.site-nav .chev { font-size: 10px; opacity: 0.6; }

.header-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

/* Language toggle — segmented pill */
.lang-toggle {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
.lang-toggle button {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: var(--t-13);
  font-weight: 600;
  color: var(--ink-500);
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .2s, color .2s;
}
.lang-toggle button.is-active {
  background: white;
  color: var(--ink-900);
  box-shadow: var(--sh-xs);
}
.lang-flag {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  background: currentColor;
  display: inline-block;
  position: relative;
  overflow: hidden;
}
.lang-flag--ma { background: #C1272D; }
.lang-flag--ma::after { content: "★"; position: absolute; inset: 0; color: #006233; font-size: 9px; display: grid; place-items: center; }
.lang-flag--fr { background: linear-gradient(to right, #0055A4 0 33%, #fff 33% 66%, #EF4135 66% 100%); }

/* =========================================================================
   BUTTONS
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--t-15);
  border: 1px solid transparent;
  transition: transform .12s ease, box-shadow .2s ease, background .2s, color .2s, border-color .2s;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--sm { padding: 8px 14px; font-size: var(--t-14); }
.btn--lg { padding: 16px 28px; font-size: var(--t-16); }

.btn--primary {
  background: var(--brand-orange);
  color: white;
  box-shadow: var(--sh-orange);
}
.btn--primary:hover { background: var(--brand-orange-600); box-shadow: 0 14px 30px rgba(245,130,32,.36); }

.btn--secondary {
  background: var(--brand-blue);
  color: white;
  box-shadow: var(--sh-blue);
}
.btn--secondary:hover { background: var(--brand-blue-600); }

.btn--ghost {
  background: transparent;
  color: var(--ink-900);
  border-color: var(--line-strong);
}
.btn--ghost:hover { background: var(--bg-soft); border-color: var(--ink-300); }

.btn--soft {
  background: var(--bg-sky);
  color: var(--brand-blue-700);
}
.btn--soft:hover { background: #DCEAF6; }

.btn--icon {
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
}

/* Arrow ↗ glyph */
.btn .arr {
  display: inline-block;
  transition: transform .2s;
}
.btn:hover .arr { transform: translateX(3px); }
[dir="rtl"] .btn:hover .arr { transform: translateX(-3px) scaleX(-1); }
[dir="rtl"] .btn .arr { transform: scaleX(-1); }

/* =========================================================================
   GLOBAL TYPE
   ========================================================================= */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink-900);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
}
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4 { letter-spacing: 0; line-height: 1.35; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--bg-sky);
  color: var(--brand-blue-700);
  font-size: var(--t-12);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand-orange);
}

.section-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
}
.section-title .accent { color: var(--brand-orange); }
.section-lede {
  margin-top: var(--s-3);
  color: var(--ink-500);
  font-size: var(--t-18);
  max-width: 56ch;
}

/* =========================================================================
   FOOTER (wave + 4-col) — preserved feel
   ========================================================================= */
.footer-wave {
  display: block;
  width: 100%;
  height: 80px;
  background:
    radial-gradient(ellipse at 50% 100%, var(--brand-blue) 30%, transparent 70%),
    linear-gradient(to bottom, transparent 0%, var(--brand-blue) 90%);
  position: relative;
  margin-top: 60px;
}
.footer-wave::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 1200px 80px at 20% 100%, var(--brand-blue-600) 40%, transparent 60%),
    radial-gradient(ellipse 1400px 70px at 80% 100%, var(--brand-blue-600) 40%, transparent 60%);
  opacity: 0.6;
}

.site-footer {
  background: var(--brand-blue);
  color: white;
}
.site-footer__top {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr 1fr;
  gap: var(--s-10);
  padding: var(--s-12) 0 var(--s-10);
}
@media (max-width: 960px) {
  .site-footer__top { grid-template-columns: 1fr 1fr; gap: var(--s-8); }
}
@media (max-width: 540px) {
  .site-footer__top { grid-template-columns: 1fr; }
}
.site-footer h4 {
  color: white;
  font-size: var(--t-16);
  letter-spacing: -0.01em;
  margin-bottom: var(--s-4);
  font-weight: 700;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.site-footer a {
  color: rgba(255,255,255,0.85);
  font-size: var(--t-14);
  transition: color .15s;
}
.site-footer a:hover { color: white; text-decoration: underline; text-underline-offset: 3px; }
.site-footer p { color: rgba(255,255,255,0.85); font-size: var(--t-14); line-height: 1.7; }
.footer-brand .brand { color: white; }
.footer-brand .brand-name b { color: white; }
.footer-brand .brand-name small { color: rgba(255,255,255,0.7); }

.footer-social {
  display: flex;
  gap: 10px;
  margin-top: var(--s-5);
}
.footer-social a {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: grid; place-items: center;
  font-size: 14px;
  transition: background .2s, transform .2s;
}
.footer-social a:hover { background: rgba(255,255,255,0.22); transform: translateY(-2px); }

.site-footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding: var(--s-5) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-3);
  font-size: var(--t-13);
  color: rgba(255,255,255,0.75);
}
.site-footer__bottom .legal { display: flex; gap: var(--s-5); }

/* =========================================================================
   UTILITY
   ========================================================================= */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); } .gap-4 { gap: var(--s-4); }
.gap-5 { gap: var(--s-5); } .gap-6 { gap: var(--s-6); } .gap-8 { gap: var(--s-8); }
.mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); } .mt-6 { margin-top: var(--s-6); } .mt-8 { margin-top: var(--s-8); }
.mb-3 { margin-bottom: var(--s-3); } .mb-5 { margin-bottom: var(--s-5); } .mb-8 { margin-bottom: var(--s-8); }
.muted { color: var(--ink-500); }
.hidden-mobile { }
@media (max-width: 720px) { .hidden-mobile { display: none !important; } }
.hidden-desktop { display: none; }
@media (max-width: 720px) { .hidden-desktop { display: initial; } }

/* Math motif — dot grid utility */
.dotgrid {
  background-image: radial-gradient(circle, rgba(35,137,209,0.18) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* Subtle decorations */
.deco-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}

/* Card primitive */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-6);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
  border-color: var(--line-strong);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: var(--t-12);
  font-weight: 600;
  background: var(--bg-sky);
  color: var(--brand-blue-700);
}
.badge--orange { background: #FEEEDD; color: var(--brand-orange-600); }
.badge--green { background: #E1F5EA; color: var(--success); }

/* Section spacing */
section { position: relative; }
.section-pad { padding: var(--s-16) 0; }
.section-pad-sm { padding: var(--s-12) 0; }
@media (max-width: 720px) {
  .section-pad { padding: var(--s-12) 0; }
  .section-pad-sm { padding: var(--s-10) 0; }
}

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Selection */
::selection { background: var(--brand-orange); color: white; }
