/* ============================================================
   nashy-course-egx — design system
   RTL Arabic study-notes site for Ahmed Nashy's EGX course.
   Pure static: no JS, no build step. One stylesheet.
   ============================================================ */

:root {
  --ink: #17222f;
  --muted: #5b6a79;
  --accent: #1e5b8c;
  --accent-deep: #143f62;
  --tint: #ecf3f8;
  --tint-2: #f6fafc;
  --line: #d9e3ec;
  --bg: #f7fafc;
  --card: #ffffff;
  --up: #2e7d5b;      /* bullish  — used in figures & semantic text  */
  --down: #b04545;    /* bearish                                            */
  --radius: 6px;
  --w: 1000px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Cairo', 'Geeza Pro', 'Geeza Pro Interface', 'SF Arabic', 'Segoe UI', sans-serif;
  font-size: 16.5px;
  line-height: 1.85;
  -webkit-text-size-adjust: 100%;
}

bdi { unicode-bidi: isolate; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- top bar ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--accent-deep);
  color: #fff;
}
.site-header .bar {
  max-width: var(--w);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.site-header .brand {
  color: #fff;
  font-weight: 800;
  font-size: 15.5px;
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}
.site-header .brand::before {
  content: "";
  width: 10px; height: 10px;
  background: #fff;
  opacity: .9;
  flex: 0 0 auto;
}
.site-header .brand:hover { text-decoration: none; }
.site-header .crumb {
  font-size: 13.5px;
  color: #c9d9e6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-header .crumb a { color: #fff; }

/* ---------- layout ---------- */
.container {
  max-width: var(--w);
  margin: 0 auto;
  padding: 0 20px;
}

main { padding: 28px 0 10px; }

/* ---------- lesson hero ---------- */
.hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 40px);
  margin-bottom: 26px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 8px; height: 100%;
  background: var(--accent);
}
.hero .lno {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-deep);
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 14px;
  margin-bottom: 14px;
}
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 4.6vw, 40px);
  font-weight: 900;
  line-height: 1.4;
}
.hero .hook {
  font-size: clamp(16px, 2.2vw, 19px);
  color: var(--muted);
  margin: 0 0 16px;
  max-width: 62ch;
}
.meta-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-chips span {
  background: var(--tint);
  border: 1px solid var(--line);
  color: var(--accent-deep);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 13px;
}

/* ---------- sections & headings ---------- */
section.block { margin-bottom: 34px; }

h2.sec {
  font-size: clamp(21px, 3.4vw, 27px);
  font-weight: 800;
  margin: 0 0 6px;
  line-height: 1.45;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
h2.sec::before {
  content: "";
  width: 12px; height: 12px;
  background: var(--accent);
  flex: 0 0 auto;
  transform: translateY(-1px);
}
h2.sec em { font-style: normal; color: var(--accent); }
.sec-sub {
  color: var(--muted);
  margin: 0 0 18px;
  font-size: 15.5px;
  max-width: 75ch;
}
h3.c {
  font-size: 17.5px;
  font-weight: 800;
  margin: 22px 0 10px;
}

/* ---------- content components ---------- */
p.body { margin: 0 0 14px; }
p.body b, li b { font-weight: 800; }

.lead {
  background: var(--tint-2);
  border-right: 4px solid var(--accent);
  border-radius: 4px;
  padding: 16px 20px;
  margin: 0 0 18px;
  max-width: none;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 0 0 16px;
}
.card.tinted { background: var(--tint-2); }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }

.num-card {
  display: flex;
  gap: 16px;
  background: var(--tint-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 0 0 14px;
}
.num-card .n {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}
.num-card .t { flex: 1; min-width: 0; }
.num-card .t h3 { margin: 0 0 6px; font-size: 16.5px; font-weight: 800; }
.num-card .t p { margin: 0; font-size: 15.2px; line-height: 1.8; }

.golden {
  background: var(--accent-deep);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 8px 0 18px;
}
.golden .gt {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 6px;
}
.golden p { margin: 0; font-size: 15.2px; line-height: 1.85; color: #e8eff5; }
.golden p b { color: #fff; }

ul.list { margin: 0 0 16px; padding: 0; list-style: none; }
ul.list li {
  position: relative;
  padding-right: 22px;
  margin-bottom: 9px;
  font-size: 15.4px;
}
ul.list li::before {
  content: "";
  position: absolute;
  right: 0; top: 11px;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 2px;
}

.note {
  border: 1px solid var(--line);
  border-right: 4px solid var(--accent);
  background: var(--card);
  border-radius: 4px;
  padding: 13px 18px;
  font-size: 14.8px;
  margin: 0 0 16px;
}
.note .nt { font-weight: 800; color: var(--accent-deep); }
.note b { font-weight: 800; }

/* ---------- tables ---------- */
.tbl-wrap {
  overflow-x: auto;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.6px;
  min-width: 420px;
}
table.tbl th {
  background: var(--accent-deep);
  color: #fff;
  font-weight: 700;
  text-align: right;
  padding: 9px 14px;
  font-size: 13.8px;
  white-space: nowrap;
}
table.tbl td {
  border-bottom: 1px solid var(--line);
  padding: 9px 14px;
  vertical-align: top;
}
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:nth-child(even) td { background: var(--tint-2); }
table.tbl td.tme {
  direction: ltr;
  text-align: right;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  width: 1%;
}

/* ---------- chips / stats ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chips .chip {
  background: var(--tint);
  color: var(--accent-deep);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin: 0 0 18px;
}
.stat {
  background: var(--tint-2);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 14px 11px;
  text-align: center;
}
.stat .v {
  font-size: 30px;
  font-weight: 900;
  color: var(--accent-deep);
  direction: ltr;
  line-height: 1.2;
}
.stat .l { font-size: 13.6px; font-weight: 700; margin-top: 4px; }
.stat .d { font-size: 12.8px; color: var(--muted); line-height: 1.65; margin-top: 4px; }

/* ---------- lecture video ---------- */
.video-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin: 0 0 26px;
}
.video-card .v-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--accent-deep);
  padding: 2px 6px 8px;
}
.video-card .v-label::before {
  content: "";
  width: 0; height: 0;
  border-right: 9px solid var(--accent);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}
