/* ==========================================================================
   Phoenix Institute — marketing site
   One stylesheet serves both locales. Direction-sensitive rules use CSS
   logical properties (inline-start/end) so RTL works without a second file.
   ========================================================================== */

/* ---------- Design tokens ------------------------------------------------ */
:root {
  /* Brand — sampled from logo.png */
  --teal-900: #073B39;
  --teal-800: #0B4F4D;
  --teal-700: #0E7A76;
  --teal-600: #12908C;
  --teal-500: #19A29E;
  --teal-300: #7FCFCC;
  --teal-100: #D6F0EE;
  --teal-50:  #EDF9F8;

  --flame-600: #E2743A;
  --flame-500: #F0894F;
  --flame-300: #F7BE9B;
  --coral-500: #E15D5D;

  --cream-50: #FFFAE8;
  --cream-100: #FBF3DC;

  /* Semantic */
  --bg:            #FFFFFF;
  --bg-alt:        var(--cream-50);
  --bg-deep:       var(--teal-900);
  --surface:       #FFFFFF;
  --surface-2:     var(--teal-50);
  --border:        #E4E9E8;
  --border-strong: #CBD8D7;

  --text:      #10302F;
  --text-soft: #4B6564;
  --text-mute: #6E8483;
  --text-on-deep:      #EAF6F5;
  --text-on-deep-soft: #A9CDCB;

  --accent:       var(--teal-600);
  --accent-hover: var(--teal-700);
  --on-accent:    #FFFFFF;

  /* Type — Cairo carries Arabic, Plus Jakarta Sans carries Latin */
  --font-sans: "Plus Jakarta Sans", "Cairo", ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-ar:   "Cairo", "Segoe UI", Tahoma, ui-sans-serif, system-ui, sans-serif;

  /* Type scale */
  --step--1: clamp(.82rem, .79rem + .12vw, .89rem);
  --step-0:  clamp(1rem, .96rem + .2vw, 1.08rem);
  --step-1:  clamp(1.2rem, 1.12rem + .38vw, 1.42rem);
  --step-2:  clamp(1.45rem, 1.3rem + .72vw, 1.9rem);
  --step-3:  clamp(1.75rem, 1.5rem + 1.2vw, 2.5rem);
  --step-4:  clamp(2.1rem, 1.65rem + 2.1vw, 3.4rem);

  --radius:    14px;
  --radius-lg: 22px;
  --radius-xl: 30px;

  --shadow-sm: 0 1px 2px rgba(7, 59, 57, .06), 0 2px 6px rgba(7, 59, 57, .05);
  --shadow-md: 0 4px 10px rgba(7, 59, 57, .07), 0 12px 28px rgba(7, 59, 57, .07);
  --shadow-lg: 0 10px 24px rgba(7, 59, 57, .09), 0 28px 60px rgba(7, 59, 57, .1);
  --shadow-accent: 0 8px 22px rgba(18, 144, 140, .28);

  --wrap: 1160px;
  --gutter: clamp(1.15rem, 4vw, 2.5rem);
  --section-y: clamp(3.75rem, 8vw, 7rem);

  --ease: cubic-bezier(.22, .61, .36, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #071F1E;
    --bg-alt:        #0A2A28;
    --bg-deep:       #041413;
    --surface:       #0D2F2D;
    --surface-2:     #103936;
    --border:        #1D4744;
    --border-strong: #2A5B57;

    --text:      #E9F5F4;
    --text-soft: #B4D0CE;
    --text-mute: #8FB3B1;

    --accent:       var(--teal-500);
    --accent-hover: var(--teal-300);
    --on-accent:    #04211F;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, .45);
    --shadow-lg: 0 16px 44px rgba(0, 0, 0, .5);
    --shadow-accent: 0 8px 22px rgba(25, 162, 158, .3);
  }
}

/* ---------- Reset -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* `clip` rather than `hidden`: hidden would turn body into a scroll
     container, which breaks the sticky header in several browsers. */
  overflow-x: clip;
}

