/* ---------- Tokens ---------- */
:root {
  --red: #f03;
  --red-dark: #cc0029;
  --red-soft: #fff0f2;
  --ink: #0f0f0f;
  --ink-2: #3d3d3d;
  --muted: #606060;
  --bg: #fff;
  --surface: #f2f2f2;
  --card: #fff;
  --line: #e5e5e5;
  --shadow: 0 1px 2px #0000000f, 0 8px 24px #0000000f;
  --radius: 14px;
  --max: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 68px;
  --stage-bg: #f4f4f6;
  --glass: #ffffffd9;
  --glass-line: #00000014;
  --glass-shadow: 0 20px 50px #1414281f;
  --rail-dot: #c9c9d0;
  --ease: cubic-bezier(.22, .8, .24, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --red-soft: #2a0d12;
  --ink: #f1f1f1;
  --ink-2: #d0d0d0;
  --muted: #aaa;
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --card: #212121;
  --line: #2e2e2e;
  --shadow: none;
  --stage-bg: #0b0b0d;
  --glass: #0f0f12cc;
  --glass-line: #ffffff14;
  --glass-shadow: 0 20px 60px #00000080;
  --rail-dot: #444;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0; font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.8; -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 700; }
p { margin: 0; }
button { font: inherit; }
.icon { width: 1.15em; height: 1.15em; flex: none; }
.container { width: min(var(--max), 100% - 2 * var(--gutter)); margin-inline: auto; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; z-index: 200; background: var(--red); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { inset-inline-start: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; cursor: pointer; white-space: nowrap;
  transition: background .2s, border-color .2s, transform .2s var(--ease), color .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn--red { background: var(--red); color: #fff; }
.btn--red:hover { background: var(--red-dark); }
.btn--ghost { border-color: var(--line); background: var(--card); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink-2); }
.btn--white { background: #fff; color: var(--red); }
.btn--white:hover { background: #ffe9ec; }
.btn--sm { height: 36px; padding: 0 16px; font-size: .85rem; }
.btn .icon--flip, .link-arrow .icon { transform: scaleX(-1); }
[dir="rtl"] .btn .icon--arrow { transform: none; }

.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--red); font-weight: 600; font-size: .9rem; margin-bottom: 10px; }
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--red); border-radius: 2px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { height: 100%; display: flex; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; margin-inline-end: auto; }
.brand svg { width: 28px; height: 20px; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 16px; border-radius: 999px; font-weight: 500; font-size: .95rem; color: var(--ink-2); transition: background .2s, color .2s; }
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.header-actions { display: flex; align-items: center; gap: 10px; margin-inline-start: 18px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; transition: background .2s;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn .icon { width: 18px; height: 18px; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(56px, 9vw, 110px) 0 clamp(56px, 8vw, 96px); }
.hero__3d { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }
.hero__grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(32px, 6vw, 72px); align-items: center; }
.hero h1 { font-size: clamp(2.3rem, 5.4vw, 3.9rem); letter-spacing: -.01em; margin-bottom: 18px; }
.hero h1 span { color: var(--red); }
.hero__lead { color: var(--ink-2); font-size: 1.12rem; max-width: 56ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.stats { display: flex; flex-wrap: wrap; gap: clamp(24px, 4vw, 48px); margin-top: 36px; }
.stats b { display: block; font-size: 1.7rem; line-height: 1.2; direction: ltr; text-align: end; }
[dir="rtl"] .stats b { text-align: right; unicode-bidi: plaintext; }
.stats small { color: var(--muted); font-size: .8rem; }
.hero__media { position: relative; margin: 0; }
.hero__media::before {
  content: ""; position: absolute; inset: 22px 22px -22px -22px; border-radius: 22px; background: var(--red); z-index: 0;
}
.hero__media img { position: relative; z-index: 1; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 22px; }

/* ---------- Social strip ---------- */
.social-strip { border-block: 1px solid var(--line); background: var(--bg); position: relative; }
.social-strip .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; padding-block: 18px; }
.social-strip a { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .95rem; color: var(--ink-2); transition: color .2s; }
.social-strip a:hover { color: var(--ink); }
.social-strip a.is-yt { color: var(--red); }

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 9vw, 110px) 0; }
.section--alt { background: var(--surface); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 32px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.section-head p { color: var(--muted); margin-top: 6px; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; color: var(--red); font-weight: 600; font-size: .95rem; }
.link-arrow:hover { text-decoration: underline; }

/* ---------- Video cards ---------- */
.video-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 24px; }
.video-card { display: block; }
.video-card__thumb { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; background: var(--surface); }
.video-card__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.video-card__thumb::after {
  content: ""; position: absolute; inset: 0; background: #0006; opacity: 0; transition: opacity .25s;
}
.video-card__play {
  position: absolute; z-index: 1; top: 50%; left: 50%; width: 58px; height: 40px; margin: -20px 0 0 -29px;
  display: grid; place-items: center; border-radius: 12px; background: var(--red); color: #fff;
  opacity: 0; transform: scale(.8); transition: opacity .25s, transform .25s var(--ease);
}
.video-card__play .icon { width: 20px; height: 20px; }
.video-card:hover .video-card__thumb img { transform: scale(1.05); }
.video-card:hover .video-card__thumb::after, .video-card:hover .video-card__play { opacity: 1; transform: none; }
.video-card__duration {
  position: absolute; z-index: 1; bottom: 8px; left: 8px; background: #000c; color: #fff;
  font-size: .75rem; font-weight: 600; padding: 1px 7px; border-radius: 6px; direction: ltr;
}
.video-card__tag { display: inline-block; margin-top: 12px; font-size: .78rem; font-weight: 600; color: var(--red); background: var(--red-soft); padding: 2px 10px; border-radius: 999px; }
.video-card h3 { font-size: 1.02rem; font-weight: 600; margin-top: 10px; line-height: 1.55; }
.video-card time { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; }

/* ---------- Course feature ---------- */
.feature { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.feature__media { border-radius: 18px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--card); position: relative; }
.feature__media img { width: 100%; height: 100%; object-fit: cover; }
.feature__badge { position: absolute; top: 14px; inset-inline-start: 14px; background: var(--red); color: #fff; font-size: .78rem; font-weight: 600; padding: 3px 12px; border-radius: 999px; }
.feature h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); direction: ltr; text-align: right; }
.feature__sub { font-weight: 700; margin: 6px 0 14px; }
.feature p { color: var(--ink-2); }
.checklist { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.checklist li { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.checklist .icon { width: 22px; height: 22px; padding: 4px; border-radius: 50%; background: var(--red); color: #fff; }
.feature .hero__cta { margin-top: 26px; }
.course-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: clamp(20px, 3vw, 32px); box-shadow: var(--shadow); }

/* ---------- Page head (inner pages) ---------- */
.page-head { padding: clamp(48px, 8vw, 96px) 0 clamp(28px, 4vw, 44px); }
.page-head h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.page-head p { color: var(--ink-2); font-size: 1.1rem; margin-top: 10px; max-width: 60ch; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.chips a { padding: 7px 18px; border-radius: 999px; background: var(--surface); font-weight: 600; font-size: .9rem; transition: background .2s, color .2s; }
.chips a:hover { background: var(--ink); color: var(--bg); }

/* ---------- Contact page ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.mail-card { background: var(--red); color: #fff; border-radius: 22px; padding: clamp(24px, 4vw, 40px); }
.mail-card__icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: #ffffff26; margin-bottom: 18px; }
.mail-card__icon .icon { width: 24px; height: 24px; }
.mail-card h2 { font-size: 1.6rem; }
.mail-card p { opacity: .9; margin: 8px 0 18px; }
.mail-card__addr { display: inline-block; font-size: 1.25rem; font-weight: 700; text-decoration: underline; text-underline-offset: 6px; direction: ltr; margin-bottom: 22px; }
.social-list { display: grid; gap: 12px; }
.social-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); transition: border-color .2s, transform .2s var(--ease);
}
.social-row:hover { border-color: var(--red); transform: translateX(-3px); }
.social-row__icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--surface); }
.social-row__icon.is-yt { color: var(--red); }
.social-row b { display: block; font-size: .98rem; }
.social-row small { color: var(--muted); direction: ltr; display: block; text-align: right; }
.social-row > .icon { margin-inline-start: auto; color: var(--muted); }

/* ---------- Contact band + footer ---------- */
.contact-band { background: var(--red); color: #fff; padding: clamp(40px, 6vw, 64px) 0; }
.contact-band .container { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.contact-band h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); }
.contact-band p { opacity: .9; margin-top: 6px; }
.site-footer { padding: 56px 0 28px; border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.footer-grid h3 { font-size: 1.2rem; margin-bottom: 10px; }
.footer-grid p { color: var(--ink-2); font-size: .95rem; }
.footer-mail { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; direction: ltr; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-links a { color: var(--ink-2); }
.footer-links a:hover { color: var(--red); }
.footer-social { display: grid; grid-template-columns: repeat(3, 40px); gap: 10px; justify-content: end; }
.footer-social a { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--surface); transition: background .2s, color .2s; }
.footer-social a:hover { background: var(--red); color: #fff; }
.footer-bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

/* ---------- Journey ---------- */
.journey { padding-top: clamp(64px, 9vw, 110px); background: var(--stage-bg); }
.journey__head { text-align: center; margin-bottom: 40px; }
.journey__head .eyebrow { justify-content: center; }
.journey__head h2 { font-size: clamp(1.8rem, 3.8vw, 2.6rem); }
/* Fallback list (no WebGL / reduced motion) */
.timeline { list-style: none; padding: 0 0 clamp(64px, 9vw, 110px); margin: 0; display: grid; gap: 22px; max-width: 820px; margin-inline: auto; }
.tl { display: grid; grid-template-columns: 220px 1fr; gap: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.tl img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 4px solid var(--red); }
.tl__date { color: var(--red); font-weight: 700; }
.tl h3 { font-size: 1.3rem; margin: 2px 0 8px; }
.tl p { color: var(--ink-2); }
.tl p + p { margin-top: 8px; }
.tl--noimg { grid-template-columns: 1fr; }

/* 3D mode */
.journey.is-3d .timeline { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); padding: 0; }
.j3d-track { position: relative; height: calc(var(--n) * 70vh + 100vh); }
.j3d { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); height: calc(100svh - var(--header-h)); overflow: hidden; }
.j3d__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .8s; }
.j3d.is-ready .j3d__canvas { opacity: 1; }
.j3d__info {
  position: absolute; z-index: 2; top: 50%; inset-inline-start: calc(var(--gutter) + 64px);
  width: min(440px, 38vw); transform: translateY(-50%);
  padding: 26px 28px; border-radius: 18px; background: var(--glass);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow);
  transition: opacity .22s ease, transform .35s var(--ease);
}
.j3d__info.is-out { opacity: 0; transform: translateY(calc(-50% + 14px)); }
.j3d__date { color: var(--red); font-weight: 700; font-size: .9rem; }
.j3d__title { font-size: 1.6rem; margin: 4px 0 12px; }
.j3d__text { display: grid; gap: 10px; color: var(--ink-2); font-size: .98rem; max-height: 46vh; overflow-y: auto; }
.j3d__rail {
  position: absolute; z-index: 2; inset-inline-start: var(--gutter); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
}
.j3d__rail button {
  display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; padding: 5px 2px;
  color: var(--muted); font-size: .78rem; font-weight: 600;
}
.j3d__rail button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--rail-dot); transition: transform .3s, background .3s; flex: none; }
.j3d__rail button span { opacity: 0; transform: translateX(6px); transition: opacity .25s, transform .25s; white-space: nowrap; }
.j3d__rail button:hover span, .j3d__rail button[aria-current] span { opacity: 1; transform: none; }
.j3d__rail button[aria-current] { color: var(--ink); }
.j3d__rail button[aria-current]::before { background: var(--red); transform: scale(1.4); }
.j3d__hint { position: absolute; z-index: 2; bottom: 22px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; transition: opacity .3s; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero__grid, .feature, .contact-grid { grid-template-columns: 1fr; }
  .hero__media { max-width: 620px; }
  .video-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-social { justify-content: start; }
}
@media (max-width: 820px) {
  .menu-btn { display: grid; }
  .nav {
    position: absolute; top: var(--header-h); inset-inline: 0; flex-direction: column; gap: 2px; padding: 10px var(--gutter) 16px;
    background: var(--bg); border-bottom: 1px solid var(--line); display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 10px 14px; }
  .header-actions { margin-inline-start: 0; }
  .header-actions .btn span { display: none; }
  .header-actions .btn { padding: 0 12px; }
  .j3d__rail { display: none; }
  .j3d__info {
    top: auto; bottom: 14px; inset-inline: 14px; width: auto; transform: none; padding: 16px 18px; max-height: 42%;
    display: flex; flex-direction: column;
  }
  .j3d__info.is-out { transform: translateY(14px); }
  .j3d__title { font-size: 1.2rem; margin: 2px 0 6px; }
  .j3d__text { font-size: .9rem; line-height: 1.7; max-height: none; overflow-y: auto; }
  .j3d__hint { bottom: auto; top: 12px; }
}
@media (max-width: 600px) {
  .video-grid { grid-template-columns: 1fr; }
  .social-strip .container { justify-content: center; gap: 10px 22px; }
  .hero__media::before { inset: 12px 12px -12px -12px; }
  .footer-grid { grid-template-columns: 1fr; }
  .tl { grid-template-columns: 1fr; }
  .contact-band .container { flex-direction: column; align-items: flex-start; }
}
