/* Wealth Logic Pro — نظام التصميم (الإصدار 2) */
:root {
  --navy: #0b2545;
  --navy-2: #13315c;
  --teal: #1fb5b0;
  --teal-deep: #0f7f7c;
  --teal-soft: #d6f3f1;
  --gold: #c9a227;
  --gold-soft: #f6eccb;

  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eaf0f7;
  --text: #13202f;
  --muted: #56647a;
  --border: #d8e2ee;
  --shadow: 0 10px 30px rgba(11, 37, 69, .08);
  --shadow-lg: 0 18px 40px rgba(11, 37, 69, .14);
  --radius: 16px;
  --focus: #1fb5b0;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #08131f;
  --surface: #0f2038;
  --surface-2: #0c1b2e;
  --text: #e9f0f8;
  --muted: #9db0c6;
  --border: #1d3350;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, .5);
  --teal-soft: #103538;
  --gold-soft: #3a2f10;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08131f;
    --surface: #0f2038;
    --surface-2: #0c1b2e;
    --text: #e9f0f8;
    --muted: #9db0c6;
    --border: #1d3350;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --shadow-lg: 0 18px 40px rgba(0, 0, 0, .5);
    --teal-soft: #103538;
    --gold-soft: #3a2f10;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Tajawal", "Cairo", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.85;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: "Cairo", "Tajawal", sans-serif; line-height: 1.35; margin: .6em 0 .4em; letter-spacing: 0; }
h1 { font-size: clamp(1.8rem, 4.2vw, 2.8rem); font-weight: 800; }
h2 { font-size: clamp(1.35rem, 3vw, 1.85rem); font-weight: 700; }
h3 { font-size: 1.12rem; font-weight: 700; }
p { margin: .6em 0; }
a { color: var(--teal-deep); text-decoration: none; }
[data-theme="dark"] a, a.on-dark { color: var(--teal); }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip-link {
  position: absolute; right: -999px; top: 0; background: var(--gold); color: #000;
  padding: .5rem 1rem; z-index: 100;
}
.skip-link:focus { right: 1rem; }

.container { width: min(1160px, 92%); margin-inline: auto; }
.section { padding: clamp(2.75rem, 6vw, 4.5rem) 0; }
.section.alt { background: var(--surface-2); }
.section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.section-title h2 { margin: 0; display: flex; align-items: center; gap: .6rem; }
.section-title h2::before {
  content: ""; width: 6px; height: 1.15em; border-radius: 3px;
  background: linear-gradient(var(--gold), var(--teal));
}
.section-title a { font-weight: 700; white-space: nowrap; }
.muted { color: var(--muted); }

/* ===== الشريط العلوي ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-wrap { display: flex; align-items: center; gap: 1rem; padding: .75rem 0; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo svg { width: 40px; height: 40px; flex: 0 0 auto; }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text strong { font-family: "Cairo", sans-serif; font-weight: 800; font-size: 1.2rem; letter-spacing: .01em; }
.logo-text small { font-size: .74rem; color: var(--gold); font-weight: 700; margin-top: 2px; }

.main-nav { display: flex; gap: .2rem; margin-inline-start: auto; flex-wrap: wrap; }
.main-nav a { color: var(--text); padding: .45rem .8rem; border-radius: 10px; font-weight: 600; }
.main-nav a:hover, .main-nav a[aria-current="page"] { background: var(--teal-soft); text-decoration: none; color: var(--teal-deep); }
[data-theme="dark"] .main-nav a:hover, [data-theme="dark"] .main-nav a[aria-current="page"] { color: var(--text); }

.header-tools { display: flex; align-items: center; gap: .5rem; }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 12px; width: 42px; height: 42px; cursor: pointer; font: inherit; font-size: 1.05rem;
  display: inline-grid; place-items: center;
}
.menu-toggle { display: none; }

.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search input {
  width: 100%; font: inherit; padding: .6rem 2.5rem .6rem 1rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.search input:focus { background: var(--surface); }
.search svg { position: absolute; right: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-results {
  position: absolute; top: calc(100% + 6px); right: 0; left: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); display: none; max-height: 340px; overflow: auto; z-index: 60;
}
.search-results.open { display: block; }
.search-results a { display: block; padding: .65rem 1rem; color: var(--text); border-bottom: 1px solid var(--border); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover { background: var(--surface-2); text-decoration: none; }

/* ===== الأزرار ===== */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-weight: 700; padding: .75rem 1.4rem; border-radius: 12px;
  border: 0; cursor: pointer; background: var(--teal-deep); color: #fff; text-decoration: none; transition: transform .15s ease, filter .15s ease;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); transform: translateY(-1px); }
.btn-gold { background: linear-gradient(135deg, #e0b93a, var(--gold)); color: #1a1400; }
.btn-ghost { background: rgba(255,255,255,.06); color: #fff; border: 1px solid rgba(255,255,255,.28); }

/* ===== البطل ===== */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(31,181,176,.35), transparent 60%),
    radial-gradient(700px 400px at 100% 110%, rgba(201,162,39,.22), transparent 60%),
    linear-gradient(135deg, #0a1f3a 0%, #0f3a5e 55%, #0b5159 100%);
  padding: clamp(3.25rem, 8vw, 6rem) 0;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.hero > .container { position: relative; z-index: 1; }
.hero h1 { color: #fff; margin-top: .2em; }
.hero p { color: #d3e4f0; font-size: 1.12rem; max-width: 620px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .92rem; color: var(--gold);
  background: rgba(201,162,39,.12); border: 1px solid rgba(201,162,39,.35); padding: .3rem .85rem; border-radius: 999px;
}
.hero-grid { display: grid; gap: 2.5rem; grid-template-columns: 1.25fr .75fr; align-items: center; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.hero-card {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16); border-radius: 20px;
  padding: 1.4rem; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.hero-card .chart { width: 100%; height: auto; margin-bottom: .8rem; }
.hero-card h3 { color: #fff; margin: 0 0 .5rem; font-size: 1rem; opacity: .95; }
.hero-card a {
  color: #fff; display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .7rem .2rem; border-top: 1px solid rgba(255,255,255,.12); font-weight: 600;
}
.hero-card a:hover { text-decoration: none; color: var(--gold); }
.hero-card a::after { content: "←"; opacity: .6; }

/* ===== البطاقات ===== */
.grid { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.card-body { padding: 1.25rem 1.3rem 1.4rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.card h3 { margin: 0; font-size: 1.12rem; line-height: 1.5; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--teal-deep); text-decoration: none; }
.card p { margin: 0; color: var(--muted); font-size: .97rem; }
.card .meta { font-size: .85rem; color: var(--muted); }
.card .more { margin-top: auto; font-weight: 700; color: var(--teal-deep); }
[data-theme="dark"] .card .more { color: var(--teal); }
.card .icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--navy), var(--teal-deep)); color: #fff; font-weight: 800; font-size: 1.15rem;
  box-shadow: 0 6px 16px rgba(15,127,124,.3);
}
.card-tool { padding: 1.4rem; }
.card-tool .more { margin-top: .4rem; }

.tag {
  display: inline-block; font-size: .8rem; font-weight: 700; padding: .2rem .7rem; border-radius: 999px;
  background: var(--teal-soft); color: var(--teal-deep); width: fit-content;
}
[data-theme="dark"] .tag { color: var(--teal); }
.tag.gold { background: var(--gold-soft); color: #7a5d00; }

/* ===== الفلاتر ===== */
.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: .5rem 1rem;
  border-radius: 999px; cursor: pointer; font: inherit; font-weight: 600;
}
.chip:hover { border-color: var(--teal); }
.chip[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--teal-deep); border-color: var(--teal-deep); }

/* ===== الأدوات ===== */
.breadcrumb { font-size: .9rem; color: var(--muted); margin: 1.2rem 0 .4rem; }
.breadcrumb a { color: var(--muted); }
.page-head { padding: 2rem 0 .5rem; }
.page-head p { color: var(--muted); font-size: 1.05rem; max-width: 700px; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 760px; }

.calc {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow); padding: clamp(1.25rem, 3vw, 2.25rem); margin-top: 1.5rem;
}
.form-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.field label { display: block; font-weight: 700; margin-bottom: .35rem; }
.field input, .field select {
  width: 100%; font: inherit; padding: .7rem .85rem; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
}
.field input:focus, .field select:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px rgba(31,181,176,.2); }
.field .hint { font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.result {
  margin-top: 1.5rem; background: linear-gradient(135deg, var(--teal-soft), color-mix(in srgb, var(--teal-soft) 60%, var(--gold-soft)));
  border-radius: 16px; padding: 1.25rem 1.35rem; border: 1px solid var(--border);
}
.result .big { font-size: 1.6rem; font-weight: 800; color: var(--text); font-family: "Cairo", sans-serif; margin-bottom: .5rem; }
.result .row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; border-bottom: 1px dashed var(--border); padding: .45rem 0; }
.result .row:last-child { border-bottom: 0; }
.result .row strong { color: var(--text); text-align: left; }
.calc-note { font-size: .88rem; color: var(--muted); margin-top: .75rem; }
.error { color: #b42318; font-weight: 700; margin-top: .75rem; }
.example-box {
  background: var(--gold-soft); border-inline-start: 4px solid var(--gold); border-radius: 12px; padding: 1rem 1.2rem; margin: 1rem 0;
}

/* ===== المحتوى ===== */
.article-cover { border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-lg); margin: 1.5rem 0 2rem; }
.article-cover img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; }
.article-meta { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .92rem; margin: .4rem 0 1rem; }
.prose { max-width: 760px; }
.prose p, .prose li { font-size: 1.05rem; }
.prose ul, .prose ol { padding-inline-start: 1.4rem; }
.prose h2 { margin-top: 1.9em; }
.faq details {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .9rem 1.1rem; margin-bottom: .6rem;
}
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { color: var(--muted); }

/* ===== النشرة ===== */
.newsletter {
  position: relative; overflow: hidden; color: #fff; border-radius: 22px; padding: clamp(1.6rem, 4vw, 2.75rem);
  background: linear-gradient(120deg, #0a1f3a, #0f4c5c);
  display: grid; gap: 1.4rem; grid-template-columns: 1fr 1fr; align-items: center;
}
.newsletter h2 { color: #fff; margin: 0 0 .3rem; }
.newsletter p { color: #cfe3ef; margin: 0; }
.newsletter form { display: flex; gap: .5rem; flex-wrap: wrap; }
.newsletter input[type="email"] {
  flex: 1 1 220px; font: inherit; padding: .8rem 1rem; border-radius: 12px; border: 0; color: #111;
}
.newsletter .form-status { color: #cfe3ef; }

/* ===== نماذج ===== */
.contact-form { display: grid; gap: .9rem; max-width: 620px; margin-top: 1.5rem; }
.contact-form label { font-weight: 700; }
.contact-form input, .contact-form textarea {
  width: 100%; font: inherit; padding: .75rem .95rem; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.contact-form textarea { min-height: 150px; resize: vertical; }
.form-status { font-weight: 700; }

/* ===== التذييل ===== */
.site-footer { background: #0a1a2e; color: #b9cadb; padding: 3rem 0 1.5rem; margin-top: 3.5rem; }
.site-footer a { color: #d7e5f1; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 1.6fr 1fr 1fr; }
.footer-grid h3 { color: #fff; font-size: 1rem; margin-top: 0; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: .45rem; }
.footer-brand p { max-width: 380px; font-size: .97rem; }
.copy { border-top: 1px solid rgba(255,255,255,.1); margin-top: 2rem; padding-top: 1.1rem; font-size: .88rem; color: #8ea3b9; }

/* ===== الجوال ===== */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .newsletter { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .menu-toggle { display: inline-grid; }
  .main-nav {
    display: none; width: 100%; flex-direction: column; margin: 0; padding-bottom: .5rem;
  }
  .main-nav.open { display: flex; }
  .search { max-width: none; order: 10; flex-basis: 100%; }
  .header-tools { margin-inline-start: auto; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-actions .btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