/* Arabic locale: Cairo first, slightly looser leading for legibility */
html[lang="ar"] body { font-family: var(--font-ar); line-height: 1.85; }

img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .22em; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { padding: 0; list-style: none; }

h1, h2, h3, h4 { line-height: 1.22; font-weight: 800; letter-spacing: -.015em; text-wrap: balance; }
html[lang="ar"] h1, html[lang="ar"] h2,
html[lang="ar"] h3, html[lang="ar"] h4 { letter-spacing: 0; line-height: 1.4; }
p { text-wrap: pretty; }

:where(a, button, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Layout primitives ------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); }
.section--alt { background: var(--bg-alt); }
.section--deep { background: var(--bg-deep); color: var(--text-on-deep); }

.skip-link {
  /* Centred with inset-inline + auto margins so it works in RTL too */
  position: absolute;
  inset-inline: 0;
  inset-block-start: -100px;
  width: max-content;
  margin-inline: auto;
  z-index: 999;
  padding: .7rem 1.25rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 700;
  text-decoration: none;
  transition: inset-block-start .2s var(--ease);
}
.skip-link:focus { inset-block-start: 0; }

/* ---------- Section headers --------------------------------------------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin-block-end: .9rem;
  padding: .38rem .95rem;
  border: 1px solid var(--teal-300);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--teal-700);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
html[lang="ar"] .eyebrow { letter-spacing: 0; text-transform: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .eyebrow { color: var(--teal-300); }
}
.section--deep .eyebrow {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .22);
  color: var(--teal-300);
}
.eyebrow::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--flame-500);
}

.section-head { max-width: 46rem; margin-block-end: clamp(2.25rem, 5vw, 3.5rem); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head h2 { font-size: var(--step-3); color: var(--text); }
.section--deep .section-head h2 { color: var(--text-on-deep); }
.section-head p {
  margin-block-start: 1rem;
  font-size: var(--step-1);
  color: var(--text-soft);
  font-weight: 400;
}
.section--deep .section-head p { color: var(--text-on-deep-soft); }

/* ---------- Buttons ------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  white-space: nowrap;
  padding: .9rem 1.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 700;
  font-size: var(--step-0);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease),
              background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn svg { flex: none; }

.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-accent); }
.btn--primary:hover { background: var(--accent-hover); }

.btn--flame {
  background: linear-gradient(120deg, var(--flame-500), var(--coral-500));
  color: #fff;
  box-shadow: 0 8px 22px rgba(225, 93, 93, .3);
}
.btn--flame:hover { filter: brightness(1.05); }

.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.section--deep .btn--ghost { border-color: rgba(255, 255, 255, .3); color: var(--text-on-deep); }
.section--deep .btn--ghost:hover { border-color: var(--teal-300); color: var(--teal-300); }

.btn--lg { padding: 1.05rem 2rem; font-size: var(--step-1); }

/* Mirror directional glyphs (arrows) when the document flips */
[dir="rtl"] .icon-flip { transform: scaleX(-1); }

/* ---------- Header ------------------------------------------------------- */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-block-end: 1px solid transparent;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.site-header.is-stuck { border-block-end-color: var(--border); box-shadow: var(--shadow-sm); }

.nav { display: flex; align-items: center; gap: 1rem; min-height: 4.5rem; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  margin-inline-end: auto;
}
.brand img { width: 42px; height: 42px; border-radius: 11px; }
.brand img { flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.12; white-space: nowrap; }
.brand-name { font-size: 1.05rem; letter-spacing: -.02em; }
.brand-sub {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-mute);
}
html[lang="ar"] .brand-name { letter-spacing: 0; }
html[lang="ar"] .brand-sub { letter-spacing: 0; text-transform: none; font-size: .74rem; }

