/* ============================================================ */
/* PRO MAX UI/UX — Design System                                  */
/* Token layer -> primitives -> components -> motion -> polish     */
/* ============================================================ */

/* ============ TOKENS ============ */
:root,
html[data-theme="light"] {
  --bg: #fafaf9;
  --bg-gradient: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(99, 102, 241, 0.06), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --surface-3: #eeecea;
  --border: rgba(28, 25, 23, 0.08);
  --border-strong: rgba(28, 25, 23, 0.16);
  --ring: rgba(99, 102, 241, 0.35);
  --text: #0c0a09;
  --text-2: #292524;
  --text-muted: #78716c;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-contrast: #ffffff;
  --accent-2: #0891b2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;

  --shadow-xs: 0 1px 2px rgba(12, 10, 9, 0.04);
  --shadow-sm: 0 1px 3px rgba(12, 10, 9, 0.06), 0 1px 2px rgba(12, 10, 9, 0.04);
  --shadow-md: 0 4px 8px rgba(12, 10, 9, 0.06), 0 2px 4px rgba(12, 10, 9, 0.04);
  --shadow-lg: 0 12px 24px rgba(12, 10, 9, 0.08), 0 4px 8px rgba(12, 10, 9, 0.04);
  --shadow-xl: 0 24px 48px rgba(12, 10, 9, 0.10), 0 8px 16px rgba(12, 10, 9, 0.04);
  --shadow-accent: 0 1px 3px rgba(99, 102, 241, 0.18), 0 8px 24px rgba(99, 102, 241, 0.12);

  --gradient-hero: linear-gradient(135deg, #6366f1 0%, #0891b2 55%, #d97706 100%);
  --gradient-brand: linear-gradient(135deg, #6366f1, #0891b2);

  /* Hero section */
  --hero-bg: linear-gradient(180deg, rgba(99,102,241,0.04) 0%, transparent 60%);
  --hero-orb-1: rgba(99, 102, 241, 0.08);
  --hero-orb-2: rgba(8, 145, 178, 0.06);
  --hero-orb-3: rgba(217, 119, 6, 0.05);

  /* Timeline */
  --timeline-line: rgba(28, 25, 23, 0.10);
  --timeline-line-done: linear-gradient(180deg, var(--success), var(--accent-2));
}

html[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-gradient: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(129, 140, 248, 0.08), transparent 60%);
  --surface: #111111;
  --surface-2: #1a1a1a;
  --surface-3: #222222;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --ring: rgba(129, 140, 248, 0.45);
  --text: #fafaf9;
  --text-2: #d6d3d1;
  --text-muted: #a8a29e;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(129, 140, 248, 0.12);
  --accent-contrast: #0a0a0a;
  --accent-2: #22d3ee;
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.3);
  --shadow-accent: 0 1px 3px rgba(129, 140, 248, 0.3), 0 8px 24px rgba(129, 140, 248, 0.2);

  --gradient-hero: linear-gradient(135deg, #a5b4fc 0%, #22d3ee 55%, #fbbf24 100%);
  --gradient-brand: linear-gradient(135deg, #818cf8, #22d3ee);

  --hero-bg: linear-gradient(180deg, rgba(129,140,248,0.06) 0%, transparent 60%);
  --hero-orb-1: rgba(129, 140, 248, 0.10);
  --hero-orb-2: rgba(34, 211, 238, 0.08);
  --hero-orb-3: rgba(251, 191, 36, 0.06);

  --timeline-line: rgba(255, 255, 255, 0.08);
}

:root {
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-md: 15px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 32px;
  --text-4xl: 40px;
  --text-5xl: 52px;
  --text-6xl: 64px;

  --lh-tight: 1.1;
  --lh-heading: 1.3;
  --lh-body: 1.6;
  --lh-long: 1.75;

  --tracking-tighter: -0.03em;
  --tracking-tight: -0.01em;
  --tracking-normal: 0;
  --tracking-wide: 0.04em;
  --tracking-wider: 0.08em;

  --font-sans: -apple-system, 'SF Pro Text', 'Inter', system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-ar: 'SF Arabic', 'Tajawal', 'Cairo', 'Noto Sans Arabic', 'Amiri', system-ui, sans-serif;
  --font-serif: 'Iowan Old Style', 'Palatino Linotype', ui-serif, Georgia, serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Menlo', 'Monaco', 'Courier New', ui-monospace, monospace;

  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  --duration-instant: 80ms;
  --duration-fast: 150ms;
  --duration-base: 220ms;
  --duration-slow: 350ms;
  --duration-slower: 500ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);

  --container-narrow: 720px;
  --container-wide: 1120px;
  --nav-height: 60px;
}

/* ============ RESET + BASE ============ */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--lh-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'ss01' 1, 'cv01' 1;
}

