/* ============================================
   Rabha.digital — Pattern D: Comparison-First
   Finance Niche | RTL Arabic | Morocco GEO
   ============================================ */

/* --- CSS Variables --- */
:root {
  --brand: #0f172a;
  --brand-light: #1e293b;
  --accent: #059669;
  --accent-hover: #047857;
  --accent-warm: #d97706;
  --accent-warm-hover: #b45309;
  --bg: #ffffff;
  --bg-alt: #f0fdf4;
  --bg-dark: #0f172a;
  --text: #1e293b;
  --text-light: #f8fafc;
  --muted: #64748b;
  --border: #e2e8f0;
  --card: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font: 'IBM Plex Sans Arabic', 'Noto Sans Arabic', sans-serif;
  --max-w: 1200px;
  --max-w-narrow: 860px;
  --nav-h: 64px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }
ul, ol { padding-right: 1.5rem; }
table { border-collapse: collapse; width: 100%; }

/* --- Typography --- */
h1 { font-size: 2.25rem; font-weight: 700; line-height: 1.3; color: var(--brand); margin-bottom: 1rem; }
h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.4; color: var(--brand); margin: 2.5rem 0 1rem; }
h3 { font-size: 1.375rem; font-weight: 600; line-height: 1.4; color: var(--brand-light); margin: 1.5rem 0 0.75rem; }
h4 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; margin: 1rem 0 0.5rem; }
p { margin-bottom: 1rem; color: var(--text); }
small { font-size: 0.875rem; color: var(--muted); }