.nav-links { display: flex; align-items: center; gap: .35rem; }
.nav-links a {
  padding: .5rem .7rem;
  border-radius: 9px;
  color: var(--text-soft);
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
  text-decoration: none;
  transition: color .18s var(--ease), background-color .18s var(--ease);
}
.nav-links a:hover { color: var(--accent); background: var(--surface-2); }
/* Current page marked for both sighted users and assistive tech */
.nav-links a[aria-current="page"] { color: var(--accent); font-weight: 700; }

.nav-actions { display: flex; align-items: center; gap: .6rem; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem .95rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  font-weight: 700;
  font-size: .9rem;
  text-decoration: none;
  transition: border-color .18s var(--ease), color .18s var(--ease);
}
.lang-switch:hover { border-color: var(--accent); color: var(--accent); }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: transparent;
  cursor: pointer;
}
.nav-toggle span {
  position: relative;
  width: 18px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: background-color .2s var(--ease);
}
.nav-toggle span::before, .nav-toggle span::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  width: 18px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s var(--ease);
}
.nav-toggle span::before { transform: translateY(-6px); }
.nav-toggle span::after  { transform: translateY(6px); }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after  { transform: rotate(-45deg); }

/* Raised from 940px when the nav grew to seven items: below this the row
   gets tight enough that the brand and link labels start wrapping. */
@media (max-width: 1100px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: fixed;
    inset-block-start: 4.5rem;
    inset-inline: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: .75rem var(--gutter) 1.5rem;
    background: var(--bg);
    border-block-end: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s var(--ease), transform .22s var(--ease), visibility .22s;
  }
  .nav-links.is-open { transform: translateY(0); opacity: 1; visibility: visible; }
  .nav-links a { padding: .85rem .4rem; font-size: 1.05rem; border-block-end: 1px solid var(--border); }
  .btn--header { display: none; }
}

/* ---------- Hero --------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3rem, 7vw, 5.5rem) clamp(3.5rem, 8vw, 6.5rem);
  background:
    radial-gradient(70ch 46ch at 12% -10%, var(--teal-50), transparent 62%),
    radial-gradient(60ch 40ch at 92% 4%, color-mix(in srgb, var(--flame-300) 34%, transparent), transparent 60%),
    var(--bg);
}
.hero::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block-end: 0;
  width: 100%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: center;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-copy .eyebrow, .hero-actions, .hero-meta { justify-content: center; }
  .hero-lede { margin-inline: auto; }
}

.hero h1 { font-size: var(--step-4); color: var(--teal-900); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero h1 { color: var(--text); }
}
.hero h1 .accent {
  background: linear-gradient(120deg, var(--flame-500), var(--coral-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lede {
  max-width: 34rem;
  margin-block-start: 1.25rem;
  font-size: var(--step-1);
  color: var(--text-soft);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .85rem; margin-block-start: 2rem; }
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.5rem;
  margin-block-start: 1.5rem;
  font-size: var(--step--1);
  color: var(--text-mute);
}
.hero-meta li { display: inline-flex; align-items: center; gap: .45rem; }
.hero-meta svg { color: var(--teal-500); flex: none; }

/* Phone mockup ------------------------------------------------------------ */
.device-stage { display: grid; place-items: center; position: relative; }
.device-stage::before {
  content: "";
  position: absolute;
  width: min(112%, 480px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--teal-300) 40%, transparent), transparent 66%);
  filter: blur(10px);
}
.device {
  position: relative;
  width: min(100%, 310px);
  padding: 11px;
  border-radius: 42px;
  background: linear-gradient(160deg, #23423F, #0C2523);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255, 255, 255, .1);
}
.device svg { border-radius: 32px; display: block; width: 100%; height: auto; }

/* ---------- Cards / features -------------------------------------------- */
.grid { display: grid; gap: clamp(1rem, 2.2vw, 1.5rem); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); }

.card {
  position: relative;
  padding: clamp(1.5rem, 2.6vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--teal-300); }