body {
  background: var(--bg) var(--bg-gradient);
  background-attachment: fixed;
  transition: background-color var(--duration-base) var(--ease-out),
              color var(--duration-base) var(--ease-out);
}

html[lang="ar"] body { font-family: var(--font-ar); line-height: var(--lh-long); }

.kw, pre, code,
html[lang="ar"] pre,
html[lang="ar"] code,
html[lang="ar"] .kw {
  font-family: var(--font-mono) !important;
  direction: ltr !important;
  unicode-bidi: isolate;
  text-align: left;
}

/* ============ PRIMITIVES ============ */

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--accent-hover); text-decoration: underline; }

button, .btn-primary, .btn-ghost {
  font-family: inherit;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: var(--tracking-normal);
  transition:
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    transform var(--duration-instant) var(--ease-out);
  white-space: nowrap;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  height: 44px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
}
.btn-primary:hover {
  background: var(--text-2);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--bg);
}
.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-xs); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  height: 36px;
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; }
.btn-ghost:active { transform: scale(0.97); }

.lang-btn { min-width: 40px; font-weight: 600; letter-spacing: 0.05em; }

/* ============ SITE NAV ============ */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--duration-base) var(--ease-out);
}
@supports not (background: color-mix(in srgb, red, blue)) {
  .site-nav { background: rgba(250, 250, 249, 0.82); }
  html[data-theme="dark"] .site-nav { background: rgba(10, 10, 10, 0.82); }
}

.site-nav-inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--nav-height);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text);
  font-weight: 700;
  font-size: var(--text-base);
  letter-spacing: var(--tracking-tight);
}
.site-brand:hover { text-decoration: none; color: var(--text); }
.site-brand .mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--gradient-brand);
  color: #ffffff;
  display: inline-grid;
  place-items: center;
  font-size: var(--text-sm);
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-accent);
}

.site-nav-menu {
  display: flex;
  gap: var(--space-6);
  align-items: center;
  flex-wrap: wrap;
}
.site-nav-menu a {
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-1) 0;
  border-bottom: 2px solid transparent;
  transition: color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
.site-nav-menu a:hover { color: var(--text); text-decoration: none; }
.site-nav-menu a.active { color: var(--accent); border-bottom-color: var(--accent); }

.site-tools { display: inline-flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

/* ============ LAYOUT ============ */

.page-wrap {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: var(--space-12) var(--space-5) var(--space-20);
}

.page-wrap--wide {
  max-width: var(--container-wide);
}

/* ============ PREMIUM HERO ============ */

.hero-premium {
  position: relative;
  text-align: center;
  padding: var(--space-20) var(--space-5) var(--space-16);
  margin-bottom: var(--space-8);
  overflow: hidden;
}

.hero-premium::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--hero-bg);
  pointer-events: none;
}

.hero-orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  animation: orbFloat 12s ease-in-out infinite;
}

.hero-orb--1 {
  width: 400px;
  height: 400px;
  background: var(--hero-orb-1);
  top: -100px;
  left: 10%;
  animation-delay: 0s;
}

.hero-orb--2 {
  width: 300px;
  height: 300px;
  background: var(--hero-orb-2);
  top: -50px;
  right: 15%;
  animation-delay: -4s;
}

.hero-orb--3 {
  width: 250px;
  height: 250px;
  background: var(--hero-orb-3);
  bottom: -80px;
  left: 40%;
  animation-delay: -8s;
}

@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

.hero-premium__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  margin-bottom: var(--space-6);
  position: relative;
}

.hero-premium__title {
  font-size: clamp(var(--text-4xl), 6vw, var(--text-6xl));
  font-weight: 800;
  margin: 0 0 var(--space-5);
  letter-spacing: var(--tracking-tighter);
  line-height: var(--lh-tight);
  color: var(--text);
  position: relative;
}

