/* لمسات الهوية والحركة — منصة الشرق الأوسط التعليمية */
@import url("https://fonts.googleapis.com/css2?family=Aref+Ruqaa:wght@700&family=Cinzel:wght@600&family=Cairo:wght@800&display=swap");

/* انتقال الصفحات: البطاقة تتمدد إلى رأس الصفحة الجديدة (المتصفحات الداعمة) */
@view-transition { navigation: auto; }
.mep-hero-card, .mep-banner { view-transition-name: mep-hero; }
::view-transition-group(mep-hero) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; }

/* ---------- 14. ملمس ورقي على المساحات الفاتحة ---------- */
html:not([data-theme="dark"]) body {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .18 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 15. انتقال المظهر مثل الغروب ---------- */
html.mep-theme-vt::view-transition-old(root) { animation: none; }
html.mep-theme-vt::view-transition-new(root) { animation: mepDusk .55s cubic-bezier(.4, 0, .2, 1); }
@keyframes mepDusk { from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 0)); } to { clip-path: circle(150vmax at var(--vt-x, 50%) var(--vt-y, 0)); } }
html.mep-theme-anim, html.mep-theme-anim * { transition: background-color .5s ease, color .5s ease, border-color .5s ease !important; }

/* ---------- 1، 3، 4. الواجهة: نافذة على مدينة تتغير سماؤها ---------- */
.home-hero.mep-sky { position: relative; overflow: hidden; isolation: isolate; padding: 70px 0 150px !important; background: var(--sky); transition: background 1s; }
.mep-sky { --sky: linear-gradient(180deg, #2a2f6e 0%, #c76b4a 55%, #f5b860 100%); }
.mep-sky.t-dawn  { --sky: linear-gradient(180deg, #24306e 0%, #8d5a8f 38%, #e98d5a 70%, #ffd38a 100%); --far: #6a5a8a; --mid: #4a3a64; --near: #2a2140; --win: #ffd98a; --sun: #ffe3a3; }
.mep-sky.t-day   { --sky: linear-gradient(180deg, #2c5aa0 0%, #5d8fd0 45%, #b9d4ee 85%, #f4e2b8 100%); --far: #7c93b4; --mid: #4c6185; --near: #273555; --win: #fff1c7; --sun: #fff6d8; }
.mep-sky.t-dusk  { --sky: linear-gradient(180deg, #2b1f4f 0%, #7a2c4f 40%, #d8613f 72%, #f7b25b 100%); --far: #7a4058; --mid: #4e2440; --near: #2a1228; --win: #ffc06b; --sun: #ffd07a; }
.mep-sky.t-night { --sky: linear-gradient(180deg, #070b24 0%, #121a46 50%, #26306a 100%); --far: #2a3366; --mid: #1a2150; --near: #0c1131; --win: #ffcf6e; --sun: #f3f0e0; }
.mep-sky::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, rgba(8,10,30,.15) 0%, rgba(8,10,30,.35) 45%, rgba(8,10,30,.05) 100%); }
.mep-sky.t-day::before { background: linear-gradient(180deg, rgba(8,10,30,.05) 0%, rgba(8,10,30,.28) 45%, rgba(8,10,30,0) 100%); }
.mep-sky > .mep-wrap { position: relative; z-index: 3; }
.mep-sky h2, .mep-sky p { text-shadow: 0 2px 14px rgba(0,0,0,.45); }
.mep-skyline { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.mep-skyline svg { position: absolute; left: 0; right: 0; bottom: -2px; width: 100%; height: 72%; will-change: transform; }
.mep-skyline .sun { position: absolute; width: 70px; height: 70px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 60px 20px color-mix(in srgb, var(--sun) 55%, transparent); left: 3%; top: 2.5%; will-change: transform; }
.t-night .mep-skyline .sun { width: 46px; height: 46px; box-shadow: 0 0 40px 8px rgba(243,240,224,.25); top: 2.5%; }
@media (max-width: 600px) { .mep-skyline .sun { width: 52px; height: 52px; top: 12px; left: 12px; } .t-night .mep-skyline .sun { width: 38px; height: 38px; top: 14px; } }
.mep-stars { position: absolute; inset: 0 0 40% 0; opacity: 0; transition: opacity 1s; }
.t-night .mep-stars, .t-dawn .mep-stars { opacity: 1; }
.t-dawn .mep-stars { opacity: .35; }
.mep-stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; animation: mepTw 3s ease-in-out infinite alternate; }
@keyframes mepTw { from { opacity: .25; } to { opacity: 1; } }
.mep-sky .far { fill: var(--far); } .mep-sky .mid { fill: var(--mid); } .mep-sky .near { fill: var(--near); }
.mep-sky .win { fill: var(--win); opacity: .85; }
.mep-sky.t-day .win { opacity: .35; }

/* النافذة تنفتح */
.mep-sky.mep-open { animation: mepWindow .95s cubic-bezier(.65, 0, .25, 1) both; }
@keyframes mepWindow { from { clip-path: inset(22% 34% 22% 34% round 26px); } to { clip-path: inset(0 0 0 0 round 0); } }
.mep-sky.mep-open > .mep-wrap > * { animation: mepRise .7s .55s cubic-bezier(.2, .8, .2, 1) both; }
.mep-sky.mep-open > .mep-wrap > *:nth-child(2) { animation-delay: .65s; }
.mep-sky.mep-open > .mep-wrap > *:nth-child(3) { animation-delay: .75s; }
.mep-sky.mep-open > .mep-wrap > *:nth-child(4) { animation-delay: .85s; }
@keyframes mepRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* 2. اسم المنصة كعلامة خطية */
.mep-wordmark { display: flex; flex-direction: column; align-items: center; margin: 0 auto 26px; position: relative; }
.mep-wordmark .wm-arc { display: block; width: clamp(150px, 34vw, 230px); height: clamp(24px, 5vw, 34px); margin-bottom: -6px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.mep-wordmark .wm-en, .mep-wordmark .wm-ar { background: linear-gradient(100deg, #e9a63a 0%, #ffe7a8 40%, #f2b24a 62%, #fff3cf 78%, #d98f22 100%); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; filter: drop-shadow(0 3px 10px rgba(0,0,0,.35)); }
.mep-wordmark .wm-en { font: 600 clamp(1.5rem, 4.6vw, 2.2rem)/1.1 "Cinzel", "Cormorant Garamond", Georgia, serif; letter-spacing: .08em; direction: ltr; }
.mep-wordmark .wm-ar { font: 800 clamp(2.6rem, 10vw, 4.4rem)/1.25 "Cairo", "Tajawal", sans-serif; margin-top: 2px; }
.mep-wordmark .wm-sub { display: flex; align-items: center; gap: 14px; margin-top: 12px; font: 700 clamp(1.05rem, 3.6vw, 1.35rem) "Tajawal", "Cairo", sans-serif; color: #fff; }
.mep-wordmark .wm-sub::before, .mep-wordmark .wm-sub::after { content: ""; width: clamp(36px, 10vw, 70px); height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, #f2b24a, transparent); }

/* 17. صوت المطر */
.mep-sound { position: absolute; z-index: 4; top: 16px; inset-inline-start: 16px; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.6); background: rgba(10,12,40,.35); color: #fff; cursor: pointer; font-size: 1.05rem; display: grid; place-items: center; backdrop-filter: blur(4px); }
.mep-sound.on { background: rgba(242,178,74,.35); border-color: #f2b24a; }
/* 18. ليلة ثلج */
.mep-snow { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.mep-snow-tag { position: absolute; z-index: 4; bottom: 18px; inset-inline-end: 16px; font-size: .78rem; color: #fff; background: rgba(10,12,40,.4); padding: 3px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.35); }

/* ---------- 5. بوابة ضوء على الزر الرئيسي ---------- */
.mep-shine { position: relative; overflow: hidden; isolation: isolate; }
.mep-shine::after { content: ""; position: absolute; top: -20%; bottom: -20%; width: 40%; left: -60%; z-index: 1; pointer-events: none; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255,226,150,.85), rgba(255,255,255,.95), rgba(255,226,150,.85), transparent); opacity: 0; }
.mep-shine.go::after { animation: mepShine .75s ease-out; }
@keyframes mepShine { 0% { left: -60%; opacity: 0; } 15% { opacity: 1; } 100% { left: 130%; opacity: 0; } }
.mep-shine.go { box-shadow: 0 0 0 2px rgba(242,178,74,.65), 0 6px 22px rgba(242,178,74,.35); transition: box-shadow .3s; }

/* ---------- 9. خط ذهبي ينساب تحت القائمة ---------- */
.mep-nav .mep-wrap { position: relative; }
.mep-nav a.active { border-bottom-color: transparent !important; }
.mep-nav-line { position: absolute; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: linear-gradient(90deg, #e19a2c, #ffd37a, #e19a2c); box-shadow: 0 0 10px rgba(242,178,74,.6); pointer-events: none; transition: left .55s cubic-bezier(.65, 0, .25, 1), width .55s cubic-bezier(.65, 0, .25, 1); }

/* ---------- 12. شريط التمرير بنقطة ضوء ---------- */
.mep-progress { position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; pointer-events: none; z-index: 2; }
.mep-progress .fill { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: 0; background: linear-gradient(90deg, rgba(225,154,44,.2), #e19a2c); }
html[dir="rtl"] .mep-progress .fill { background: linear-gradient(270deg, rgba(225,154,44,.2), #e19a2c); }
.mep-progress .dot { position: absolute; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: #fff3cf; box-shadow: 0 0 10px 3px rgba(242,178,74,.85); inset-inline-start: 0; }

/* ---------- 11. حفظ المنحة كشريط كتاب ---------- */
.mep-ribbon { position: absolute; top: -4px; inset-inline-start: 22px; width: 22px; height: 38px; z-index: 5; pointer-events: none;
  background: linear-gradient(180deg, #a31226, #7a0d1e); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); box-shadow: 0 4px 8px rgba(0,0,0,.25);
  transform-origin: top; animation: mepRibbon .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.mep-ribbon.out { animation: mepRibbonOut .35s ease-in both; }
@keyframes mepRibbon { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes mepRibbonOut { from { transform: scaleY(1); } to { transform: scaleY(0); } }

/* ---------- 19. الختم المخبّأ ---------- */
.mep-stamp { position: fixed; z-index: 300; left: 50%; top: 42%; width: 190px; height: 190px; margin: -95px 0 0 -95px; pointer-events: none; color: #b3162c; animation: mepStamp 1.9s cubic-bezier(.2, .9, .3, 1) both; }
.mep-stamp svg { width: 100%; height: 100%; filter: drop-shadow(0 6px 16px rgba(0,0,0,.25)); }
@keyframes mepStamp { 0% { transform: scale(2.6) rotate(-30deg); opacity: 0; } 18% { transform: scale(.92) rotate(-12deg); opacity: .95; } 26% { transform: scale(1) rotate(-12deg); } 78% { opacity: .95; } 100% { transform: scale(1) rotate(-12deg); opacity: 0; } }

/* ---------- 20. التوقيع في آخر الصفحة ---------- */
.mep-sign { text-align: center; margin: 18px auto 6px; color: #f2c56b; }
.mep-sign svg { width: min(300px, 80vw); height: auto; display: block; margin: 0 auto; }
.mep-sign path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: var(--len, 2000); stroke-dashoffset: var(--len, 2000); }
.mep-sign.draw path { transition: stroke-dashoffset 2.6s cubic-bezier(.6, 0, .3, 1); stroke-dashoffset: 0; }
.mep-sign b { display: block; font: 700 1.25rem "Aref Ruqaa", "Cairo", serif; margin-top: 4px; opacity: 0; transform: translateY(6px); transition: opacity .8s 2.2s, transform .8s 2.2s; }
.mep-sign.draw b { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .mep-sky.mep-open, .mep-sky.mep-open > .mep-wrap > *, .mep-stars i, .mep-stamp, .mep-ribbon { animation: none !important; }
  .mep-nav-line { transition: none; }
  .mep-sign path { stroke-dashoffset: 0; transition: none !important; }
  .mep-sign b { opacity: 1; transform: none; transition: none; }
}