.card h3 { margin-block-end: .6rem; font-size: var(--step-1); }
.card p { color: var(--text-soft); font-size: .98rem; }

.card-icon {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  margin-block-end: 1.15rem;
  border-radius: 15px;
  background: linear-gradient(140deg, var(--teal-100), var(--teal-50));
  color: var(--teal-700);
  border: 1px solid var(--teal-300);
}
.card-icon--flame {
  background: linear-gradient(140deg, #FCE4D4, #FFF3EB);
  color: var(--flame-600);
  border-color: var(--flame-300);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card-icon {
    background: linear-gradient(140deg, #14514D, #103936);
    color: var(--teal-300);
    border-color: #1F5F5B;
  }
  :root:not([data-theme="light"]) .card-icon--flame {
    background: linear-gradient(140deg, #5A3423, #40251A);
    color: var(--flame-300);
    border-color: #6E4029;
  }
}

/* ---------- Steps -------------------------------------------------------- */
.steps {
  counter-reset: step;
  display: grid;
  gap: clamp(1.5rem, 2.6vw, 1.75rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 265px), 1fr));
}
.step {
  position: relative;
  padding: clamp(1.9rem, 2.8vw, 2.3rem) clamp(1.5rem, 2.6vw, 2rem) clamp(1.5rem, 2.6vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  inset-block-start: -20px;
  inset-inline-start: clamp(1.5rem, 2.6vw, 2rem);
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 13px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: var(--shadow-accent);
}
/* Arabic locale reads better with Arabic-Indic numerals */
html[lang="ar"] .step::before { content: counter(step, arabic-indic); }

.step h3 { margin-block-end: .5rem; font-size: var(--step-1); }
.step p { color: var(--text-soft); font-size: .98rem; }

/* ---------- Stats -------------------------------------------------------- */
.stats {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.stat {
  display: flex;
  flex-direction: column;
  padding: clamp(1.5rem, 3vw, 2.1rem);
  background: var(--bg-deep);
  text-align: center;
}
.stat dt { order: 2; font-size: var(--step--1); color: var(--text-on-deep-soft); }
.stat dd {
  order: 1;
  margin: 0 0 .3rem;
  font-size: var(--step-3);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--teal-300);
}

/* ---------- Video gallery ----------------------------------------------- */
.video-grid {
  display: grid;
  gap: clamp(1rem, 2.4vw, 1.6rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.video-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.video-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

/* Facade: a thumbnail + play button that swaps in the real iframe on click.
   Keeps YouTube's ~1MB of scripts off the initial page load (Core Web Vitals). */
.video-embed {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  background: linear-gradient(140deg, var(--teal-700), var(--teal-900));
}
.video-embed img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s var(--ease);
}
.video-embed:hover img { transform: scale(1.04); }
.video-embed iframe { width: 100%; height: 100%; border: 0; }

.video-embed::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(7, 59, 57, .5), transparent 55%);
  pointer-events: none;
  transition: opacity .3s var(--ease);
}
.video-embed.is-playing::after,
.video-embed.is-playing .play-btn { display: none; }

.play-btn {
  /* `inset:0 + margin:auto` centres in both axes regardless of writing
     direction. The inset-inline-start:50% + translateX(-50%) idiom does NOT:
     under RTL the offset resolves against the right edge while the transform
     still shifts left, landing the button off-centre. */
  position: absolute;
  inset: 0;
  margin: auto;
  display: grid;
  place-items: center;
  width: 66px; height: 66px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--flame-500), var(--coral-500));
  color: #fff;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .35);
  transition: transform .25s var(--ease);
  pointer-events: none;
}
.video-embed:hover .play-btn { transform: scale(1.08); }
[dir="rtl"] .play-btn svg { transform: scaleX(-1); }

/* Shown when the YouTube thumbnail fails to load (e.g. placeholder IDs) */
.video-fallback {
  position: absolute; inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--teal-600), var(--teal-900));
}
.video-fallback img { width: 42%; max-width: 118px; height: auto; object-fit: contain; opacity: .92; }