.hero-premium__title .gradient-text {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-premium__subtitle {
  font-size: var(--text-xl);
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto var(--space-8);
  line-height: var(--lh-body);
  position: relative;
}

.hero-premium__stats {
  display: flex;
  justify-content: center;
  gap: var(--space-10);
  position: relative;
}

.hero-stat {
  text-align: center;
}

.hero-stat__number {
  display: block;
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.hero-stat__label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}

/* Hero CTA button */
.hero-premium__cta {
  margin-top: var(--space-8);
  position: relative;
}

.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 52px;
  padding: 0 var(--space-8);
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
  text-decoration: none;
}

.btn-hero:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
  text-decoration: none;
  color: var(--bg);
}

.btn-hero:active {
  transform: translateY(0);
}

/* ============ ROADMAP CARDS (index page) ============ */

.roadmap-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

.roadmap-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  color: inherit;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.roadmap-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-hero);
}

.roadmap-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
  text-decoration: none;
}

.roadmap-card__emoji {
  font-size: 40px;
  margin-bottom: var(--space-4);
  display: block;
}

.roadmap-card__label {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wider);
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}

.roadmap-card__title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin: 0 0 var(--space-2);
  line-height: var(--lh-heading);
  color: var(--text);
  letter-spacing: var(--tracking-tight);
}

.roadmap-card__desc {
  color: var(--text-muted);
  font-size: var(--text-md);
  margin: 0 0 var(--space-5);
  line-height: var(--lh-body);
}

.roadmap-card__meta {
  display: flex;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
  flex-wrap: wrap;
  align-items: center;
}
.roadmap-card__meta .dot::before { content: '\00B7'; padding: 0 var(--space-2); }

/* Inline progress */
.progress-inline {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.progress-bar-small {
  width: 80px;
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-small .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width var(--duration-slow) var(--ease-out);
}
html[dir="rtl"] .progress-bar-small .fill { background: linear-gradient(-90deg, var(--accent), var(--accent-2)); }

/* ============ VISUAL ROADMAP TIMELINE ============ */

.roadmap-timeline {
  position: relative;
  padding: var(--space-6) 0;
}

/* The vertical line */
.roadmap-timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 28px;
  width: 3px;
  background: var(--timeline-line);
  border-radius: var(--radius-full);
}

html[dir="rtl"] .roadmap-timeline::before {
  left: auto;
  right: 28px;
}

.timeline-node {
  position: relative;
  display: flex;
  gap: var(--space-5);
  align-items: flex-start;
  padding-bottom: var(--space-10);
}

.timeline-node:last-child {
  padding-bottom: 0;
}

/* The circle on the timeline */
.timeline-node__marker {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  font-weight: 800;
  color: #ffffff;
  box-shadow: var(--shadow-md);
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}

.timeline-node:hover .timeline-node__marker {
  transform: scale(1.08);
  box-shadow: var(--shadow-lg);
}

.timeline-node__marker--completed {
  background: var(--success) !important;
}

.timeline-node__marker--completed::after {
  content: '\2713';
  font-size: var(--text-xl);
}

/* Course card on timeline */
.timeline-card {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  color: inherit;
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.timeline-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  text-decoration: none;
}

.timeline-card__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-3);
}

.timeline-card__title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin: 0 0 var(--space-2);
  line-height: var(--lh-heading);
  color: var(--text);
  letter-spacing: var(--tracking-tight);
  transition: color var(--duration-fast) var(--ease-out);
}

.timeline-card:hover .timeline-card__title {
  color: var(--accent);
}

.timeline-card__desc {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-4);
  line-height: var(--lh-body);
}

.timeline-card__footer {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.timeline-card__footer .dot::before { content: '\00B7'; padding: 0 var(--space-2); }

/* Lesson pills inside timeline card */
.timeline-lessons {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

.lesson-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-2);
  font-weight: 500;
  border: 1px solid var(--border);
}

.lesson-pill--done {
  background: var(--success-soft);
  color: var(--success);
  border-color: transparent;
}

/* Connector arrow between marker and card */
.timeline-node__connector {
  display: none; /* hidden on mobile, visual on desktop */
}

/* ============ SECTION HEADING ============ */