.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  background: #0d1520;
}
.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- figures ---------- */
figure.fig {
  margin: 0 0 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 8px;
}
figure.fig img, figure.fig svg {
  display: block;
  width: 100%;
  height: auto;
}
figure.fig figcaption {
  font-size: 13.2px;
  color: var(--muted);
  padding: 8px 4px 6px;
  border-top: 1px dashed var(--line);
  margin-top: 8px;
  line-height: 1.7;
}
figure.fig figcaption b { color: var(--ink); font-weight: 700; }

/* ---------- glossary ---------- */
dl.terms { margin: 0; }
dl.terms dt {
  font-weight: 800;
  color: var(--accent-deep);
  margin-top: 12px;
}
dl.terms dd { margin: 2px 0 0; font-size: 14.8px; color: var(--ink); }

/* ---------- lesson nav (prev / next) ---------- */
.lesson-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 30px 0 10px;
}
.lesson-nav a {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  transition: border-color .15s ease;
}
.lesson-nav a:hover { border-color: var(--accent); text-decoration: none; }
.lesson-nav .dir {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 3px;
}
.lesson-nav .ttl { font-size: 15.3px; font-weight: 800; color: var(--ink); line-height: 1.6; }
.lesson-nav a.next { text-align: left; }
.lesson-nav a.next .dir { text-align: left; }
.lesson-nav a.home {
  grid-column: 1 / -1;
  text-align: center;
  background: var(--tint);
}

/* ---------- home page ---------- */
.home-hero {
  background: linear-gradient(180deg, var(--accent-deep), #1b4c74);
  color: #fff;
  padding: clamp(36px, 7vw, 70px) 0;
  margin-bottom: 34px;
}
.home-hero .kicker {
  font-size: 14.5px;
  font-weight: 700;
  color: #bcd4e6;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.home-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(28px, 5.4vw, 46px);
  font-weight: 900;
  line-height: 1.4;
  max-width: 22ch;
}
.home-hero p.sub {
  font-size: clamp(15.5px, 2.2vw, 18px);
  color: #d9e6f0;
  max-width: 62ch;
  margin: 0 0 22px;
}
.home-hero .stats-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.home-hero .stats-row span {
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  padding: 4px 16px;
  font-size: 14px;
  font-weight: 700;
}
.home-hero .cta {
  display: inline-block;
  background: #fff;
  color: var(--accent-deep);
  font-weight: 800;
  border-radius: 999px;
  padding: 9px 26px;
  font-size: 15.5px;
}
.home-hero .cta:hover { text-decoration: none; background: var(--tint); }

.course-group { margin-bottom: 34px; }
.course-group > h2 {
  font-size: 19px;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--accent-deep);
}
.course-group > p.gdesc { color: var(--muted); font-size: 14.5px; margin: 0 0 14px; }

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
a.lesson-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  color: var(--ink);
  transition: border-color .15s ease, transform .15s ease;
}
a.lesson-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-2px);
}
.lesson-card .lc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.lesson-card .lc-no {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-deep);
  background: var(--tint);
  border-radius: 999px;
  padding: 2px 12px;
}
.lesson-card .lc-dur { font-size: 12.8px; color: var(--muted); font-weight: 600; }
.lesson-card .lc-title { font-size: 16.8px; font-weight: 800; line-height: 1.55; }
.lesson-card .lc-hook { font-size: 13.8px; color: var(--muted); line-height: 1.7; flex: 1; }
.lesson-card .lc-tags { font-size: 12.3px; color: var(--accent); font-weight: 700; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 44px;
  padding: 22px 0 34px;
  color: var(--muted);
  font-size: 13.8px;
}
.site-footer .cols {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  justify-content: space-between;
}
.site-footer b { color: var(--ink); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  body { font-size: 15.8px; }
  .site-header .crumb { display: none; }
  .num-card { flex-direction: row; }
  .num-card .n { width: 36px; height: 36px; font-size: 17px; }
  .lesson-nav { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  h2.sec { flex-wrap: wrap; }
  .hero::before { width: 6px; }
}

@media (max-width: 460px) {
  .container { padding: 0 14px; }
  .hero { padding: 18px 16px; }
  .card, .num-card, .golden { padding: 14px 15px; }
  .lead { padding: 13px 14px; }
  .stats { grid-template-columns: 1fr 1fr; }
}

/* ---------- print ---------- */
@media print {
  .site-header, .lesson-nav, .site-footer { display: none; }
  body { background: #fff; font-size: 12pt; }
  .hero, .card, figure.fig { break-inside: avoid; }
}