.video-body { padding: 1.15rem 1.35rem 1.4rem; }
.video-body h3 { font-size: 1.08rem; margin-block-end: .35rem; }
.video-body p { font-size: .93rem; color: var(--text-mute); }

/* ---------- Download ----------------------------------------------------- */
.download-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
  padding: clamp(1.8rem, 4vw, 3.25rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.dl-badges { display: flex; flex-wrap: wrap; gap: .6rem; margin-block-start: 1.5rem; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .85rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--text-soft);
}
.badge strong { color: var(--text); font-weight: 800; }

.install-steps { display: grid; gap: .9rem; margin-block-start: 1.5rem; }
.install-steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .85rem;
  align-items: start;
  font-size: .97rem;
  color: var(--text-soft);
}
.install-steps .num {
  display: grid;
  place-items: center;
  width: 27px; height: 27px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--teal-300);
  color: var(--teal-700);
  font-size: .85rem;
  font-weight: 800;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .install-steps .num { color: var(--teal-300); }
}

.note {
  display: flex;
  gap: .75rem;
  margin-block-start: 1.5rem;
  padding: .95rem 1.15rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border-inline-start: 3px solid var(--flame-500);
  font-size: .93rem;
  color: var(--text-soft);
}
.note svg { flex: none; color: var(--flame-600); margin-block-start: .25rem; }

/* ---------- FAQ ---------------------------------------------------------- */
.faq { display: grid; gap: .8rem; max-width: 52rem; margin-inline: auto; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.faq details[open] { border-color: var(--teal-300); box-shadow: var(--shadow-sm); }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.35rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex: none;
  width: 10px; height: 10px;
  margin-block-start: -4px;
  border-inline-end: 2px solid var(--text-mute);
  border-block-end: 2px solid var(--text-mute);
  transform: rotate(45deg);
  transition: transform .25s var(--ease);
}
.faq details[open] summary::after { transform: rotate(-135deg); margin-block-start: 4px; }
.faq .faq-body { padding: 0 1.35rem 1.25rem; color: var(--text-soft); font-size: .98rem; }

/* ---------- Map ---------------------------------------------------------- */
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: clamp(1.5rem, 3.5vw, 2.75rem);
  align-items: stretch;
}
@media (max-width: 880px) { .map-layout { grid-template-columns: 1fr; } }

.map-frame {
  position: relative;
  overflow: hidden;
  min-height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  background: var(--surface-2);
}
.map-frame iframe { width: 100%; height: 100%; min-height: 400px; border: 0; }
/* Dark mode: soften the map tiles so they do not glare against a dark page */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .map-frame iframe {
    filter: invert(.9) hue-rotate(180deg) brightness(.95) contrast(.92);
  }
}