.section-heading {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

/* ============ CARDS (legacy compat) ============ */

.cards-list,
.articles {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.card-link,
.article-card {
  display: block;
  color: inherit;
  transition: transform var(--duration-base) var(--ease-out);
}
.card-link:hover,
.article-card:hover { text-decoration: none; }
.card-link:hover .card-title,
.article-card:hover .card-title { color: var(--accent); }
.card-link:hover .card-thumb,
.article-card:hover .card-thumb { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: var(--space-5);
  display: block;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
}
.card-thumb:hover { border-color: var(--border-strong); }
.card-thumb svg { width: 100%; height: 100%; display: block; }

.card-index {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wider);
  color: var(--accent);
  font-weight: 700;
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  font-family: var(--font-sans);
}
html[lang="ar"] .card-index { font-family: var(--font-ar); letter-spacing: 0; }

.card-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin: 0 0 var(--space-2);
  line-height: var(--lh-heading);
  color: var(--text);
  letter-spacing: var(--tracking-tight);
  transition: color var(--duration-fast) var(--ease-out);
}

.card-desc {
  color: var(--text-2);
  font-size: var(--text-md);
  margin: 0 0 var(--space-3);
  line-height: var(--lh-body);
}

.card-stats {
  display: flex;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
  flex-wrap: wrap;
  align-items: center;
}
.card-stats .dot::before { content: '\00B7'; padding: 0 var(--space-2); color: var(--text-muted); }
.card-stats .progress-ring { display: inline-flex; gap: var(--space-2); align-items: center; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--gradient-brand);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-size: var(--text-base);
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.card-author-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.card-author-row .avatar { width: 28px; height: 28px; font-size: var(--text-sm); }
.card-author-row .author-name {
  font-weight: 600;
  color: var(--text-2);
  font-size: var(--text-sm);
}

.card-date {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ============ HERO HEADER (roadmap/course detail) ============ */

.hero-header {
  padding: var(--space-8) 0 var(--space-6);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
}
.hero-header h1 {
  font-size: clamp(var(--text-3xl), 4vw, var(--text-4xl));
  font-weight: 800;
  margin: var(--space-2) 0 var(--space-3);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  color: var(--text);
}
.hero-header p.hero-desc {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin: 0 0 var(--space-4);
  line-height: var(--lh-body);
  max-width: 640px;
}
.hero-header .meta-row {
  display: flex;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
  flex-wrap: wrap;
  align-items: center;
}
.hero-header .meta-row .dot::before { content: '\00B7'; padding: 0 var(--space-2); color: var(--text-muted); }

/* Breadcrumb */
.breadcrumb {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  display: flex;
  gap: var(--space-1);
  align-items: center;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--text-muted);
  padding: var(--space-1) var(--space-2);
  margin: 0 calc(-1 * var(--space-2));
  border-radius: var(--radius-xs);
  transition: color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
}
.breadcrumb a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.breadcrumb .sep::before { content: '\203A'; margin: 0 var(--space-1); color: var(--text-muted); }

/* ============ SYLLABUS ============ */

.syllabus {
  display: flex;
  flex-direction: column;
  margin-top: var(--space-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}
.syllabus-item {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--border);
  color: inherit;
  position: relative;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    padding-inline-start var(--duration-fast) var(--ease-out);
}
.syllabus-item:last-child { border-bottom: none; }
.syllabus-item::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}
html[dir="rtl"] .syllabus-item::before { inset: 0 0 0 auto; }
.syllabus-item:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.syllabus-item:hover::before { opacity: 1; }
.syllabus-item:hover .syl-title { color: var(--accent); }

.syl-num {
  font-family: var(--font-mono);
  direction: ltr;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-muted);
  min-width: 36px;
  padding-top: 2px;
}
.syllabus-item.read .syl-num { color: var(--success); }

.syl-body { flex: 1; min-width: 0; }
.syl-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 var(--space-1);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-tight);
  transition: color var(--duration-fast) var(--ease-out);
}
.syl-summary {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-2);
  line-height: var(--lh-body);
}
.syl-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}
.syl-meta .check { color: var(--success); font-weight: 700; }

