/* فاتحة الدارين — نظام التصميم */
:root {
  --sky: #1a9fe0;
  --sky-600: #0f86c4;
  --sky-300: #7cc9f2;
  --sky-100: #e3f4fd;
  --sky-50: #f3fafe;
  --navy: #1f2539;
  --navy-800: #161b2c;
  --navy-600: #2c3450;
  --ink: #1f2539;
  --muted: #5c6781;
  --line: #dfe8f0;
  --paper: #ffffff;
  --gold: #d9a441;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(22, 60, 100, .08);
  --shadow-lg: 0 24px 60px rgba(22, 60, 100, .16);
  --font: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --font-quran: "Amiri Quran", "Amiri", "Traditional Arabic", serif;
  --wrap: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.8;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: var(--sky-600); text-decoration: none; }
a:hover { color: var(--sky); }
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .5em; font-weight: 800; }
h1 { font-size: clamp(2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
ul { padding-inline-start: 1.2em; }
.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
section { padding: 84px 0; }
.alt { background: var(--sky-50); }
.dark { background: var(--navy); color: #fff; }
.dark p, .dark .lead { color: #c3cce0; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 720px; }
.center { text-align: center; }
.center .lead { margin-inline: auto; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--sky-600); font-weight: 700; font-size: .95rem; margin-bottom: 10px;
}
.eyebrow::before { content: ""; width: 26px; height: 3px; border-radius: 3px; background: var(--sky); }
.dark .eyebrow { color: var(--sky-300); }
.section-head { margin-bottom: 44px; }

/* أزرار */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 26px; border-radius: 999px; border: 2px solid transparent;
  font: inherit; font-weight: 700; cursor: pointer; transition: .2s; white-space: nowrap;
}
.btn-primary { background: var(--sky); color: #fff; box-shadow: 0 8px 22px rgba(26, 159, 224, .35); }
.btn-primary:hover { background: var(--sky-600); color: #fff; transform: translateY(-2px); }
.btn-ghost { border-color: var(--sky); color: var(--sky-600); background: transparent; }
.btn-ghost:hover { background: var(--sky-100); }
.btn-light { background: #fff; color: var(--navy); }
.btn-light:hover { background: var(--sky-100); color: var(--navy); }
.dark .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .4); }
.dark .btn-ghost:hover { background: rgba(255, 255, 255, .1); }
.btn-sm { padding: 7px 16px; font-size: .9rem; }
.btn:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--sky-300); outline-offset: 2px;
}

/* الشريط العلوي */
.topbar { background: var(--navy-800); color: #c9d3e6; font-size: .88rem; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; flex-wrap: wrap; }
.topbar a { color: #dbe6f7; padding: 6px 10px; border-radius: 8px; font-weight: 500; }
.topbar a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.topbar .tag { color: var(--sky-300); font-weight: 500; }
.topbar-links { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.lang {
  background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 8px; padding: 4px 8px; font: inherit; font-size: .85rem;
}
.lang option { color: #000; }

/* الترويسة */
.header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header .wrap { display: flex; align-items: center; gap: 18px; min-height: 76px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--navy); }
.brand img { height: 54px; width: auto; }
.brand b { display: block; font-size: 1.3rem; font-weight: 800; line-height: 1.2; color: var(--sky-600); }
.brand small { display: block; font-size: .74rem; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; }
.nav a { color: var(--ink); font-weight: 600; padding: 8px 12px; border-radius: 10px; font-size: .97rem; }
.nav a:hover, .nav a.active { background: var(--sky-100); color: var(--sky-600); }
.menu-btn { display: none; margin-inline-start: auto; background: none; border: 0; font-size: 1.7rem; cursor: pointer; color: var(--navy); }

/* الواجهة */
.hero { position: relative; overflow: hidden; background: var(--navy); color: #fff; padding: 0; }
.hero video.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .28; }
.hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(900px 500px at 80% 10%, rgba(26, 159, 224, .35), transparent 70%), linear-gradient(180deg, rgba(31, 37, 57, .55), var(--navy)); }
.hero .wrap { position: relative; z-index: 2; display: grid; grid-template-columns: 1.25fr .75fr; gap: 40px; align-items: center; padding: 96px 0 110px; }
.hero h1 { color: #fff; }
.hero h1 em { font-style: normal; color: var(--sky-300); }
.hero .lead { color: #cfd9ec; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-mark { justify-self: center; text-align: center; }
.hero-mark img { height: clamp(220px, 34vw, 380px); margin-inline: auto; filter: drop-shadow(0 20px 50px rgba(26, 159, 224, .45)); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-12px); } }
.vision-chip { display: inline-flex; align-items: baseline; gap: 10px; margin-top: 34px; padding: 14px 22px; border: 1px solid rgba(255, 255, 255, .18); border-radius: var(--radius); background: rgba(255, 255, 255, .06); }
.vision-chip strong { font-size: clamp(1.8rem, 4vw, 2.8rem); color: var(--sky-300); font-weight: 800; line-height: 1; }

.page-hero { background: linear-gradient(135deg, var(--navy), var(--navy-600)); color: #fff; padding: 70px 0; position: relative; overflow: hidden; }
.page-hero::before { content: ""; position: absolute; inset-inline-start: -60px; top: -40px; width: 300px; height: 420px; background: url(logo-mark.png) center/contain no-repeat; opacity: .08; }
.page-hero h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); color: #fff; }
.page-hero p { color: #c3cce0; max-width: 720px; margin: 0; }
.crumbs { font-size: .9rem; color: var(--sky-300); margin-bottom: 8px; }
.crumbs a { color: var(--sky-300); }

/* الشبكات والبطاقات */
.grid { display: grid; gap: 22px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g5 { grid-template-columns: repeat(5, 1fr); }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow); transition: .25s; position: relative;
}
a.card { color: inherit; display: block; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--sky-300); }
.card p { color: var(--muted); font-size: .98rem; margin: 0; }
.card h3 { color: var(--navy); }
.dark .card { background: var(--navy-600); border-color: rgba(255, 255, 255, .08); box-shadow: none; }
.dark .card h3 { color: #fff; }
.dark .card p { color: #b9c4dc; }
.icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--sky-100); color: var(--sky-600); font-size: 1.6rem; margin-bottom: 16px;
}
.dark .icon { background: rgba(124, 201, 242, .14); color: var(--sky-300); }
.card .btn { margin-top: 18px; }
.plan { display: flex; flex-direction: column; }
.plan .btn { margin-top: auto; }
.plan p { margin-bottom: 18px; }
.plan.featured { border: 2px solid var(--sky); }
.badge { display: inline-block; background: var(--sky-100); color: var(--sky-600); font-size: .78rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; margin-bottom: 10px; }
.badge.gold { background: #fbf1dc; color: #9b6d12; }

.guide { text-align: center; padding: 34px 22px; overflow: hidden; }
.guide .emoji { font-size: 3.4rem; line-height: 1; margin-bottom: 12px; display: block; }
.guide::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 6px; background: var(--c, var(--sky)); }

.counter { text-align: center; }
.counter b { display: block; font-size: clamp(2rem, 4vw, 3rem); color: var(--sky-300); font-weight: 800; line-height: 1.2; }
.counter span { color: #c3cce0; }

.video-frame { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); background: #000; aspect-ratio: 16/9; }
.video-frame video, .video-frame iframe { width: 100%; height: 100%; object-fit: cover; border: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }

.five { counter-reset: s; }
.five .card { padding-top: 34px; }
.five .card::before {
  counter-increment: s; content: counter(s); position: absolute; top: -18px; inset-inline-start: 22px;
  width: 40px; height: 40px; border-radius: 50%; background: var(--sky); color: #fff; font-weight: 800; display: grid; place-items: center;
}

.check { list-style: none; padding: 0; margin: 0; }
.check li { padding-inline-start: 30px; position: relative; margin-bottom: 10px; }
.check li::before { content: "✓"; position: absolute; inset-inline-start: 0; top: 0; color: var(--sky); font-weight: 800; }

.quote { font-family: var(--font-quran); font-size: 1.7rem; line-height: 2.3; color: var(--sky-600); text-align: center; }
.dark .quote { color: var(--sky-300); }

.placeholder { border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); background: var(--sky-50); }
.logos { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.logos div { height: 90px; border: 2px dashed var(--line); border-radius: var(--radius-sm); display: grid; place-items: center; color: #9aa6bd; font-size: .9rem; background: #fff; }

/* تبويبات */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.tabs.center { justify-content: center; }
.tab { padding: 10px 20px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font: inherit; font-weight: 700; cursor: pointer; color: var(--muted); }
.tab[aria-selected="true"] { background: var(--sky); border-color: var(--sky); color: #fff; }
.panel[hidden] { display: none; }

/* نماذج */
form.form { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.form .full { grid-column: 1 / -1; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
.form input, .form select, .form textarea {
  font: inherit; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink); width: 100%;
}
.form textarea { min-height: 120px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--sky); }
.notice { grid-column: 1 / -1; padding: 14px 18px; border-radius: var(--radius-sm); background: #e5f7ec; color: #17683a; font-weight: 600; }

/* سورة الفاتحة التفاعلية */
.portal { --c: var(--sky); }
.portal[data-age="bustan"] { --c: #2fb673; --c-bg: #eafaf1; }
.portal[data-age="noor"] { --c: #f09a1a; --c-bg: #fff5e3; }
.portal[data-age="basira"] { --c: #6c5ce7; --c-bg: #f0eefe; }
.portal-head { background: var(--c-bg); border-radius: var(--radius); padding: 28px; display: flex; gap: 20px; align-items: center; margin-bottom: 28px; border: 1px solid var(--line); }
.portal-head .emoji { font-size: 3.6rem; line-height: 1; }
.portal-head h2 { color: var(--c); margin-bottom: 4px; }
.portal-head p { margin: 0; color: var(--muted); }
.mushaf { background: #fffdf6; border: 2px solid #ecdfbd; border-radius: var(--radius); padding: 28px; }
.ayah {
  font-family: var(--font-quran); font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 2.4; text-align: center;
  padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer; border: 0; background: none; width: 100%; color: var(--ink); display: block;
}
.ayah:hover { background: #fbf3d9; }
.ayah.on { background: var(--c); color: #fff; }
.ayah .n { font-family: var(--font); font-size: .9rem; display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1.5px solid currentColor; border-radius: 50%; margin-inline-start: 10px; vertical-align: middle; }
.tafsir { position: sticky; top: 100px; border-top: 6px solid var(--c); }
.tafsir h4 { color: var(--c); }
.tafsir .val { background: var(--c-bg); border-radius: var(--radius-sm); padding: 12px 16px; margin-top: 12px; font-size: .95rem; }
.sub-title { display: flex; align-items: center; gap: 10px; margin: 48px 0 20px; }
.sub-title span { width: 44px; height: 44px; border-radius: 12px; background: var(--c-bg); display: grid; place-items: center; font-size: 1.4rem; }

.story { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.story .card { border-top: 4px solid var(--c); }
.story .card small { color: var(--c); font-weight: 700; }

.game { border-top: 6px solid var(--c); }
.q-opts { display: grid; gap: 10px; margin: 16px 0; }
.q-opt { padding: 12px 16px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: #fff; font: inherit; cursor: pointer; text-align: start; }
.q-opt:hover { border-color: var(--c); }
.q-opt.ok { background: #e5f7ec; border-color: #2fb673; }
.q-opt.no { background: #fdeaea; border-color: #e05757; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match button { padding: 12px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: #fff; font: inherit; cursor: pointer; min-height: 64px; }
.match button.q { font-family: var(--font-quran); font-size: 1.2rem; }
.match button.sel { border-color: var(--c); background: var(--c-bg); }
.match button.done { background: #e5f7ec; border-color: #2fb673; cursor: default; opacity: .8; }
.order { display: grid; gap: 10px; }
.order .item { padding: 10px 16px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: grab; font-family: var(--font-quran); font-size: 1.25rem; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.order .item.drag { opacity: .4; }
.order .item span { font-family: var(--font); font-size: .9rem; display: flex; gap: 4px; }
.order .item span button { border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; width: 32px; height: 32px; }
.result { font-weight: 700; margin-top: 12px; min-height: 1.6em; }
.points { display: inline-flex; align-items: center; gap: 8px; background: #fbf1dc; color: #9b6d12; padding: 8px 18px; border-radius: 999px; font-weight: 800; }
.task { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; background: #fff; cursor: pointer; }
.task input { width: 22px; height: 22px; accent-color: var(--c); }
.task b { margin-inline-start: auto; color: #9b6d12; white-space: nowrap; }

.cert { border: 10px double var(--sky); border-radius: 12px; padding: 40px; text-align: center; background: #fff; max-width: 760px; margin: 24px auto 0; }
.cert img { height: 110px; margin: 0 auto 10px; }
.cert .name { font-size: 2rem; font-weight: 800; color: var(--sky-600); border-bottom: 2px dotted var(--line); display: inline-block; padding: 0 30px 6px; margin: 10px 0; }

/* أخبار */
.news .thumb { height: 150px; border-radius: var(--radius-sm); background: linear-gradient(135deg, var(--sky-100), var(--sky-300)); margin-bottom: 16px; display: grid; place-items: center; font-size: 2.6rem; }
.news small { color: var(--sky-600); font-weight: 700; }

/* تذييل */
.cta { background: linear-gradient(135deg, var(--sky), var(--sky-600)); color: #fff; text-align: center; padding: 70px 0; }
.cta p { color: #e6f5fd; }
.cta h2 { color: #fff; }
.footer { background: var(--navy-800); color: #b9c4dc; padding: 60px 0 24px; font-size: .95rem; }
.footer .cols { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 32px; }
.footer h4 { color: #fff; font-size: 1.05rem; }
.footer a { color: #b9c4dc; display: block; padding: 3px 0; }
.footer a:hover { color: var(--sky-300); }
.footer img { height: 80px; margin-bottom: 12px; }
.footer .copy { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 36px; padding-top: 18px; text-align: center; font-size: .85rem; }
.social { display: flex; gap: 8px; margin-top: 10px; }
.social a { width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .08); display: grid; place-items: center; color: #fff; padding: 0; font-weight: 700; font-size: .8rem; }
.social a:hover { background: var(--sky); color: #fff; }
.social { flex-wrap: wrap; }
.social.on-light a { background: var(--sky); }
.social.on-light a:hover { background: var(--sky-600); }

/* المحتوى القادم من لوحة التحكم */
.notice.err { background: #fdeaea; color: #a12626; }
.thumb-img { width: 100%; height: 170px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 14px; }
.avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin: 0 auto 12px; border: 3px solid var(--sky-100); }
.card small { color: var(--sky-600); font-weight: 700; }
details.more { margin-top: 10px; }
details.more summary { cursor: pointer; color: var(--sky-600); font-weight: 700; }
details.more div { white-space: pre-line; color: var(--muted); margin-top: 8px; font-size: .98rem; }
.dl-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.logos a { height: 90px; border: 1px solid var(--line); border-radius: var(--radius-sm); display: grid; place-items: center; background: #fff; padding: 12px; color: var(--navy); font-weight: 700; text-align: center; }
.logos div:has(img) { border-style: solid; padding: 12px; }
.logos img { max-height: 64px; width: auto; object-fit: contain; }

/* منع تمدد أعمدة الشبكات بالمحتوى الطويل (كلمات ألمانية، قوائم اختيار) */
.grid > *, .split > *, form.form > *, .hero .wrap > * { min-width: 0; }
h1, h2, h3, h4, p, li, .counter span, .btn { overflow-wrap: break-word; }
@media (max-width: 520px) { .btn { white-space: normal; text-align: center; } }

/* اللغات غير العربية */
html:not([lang="ar"]) h1, html:not([lang="ar"]) h2, html:not([lang="ar"]) h3, html:not([lang="ar"]) .counter { hyphens: auto; }
html.i18n-wait body { visibility: hidden; }
html:not([lang="ar"]) body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif; line-height: 1.65; }
html:not([lang="ar"]) .nav a { padding-inline: 9px; font-size: .92rem; }
html:not([lang="ar"]) .check li::before { content: "✓"; }

.reveal { opacity: 0; transform: translateY(20px); transition: .6s; }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 1080px) {
  .nav { display: none; position: absolute; top: 100%; inset-inline: 0; background: #fff; flex-direction: column; align-items: stretch; padding: 12px 16px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .menu-btn { display: block; }
  .g5 { grid-template-columns: repeat(3, 1fr); }
  .g4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  section { padding: 56px 0; }
  .hero .wrap, .split, .g3, .footer .cols { grid-template-columns: 1fr; }
  .hero .wrap { padding: 56px 0 70px; text-align: center; }
  .hero-cta { justify-content: center; }
  .hero-mark { order: -1; }
  .g2, .g5, form.form, [data-surah] { grid-template-columns: 1fr !important; }
  .tafsir { position: static; }
  .topbar .tag { display: none; }
  .portal-head { flex-direction: column; text-align: center; }
}
@media (max-width: 520px) {
  .g4, .match { grid-template-columns: 1fr; }
  .brand small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
@media print {
  .topbar, .header, .footer, .cta, .no-print { display: none !important; }
  body.print-cert * { visibility: hidden; }
  body.print-cert .cert, body.print-cert .cert * { visibility: visible; }
  body.print-cert .cert { position: absolute; top: 20px; inset-inline: 20px; margin: 0; max-width: none; }
}
