/* Course site — Udemy-flavoured, Arabic-first, RTL.
   No web fonts on purpose: the classroom may be offline, and a font that
   fails to load is worse than a system font that always works. */

:root {
  --ink: #1c1d1f;
  --ink-2: #3d3f43;
  --muted: #6a6f73;
  --line: #e4e6e8;
  --bg: #ffffff;
  --bg-2: #f7f9fa;
  --brand: #6d28d9;
  --brand-2: #8b5cf6;
  --brand-soft: #f3eefe;
  --accent: #16a34a;
  --warn: #b45309;
  --warn-bg: #fff7ed;
  --radius: 12px;
  --shadow: 0 2px 4px rgba(0, 0, 0, .08), 0 8px 24px rgba(0, 0, 0, .06);
  --font: "Segoe UI", Tahoma, "Noto Kufi Arabic", "Dubai", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.85;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(1.7rem, 4vw, 2.7rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
a { color: var(--brand); }

code {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .12em .45em;
  font-size: .92em;
  font-family: Consolas, "Courier New", monospace;
  direction: ltr;
  display: inline-block;
}
code[dir="rtl"] { direction: rtl; font-family: var(--font); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 56px 20px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.band { background: var(--bg-2); max-width: none; }
.band > * { max-width: 1120px; margin-inline: auto; }

/* ---------- header ---------- */
.hdr {
  position: sticky; top: 0; z-index: 60;
  background: #fff; border-bottom: 1px solid var(--line);
}
.hdr-in {
  max-width: 1120px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 18px; height: 66px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-txt {
  font-weight: 700; font-size: 1.02rem;
  padding-inline-start: 12px; border-inline-start: 1px solid var(--line);
}

.nav { display: flex; gap: 4px; margin-inline-start: auto; }
.nav a {
  padding: 9px 15px; border-radius: 8px; text-decoration: none;
  color: var(--ink-2); font-weight: 600; font-size: .96rem;
}
.nav a:hover { background: var(--bg-2); color: var(--brand); }
.nav a.on { background: var(--brand-soft); color: var(--brand); }

.speak-toggle {
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  border-radius: 8px; padding: 8px 12px; font-family: inherit;
  font-size: .9rem; font-weight: 600; color: var(--ink-2);
}
.speak-toggle[aria-pressed="false"] { opacity: .45; }
a.logout-btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
a.logout-btn:hover { background: var(--bg-2); color: var(--ink); }

.burger { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; }
.burger span { width: 24px; height: 2px; background: var(--ink); border-radius: 2px; transition: .25s; }
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-scrim { display: none; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #1b1235 0%, #2d1b69 55%, #4c1d95 100%);
  color: #fff;
}
.hero-in { position: relative; z-index: 2; max-width: 1120px; margin: 0 auto; padding: 84px 20px 92px; }
.eyebrow {
  display: inline-block; background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .22);
  padding: 5px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600;
}
.hero h1 { margin: 18px 0 14px; max-width: 20ch; }
.hero-sub { font-size: 1.1rem; max-width: 56ch; color: #d8d2ee; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

.hero-art { position: absolute; inset: 0; z-index: 1; }
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; }
.o1 { width: 340px; height: 340px; background: #a855f7; top: -80px; left: -60px; }
.o2 { width: 280px; height: 280px; background: #22d3ee; bottom: -90px; left: 32%; opacity: .32; }
.o3 { width: 300px; height: 300px; background: #f472b6; top: 20%; right: -70px; opacity: .3; }
.grid-lines {
  position: absolute; inset: 0; opacity: .1;
  background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at 50% 40%, #000, transparent 72%);
}

.btn {
  display: inline-block; padding: 13px 26px; border-radius: 9px;
  text-decoration: none; font-weight: 700; font-size: 1rem;
  border: 1px solid transparent; cursor: pointer; font-family: inherit;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #5b21b6; }
.btn-ghost { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .35); }

/* ---------- cards ---------- */
.sec-head { margin-bottom: 28px; }
.sec-head h2 { margin-bottom: 4px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  text-decoration: none; color: inherit; background: #fff;
  transition: transform .18s, box-shadow .18s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card.locked { opacity: .68; }
.card-thumb {
  height: 128px; position: relative; display: grid; place-items: center;
}
.card-num { font-size: 3rem; font-weight: 800; color: rgba(255, 255, 255, .92); }
.lock { position: absolute; top: 10px; inset-inline-end: 12px; font-size: 1.1rem; }
.t1 { background: linear-gradient(135deg, #6d28d9, #a855f7); }
.t2 { background: linear-gradient(135deg, #0e7490, #22d3ee); }
.t3 { background: linear-gradient(135deg, #b45309, #fbbf24); }
.t4 { background: linear-gradient(135deg, #be185d, #f472b6); }
.t5 { background: linear-gradient(135deg, #15803d, #4ade80); }
.card-body { padding: 16px 18px 20px; }
.card-body h3 { margin-bottom: 6px; }
.card-body p { color: var(--muted); font-size: .93rem; margin-bottom: 12px; }

.pill {
  display: inline-block; font-size: .78rem; font-weight: 700;
  background: var(--bg-2); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px;
}
.pill-live { background: #ecfdf5; color: var(--accent); border-color: #a7f3d0; }

/* ---------- tools ---------- */
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tool {
  display: block; padding: 16px 18px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: inherit;
}
.tool:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.tool b { display: block; margin-bottom: 3px; direction: ltr; text-align: start; }
.tool small { color: var(--muted); line-height: 1.6; display: block; }
.tool-pro { background: #0f172a; border-color: #0f172a; color: #e2e8f0; }
.tool-pro small { color: #94a3b8; }
.tool-pro .pill { background: #1e293b; border-color: #334155; color: #7dd3fc; }
.tool-pro:hover { border-color: #38bdf8; }

.warn {
  margin-top: 22px; background: var(--warn-bg); border: 1px solid #fed7aa;
  color: #7c2d12; border-radius: var(--radius); padding: 14px 18px;
}

/* ---------- day page ---------- */
.day-hero {
  background: linear-gradient(160deg, #1b1235, #4c1d95); color: #fff;
}
.day-hero .wrap { padding: 60px 20px 52px; }
.prog { height: 7px; background: rgba(255, 255, 255, .2); border-radius: 99px; max-width: 380px; margin-top: 18px; }
.prog-bar { height: 100%; background: #4ade80; border-radius: 99px; }

.day-grid { display: grid; grid-template-columns: 1fr 280px; gap: 40px; align-items: start; }
.day-side { position: sticky; top: 86px; display: grid; gap: 16px; }
.side-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: #fff; }
.side-tip { background: var(--brand-soft); border-color: #ddd0fb; }
.side-tip p { margin: 0; font-size: .92rem; }
.toc { display: grid; }
.toc a {
  padding: 8px 10px; border-radius: 7px; text-decoration: none;
  color: var(--ink-2); font-size: .93rem; font-weight: 600;
}
.toc a:hover { background: var(--brand-soft); color: var(--brand); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 40px; }
.box { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.box h3 { margin-bottom: 10px; }
.box ul { margin: 0; padding-inline-start: 20px; }
.box li { margin-bottom: 7px; }
.box-teach { background: var(--brand-soft); border-color: #ddd0fb; }
.box-learn { background: #ecfdf5; border-color: #a7f3d0; }

.lesson { padding: 34px 0; border-top: 1px solid var(--line); scroll-margin-top: 84px; }
.lesson-h { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.lesson-h h2 { margin: 0; flex: 1; }
.lesson-n {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--brand); color: #fff; font-weight: 800;
  display: grid; place-items: center;
}
.dur { font-size: .84rem; color: var(--muted); background: var(--bg-2); border-radius: 999px; padding: 4px 12px; }
.tag { font-size: .78rem; font-weight: 800; border-radius: 999px; padding: 4px 12px; }
.tag-core { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.tag-bonus { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.lesson.bonus { background: #fffdf9; border-radius: var(--radius); padding-inline: 20px; }

.stack {
  background: #0f172a; color: #e2e8f0; border-radius: var(--radius);
  padding: 18px 22px; margin: 18px 0; font-family: Consolas, "Courier New", monospace;
  direction: ltr; font-size: .92rem; line-height: 1.75; overflow-x: auto;
}
.stack b { color: #7dd3fc; font-weight: 700; }

.dl { display: grid; gap: 10px; margin: 16px 0; }
.dl > div {
  display: grid; grid-template-columns: 130px 1fr; gap: 14px;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px;
}
.dl dt { font-weight: 800; color: var(--brand); direction: ltr; }
.dl dd { margin: 0; color: var(--ink-2); }
@media (max-width: 620px) { .dl > div { grid-template-columns: 1fr; gap: 2px; } }

.steps, .followups { padding-inline-start: 22px; }
.steps li, .followups li { margin-bottom: 12px; }
.followups li { line-height: 2.4; }

.quote {
  margin: 20px 0; padding: 16px 22px; border: 0;
  border-inline-start: 4px solid var(--brand);
  background: var(--brand-soft); border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 1.08rem; font-weight: 600;
}

.five { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.five > div {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: center; background: #fff;
}
.five span {
  display: inline-grid; place-items: center; width: 28px; height: 28px;
  border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; font-size: .85rem;
}
.five b { display: block; margin: 8px 0 2px; }
.five small { color: var(--muted); line-height: 1.55; display: block; }

.note {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 18px; margin: 18px 0;
}
.note-warn { background: var(--warn-bg); border-color: #fed7aa; color: #7c2d12; }
.note-key { background: var(--brand-soft); border-color: #ddd0fb; }

/* ---------- prompt boxes ---------- */
.prompt-box {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin: 20px 0; background: #fff;
}
.prompt-h {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg-2); padding: 11px 16px;
  border-bottom: 1px solid var(--line); font-weight: 700; font-size: .92rem;
}
.copy {
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  border-radius: 7px; padding: 6px 15px; font-family: inherit;
  font-weight: 700; font-size: .85rem; color: var(--brand);
}
.copy:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.prompt-box pre {
  margin: 0; padding: 18px; white-space: pre-wrap; word-wrap: break-word;
  font-family: var(--font); font-size: .96rem; line-height: 2; background: #fff;
}
.prompt-box pre[dir="ltr"] { font-family: Consolas, "Courier New", monospace; font-size: .9rem; }

.en-version { margin: 18px 0; }
.en-version summary { cursor: pointer; font-weight: 700; color: var(--brand); padding: 8px 0; }

/* ---------- pronunciation ---------- */
.term {
  direction: ltr; display: inline-block;
  border-bottom: 2px dotted var(--brand);
  cursor: pointer; font-weight: 700; color: var(--brand);
}
.term:hover { background: var(--brand-soft); }
.term.saying { background: var(--brand); color: #fff; }
.term::after { content: " 🔊"; font-size: .78em; opacity: .65; }

/* ---------- instructor mode ----------
   Hidden for students. Rami flips the 🎓 switch and his script appears. */
.teach { display: none; }
body.teaching .teach {
  display: block;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-inline-start: 5px solid #f59e0b;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 18px 0;
}
body.teaching .teach::before {
  content: "🎓 نص المدرّس — لا يظهر للطلاب";
  display: block;
  font-weight: 800;
  font-size: .82rem;
  color: #92400e;
  letter-spacing: .3px;
  margin-bottom: 8px;
}
.teach p:last-child, .teach ul:last-child { margin-bottom: 0; }
.teach ul { padding-inline-start: 20px; margin: 0 0 .8em; }
.teach li { margin-bottom: 5px; }
.teach .ask {
  background: #fff; border: 1px dashed #f59e0b; border-radius: 8px;
  padding: 9px 14px; margin: 10px 0 0; font-weight: 700; color: #7c2d12;
}
.teach-btn[aria-pressed="true"] { background: #fef3c7; border-color: #f59e0b; color: #92400e; opacity: 1; }

/* ---------- self-serve student steps ---------- */
.selfserve {
  border: 2px solid var(--accent); border-radius: var(--radius);
  padding: 18px 22px; margin: 20px 0; background: #f0fdf4;
}
.selfserve h4 { margin: 0 0 10px; color: #065f46; }
.selfserve h4::before { content: "▶ "; }
.selfserve ol { margin: 0; padding-inline-start: 22px; }
.selfserve li { margin-bottom: 8px; }
.selfserve li:last-child { margin-bottom: 0; }

/* ---------- gallery ---------- */
.upload {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; background: var(--bg-2); margin-bottom: 34px;
}
.up-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.upload label { display: block; font-weight: 600; }
.upload label > span { display: block; margin-bottom: 5px; font-size: .92rem; }
.upload input[type="text"], .upload select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 8px; font-family: inherit; font-size: 1rem; background: #fff;
}
.drop {
  border: 2px dashed #c9b8f5; border-radius: var(--radius);
  padding: 30px; text-align: center; cursor: pointer;
  background: #fff; margin-bottom: 14px; display: block;
  position: relative;
}
.drop:hover { border-color: var(--brand); background: var(--brand-soft); }
/* Clipped, not display:none. A `required` control that is display:none cannot
   be focused, so the browser refuses to submit the form and shows no message —
   the upload button just looks dead. Keep it in the layout and hide it. */
.drop input {
  position: absolute; bottom: 4px; inset-inline-start: 50%;
  width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.drop span { color: var(--muted); font-weight: 600; }
.drop.has-files { border-color: var(--brand); background: var(--brand-soft); }
.drop.has-files span { color: var(--ink); }

.flash {
  background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
  border-radius: var(--radius); padding: 13px 18px; margin-bottom: 20px; font-weight: 600;
}
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.gal-item { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.gal-item img, .gal-item video { width: 100%; height: 170px; object-fit: cover; display: block; background: #000; }
.gal-item figcaption { padding: 10px 13px; display: flex; align-items: center; gap: 8px; font-size: .9rem; }

/* ---------- soon ---------- */
.soon { text-align: center; padding-block: 80px; }
.soon-badge {
  width: 74px; height: 74px; border-radius: 50%; margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 2rem; font-weight: 800; display: grid; place-items: center;
}
.soon-lock { font-size: 2.6rem; margin: 14px 0; }
.lead { font-size: 1.12rem; color: var(--ink-2); }

/* ---------- footer ---------- */
.ftr { background: #1c1d1f; color: #b9bdc2; padding: 34px 20px; text-align: center; }
.ftr-logo { height: 30px; width: auto; margin: 0 auto 12px; display: block; }
.ftr p { margin: 5px 0; font-size: .92rem; }
.ftr code { background: #2f3134; border-color: #44474b; color: #fff; }
.ftr-note { font-size: .8rem; color: #85898e; margin-top: 14px; }

/* ---------- login ---------- */
.login-wrap {
  min-height: calc(100vh - 66px - 190px);
  display: grid;
  place-items: center;
  padding: 48px 18px;
  background: var(--bg-2);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 30px 26px;
  text-align: center;
}
.login-lock { font-size: 1.9rem; line-height: 1; margin-bottom: 10px; }
.login-card h1 { font-size: 1.45rem; margin: 0 0 6px; }
.login-sub { color: var(--muted); font-size: .92rem; margin: 0 0 22px; }
.login-card label {
  display: block;
  text-align: start;
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.login-card input {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 11px 13px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}
.login-card input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.login-btn { width: 100%; justify-content: center; margin-top: 4px; }
.login-err {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: .9rem;
  margin: 0 0 18px;
}
.login-note {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.75;
  margin: 18px 0 0;
}

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .day-grid { grid-template-columns: 1fr; }
  .day-side { position: static; order: -1; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .burger { display: flex; }
  /* the logo alone identifies the site; the Arabic title would push the
     toggles off-screen on a phone */
  .brand-txt { display: none; }
  .brand-logo { height: 26px; }
  .speak-toggle span { display: none; }

  .nav {
    position: fixed; inset-block: 66px 0; inset-inline-end: 0;
    width: min(78vw, 300px); background: #fff; z-index: 70;
    flex-direction: column; gap: 2px; padding: 20px 16px;
    border-inline-start: 1px solid var(--line);
    transform: translateX(-100%); transition: transform .26s ease;
    box-shadow: -8px 0 28px rgba(0, 0, 0, .12);
  }
  html[dir="rtl"] .nav { transform: translateX(100%); }
  .nav.open, html[dir="rtl"] .nav.open { transform: translateX(0); }
  .nav a { padding: 13px 14px; font-size: 1.02rem; }

  .nav-scrim.on {
    display: block; position: fixed; inset: 66px 0 0 0;
    background: rgba(0, 0, 0, .38); z-index: 65;
  }

  .two-col, .up-row { grid-template-columns: 1fr; }
  .wrap { padding: 40px 18px; }
  .hero-in { padding: 58px 18px 64px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
