/* قمري — محوّل التاريخ الهجري والميلادي (qamri.app) */

:root {
  --paper: #edf1ec;
  --card: #ffffff;
  --ink: #0f1f1e;
  --muted: #4f605b;
  --line: #d2dbd6;

  --teal: #0b5f5a;          /* الهجري */
  --teal-hover: #094c48;
  --ochre: #8a6212;         /* الميلادي (للنص على الفاتح) */
  --gold: #c8952e;
  --gold-soft: #e7c36f;     /* الميلادي (على الداكن) */

  --night: #072f31;
  --night-2: #0d4548;
  --moon: #f3ebd3;

  --radius-lg: 22px;
  --radius-md: 12px;

  --font-display: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 93.75%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; scroll-behavior: smooth; }   /* تصغير خط الموقع: كل الأحجام مبنية بوحدة rem فتصغر معًا بنسبة متسقة */

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.85;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;          /* احتياط: لا شيء يوسّع الصفحة أفقيًا */
  overflow-x: clip;
}

img, svg { max-width: 100%; }
a { color: var(--teal); text-underline-offset: 0.25em; }
a:hover { color: var(--teal-hover); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.wrap-wide { width: min(1400px, 100% - 1.5rem); margin-inline: auto; }
@media (min-width: 960px) { .wrap-wide { width: min(1400px, 100% - 6rem); } }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- شاشة التحميل عند دخول الموقع ---------- */
.site-loader {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: var(--paper); transition: opacity 0.35s ease, visibility 0.35s ease;
}
.site-loader .loader-mark { width: 4.5rem; height: 4.5rem; animation: loader-breathe 1.4s ease-in-out infinite; }
.site-loader .loader-mark .brand-mark { width: 100%; height: 100%; }
.site-loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
@keyframes loader-breathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.88); opacity: 0.7; } }
@media (prefers-reduced-motion: reduce) { .site-loader .loader-mark { animation: none; } .site-loader { transition: opacity 0.15s linear; } }

.skip {
  position: absolute; inset-inline-start: 1rem; top: -4rem; z-index: 30;
  background: var(--ink); color: #fff; padding: 0.5rem 1rem; border-radius: 8px;
}
.skip:focus { top: 1rem; }

/* ---------- الترويسة ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.5rem 1rem; padding-block: 0.8rem;
}
.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.brand-mark { width: 42px; height: 42px; flex: none; }
.brand-mark .m { fill: url(#qm-moon); }
.brand-mark .s { fill: url(#qm-star); }
.brand-mark.on-dark .m { fill: url(#qm-moon-light); }
.brand-mark.on-dark .s { fill: #e7c36f; }
/* النجوم تتلألأ بهدوء في شعار الترويسة فقط */
.brand-mark.is-live .s { transform-box: fill-box; transform-origin: center; animation: twinkle 3.6s ease-in-out infinite; }
.brand-mark.is-live .s2 { animation-delay: 0.9s; }
.brand-mark.is-live .s3 { animation-delay: 1.8s; }
@keyframes twinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.55; transform: scale(0.78); } }
@media (prefers-reduced-motion: reduce) { .brand-mark.is-live .s { animation: none; } }
.brand-name { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.55rem; line-height: 1.2; }

.nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.nav a {
  padding: 0.4rem 0.95rem; border-radius: 999px; text-decoration: none;
  color: var(--ink); font-weight: 500; font-size: 0.98rem; line-height: 1.6;
}
.nav a:hover { background: rgba(11, 95, 90, 0.1); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--teal); color: #fff; }

/* تاريخ اليوم في الترويسة */
.head-today { display: flex; flex: 1 1 auto; align-items: center; justify-content: center; gap: 0.5rem; min-width: 0; }
.ht-label { font-size: 0.92rem; font-weight: 700; color: var(--muted); }
.ht-row {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.95rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.8); font-size: 0.93rem; font-weight: 600; line-height: 1.7; white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(11, 95, 90, 0.1), 0 6px 14px -12px rgba(7, 47, 49, 0.6);
}
.head-today .dot { flex: none; }
.head-today .dot-h { background: var(--teal); }
.head-today .dot-g { background: var(--ochre); }
.ht-wd { font-weight: 700; }
/* أقل من 1000px: سطران صغيران بلا إطار ولا اسم اليوم ليتسعا بين الشعار والقائمة */
@media (max-width: 999px) {
  .head-today { flex-direction: column; align-items: flex-start; gap: 0.05rem; padding-inline: 0.5rem; }
  .ht-label, .ht-wd { display: none; }
  .ht-row { padding: 0; gap: 0.4rem; background: none; box-shadow: none; font-size: 0.8rem; line-height: 1.5; }
  .head-today .dot { width: 0.5rem; height: 0.5rem; }
}
@media (max-width: 380px) { .ht-row { font-size: 0.75rem; } .head-today { padding-inline: 0.3rem; } }
@media (max-width: 350px) { .head-today { display: none; } }