.contact-list { display: grid; gap: 1rem; align-content: start; }
.contact-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .95rem;
  align-items: start;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.contact-item .ci-icon {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--teal-700);
  border: 1px solid var(--teal-300);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .contact-item .ci-icon { color: var(--teal-300); }
}
.contact-item h3 {
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-mute);
}
html[lang="ar"] .contact-item h3 { letter-spacing: 0; text-transform: none; font-size: .9rem; }
.contact-item p, .contact-item a {
  font-size: 1rem;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  word-break: break-word;
}
.contact-item a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- CTA band ----------------------------------------------------- */
.cta-band {
  position: relative;
  overflow: hidden;
  padding: clamp(2.5rem, 5.5vw, 4.25rem);
  border-radius: var(--radius-xl);
  background: linear-gradient(130deg, var(--teal-800), var(--teal-600) 58%, var(--teal-700));
  color: #fff;
  text-align: center;
}
.cta-band::before {
  content: "";
  position: absolute;
  inset-block-start: -45%;
  inset-inline-end: -12%;
  width: 460px; height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 137, 79, .42), transparent 66%);
}
.cta-band > * { position: relative; }
.cta-band h2 { font-size: var(--step-3); }
.cta-band p { max-width: 40rem; margin: 1rem auto 0; color: rgba(255, 255, 255, .88); font-size: var(--step-1); }
.cta-band .hero-actions { justify-content: center; }
.cta-band .btn--ghost { border-color: rgba(255, 255, 255, .45); color: #fff; }
.cta-band .btn--ghost:hover { background: rgba(255, 255, 255, .12); border-color: #fff; color: #fff; }

/* ---------- Footer ------------------------------------------------------- */
.site-footer {
  padding-block: clamp(3rem, 6vw, 4.5rem) 2rem;
  background: var(--bg-deep);
  color: var(--text-on-deep-soft);
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(auto-fit, minmax(150px, 1fr));
  gap: clamp(2rem, 4vw, 3.5rem);
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
}
.footer-brand img { width: 46px; height: 46px; border-radius: 12px; }
.footer-about { max-width: 34ch; margin-block-start: 1.1rem; font-size: .95rem; line-height: 1.75; }

.footer-col h3 {
  margin-block-end: 1rem;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
}
html[lang="ar"] .footer-col h3 { letter-spacing: 0; text-transform: none; font-size: .95rem; }
.footer-col ul { display: grid; gap: .6rem; }
.footer-col a {
  color: var(--text-on-deep-soft);
  text-decoration: none;
  font-size: .95rem;
  transition: color .18s var(--ease);
}
.footer-col a:hover { color: var(--teal-300); }

.socials { display: flex; gap: .6rem; margin-block-start: 1.5rem; }
.socials a {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .18);
  color: var(--text-on-deep-soft);
  transition: background-color .18s var(--ease), color .18s var(--ease),
              border-color .18s var(--ease), transform .18s var(--ease);
}
.socials a:hover { background: var(--teal-600); border-color: var(--teal-600); color: #fff; transform: translateY(-2px); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-block-start: clamp(2.5rem, 5vw, 3.5rem);
  padding-block-start: 1.5rem;
  border-block-start: 1px solid rgba(255, 255, 255, .13);
  font-size: .9rem;
}
.footer-bottom nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-bottom a { color: var(--text-on-deep-soft); text-decoration: none; }
.footer-bottom a:hover { color: var(--teal-300); }

/* ---------- Scroll reveal ------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ---------- Utilities ---------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- 404 ---------------------------------------------------------- */
.error-page {
  display: grid;
  place-items: center;
  min-height: 78vh;
  padding-block: 4rem;
  text-align: center;
}
.error-code {
  font-size: clamp(4.5rem, 16vw, 9rem);
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(120deg, var(--teal-600), var(--flame-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media print {
  .site-header, .site-footer, .video-grid, .map-frame, .hero-actions { display: none; }
}

/* ==========================================================================
   Teachers & subjects
   Used by the generated pages under teachers/ and subjects/.
   ========================================================================== */

/* ---------- Breadcrumb --------------------------------------------------- */
.breadcrumb {
  padding-block: 1rem;
  border-block-end: 1px solid var(--border);
  background: var(--bg);
  font-size: var(--step--1);
}
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.breadcrumb li { display: inline-flex; align-items: center; gap: .5rem; color: var(--text-mute); }
.breadcrumb li + li::before {
  content: "";
  width: 6px; height: 6px;
  border-block-start: 1.5px solid var(--border-strong);
  border-inline-end: 1.5px solid var(--border-strong);
  transform: rotate(45deg);
}
[dir="rtl"] .breadcrumb li + li::before { transform: rotate(-135deg); }
.breadcrumb a { color: var(--text-soft); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--text); font-weight: 700; }

/* ---------- Avatars ------------------------------------------------------ */
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-strong);
  overflow: hidden;
}
.avatar--md { width: 88px; }
.avatar--lg { width: min(190px, 42vw); }

.avatar--initials {
  background: linear-gradient(140deg, var(--teal-500), var(--teal-800));
  color: #fff;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1;
  user-select: none;
}
.avatar--md.avatar--initials { font-size: 2rem; }
.avatar--lg.avatar--initials { font-size: clamp(2.6rem, 9vw, 4.2rem); }

/* ---------- Chips (subject links) --------------------------------------- */
.chip-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-block-start: 1rem; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: .34rem .8rem;
  border: 1px solid var(--teal-300);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--teal-700);
  font-size: var(--step--1);
  font-weight: 700;
  text-decoration: none;
  transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.chip:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip { color: var(--teal-300); }
  :root:not([data-theme="light"]) .chip:hover { color: var(--on-accent); }
}