/* Progress ring */
.progress-ring {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ============ ARTICLE PAGE ============ */

.article-wrap {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: var(--space-10) var(--space-5) var(--space-20);
}
.article-header { margin-bottom: var(--space-6); }

.back-link {
  color: var(--text-muted);
  font-size: var(--text-sm);
  display: inline-block;
  margin-bottom: var(--space-6);
  padding: var(--space-1) var(--space-2);
  margin-inline-start: calc(-1 * var(--space-2));
  border-radius: var(--radius-xs);
  transition: color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
}
.back-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

.article-tags { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }
.tag {
  font-size: var(--text-xs);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-weight: 500;
  letter-spacing: var(--tracking-normal);
}

.article-title {
  font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl));
  font-weight: 800;
  margin: 0 0 var(--space-3);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tighter);
  color: var(--text);
}
.article-lead {
  font-size: var(--text-xl);
  color: var(--text-muted);
  font-style: italic;
  margin: var(--space-3) 0 var(--space-5);
  line-height: var(--lh-heading);
}
.article-title-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-5) 0 var(--space-6);
}

.author-bar {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-8);
  font-size: var(--text-sm);
  color: var(--text-muted);
  flex-wrap: wrap;
}
.author-bar .avatar { width: 40px; height: 40px; font-size: var(--text-lg); }
.author-bar .author-name { color: var(--text); font-weight: 600; font-size: var(--text-md); }
.author-bar .dot::before { content: '\00B7'; padding: 0 var(--space-2); color: var(--text-muted); }

.article-hero-figure {
  margin: 0 0 var(--space-10);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.article-hero-figure svg { width: 100%; height: auto; display: block; }
.article-hero-figure .caption {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin-top: var(--space-4);
  font-style: italic;
}

/* ============ ARTICLE BODY TYPOGRAPHY ============ */

.article-body {
  font-size: var(--text-lg);
  line-height: var(--lh-long);
  color: var(--text-2);
  font-family: var(--font-serif);
}
html[lang="ar"] .article-body {
  font-family: var(--font-ar);
  font-size: var(--text-base);
  line-height: 2;
}

.article-body p { margin: 0 0 var(--space-6); }

.article-body h2 {
  font-family: var(--font-sans);
  font-size: var(--text-2xl);
  font-weight: 700;
  margin: var(--space-10) 0 var(--space-4);
  color: var(--text);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-heading);
}
html[lang="ar"] .article-body h2 { font-family: var(--font-ar); }

.article-body h3 {
  font-family: var(--font-sans);
  font-size: var(--text-xl);
  font-weight: 700;
  margin: var(--space-8) 0 var(--space-3);
  color: var(--text);
  line-height: var(--lh-heading);
}
html[lang="ar"] .article-body h3 { font-family: var(--font-ar); }

.article-body ul,
.article-body ol { margin: 0 0 var(--space-6); padding-inline-start: var(--space-6); }
.article-body li { margin-bottom: var(--space-2); }

.article-body pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  overflow-x: auto;
  font-size: var(--text-sm);
  margin: 0 0 var(--space-6);
  box-shadow: var(--shadow-xs);
}
.article-body code {
  background: var(--surface-2);
  padding: 2px var(--space-2);
  border-radius: var(--radius-xs);
  font-size: 0.92em;
  color: var(--warning);
  border: 1px solid var(--border);
}

.pull-quote {
  margin: var(--space-8) 0;
  padding: var(--space-5) var(--space-6);
  border-inline-start: 3px solid var(--warning);
  background: var(--warning-soft);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text);
  font-size: var(--text-xl);
  font-style: italic;
  line-height: var(--lh-heading);
  font-family: var(--font-serif);
}
html[lang="ar"] .pull-quote { font-family: var(--font-ar); border-radius: var(--radius-md) 0 0 var(--radius-md); }

.article-body .article-note {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-5);
  background: var(--accent-soft);
  border-inline-start: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: var(--text-base);
  color: var(--text);
  font-style: normal;
  font-family: var(--font-sans);
}
html[lang="ar"] .article-body .article-note {
  font-family: var(--font-ar);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.takeaway {
  margin: var(--space-10) 0;
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
}
.takeaway-label {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wider);
  color: var(--accent);
  font-weight: 700;
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  font-family: var(--font-sans);
}
html[lang="ar"] .takeaway-label { font-family: var(--font-ar); letter-spacing: 0; }
.takeaway-text {
  font-size: var(--text-base);
  color: var(--text);
  font-weight: 500;
  line-height: var(--lh-body);
  font-family: var(--font-sans);
}
html[lang="ar"] .takeaway-text { font-family: var(--font-ar); font-size: var(--text-lg); }