/* زر القائمة (الجوال) */
.menu-btn {
  display: none; place-items: center; width: 2.9rem; height: 2.9rem; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink);
  transition: background 0.15s, border-color 0.15s;
}
.menu-btn:hover { background: #e9f2ee; border-color: #c3d6cd; }
.menu-btn svg { width: 1.4rem; height: 1.4rem; }
@media (max-width: 760px) {
  .nav { display: none; }
  .menu-btn { display: grid; }
  .site-header .wrap { flex-wrap: nowrap; }
}

/* القائمة الجانبية (الجوال): تنزلق من اليمين */
.drawer {
  width: min(86vw, 22rem); max-width: none; height: 100vh; height: 100dvh; max-height: none;
  margin: 0; margin-inline-end: auto; padding: 0; border: 0; overflow: hidden;
  border-radius: 1.75rem 0 0 1.75rem; background: var(--paper); color: var(--ink);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.35);
}
.drawer[open] { display: flex; flex-direction: column; animation: drawer-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1); }
.drawer.is-closing { animation: drawer-out 0.2s ease-in forwards; }
.drawer::backdrop { background: rgba(4, 30, 32, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.drawer[open]::backdrop { animation: pk-fade 0.28s ease-out; }
@keyframes drawer-in { from { transform: translateX(100%); } }
@keyframes drawer-out { to { transform: translateX(100%); } }

.drawer-head {
  position: relative; isolation: isolate; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.25rem; color: var(--moon);
  background: radial-gradient(120% 140% at 100% 0%, var(--night-2) 0%, var(--night) 60%, #052426 100%);
}
.drawer-head::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: repeating-radial-gradient(circle at 100% 0%, rgba(243, 235, 211, 0.07) 0 1px, transparent 1px 34px);
}
.drawer-title { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; line-height: 1.4; }
.drawer-title .brand-mark { width: 34px; height: 34px; }
.drawer-close {
  display: grid; place-items: center; width: 2.6rem; height: 2.6rem; padding: 0; cursor: pointer;
  border: 1px solid rgba(243, 235, 211, 0.32); border-radius: 50%; background: transparent; color: var(--moon);
}
.drawer-close:hover { background: rgba(243, 235, 211, 0.14); }
.drawer-close svg { width: 1rem; height: 1rem; }

.drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 1rem 0.9rem 1.25rem; }
.drawer-nav { display: flex; flex-direction: column; gap: 0.3rem; }
.drawer-nav a {
  display: flex; align-items: center; gap: 0.85rem; padding: 0.7rem 0.8rem; border-radius: 18px;
  color: var(--ink); font-size: 1.08rem; font-weight: 600; text-decoration: none; transition: background 0.15s;
}
.drawer-nav a:hover { background: rgba(11, 95, 90, 0.08); color: var(--ink); }
.drawer-nav a[aria-current="page"] { background: var(--teal); color: #fff; }
.dn-ico { display: grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; border-radius: 13px; background: #e1eee8; color: var(--teal); }
.dn-ico svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drawer-nav a[aria-current="page"] .dn-ico { background: rgba(255, 255, 255, 0.18); color: #fff; }
.drawer-group { margin: 1.4rem 0.8rem 0.4rem; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.drawer-nav.is-legal a { font-size: 1rem; font-weight: 500; }
.drawer-nav.is-legal .dn-ico { width: 2.2rem; height: 2.2rem; border-radius: 11px; background: #ebf1ee; color: var(--muted); }
.drawer-nav.is-legal a[aria-current="page"] .dn-ico { background: rgba(255, 255, 255, 0.18); color: #fff; }
.drawer-foot { flex: none; padding: 0.9rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .drawer[open], .drawer.is-closing, .drawer[open]::backdrop { animation: none; } }

/* ---------- الواجهة الرئيسية ---------- */
.hero { position: relative; isolation: isolate; padding: clamp(1rem, 2.5vw, 2rem) 0 clamp(1.5rem, 3vw, 2.5rem); }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: repeating-radial-gradient(circle at 92% -12%, rgba(11, 95, 90, 0.1) 0 1px, transparent 1px 44px);
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 92%);
  mask-image: linear-gradient(to bottom, #000 30%, transparent 92%);
}
/* بطاقة التحويل: حاوية واسعة بحواف كبيرة، النموذج على اليمين ولوحة النتيجة على اليسار */
.converter {
  --mint: #dcebe4;
  position: relative; display: grid; grid-template-columns: 1fr;
  border-radius: 2rem; background: linear-gradient(150deg, #e4f1eb 0%, var(--mint) 55%, #d3e6de 100%);
}
@media (min-width: 960px) {
  .converter { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 27rem; border-radius: 3.25rem; }
}

/* --- الجانب الفاتح: العنوان والإدخال --- */
.conv-input {
  container-type: inline-size;
  display: flex; flex-direction: column; justify-content: center; gap: 1.2rem;
  padding: clamp(1.4rem, 2.8vw, 2.1rem) clamp(1.25rem, 5vw, 4.5rem);
}
.ci-title {
  margin: 0; font-family: var(--font-display); font-weight: 800; line-height: 1.35;
  font-size: clamp(1.5rem, 6.5cqw, 2.6rem); text-wrap: balance;   /* العنوان أطول الآن، فنسمح بسطرين متوازنين بدل حصره بسطر واحد */
}
.ci-desc { margin: 0; max-width: none; font-size: 1.12rem; font-weight: 400; line-height: 1.95; color: var(--muted); text-wrap: pretty; }
.ci-form { display: flex; flex-direction: column; }

.date-label { display: block; margin-bottom: 0.5rem; font-size: 1rem; font-weight: 700; color: var(--teal); }
.date-wrap { position: relative; }
.date-field {
  display: flex; align-items: center; gap: 0.6rem; min-height: 4.1rem; padding: 0.4rem;
  border: 2px solid rgba(11, 95, 90, 0.14); border-radius: 999px; background: #fff;
  box-shadow: 0 14px 30px -22px rgba(7, 47, 49, 0.6);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.date-field:focus-within { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(11, 95, 90, 0.16), 0 14px 30px -22px rgba(7, 47, 49, 0.6); }
.date-btn {
  flex: none; display: grid; place-items: center; width: 2.7rem; height: 2.7rem; padding: 0;
  border: 0; border-radius: 50%; background: #e4f0eb; color: var(--teal); cursor: pointer;
  transition: background 0.15s;
}
.date-btn:hover, .date-btn[aria-expanded="true"] { background: #d3e7df; }
.date-btn svg { width: 1.4rem; height: 1.4rem; }
.date-input {
  flex: 1 1 0; min-width: 0; width: 100%; padding: 0 0.4rem; border: 0; outline: none; background: transparent;
  font: inherit; font-size: clamp(1.35rem, 4.8vw, 1.7rem); font-weight: 600; letter-spacing: 0.05em;
  color: var(--ink); text-align: right; cursor: text;
}
.date-input::placeholder { color: #8fa79f; font-size: 1.2rem; font-weight: 500; letter-spacing: 0; }

/* مفتاح التقويم: ميلادي / هجري */
.cal-switch {
  position: relative; flex: none; display: grid; grid-template-columns: 1fr 1fr; padding: 4px;
  border-radius: 999px; background: #edf4f1; box-shadow: inset 0 0 0 1px rgba(11, 95, 90, 0.12);
}
.cal-switch input { position: absolute; width: 0; height: 0; opacity: 0; }
.cal-switch label {
  position: relative; z-index: 1; min-width: 4.3rem; padding: 0.5rem 0.95rem; border-radius: 999px;
  text-align: center; font-size: 0.98rem; font-weight: 700; line-height: 1.5; color: var(--muted);
  cursor: pointer; transition: color 0.25s;
}
.cal-switch input:checked + label { color: #fff; }
.cal-thumb {
  position: absolute; z-index: 0; inset-block: 4px; inset-inline-start: 4px; width: calc(50% - 4px);
  border-radius: 999px; background: var(--ochre); box-shadow: 0 8px 16px -8px rgba(15, 31, 30, 0.6);
  transition: transform 0.3s cubic-bezier(0.3, 0.8, 0.3, 1), background 0.3s;
}
#mode-h:checked ~ .cal-thumb { transform: translateX(-100%); background: var(--teal); }
.cal-switch input:focus-visible ~ .cal-thumb { outline: 3px solid var(--gold); outline-offset: 2px; }

.form-error { min-height: 1.3rem; margin: 0.4rem 0 0; color: #a4241c; font-size: 0.95rem; line-height: 1.6; }
.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 0.2rem; }
.conv-input .btn { display: inline-flex; align-items: center; gap: 0.5rem; height: 3rem; padding: 0 1.8rem; border-radius: 999px; }
.conv-input .btn-primary { box-shadow: 0 12px 24px -14px rgba(11, 95, 90, 0.9); }
.conv-input .btn-quiet { background: rgba(255, 255, 255, 0.55); border-color: rgba(11, 95, 90, 0.25); }
.conv-input .btn-quiet:hover { background: rgba(255, 255, 255, 0.9); }
.btn svg { width: 1.05rem; height: 1.05rem; }
.range-note { margin: 0.7rem 0 0; font-size: 0.88rem; line-height: 1.7; color: #4a5c57; }

/* عند ضيق الجانب الفاتح (الجوال): التاريخ ومفتاح ميلادي/هجري في سطر واحد، بحجم مضغوط */
@container (max-width: 25rem) {
  .date-field { flex-wrap: nowrap; gap: 0.25rem; min-height: 3.7rem; padding: 0.35rem; }
  .date-btn { width: 2.3rem; height: 2.3rem; }
  .date-btn svg { width: 1.15rem; height: 1.15rem; }
  .date-input { padding: 0 0.15rem; font-size: clamp(1rem, 5.6cqw, 1.35rem); letter-spacing: 0.02em; }
  .date-input::placeholder { font-size: 0.95rem; }
  .cal-switch label { min-width: 0; padding: 0.42rem 0.7rem; font-size: 0.85rem; }
  .actions { flex-wrap: nowrap; gap: 0.5rem; }
  .actions .btn { flex: 1 1 0; min-width: 0; padding: 0 0.6rem; justify-content: center; white-space: nowrap; font-size: 0.95rem; }
}
/* الشاشات الأضيق: نُخفي أيقونة التقويم ليتسع التاريخ (الضغط على الحقل يفتح القائمة أيضًا) */
@container (max-width: 20rem) {
  .date-btn { display: none; }
  .date-field { padding-inline-start: 0.95rem; }
  .cal-switch label { padding: 0.4rem 0.6rem; }
}
@container (max-width: 17.5rem) {
  .date-input { letter-spacing: 0; }
  .cal-switch label { padding: 0.36rem 0.5rem; font-size: 0.8rem; }
  .actions .btn svg { display: none; }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 3.05rem; padding: 0 1.4rem; border: 1px solid transparent; border-radius: var(--radius-md);
  font: inherit; font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-hover); color: #fff; }
.btn-quiet { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-quiet:hover { background: #f0f4f1; }

/* --- منتقي التاريخ: نافذة منبثقة على الحاسوب، وورقة سفلية على الجوال --- */
html { scrollbar-gutter: stable; }
html.pk-lock { overflow: hidden; }
.picker {
  --c: var(--ochre); --c2: var(--teal);
  padding: 0; border: 0; background: transparent; color: var(--ink); overflow: visible; max-width: none; max-height: none;
}
.picker { --c-tint: rgba(184, 134, 43, 0.16); }
.picker.is-h { --c: var(--teal); --c2: var(--ochre); --c-tint: rgba(11, 95, 90, 0.1); }
.picker::backdrop { background: rgba(4, 30, 32, 0.62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.picker[open] { animation: pk-pop 0.24s cubic-bezier(0.2, 0.9, 0.3, 1); }
.picker[open]::backdrop { animation: pk-fade 0.24s ease-out; }
@keyframes pk-pop { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
@keyframes pk-sheet { from { transform: translateY(100%); } }
@keyframes pk-fade { from { opacity: 0; } }

.pk-card {
  display: flex; flex-direction: column; width: min(26rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain;
  border-radius: 2rem; background: #fff; box-shadow: 0 44px 90px -30px rgba(0, 0, 0, 0.65);
}

/* رأس النافذة: التاريخ المحدد */
.pk-top {
  position: relative; isolation: isolate; flex: none; padding: 1.1rem 1.4rem 1.3rem; color: var(--moon);
  background: radial-gradient(120% 120% at 100% 0%, var(--night-2) 0%, var(--night) 60%, #052426 100%);
}
.pk-top::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: repeating-radial-gradient(circle at 100% 0%, rgba(243, 235, 211, 0.07) 0 1px, transparent 1px 34px);
}
.pk-top-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.pk-chip {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.1rem 0.9rem;
  border: 1px solid rgba(243, 235, 211, 0.32); border-radius: 999px; font-size: 0.9rem; line-height: 1.7;
}
.pk-chip .dot { background: var(--gold-soft); }
.picker.is-h .pk-chip .dot { background: #6fd3c4; }
.pk-close {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; padding: 0; cursor: pointer;
  border: 1px solid rgba(243, 235, 211, 0.3); border-radius: 50%; background: transparent; color: var(--moon);
}
.pk-close:hover { background: rgba(243, 235, 211, 0.14); }
.pk-close svg { width: 1rem; height: 1rem; }
.pk-date { display: flex; align-items: center; gap: 0.85rem; margin-top: 0.9rem; }
.pk-d { font-family: var(--font-display); font-weight: 800; font-size: 3.6rem; line-height: 1; }
.pk-my { display: flex; flex-direction: column; font-size: 1.25rem; font-weight: 600; line-height: 1.5; }
.pk-my small { font-size: 0.95rem; font-weight: 500; color: var(--gold-soft); }
.pk-eq { margin: 0.6rem 0 0; font-size: 0.93rem; color: rgba(243, 235, 211, 0.82); }
.pk-eq:empty { display: none; }

/* جسم النافذة: الشهر والأيام */
.pk-body { padding: 1.1rem 1.1rem 0.4rem; }
.pk-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.5rem; margin-bottom: 0.7rem; }
.pk-nav {
  display: grid; place-items: center; width: 2.7rem; height: 2.7rem; padding: 0;
  border: 0; border-radius: 50%; background: #eef5f2; color: var(--teal); cursor: pointer; transition: background 0.15s;
}
.pk-nav:hover:not(:disabled) { background: #dcebe5; }
.pk-nav:disabled { opacity: 0.35; cursor: default; }
.pk-nav svg { width: 1.1rem; height: 1.1rem; }
.pk-sel { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; min-width: 0; }
.pk-pill {
  min-width: 0; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 0.22rem;
  height: 2.7rem; padding: 0 0.5rem; border: 1px solid var(--line); border-radius: 999px; background: #fff;
  color: var(--ink); font: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pk-pill:hover { background: #f3f8f5; }
.pk-pill[aria-expanded="true"] { background: var(--c-tint); border-color: var(--c); color: var(--c); }
.pk-pill:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.pk-pill > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-chev { flex: none; width: 0.72rem; height: 0.72rem; transition: transform 0.2s; }
.pk-month-n { flex: none; color: inherit; font-size: inherit; font-weight: inherit; }
.pk-month-sep { flex: none; width: 1px; height: 1.35em; background: var(--line); margin: 0 0.22rem; }
.pk-pill[aria-expanded="true"] .pk-month-sep { background: rgba(11, 95, 90, 0.3); }
.pk-pill[aria-expanded="true"] .pk-chev { transform: rotate(180deg); }

/* لوحة اختيار الشهر / السنة: تغطي الأيام بنفس المساحة فلا يتغير حجم النافذة */
.pk-stage { position: relative; }
.pk-panel { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; padding-top: 0.15rem; background: #fff; animation: pk-panel-in 0.2s ease-out; }
.pk-panel[hidden] { display: none; }
@keyframes pk-panel-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes pk-tile { from { opacity: 0; transform: scale(0.9); } }
.pk-panel-title { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0.15rem 0.55rem; font-size: 0.92rem; font-weight: 700; color: var(--muted); }
.pk-panel-title span { font-size: 0.82rem; font-weight: 500; }
.pk-months { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 0.55rem; grid-template-columns: repeat(3, minmax(0, 1fr)); scrollbar-width: thin; }
.pk-mo {
  position: relative; aspect-ratio: 1.55 / 1; width: 100%; display: grid; place-items: center; padding: 0 0.3rem; border: 0; border-radius: 16px; background: #f1f6f3;
  color: var(--ink); font: inherit; font-size: 1rem; font-weight: 700; line-height: 1.3; text-align: center; cursor: pointer;
  animation: pk-tile 0.28s both; animation-delay: calc(var(--i, 0) * 22ms); transition: background 0.12s, transform 0.12s;
}
.pk-mo-n {
  position: absolute; top: 0.3rem; inset-inline-start: 0.4rem; display: grid; place-items: center;
  width: 1.15rem; height: 1.15rem; border-radius: 50%; background: rgba(11, 95, 90, 0.12);
  font-size: 0.62rem; font-weight: 800; color: var(--c);
}
.pk-mo.is-sel .pk-mo-n { background: rgba(255, 255, 255, 0.25); color: #fff; }
.pk-mo:hover { background: #e1eee8; }
.pk-mo:active { transform: scale(0.96); }
.pk-mo.is-today { box-shadow: inset 0 0 0 2px rgba(11, 95, 90, 0.4); }
.pk-mo.is-sel { background: var(--c); color: #fff; box-shadow: 0 12px 20px -12px rgba(15, 31, 30, 0.75); }
.pk-years { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 0 0.15rem 0.3rem; }
.yr-group + .yr-group { margin-top: 0.25rem; }
.yr-dec { position: sticky; top: 0; z-index: 1; padding: 0.3rem 0.2rem; background: linear-gradient(#fff 72%, rgba(255, 255, 255, 0)); font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.yr-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.45rem; }
.pk-yr { aspect-ratio: 1.5 / 1; width: 100%; border: 0; border-radius: 14px; background: #f1f6f3; color: var(--ink); font: inherit; font-size: 0.98rem; font-weight: 600; cursor: pointer; transition: background 0.12s, transform 0.12s; }
.pk-yr:hover { background: #e1eee8; }
.pk-yr:active { transform: scale(0.96); }
.pk-yr.is-today { box-shadow: inset 0 0 0 2px rgba(11, 95, 90, 0.4); }
.pk-yr.is-sel { background: var(--c); color: #fff; font-weight: 800; }
.pk-mo:focus-visible, .pk-yr:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.pk-pad { visibility: hidden; pointer-events: none; }
@media (max-width: 360px) {
  .pk-months { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
  .pk-mo { font-size: 0.92rem; border-radius: 14px; }
  .yr-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
  .pk-yr { font-size: 0.9rem; border-radius: 12px; }
}

.pk-week, .pk-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.pk-week span { padding: 0.35rem 0; text-align: center; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.pk-week span:nth-child(7) { color: var(--teal); }
.pk-grid { gap: 4px; }
.pk-day {
  display: grid; place-items: center; width: 100%; max-width: 3rem; aspect-ratio: 1 / 1; margin: 0 auto; padding: 0;
  border: 0; border-radius: 50%; background: transparent;
  color: var(--ink); font: inherit; font-size: 1.1rem; font-weight: 600; cursor: pointer; transition: background 0.12s;
}
.pk-day:hover { background: #e8f2ee; }
.pk-day.is-today { box-shadow: inset 0 0 0 2px rgba(11, 95, 90, 0.4); }
.pk-day.is-sel { background: var(--c); color: #fff; font-weight: 800; box-shadow: 0 10px 18px -10px rgba(15, 31, 30, 0.7); }
.pk-day:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }

.pk-foot { display: flex; padding: 0.6rem 1.1rem 1.15rem; }
.pk-today {
  flex: 1; height: 2.9rem; padding: 0 1.3rem; border: 0; border-radius: 999px; background: #e4f0eb;
  color: var(--teal); font: inherit; font-weight: 700; cursor: pointer; transition: background 0.15s;
}
.pk-today:hover { background: #d3e7df; }

/* الجوال: ورقة تنزلق من الأسفل، وتتكيّف مع عرض الشاشة وارتفاعها */
@media (max-width: 600px) {
  .picker { width: 100%; margin: auto 0 0; }
  .picker[open] { animation: pk-sheet 0.3s cubic-bezier(0.2, 0.9, 0.3, 1); }
  .pk-card {
    width: 100%; max-height: 96vh; max-height: 96dvh; border-radius: 1.75rem 1.75rem 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px); transition: transform 0.2s ease-out;
  }
  .pk-top { padding: 1.7rem clamp(1rem, 5vw, 1.4rem) 1.1rem; cursor: grab; touch-action: none; }
  .pk-top::after {
    content: ""; position: absolute; top: 0.6rem; left: 50%; width: 3rem; height: 0.32rem;
    border-radius: 999px; background: rgba(243, 235, 211, 0.4); transform: translateX(-50%);
  }
  .pk-d { font-size: clamp(2.6rem, 12vw, 3.3rem); }
  .pk-my { font-size: clamp(1.1rem, 4.8vw, 1.3rem); }
  .pk-body { padding: 1rem clamp(0.6rem, 3.6vw, 1rem) 0.3rem; }
  .pk-head { gap: 0.4rem; }
  .pk-nav { width: 2.8rem; height: 2.8rem; }
  .pk-pill { height: 2.8rem; padding: 0 0.8rem; }
  .pk-mo { font-size: 0.95rem; }
  .pk-grid { gap: clamp(2px, 0.9vw, 6px); }
  .pk-day { font-size: clamp(1.02rem, 4.4vw, 1.2rem); }
  .pk-foot { padding: 0.6rem clamp(0.75rem, 4vw, 1.1rem) 1.1rem; }
  .pk-today { height: 3rem; }
}
/* شاشات قصيرة: نضغط الرأس والأيام حتى لا تحتاج الورقة إلى تمرير */
@media (max-height: 720px) and (max-width: 600px) {
  .pk-top { padding-block: 1.4rem 0.8rem; }
  .pk-d { font-size: 2.5rem; }
  .pk-date { margin-top: 0.4rem; }
  .pk-eq { margin-top: 0.3rem; font-size: 0.88rem; }
  .pk-body { padding-top: 0.7rem; }
  .pk-day { width: 2.6rem; max-width: 100%; aspect-ratio: auto; height: 2.6rem; }
  .pk-week span { padding-block: 0.2rem; }
  .pk-foot { padding-block: 0.45rem 0.8rem; }
  .pk-today { height: 2.7rem; }
}
@media (max-height: 580px) and (max-width: 600px) { .pk-eq { display: none; } .pk-day { height: 2.4rem; width: 2.4rem; } }
@media (max-height: 640px) and (min-width: 601px) { .pk-day { width: 2.6rem; max-width: none; aspect-ratio: auto; height: 2.6rem; } .pk-d { font-size: 2.8rem; } }
/* أزرار الشهر والسنة على الهواتف الضيقة (بعد قواعد الجوال حتى لا تُلغى) */
@media (max-width: 380px) { .pk-pill { padding: 0 0.6rem; font-size: 0.9rem; gap: 0.25rem; } .pk-year-btn { min-width: 0; } .pk-chev { width: 0.6rem; height: 0.6rem; } }
@media (max-width: 340px) { .pk-head { gap: 0.3rem; } .pk-nav { width: 2.4rem; height: 2.4rem; } .pk-pill { height: 2.6rem; padding: 0 0.5rem; font-size: 0.8rem; } }
@media (prefers-reduced-motion: reduce) { .picker[open], .picker[open]::backdrop { animation: none; } }

/* --- الجانب الداكن: النتيجة (بطاقة داخل الحاوية) --- */
.conv-result {
  position: relative; isolation: isolate; overflow: hidden; color: var(--moon);
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto;
  grid-template-areas: "chip moon" "body body" "foot foot"; gap: 0.9rem 1rem;
  margin: 0.75rem; padding: clamp(1.25rem, 2.6vw, 1.9rem); border-radius: 1.75rem;
  background: radial-gradient(120% 90% at 100% 0%, var(--night-2) 0%, var(--night) 58%, #052426 100%);
}
@media (min-width: 960px) {
  .conv-result { margin: 1.1rem; border-radius: 2.4rem; grid-template-areas: "chip chip" "body moon" "foot foot"; gap: 0.75rem 1.5rem; }
}
.conv-result::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: repeating-radial-gradient(circle at 12% 12%, rgba(243, 235, 211, 0.06) 0 1px, transparent 1px 38px);
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent 95%);
  mask-image: linear-gradient(to bottom, #000 35%, transparent 95%);
}
@media (min-width: 960px) {
  .conv-result::before { background: repeating-radial-gradient(circle at 16% 50%, rgba(243, 235, 211, 0.06) 0 1px, transparent 1px 38px); -webkit-mask-image: none; mask-image: none; }
}
.chip {
  grid-area: chip; display: inline-flex; align-items: center; gap: 0.5rem; align-self: start; justify-self: start; margin: 0;
  padding: 0.15rem 0.9rem; border: 1px solid rgba(243, 235, 211, 0.32); border-radius: 999px;
  font-size: 0.92rem; line-height: 1.7; color: rgba(243, 235, 211, 0.92);
}
.dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; display: inline-block; }
.dot-h { background: #6fd3c4; }
.dot-g { background: var(--gold-soft); }

.moon-wrap { grid-area: moon; width: 84px; margin: 0; align-self: start; }
.moon { display: block; width: 100%; height: auto; }
@media (min-width: 960px) { .moon-wrap { width: clamp(120px, 12vw, 170px); align-self: center; } }

.r-body { grid-area: body; align-self: center; }
.r-empty { grid-area: body; align-self: center; display: flex; flex-direction: column; gap: 0.4rem; }
/* الحالة الفارغة: نُخفي النتيجة بـ visibility (لا display) لتبقى أبعاد اللوحة كما هي بعد التحويل */
.conv-result.is-empty .r-body, .conv-result.is-empty .r-foot { visibility: hidden; }
.conv-result:not(.is-empty) .r-empty { visibility: hidden; }
.conv-result:not(.is-empty) .r-quick { visibility: hidden; }

/* أمثلة سريعة تملأ أسفل اللوحة في الحالة الفارغة (تشغل نفس حيّز شريط النتيجة فلا يتغير المقاس) */
.r-quick { grid-area: foot; display: flex; flex-direction: column; gap: 0.6rem; padding-top: 0.9rem; border-top: 1px solid rgba(243, 235, 211, 0.16); }
.q-label { margin: 0; font-size: 0.88rem; color: rgba(243, 235, 211, 0.72); }
.q-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.q-chip {
  padding: 0.35rem 1rem; border: 1px solid rgba(243, 235, 211, 0.34); border-radius: 999px; background: rgba(243, 235, 211, 0.05);
  color: var(--moon); font: inherit; font-size: 0.93rem; font-weight: 600; line-height: 1.6; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.q-chip:hover { background: rgba(243, 235, 211, 0.14); border-color: rgba(243, 235, 211, 0.6); }
.q-chip:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
/* الجوال: الأزرار الأربعة في سطر واحد بحجم مصغّر يتبع عرض الشاشة */
@media (max-width: 600px) {
  .q-chips { flex-wrap: nowrap; gap: 0.35rem; }
  .q-chip { flex: 1 1 auto; min-width: 0; padding: 0.3rem 0.4rem; font-size: clamp(0.62rem, 3.1vw, 0.9rem); white-space: nowrap; text-align: center; }
}
@media (max-width: 350px) { .q-chips { gap: 0.25rem; } .q-chip { padding: 0.28rem 0.25rem; } }
.r-empty-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.4; }
.r-empty-sub { margin: 0; max-width: 22rem; font-size: 1.02rem; line-height: 1.85; color: rgba(243, 235, 211, 0.78); }
.dot-n { background: rgba(243, 235, 211, 0.5); }
.r-body, .moon-wrap { transition: opacity 0.25s; }
.conv-result.is-stale .r-body, .conv-result.is-stale .moon-wrap { opacity: 0.4; }
.r-date { display: flex; align-items: center; gap: 1rem; }
.r-day { font-family: var(--font-display); font-weight: 700; font-size: clamp(4rem, 7vw, 5.6rem); line-height: 0.95; color: var(--moon); }
.r-ym { display: flex; flex-direction: column; }
.r-month { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1.3; }
.r-year { font-size: 1.25rem; line-height: 1.5; color: var(--gold-soft); }
.r-weekday { margin: 0.6rem 0 0; font-size: 1.2rem; font-weight: 600; }
.r-match { margin: 0.1rem 0 0; color: rgba(243, 235, 211, 0.8); }

.r-foot {
  grid-area: foot; display: flex; flex-direction: column; gap: 0.75rem; padding-top: 0.9rem;
  border-top: 1px solid rgba(243, 235, 211, 0.16);
}
@media (min-width: 640px) { .r-foot { flex-direction: row; align-items: center; justify-content: space-between; gap: 1rem; } }
.moon-cap { margin: 0; font-size: 0.9rem; line-height: 1.7; color: rgba(243, 235, 211, 0.74); }
.r-actions { display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.r-share { display: inline-flex; flex-wrap: wrap; gap: 0.55rem; margin-inline-start: auto; }
.share-btn {
  display: grid; place-items: center; width: 2.7rem; height: 2.7rem; border-radius: 50%;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.share-btn svg { width: 1.2rem; height: 1.2rem; }
.share-btn:hover { transform: translateY(-3px); box-shadow: 0 10px 18px -10px rgba(0, 0, 0, 0.45); filter: brightness(1.08); }
.share-btn.is-whatsapp { background: var(--teal); }
.share-btn.is-telegram { background: var(--gold); }
.share-btn:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
.r-share.is-off .share-btn { opacity: 0.4; pointer-events: none; }
.btn-ghost { height: 2.6rem; padding: 0 1.2rem; background: transparent; border-color: rgba(243, 235, 211, 0.38); color: var(--moon); font-size: 0.95rem; border-radius: 999px; }
.btn-ghost:hover { background: rgba(243, 235, 211, 0.1); }
.btn-ghost:disabled { opacity: 0.45; cursor: default; }
.btn-ghost:focus-visible { outline-color: var(--gold-soft); }

/* ---------- الأقسام ---------- */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }

/* ---------- ظهور تدريجي للأقسام عند التمرير ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { transition: none; opacity: 1; transform: none; } }
.section h2 { margin: 0 0 0.4rem; font-family: var(--font-display); font-weight: 700; font-size: clamp(1.6rem, 3.4vw, 2.2rem); line-height: 1.4; }
.section .sub { margin: 0 0 1.5rem; max-width: 46rem; color: var(--muted); }
.section-tight { padding-top: 0; }
/* نُقرّب قسم المناسبات من قسم الأشهر: بلا فراغ كبير بينهما */
section[aria-labelledby="h-occ"] { padding-bottom: 0.5rem; }
section[aria-labelledby="h-months"] { padding-top: 1.75rem; }

/* المناسبات القادمة: سلايدر أفقي */
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.sec-head .sub { margin-bottom: 0; }
.slider-nav { display: flex; flex: none; gap: 0.5rem; }
.sl-btn {
  display: grid; place-items: center; width: 2.9rem; height: 2.9rem; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--teal); cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sl-btn svg { width: 1.15rem; height: 1.15rem; }
.sl-btn:hover:not(:disabled) { background: var(--teal); border-color: var(--teal); color: #fff; }
.sl-btn:disabled { opacity: 0.35; cursor: default; }
@media (max-width: 600px) { .slider-nav { display: none; } }   /* على الجوال يكفي السحب والنقاط */

.occ-track {
  position: relative; display: flex; gap: 1rem; margin: 0; padding: 0.25rem 0 0.75rem; list-style: none;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none;
}
.occ-track::-webkit-scrollbar { display: none; }
.occ-track:focus-visible { outline-offset: 4px; }
.sl-dots { display: flex; justify-content: center; gap: 0.4rem; margin-top: 0.4rem; }
.sl-dots:empty { display: none; }
.sl-dot { width: 0.6rem; height: 0.6rem; padding: 0; border: 0; border-radius: 999px; background: #c3d2cb; cursor: pointer; transition: width 0.2s, background 0.2s; }
.sl-dot.is-active { width: 1.7rem; background: var(--teal); }

.occ-card {
  flex: 0 0 min(19.5rem, 82%); scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 0.15rem; min-width: 0;
  padding: 1.25rem 1.4rem 1.35rem; background: #fff;
  border: 1px solid var(--line); border-radius: 22px;
}
.occ-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 0.75rem; margin-bottom: 0.7rem; }
.occ-moon { display: block; width: 58px; height: 58px; flex: none; }
.occ-moon svg { display: block; width: 100%; height: 100%; }
.occ-left {
  padding: 0.1rem 0.9rem; border-radius: 999px; background: rgba(11, 95, 90, 0.1);
  color: var(--teal); font-size: 0.92rem; font-weight: 600; line-height: 1.7; white-space: nowrap;
}
.occ-left.is-now { background: var(--gold-soft); color: #4a3407; }
.occ-name { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; line-height: 1.5; }
.occ-date { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.35rem; }
.occ-day { font-family: var(--font-display); font-weight: 800; font-size: 2.7rem; line-height: 1; color: var(--teal); }
.occ-hm { font-weight: 600; line-height: 1.5; color: var(--teal); }
.occ-g { margin: auto 0 0; padding-top: 0.75rem; border-top: 1px dashed var(--line); font-weight: 500; color: var(--ochre); }
.occ-date + .occ-g { margin-top: 0.8rem; }

/* المناسبة الأقرب: بطاقة ليلية */
.occ-card.is-next {
  position: relative; isolation: isolate; overflow: hidden; border: 0; color: var(--moon);
  background: radial-gradient(120% 90% at 100% 0%, var(--night-2) 0%, var(--night) 58%, #052426 100%);
}
.occ-card.is-next::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: repeating-radial-gradient(circle at 100% 0%, rgba(243, 235, 211, 0.07) 0 1px, transparent 1px 34px);
}
.is-next .occ-left { background: var(--gold-soft); color: #4a3407; }
.is-next .occ-name, .is-next .occ-day { color: var(--moon); }
.is-next .occ-hm { color: var(--gold-soft); }
.is-next .occ-g { border-top: 1px solid rgba(243, 235, 211, 0.2); color: rgba(243, 235, 211, 0.88); }

/* الأشهر: لوحتان مضغوطتان (ميلادي / هجري) مع الشهر الحالي */
.months-box { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 900px) { .months-box { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mb { --c: var(--teal); --c-tint: rgba(11, 95, 90, 0.1); padding: 1.1rem 1.2rem 1.2rem; background: #fff; border: 1px solid var(--line); border-radius: 24px; }
.mb.is-g { --c: var(--ochre); --c-tint: rgba(184, 134, 43, 0.16); }
.mb-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.8rem; }
.mb-head h3 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; line-height: 1.5; color: var(--c); }
.mb-head .dot { width: 0.7rem; height: 0.7rem; background: var(--c); }

.mb-now { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 0.1rem 0.75rem; padding: 0.8rem 1rem 0.9rem; border-radius: 18px; background: var(--c-tint); }
.mb-now-k { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.mb-now-sub { font-size: 0.88rem; color: var(--muted); text-align: end; }
.mb-now-name { grid-column: 1 / -1; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.3rem, 2.4vw, 1.6rem); line-height: 1.45; color: var(--c); }
.mb-now-name:empty, .mb-now-sub:empty { display: none; }
.mb-bar { grid-column: 1 / -1; height: 6px; margin-top: 0.4rem; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.75); }
.mb-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--c); transition: width 0.7s cubic-bezier(0.3, 0.8, 0.3, 1); }

.mb-slider { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.85rem; }
.mb-slider .mb-chips { flex: 1 1 auto; min-width: 0; margin: 0; }
.mb-arrow { display: none; }   /* الأسهم مُزالة: التنقل بالسحب على الجوال، وبالشبكة الكاملة على الشاشات الأوسع */
.mb-chips { position: relative; display: flex; gap: 0.4rem; margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.mb-chips::-webkit-scrollbar { display: none; }
.mb-chips li {
  position: relative; flex: none; scroll-snap-align: center; display: inline-flex; align-items: center;
  padding: 0.38rem 0.85rem; padding-inline-start: 2.15rem; border-radius: 999px; background: #f0f5f2;
  font-size: 0.92rem; font-weight: 600; line-height: 1.5; color: #3b4d48; white-space: nowrap;
}
.mb-chip-n {
  position: absolute; top: 50%; inset-inline-start: 0.45rem; transform: translateY(-50%);
  display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; padding: 0 0.2rem;
  border-radius: 50%; background: rgba(11, 95, 90, 0.14); font-size: 0.76rem; font-weight: 800; color: var(--c);
}
.mb-chips li.is-current { background: var(--c); color: #fff; }
.mb-chips li.is-current .mb-chip-n { background: rgba(255, 255, 255, 0.28); color: #fff; }
@media (min-width: 640px) {
  .mb-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); overflow: visible; scroll-snap-type: none; }
  .mb-chips li { justify-content: center; padding-inline: 2.15rem; text-align: center; border-radius: 12px; }
}

/* ---------- صفحة مقالات: شبكة بطاقات ---------- */
.a-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.a-card { border-radius: 26px; overflow: hidden; background: #fff; box-shadow: 0 1px 0 rgba(15, 31, 30, 0.06), 0 26px 60px -34px rgba(7, 47, 49, 0.5); transition: transform 0.18s, box-shadow 0.18s; }
.a-card:hover { transform: translateY(-3px); box-shadow: 0 1px 0 rgba(15, 31, 30, 0.06), 0 32px 70px -30px rgba(7, 47, 49, 0.58); }
.a-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.a-art {
  position: relative; isolation: isolate; display: grid; place-items: center; padding: 2rem;
  background: radial-gradient(120% 140% at 100% 0%, var(--night-2) 0%, var(--night) 60%, #052426 100%);
}
.a-art::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: repeating-radial-gradient(circle at 100% 0%, rgba(243, 235, 211, 0.07) 0 1px, transparent 1px 34px);
}
.a-mark .brand-mark { width: 3.4rem; height: 3.4rem; }
.a-body { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; padding: 1.4rem 1.5rem 1.6rem; }
.a-tag { align-self: flex-start; padding: 0.15rem 0.85rem; border-radius: 999px; background: rgba(11, 95, 90, 0.1); color: var(--teal); font-size: 0.82rem; font-weight: 700; }
.a-title { margin: 0.2rem 0 0; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; line-height: 1.5; color: var(--ink); }
.a-excerpt { margin: 0; flex: 1; font-size: 0.98rem; line-height: 1.85; color: var(--muted); }
.a-meta { display: flex; align-items: center; gap: 0.5rem; margin: 0.2rem 0 0; font-size: 0.86rem; color: var(--muted); }
.a-meta .dot { width: 0.3rem; height: 0.3rem; border-radius: 50%; background: currentColor; opacity: 0.5; }
.a-cta { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem; font-weight: 700; color: var(--teal); }
.a-cta svg { width: 1.05rem; height: 1.05rem; transition: transform 0.18s; }
.a-card:hover .a-cta svg { transform: translateX(-3px); }

.a-card.is-featured { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .a-card.is-featured .a-link { flex-direction: row-reverse; }
  .a-card.is-featured .a-art { flex: 0 0 40%; padding: 2.5rem; }
  .a-card.is-featured .a-mark .brand-mark { width: 5.5rem; height: 5.5rem; }
  .a-card.is-featured .a-body { justify-content: center; padding: 2.25rem 2.5rem; }
  .a-card.is-featured .a-title { font-size: 1.7rem; }
  .a-card.is-featured .a-excerpt { font-size: 1.05rem; }
}

.a-more { max-width: 46rem; margin: 1.75rem auto 0; text-align: center; font-size: 0.95rem; color: var(--muted); }

/* ---------- قسم المقالات بالصفحة الرئيسية: مقال مميّز كبير + قائمة صغيرة جنبه (ثابت، بلا سلايدر) ---------- */
.art-feature-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; align-items: stretch; }
@media (min-width: 860px) { .art-feature-grid { grid-template-columns: 1fr 1fr; } }

.art-feature {
  display: flex; flex-direction: column; border-radius: 26px; overflow: hidden; color: inherit; text-decoration: none;
  background: #fff; box-shadow: 0 1px 0 rgba(15, 31, 30, 0.06), 0 26px 60px -34px rgba(7, 47, 49, 0.5);
  transition: transform 0.18s, box-shadow 0.18s;
}
.art-feature:hover { transform: translateY(-3px); box-shadow: 0 1px 0 rgba(15, 31, 30, 0.06), 0 32px 70px -30px rgba(7, 47, 49, 0.58); }
.art-feature .af-art {
  position: relative; isolation: isolate; display: grid; place-items: center; padding: 1.3rem; flex: none;
  background: radial-gradient(120% 140% at 100% 0%, var(--night-2) 0%, var(--night) 60%, #052426 100%);
}
.art-feature .af-art::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: repeating-radial-gradient(circle at 100% 0%, rgba(243, 235, 211, 0.07) 0 1px, transparent 1px 34px);
}
.art-feature .af-art .brand-mark { width: 2.6rem; height: 2.6rem; }
.af-body { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; padding: 1.2rem 1.4rem 1.4rem; }
.af-title { margin: 0.1rem 0 0; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; line-height: 1.5; color: var(--ink); }
.af-excerpt {
  margin: 0; font-size: 0.96rem; line-height: 1.8; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (min-width: 640px) {
  .art-feature { flex-direction: row-reverse; }
  .art-feature .af-art { flex: 0 0 34%; padding: 1.4rem; }
  .af-body { justify-content: center; }
}

.art-list { display: flex; flex-direction: column; gap: 0.6rem; margin: 0; padding: 0; list-style: none; height: 100%; }
.art-list li { display: flex; flex: 1; }
.art-row {
  flex: 1; width: 100%;
  display: flex; align-items: center; gap: 0.85rem; height: 100%; padding: 0.85rem 1.1rem; border-radius: 16px;
  background: #fff; box-shadow: inset 0 0 0 1px var(--line); color: inherit; text-decoration: none;
  transition: box-shadow 0.15s, background 0.15s;
}
.art-row:hover { background: #f5f9f7; box-shadow: inset 0 0 0 1px var(--teal); color: inherit; }
.ar-dot { flex: none; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--teal); }
.ar-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.ar-tag { font-size: 0.78rem; font-weight: 700; color: var(--teal); }
.ar-title { font-weight: 700; font-size: 0.98rem; line-height: 1.55; color: var(--ink); }
.ar-meta { font-size: 0.82rem; color: var(--muted); }
.ar-arrow { flex: none; width: 1.05rem; height: 1.05rem; color: var(--teal); transition: transform 0.15s; }
.art-row:hover .ar-arrow { transform: translateX(-3px); }

.art-more { display: flex; justify-content: center; margin: 1.5rem 0 0; }
.art-more a {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 3.1rem; padding: 0 1.9rem;
  border: 2px solid var(--teal); border-radius: 999px; background: transparent;
  font-weight: 700; font-size: 1.02rem; color: var(--teal); text-decoration: none;
  transition: background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.art-more a:hover {
  background: var(--teal); color: #fff; text-decoration: none; transform: translateY(-2px);
  box-shadow: 0 14px 26px -14px rgba(11, 95, 90, 0.6);
}
.art-more svg { width: 1.05rem; height: 1.05rem; transition: transform 0.15s; }
.art-more a:hover svg { transform: translateX(-3px); }

/* ---------- الصفحات الداخلية ---------- */

.page-head { padding: clamp(2.25rem, 5vw, 3.5rem) 0 0.5rem; }
.page-head h1 { margin: 0 0 0.5rem; font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.3; }
.page-head .lead { margin: 0; max-width: 40rem; font-size: 1.15rem; color: var(--muted); }
.page-head.is-article { text-align: center; }
.page-head.is-article .lead, .page-head.is-article .crumbs, .page-head.is-article .article-meta { margin-inline: auto; justify-content: center; }
.page-head.is-article h1 { max-width: 42rem; margin-inline: auto; }
.page-body { padding: 1.5rem 0 clamp(2.5rem, 6vw, 4rem); }

.prose { max-width: 46rem; margin-inline: auto; }
.prose h2 { margin: 2.2rem 0 0.35rem; font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; line-height: 1.5; }
.prose h2:first-child { margin-top: 0; }
.prose p { margin: 0.4rem 0 0.8rem; }
.prose ul { margin: 0.4rem 0 0.8rem; padding-inline-start: 1.3rem; }
.prose li { margin: 0.2rem 0; }

/* ---------- مقالات: عناصر تنسيق غنية (قابلة لإعادة الاستخدام في أي مقال) ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 0.9rem; font-size: 0.92rem; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--teal); text-decoration: underline; text-underline-offset: 0.25em; }
.crumbs span[aria-hidden] { opacity: 0.6; }
.crumbs .current { color: var(--ink); font-weight: 600; }

.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin: 0.9rem 0 0; font-size: 0.92rem; color: var(--muted); }
.article-meta .dot { width: 0.35rem; height: 0.35rem; border-radius: 50%; background: currentColor; opacity: 0.5; }

.toc {
  max-width: 46rem; margin: 1.75rem auto; padding: 1.1rem 1.4rem; border-radius: 20px;
  background: #eef5f2; box-shadow: inset 0 0 0 1px rgba(11, 95, 90, 0.1);
}
.toc p { margin: 0 0 0.55rem; font-weight: 700; color: var(--teal); font-size: 0.98rem; }
.toc ol { margin: 0; padding-inline-start: 1.2rem; columns: 1; }
@media (min-width: 640px) { .toc ol { columns: 2; column-gap: 1.5rem; } }
.toc li { margin: 0.2rem 0; break-inside: avoid; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--teal); text-decoration: underline; text-underline-offset: 0.25em; }

.prose h2 { scroll-margin-top: 5.5rem; }
.prose h2 .n {
  display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem; margin-inline-end: 0.5rem;
  border-radius: 50%; background: var(--teal); color: #fff; font-family: var(--font-body); font-size: 0.95rem; font-weight: 700; vertical-align: middle;
}

.callout.is-teal { background: #eef5f2; box-shadow: inset 0 0 0 1px rgba(11, 95, 90, 0.14); }
.callout.is-teal .ic { background: rgba(11, 95, 90, 0.16); color: var(--teal); }
.callout.is-teal strong { color: var(--teal); }

.feature-list { display: grid; gap: 0.75rem; margin: 0.6rem 0 1rem; padding: 0; list-style: none; max-width: 46rem; margin-inline: auto; }
@media (min-width: 640px) { .feature-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.feature-list li { display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.9rem 1.05rem; border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); line-height: 1.75; }
.feature-list .ck { flex: none; display: grid; place-items: center; width: 1.6rem; height: 1.6rem; margin-top: 0.1rem; border-radius: 50%; background: rgba(11, 95, 90, 0.1); color: var(--teal); font-size: 0.85rem; }

.callout {
  display: flex; gap: 0.85rem; align-items: flex-start; max-width: 46rem; margin: 1.1rem 0 1.3rem;
  padding: 1.1rem 1.3rem; border-radius: 18px; background: #fff7e4; box-shadow: inset 0 0 0 1px rgba(200, 149, 46, 0.28);
}
.callout .ic { flex: none; width: 2.1rem; height: 2.1rem; display: grid; place-items: center; border-radius: 50%; background: var(--gold-soft); color: #4a3407; font-size: 1.1rem; }
.callout p { margin: 0; line-height: 1.85; }
.callout strong { color: #7a5a15; }


.example-box {
  max-width: 46rem; margin: 1.1rem 0 1.4rem; padding: 1.2rem 1.4rem; border-radius: 20px;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 0 rgba(15, 31, 30, 0.05), 0 20px 44px -30px rgba(7, 47, 49, 0.5);
}
.example-box .tag {
  display: inline-block; margin-bottom: 0.6rem; padding: 0.15rem 0.8rem; border-radius: 999px;
  background: rgba(11, 95, 90, 0.1); color: var(--teal); font-size: 0.82rem; font-weight: 700;
}
.example-box p { margin: 0.35rem 0; line-height: 1.9; }
.example-box .src { margin-top: 0.6rem; font-size: 0.85rem; color: var(--muted); }

.table-scroll { max-width: 46rem; margin: 1.1rem 0 1.4rem; overflow-x: auto; border-radius: 18px; border: 1px solid var(--line); }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.cmp-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.cmp-table th, .cmp-table td { padding: 0.75rem 1.1rem; text-align: start; vertical-align: top; }
.cmp-table thead th { background: #f3f6f2; font-weight: 700; border-bottom: 1px solid var(--line); }
.cmp-table thead th:first-child { color: var(--muted); font-weight: 600; }
.cmp-table tbody th { font-weight: 700; color: var(--muted); white-space: nowrap; }
.cmp-table tbody tr + tr th, .cmp-table tbody tr + tr td { border-top: 1px solid var(--line); }
.cmp-table td:nth-child(2) { color: var(--teal); }
.cmp-table td:nth-child(3) { color: var(--ochre); }

.takeaway {
  max-width: 46rem; margin: 1.6rem 0; padding: 1.3rem 1.5rem; border-radius: 22px; color: var(--moon);
  background: radial-gradient(120% 140% at 100% 0%, var(--night-2) 0%, var(--night) 60%, #052426 100%);
}
.takeaway p:first-child { margin-top: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--gold-soft); }
.takeaway p { line-height: 1.9; }
.takeaway p:last-child { margin-bottom: 0; }
.takeaway a { color: var(--moon); text-decoration: underline; text-underline-offset: 0.25em; }

.article-faq { max-width: 46rem; margin-top: 0.5rem; }
.article-faq details { border-bottom: 1px solid var(--line); }
.article-faq details:first-of-type { border-top: 1px solid var(--line); }
.article-faq summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0.1rem; cursor: pointer; list-style: none; font-weight: 700; font-size: 1.03rem; }
.article-faq summary::-webkit-details-marker { display: none; }
.article-faq summary::after { content: "+"; flex: none; font-size: 1.5rem; line-height: 1; color: var(--teal); transition: transform 0.2s; }
.article-faq details[open] summary::after { transform: rotate(45deg); }
.article-faq details p { margin: 0 0.1rem 1.05rem; color: var(--muted); line-height: 1.9; }

.article-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; max-width: 46rem;
  margin: 1.75rem auto 0.5rem; padding: 1.2rem 1.4rem; border-radius: 20px; background: #eef5f2;
}
.article-cta p { margin: 0; font-weight: 600; }
.article-cta .btn { flex: none; }

.updated { margin: 0 0 1.5rem; font-size: 0.92rem; color: var(--muted); }

/* صفحة اتصل بنا: بريد إلكتروني فقط */
.mail-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem; max-width: 34rem; margin: 0.5rem auto 0;
  padding: clamp(1.75rem, 5vw, 2.75rem) clamp(1.25rem, 5vw, 2.5rem); text-align: center;
  border-radius: 28px; background: #fff; box-shadow: 0 1px 0 rgba(15, 31, 30, 0.06), 0 26px 60px -34px rgba(7, 47, 49, 0.55);
}
.mail-ico { display: grid; place-items: center; width: 4rem; height: 4rem; margin-bottom: 0.4rem; border-radius: 50%; background: #e4f0eb; color: var(--teal); }
.mail-ico svg { width: 1.9rem; height: 1.9rem; }
.mail-k { margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.mail-addr {
  max-width: 100%; margin: 0.15rem 0 0.7rem; overflow-wrap: anywhere; direction: ltr; unicode-bidi: embed;
  font-family: var(--font-display); font-weight: 800; font-size: clamp(1.35rem, 5.4vw, 2rem); line-height: 1.4; color: var(--teal); text-decoration: none;
}
.mail-addr:hover { text-decoration: underline; text-underline-offset: 0.3em; }
.mail-copy {
  height: 2.8rem; padding: 0 1.6rem; border: 1px solid rgba(11, 95, 90, 0.28); border-radius: 999px; background: #eef5f2;
  color: var(--teal); font: inherit; font-weight: 700; cursor: pointer; transition: background 0.15s;
}
.mail-copy:hover { background: #dcebe5; }
.mail-note { max-width: 34rem; margin: 1rem auto 0; text-align: center; font-size: 0.95rem; color: var(--muted); }

.contact-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 860px) { .contact-grid { grid-template-columns: 1.5fr 1fr; } }
.contact-card { padding: clamp(1.25rem, 3vw, 2rem); background: #fff; border-radius: var(--radius-lg); box-shadow: 0 1px 0 rgba(15, 31, 30, 0.06), 0 22px 50px -32px rgba(7, 47, 49, 0.45); }
.contact-card .field + .field { margin-top: 1rem; }
textarea.control { height: auto; min-height: 9.5rem; padding: 0.7rem 0.9rem; line-height: 1.8; resize: vertical; }
.form-status { min-height: 1.6rem; margin: 0.9rem 0 0; font-size: 0.95rem; color: var(--teal); }
.form-hint { margin: 0.6rem 0 0; font-size: 0.88rem; color: var(--muted); }
.aside h2 { margin: 0 0 0.4rem; font-family: var(--font-display); font-size: 1.35rem; }
.aside p { margin: 0 0 1rem; color: var(--muted); }
.aside .mail { display: inline-block; font-weight: 600; font-size: 1.1rem; direction: ltr; unicode-bidi: embed; }

/* ---------- التذييل ---------- */
.site-footer { margin-top: 1.5rem; padding: 0 0 2rem; }
.footer-pill {
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem; text-align: center;
  padding: 1.5rem 1.5rem; border-radius: 32px; background: #dbe8e2; color: var(--muted);
}
.footer-brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; line-height: 1.3; color: var(--teal); text-decoration: none; }
.footer-brand:hover { color: var(--teal-hover); }
.footer-brand svg { width: 34px; height: 34px; flex: none; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem 1.75rem; margin: 0; padding: 0; list-style: none; }
.footer-links a { color: #2f4a45; font-weight: 500; text-decoration: none; }
.footer-links a:hover, .footer-links a[aria-current="page"] { color: var(--teal); text-decoration: underline; text-underline-offset: 0.3em; }
.footer-copy { margin: 0; font-size: 0.95rem; }
@media (min-width: 900px) {
  .footer-pill { flex-direction: row; justify-content: space-between; padding: 1.15rem 2.5rem; border-radius: 999px; text-align: start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}