/* Inside a fully clickable card the chips are labels, not links */
.chip--static { cursor: inherit; }
.chip--static:hover { background: var(--surface-2); border-color: var(--teal-300); color: var(--teal-700); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip--static:hover { color: var(--teal-300); }
}
.teacher-card .chip-row { margin-block-start: .9rem; }

.track-row { display: inline-flex; flex-wrap: wrap; gap: .4rem; margin-block-start: .7rem; }
.track-badge {
  padding: .22rem .7rem;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--flame-500), var(--coral-500));
  color: #fff;
  font-size: .74rem;
  font-weight: 700;
}

/* ---------- Whole-card links --------------------------------------------
   One <a> inside the card is stretched over the whole surface, so the card
   is a single click target while the accessible name stays the heading text.
   Anything that must stay separately clickable needs position:relative and
   a z-index above 1.
   ------------------------------------------------------------------------ */
.stretched-link { color: inherit; text-decoration: none; }
.stretched-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

/* ---------- Teacher cards ------------------------------------------------ */
.teacher-grid {
  display: grid;
  gap: clamp(1.1rem, 2.4vw, 1.75rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
}

.teacher-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform .28s var(--ease), box-shadow .28s var(--ease), border-color .28s var(--ease);
}
.teacher-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--teal-300); }
.teacher-card:focus-within { border-color: var(--accent); box-shadow: var(--shadow-md); }
.teacher-card[hidden] { display: none; }

.teacher-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(140deg, var(--teal-100), var(--teal-50));
}
.teacher-card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 22%;
  transition: transform .5s var(--ease);
}
.teacher-card:hover .teacher-card__media img { transform: scale(1.05); }
.teacher-card__media::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(7, 59, 57, .3), transparent 45%);
}

/* Initials tile when a teacher has no photo yet */
.teacher-card__initials {
  display: grid;
  place-items: center;
  width: 100%; height: 100%;
  background: linear-gradient(140deg, var(--teal-500), var(--teal-800));
  color: #fff;
  font-size: clamp(2.6rem, 7vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -.02em;
  user-select: none;
}

.teacher-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: clamp(1.25rem, 2.4vw, 1.6rem);
}
.teacher-card__name { font-size: 1.14rem; font-weight: 800; line-height: 1.3; color: var(--text); }
.teacher-card:hover .teacher-card__name { color: var(--accent); }
.teacher-card__title { margin-block-start: .25rem; font-size: .92rem; color: var(--flame-600); font-weight: 700; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .teacher-card__title { color: var(--flame-300); }
}
.teacher-card__short { margin-block-start: .8rem; font-size: .95rem; color: var(--text-soft); }

.teacher-card__cta {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-block-start: auto;
  padding-block-start: 1.15rem;
  color: var(--accent);
  font-weight: 700;
  font-size: .94rem;
}
.teacher-card__cta svg { transition: transform .2s var(--ease); }
.teacher-card:hover .teacher-card__cta svg { transform: translateX(3px); }
[dir="rtl"] .teacher-card:hover .teacher-card__cta svg { transform: scaleX(-1) translateX(3px); }