/* ============ ARTICLE NAV (prev/next) ============ */
.article-nav {
  margin: var(--space-12) 0 0;
  padding-top: var(--space-8);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.nav-link {
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: inherit;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out);
}
.nav-link:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}
.nav-link .nav-dir {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-bottom: var(--space-1);
}
.nav-link .nav-title { font-weight: 600; color: var(--text); font-size: var(--text-sm); line-height: var(--lh-heading); }

/* ============ RELATED ============ */
.related {
  margin-top: var(--space-16);
  padding-top: var(--space-10);
  border-top: 1px solid var(--border);
}
.related h3 {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
  font-weight: 700;
  margin: 0 0 var(--space-5);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
}
.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  color: inherit;
  box-shadow: var(--shadow-xs);
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}
.related-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.related-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.related-thumb svg { width: 100%; height: 100%; display: block; }
.related-body { padding: var(--space-4) var(--space-5); }
.related-body .rtitle {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-1);
  line-height: var(--lh-heading);
}
.related-body .rmeta { font-size: var(--text-xs); color: var(--text-muted); }

/* ============ READING PROGRESS BAR ============ */
.read-progress {
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0;
  z-index: 40;
  transition: width var(--duration-fast) var(--ease-out);
}
html[dir="rtl"] .read-progress { background: linear-gradient(-90deg, var(--accent), var(--accent-2)); }

/* ============ PAGINATION ============ */
.pagination {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-16);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border);
}
.pagination a, .pagination span {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-muted);
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.pagination a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.pagination .current { color: var(--text); font-weight: 700; background: var(--surface-2); }

/* ============ FOCUS ============ */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.btn-primary:focus-visible,
.btn-ghost:focus-visible {
  box-shadow: 0 0 0 4px var(--ring);
  outline: none;
}
.article-card:focus-visible,
.card-link:focus-visible,
.nav-link:focus-visible,
.related-card:focus-visible,
.syllabus-item:focus-visible,
.timeline-card:focus-visible,
.roadmap-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
  border-radius: var(--radius-lg);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 720px) {
  .page-wrap, .article-wrap { padding-top: var(--space-8); padding-bottom: var(--space-16); }
  .hero-premium { padding: var(--space-12) var(--space-5) var(--space-10); }
  .hero-premium__title { font-size: var(--text-4xl); }
  .hero-premium__stats { gap: var(--space-6); }
  .hero-stat__number { font-size: var(--text-2xl); }
  .article-title { font-size: var(--text-3xl); }
  .article-lead { font-size: var(--text-lg); }
  .article-body { font-size: var(--text-base); line-height: var(--lh-body); }
  .card-title { font-size: var(--text-xl); }
  .card-thumb { border-radius: var(--radius-md); }
  .article-nav { grid-template-columns: 1fr; }

  .timeline-node__marker {
    width: 44px;
    height: 44px;
    font-size: var(--text-base);
  }

  .roadmap-timeline::before {
    left: 22px;
  }
  html[dir="rtl"] .roadmap-timeline::before {
    left: auto;
    right: 22px;
  }

  .timeline-card {
    padding: var(--space-4);
  }

  .timeline-card__title {
    font-size: var(--text-lg);
  }
}

@media (max-width: 640px) {
  .site-nav-inner { flex-wrap: wrap; }
  .site-nav-menu {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: var(--space-4);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border);
  }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .card-link:hover .card-thumb,
  .article-card:hover .card-thumb,
  .nav-link:hover,
  .related-card:hover,
  .btn-primary:hover,
  .syllabus-item:hover,
  .timeline-card:hover,
  .timeline-node:hover .timeline-node__marker,
  .roadmap-card:hover { transform: none !important; }
}

/* ============ PRINT ============ */
@media print {
  .site-nav, .read-progress, .article-nav, .related, .back-link, .breadcrumb, .hero-orbs { display: none; }
  body { background: #ffffff; color: #000; }
  .article-body { font-size: 11pt; line-height: 1.55; color: #000; }
  a { color: #000; text-decoration: underline; }
}