/* --- Layout --- */
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }
.wrap-narrow { max-width: var(--max-w-narrow); margin: 0 auto; padding: 0 1.5rem; }
.section-alt { background: var(--bg-alt); }
.section-dark { background: var(--brand); color: var(--text-light); }
.section-dark h2, .section-dark h3 { color: var(--text-light); }
.section-dark p { color: #cbd5e1; }
.pad-section { padding: 4rem 0; }

/* --- Navigation --- */
.nav-rail {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,23,42,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  height: var(--nav-h);
}
.nav-rail .wrap { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.nav-logo { display: flex; align-items: center; gap: 0.5rem; color: #fff; font-weight: 700; font-size: 1.25rem; }
.nav-logo img { width: 32px; height: 32px; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; list-style: none; padding: 0; margin: 0; }
.nav-links a { color: #cbd5e1; font-size: 0.9375rem; font-weight: 500; }
.nav-links a:hover { color: #fff; }
.burger-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; padding: 0.25rem; }

/* --- Breadcrumbs --- */
.crumb-line { padding: 0.75rem 0; font-size: 0.875rem; color: var(--muted); }
.crumb-line a { color: var(--muted); }
.crumb-line a:hover { color: var(--accent); }
.crumb-line span { margin: 0 0.35rem; }

/* --- Hero Clash (Comparison Hero) --- */
.hero-clash {
  position: relative;
  background: linear-gradient(135deg, var(--brand) 0%, #1a365d 50%, #0c4a6e 100%);
  color: #fff;
  padding: 4rem 0 3rem;
  overflow: hidden;
}
.hero-clash::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: url('/assets/img/hero-banner.webp') center/cover no-repeat;
  opacity: 0.15;
}
.hero-clash .wrap { position: relative; z-index: 1; }
.hero-clash h1 { color: #fff; font-size: 2.5rem; margin-bottom: 0.75rem; }
.hero-clash .hero-sub { font-size: 1.125rem; color: #94a3b8; margin-bottom: 2rem; max-width: 700px; }
.hero-badge { display: inline-block; background: var(--accent); color: #fff; font-size: 0.8125rem; font-weight: 600; padding: 0.25rem 0.75rem; border-radius: 20px; margin-bottom: 1rem; }

/* --- Inner Hero (non-homepage) --- */
.inner-hero {
  background: linear-gradient(135deg, var(--brand) 0%, #1a365d 100%);
  color: #fff;
  padding: 3rem 0 2.5rem;
}
.inner-hero h1 { color: #fff; font-size: 2rem; margin-bottom: 0.5rem; }
.inner-hero .hero-sub { font-size: 1rem; color: #94a3b8; max-width: 650px; }

/* --- Comparison Table --- */
.feature-matrix { overflow-x: auto; margin: 2rem 0; border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
.feature-matrix table { width: 100%; min-width: 700px; background: var(--card); }
.feature-matrix th {
  background: var(--brand);
  color: #fff;
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}
.feature-matrix th:first-child { text-align: right; }
.feature-matrix td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
  text-align: center;
}
.feature-matrix td:first-child { text-align: right; font-weight: 500; }
.feature-matrix tr:nth-child(even) { background: var(--bg-alt); }
.feature-matrix tr:hover { background: #ecfdf5; }
.feature-matrix .col-highlight { background: #ecfdf5; }
.feature-matrix .col-highlight th { background: var(--accent); }
.feature-matrix .check { color: var(--accent); font-weight: 700; font-size: 1.1rem; }
.feature-matrix .cross { color: #dc2626; font-weight: 700; font-size: 1.1rem; }
.feature-matrix .winner-row td { background: #ecfdf5; font-weight: 600; }

/* --- Offer Tiles (Cards) --- */
.offer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin: 2rem 0; }
.offer-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  position: relative;
}
.offer-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.offer-tile.top-pick { border-color: var(--accent); border-width: 2px; }
.offer-tile .tile-rank {
  position: absolute; top: -12px; right: 1.25rem;
  background: var(--accent); color: #fff;
  font-size: 0.75rem; font-weight: 700; padding: 0.2rem 0.75rem; border-radius: 12px;
}
.offer-tile .tile-rank.runner { background: var(--muted); }
.offer-tile h3 { font-size: 1.25rem; margin: 0.5rem 0 0.25rem; }
.offer-tile .tile-score { font-size: 2rem; font-weight: 700; color: var(--accent); }
.offer-tile .tile-score span { font-size: 0.875rem; color: var(--muted); font-weight: 400; }
.offer-tile ul { list-style: none; padding: 0; margin: 0.75rem 0; }
.offer-tile ul li { padding: 0.35rem 0; font-size: 0.9375rem; display: flex; align-items: center; gap: 0.5rem; }
.offer-tile ul li::before { content: '✓'; color: var(--accent); font-weight: 700; flex-shrink: 0; }
.offer-tile .tile-cta { margin-top: 1rem; }

/* --- Verdict Cards (Pros/Cons) --- */
.verdict-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 2rem 0; }
.verdict-card {
  border-radius: var(--radius-md);
  padding: 1.5rem;
}
.verdict-card.pros { background: #ecfdf5; border: 1px solid #a7f3d0; }
.verdict-card.cons { background: #fef2f2; border: 1px solid #fecaca; }
.verdict-card h3 { font-size: 1.125rem; margin-bottom: 0.75rem; }
.verdict-card.pros h3 { color: var(--accent); }
.verdict-card.cons h3 { color: #dc2626; }
.verdict-card ul { list-style: none; padding: 0; }
.verdict-card ul li { padding: 0.3rem 0; font-size: 0.9375rem; display: flex; align-items: flex-start; gap: 0.5rem; }
.verdict-card.pros ul li::before { content: '+'; color: var(--accent); font-weight: 700; flex-shrink: 0; }
.verdict-card.cons ul li::before { content: '−'; color: #dc2626; font-weight: 700; flex-shrink: 0; }

/* --- CTA Button --- */
.convert-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 2rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  text-align: center;
  font-family: var(--font);
}
.convert-btn:hover { background: var(--accent-hover); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.convert-btn:active { transform: translateY(0); }
.convert-btn.warm { background: var(--accent-warm); }
.convert-btn.warm:hover { background: var(--accent-warm-hover); }
.convert-btn.outline { background: transparent; border: 2px solid var(--accent); color: var(--accent); }
.convert-btn.outline:hover { background: var(--accent); color: #fff; }
.convert-btn.lg { padding: 1rem 2.5rem; font-size: 1.125rem; }

/* --- Action Strip (CTA Banner) --- */
.action-strip {
  background: linear-gradient(135deg, var(--accent) 0%, #047857 100%);
  color: #fff;
  text-align: center;
  padding: 3rem 0;
  margin: 2rem 0;
}
.action-strip h2 { color: #fff; margin-bottom: 0.75rem; }
.action-strip p { color: #d1fae5; margin-bottom: 1.5rem; font-size: 1.0625rem; }

/* --- Cred Strip (Trust Indicators) --- */
.cred-strip {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 2rem;
  padding: 1.5rem 0; margin: 1.5rem 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.cred-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9375rem; color: var(--muted); }
.cred-icon { font-size: 1.5rem; }

/* --- QA Accordion (FAQ) --- */
.qa-accordion { margin: 2rem 0; }
.qa-accordion details { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.75rem; overflow: hidden; transition: box-shadow 0.2s; }
.qa-accordion details:hover { box-shadow: var(--shadow-sm); }
.qa-accordion details[open] { box-shadow: var(--shadow-sm); border-color: var(--accent); }
.qa-accordion summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  user-select: none;
}
.qa-accordion summary::-webkit-details-marker { display: none; }
.qa-accordion summary::after { content: '+'; font-size: 1.25rem; color: var(--accent); font-weight: 700; flex-shrink: 0; transition: transform 0.2s; }
.qa-accordion details[open] summary::after { content: '−'; }
.qa-accordion .qa-body { padding: 0 1.25rem 1rem; color: var(--text); line-height: 1.8; }

/* --- Story Body (Article) --- */
.story-body h2 { border-bottom: 2px solid var(--accent); padding-bottom: 0.5rem; }
.story-body ul, .story-body ol { margin-bottom: 1rem; }
.story-body li { margin-bottom: 0.4rem; }
.story-body img { border-radius: var(--radius-md); margin: 1.5rem 0; }

/* --- Jump Index (TOC) --- */
.jump-index {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0 2rem;
}
.jump-index h4 { font-size: 1rem; margin-bottom: 0.75rem; color: var(--brand); }
.jump-index ol { padding-right: 1.25rem; margin: 0; }
.jump-index ol li { margin-bottom: 0.35rem; }
.jump-index ol li a { font-size: 0.9375rem; color: var(--text); }
.jump-index ol li a:hover { color: var(--accent); }

/* --- Source Badge (Evidence Notes) --- */
.source-badge {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.875rem;
  color: #92400e;
}
.source-badge strong { color: #78350f; }

/* --- UseCase Block --- */
.usecase-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
  margin: 2rem 0;
  padding: 2rem 0;
}
.usecase-block.reverse { direction: ltr; }
.usecase-block.reverse > * { direction: rtl; text-align: right; }
.usecase-block img { border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
.usecase-text h2, .usecase-text h3 { margin-top: 0; }

/* --- Steps (How-To) --- */
.step-list { counter-reset: step; list-style: none; padding: 0; margin: 1.5rem 0; }
.step-list li {
  counter-increment: step;
  position: relative;
  padding: 1.25rem 1.25rem 1.25rem 3.5rem;
  margin-bottom: 1rem;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  border-right: 3px solid var(--accent);
}
.step-list li::before {
  content: counter(step);
  position: absolute;
  right: 1rem; top: 1.25rem;
  width: 2rem; height: 2rem;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.875rem;
}
.step-list li strong { display: block; margin-bottom: 0.25rem; }

/* --- Badge / Tag --- */
.tag {
  display: inline-block;
  background: var(--bg-alt);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin: 0 0.25rem 0.25rem 0;
}

/* --- Site Footer --- */
.site-footer {
  background: var(--brand);
  color: #94a3b8;
  padding: 3rem 0 1.5rem;
  font-size: 0.9375rem;
}
.site-footer h4 { color: #fff; margin-bottom: 0.75rem; font-size: 1rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-grid a { color: #94a3b8; }
.footer-grid a:hover { color: #fff; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid ul li { margin-bottom: 0.4rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 1.5rem; text-align: center; font-size: 0.8125rem; color: #64748b; }
.footer-risk { font-size: 0.8125rem; color: #64748b; margin-top: 1rem; text-align: center; max-width: 800px; margin-left: auto; margin-right: auto; }

/* --- Ad Slot (Banner) --- */
.ad-slot {
  background: linear-gradient(135deg, var(--brand) 0%, #1e3a5f 100%);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  margin: 2rem 0;
  box-shadow: var(--shadow-md);
}
.ad-slot h3 { color: #fff; margin-bottom: 0.5rem; }
.ad-slot p { color: #cbd5e1; margin-bottom: 1rem; }

/* --- Utility --- */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 2rem; }
.flex-center { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* --- Responsive: 900px --- */
@media (max-width: 900px) {
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.5rem; }
  .hero-clash { padding: 2.5rem 0 2rem; }
  .hero-clash h1 { font-size: 2rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .verdict-row { grid-template-columns: 1fr; }
  .usecase-block, .usecase-block.reverse { grid-template-columns: 1fr; direction: rtl; }
  .usecase-block.reverse > * { direction: rtl; }
  .offer-grid { grid-template-columns: 1fr 1fr; }
}

/* --- Responsive: 600px --- */
@media (max-width: 600px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  :root { --nav-h: 56px; }
  .nav-links { display: none; flex-direction: column; position: absolute; top: var(--nav-h); right: 0; left: 0; background: var(--brand); padding: 1rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); gap: 0.75rem; }
  .nav-links.open { display: flex; }
  .burger-toggle { display: block; }
  .hero-clash { padding: 2rem 0 1.5rem; }
  .hero-clash h1 { font-size: 1.625rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .offer-grid { grid-template-columns: 1fr; }
  .cred-strip { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .feature-matrix { font-size: 0.8125rem; }
  .action-strip { padding: 2rem 0; }
  .pad-section { padding: 2.5rem 0; }
}

/* --- Print --- */
@media print {
  .nav-rail, .burger-toggle, .convert-btn, .action-strip, .ad-slot, .jump-index, .site-footer { display: none !important; }
  body { color: #000; background: #fff; font-size: 12pt; line-height: 1.5; }
  h1, h2, h3 { color: #000; break-after: avoid; }
  .hero-clash { background: #f0fdf4 !important; color: #000 !important; padding: 1rem 0; }
  .hero-clash, .hero-clash h1, .hero-clash .hero-sub { color: #000 !important; }
  .hero-clash::before { display: none; }
  .qa-accordion details { break-inside: avoid; }
  .feature-matrix { box-shadow: none; border: 1px solid #ccc; }
  a { color: #000; text-decoration: underline; }
  .source-badge { border: 1px solid #ccc; background: #f9f9f9; }
  @page { margin: 2cm; }
}
/* Search-intent hub and verification notes */
.intent-hub{padding:38px 0;background:#f4f8f6;border-bottom:1px solid #dbe8e1}.intent-hub h2{margin:.2rem 0 .5rem}.eyebrow{margin:0;color:#13734b;font-weight:800;font-size:.8rem;letter-spacing:.08em}.intent-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:22px}.intent-grid a{display:flex;flex-direction:column;gap:5px;padding:17px;border:1px solid #cfe0d7;border-radius:12px;background:#fff;color:inherit;text-decoration:none}.intent-grid a:hover{border-color:#16885b;transform:translateY(-1px)}.intent-grid span{font-size:.9rem;color:#52635b}.verification-note{margin:22px 0;padding:15px 18px;border-right:4px solid #b87516;background:#fff8e8;line-height:1.75}.topic-path{padding:18px 0;background:#eef5f1;border-top:1px solid #d7e6de}.topic-path .wrap{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.topic-path a{text-decoration:underline;text-underline-offset:3px}@media(max-width:800px){.intent-grid{grid-template-columns:1fr}.intent-hub{padding:28px 0}.verification-note{font-size:.92rem}}