/* ---------- Subject cards ------------------------------------------------ */
.subject-grid {
  display: grid;
  gap: clamp(1.1rem, 2.4vw, 1.75rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
}

.subject-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform .28s var(--ease), box-shadow .28s var(--ease), border-color .28s var(--ease);
}
.subject-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--teal-300); }
.subject-card:focus-within { border-color: var(--accent); box-shadow: var(--shadow-md); }

.subject-card__media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.subject-card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease);
}
.subject-card:hover .subject-card__media img { transform: scale(1.06); }

/* Track badges sit on the cover */
.subject-card__media .track-row {
  position: absolute;
  inset-block-end: .7rem;
  inset-inline-start: .7rem;
  margin: 0;
  z-index: 2;
}
.subject-card__media .track-badge {
  background: rgba(255, 255, 255, .93);
  color: var(--teal-900);
  backdrop-filter: blur(4px);
}

.subject-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: clamp(1.25rem, 2.4vw, 1.6rem);
}
.subject-card__name { font-size: var(--step-1); font-weight: 800; line-height: 1.3; color: var(--text); }
.subject-card:hover .subject-card__name { color: var(--accent); }
.subject-card__short { margin-block-start: .7rem; font-size: .95rem; color: var(--text-soft); }
.subject-card__meta {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-block-start: .9rem;
  font-size: var(--step--1);
  color: var(--text-mute);
  font-weight: 600;
}
.subject-card__meta svg { flex: none; color: var(--teal-500); }

/* ---------- Subject page header ----------------------------------------- */
/* Text first in the DOM so it leads in both reading directions */
.subject-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}
@media (max-width: 780px) { .subject-hero { grid-template-columns: 1fr; } }
.subject-hero h1 { font-size: var(--step-3); }
.subject-hero__cover {
  overflow: hidden;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.subject-hero__cover img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.subject-hero__text .prose { margin-block-start: 1.25rem; }

/* ---------- Teacher profile --------------------------------------------- */
.profile-hero {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-block-end: clamp(1.75rem, 4vw, 2.5rem);
  border-block-end: 1px solid var(--border);
}
@media (max-width: 700px) { .profile-hero { flex-direction: column; align-items: flex-start; } }
.profile-media { flex: none; }
.profile-body { min-width: 0; }
.profile-body h1 { font-size: var(--step-3); }
.profile-title { margin-block-start: .5rem; font-size: var(--step-1); color: var(--flame-600); font-weight: 700; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .profile-title { color: var(--flame-300); }
}

.highlight-list { display: grid; gap: .55rem; margin-block-start: 1.4rem; }
.highlight-list li { display: flex; align-items: flex-start; gap: .6rem; font-size: .97rem; color: var(--text-soft); }
.highlight-list svg { flex: none; margin-block-start: .3rem; color: var(--teal-500); }

.profile-about { margin-block-start: clamp(2rem, 4vw, 3rem); }
.profile-about h2 { font-size: var(--step-2); margin-block-end: 1rem; }

/* ---------- Prose -------------------------------------------------------- */
.prose { max-width: 68ch; }
.prose p { margin-block-start: 1rem; color: var(--text-soft); }
.prose p:first-child { margin-block-start: 0; }

/* ---------- Filter bar --------------------------------------------------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  margin-block-end: clamp(1.75rem, 4vw, 2.5rem);
}
.filter-chip {
  padding: .5rem 1.05rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: .93rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* ---------- Misc --------------------------------------------------------- */
.empty-note {
  padding: 1.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-mute);
  text-align: center;
}
.back-link { margin-block-start: clamp(1.75rem, 4vw, 2.5rem); }
.back-link a { font-weight: 700; text-decoration: none; }
.back-link a::before { content: "\2190"; margin-inline-end: .45rem; }
[dir="rtl"] .back-link a::before { content: "\2192"; }
.back-link a:hover { text-decoration: underline; }

.video-card--solo { max-width: 780px; margin-inline: auto; }
