/**
 * ثهلان – مربعات الهيرو: قصة الغلاف واختيارات المحرر
 * النمط الفاتح: إطار/مربع فاتح (أبيض) + نص أسود
 * النمط الداكن: إطار/مربع أسود + نص أبيض
 * أنيميشنات إبداعية عصرية جذابة
 */

/* ========== قصة الغلاف – النمط الفاتح (إطار فاتح، نص أسود) ========== */
.cover,
html:not([data-theme="dark"]) .hero .cover {
  background: #ffffff !important;
  border: 1px solid rgba(201, 162, 39, 0.3) !important;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset,
    0 0 80px rgba(201, 162, 39, 0.08) !important;
  position: relative;
  overflow: hidden;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
              box-shadow 0.5s ease !important;
}

/* ========== قصة الغلاف – النمط الداكن (إطار أسود، نص أبيض) ========== */
[data-theme="dark"] .cover,
html[data-theme="dark"] .hero .cover {
  background: #0d0d0d !important;
  border: 1px solid rgba(201, 162, 39, 0.35) !important;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 60px rgba(201, 162, 39, 0.12) !important;
}

.cover::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(201, 162, 39, 0.15), transparent);
  animation: coverShimmer 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 10;
}

@keyframes coverShimmer {
  0%, 100% { left: -100%; }
  50% { left: 150%; }
}

.cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 80%, rgba(201, 162, 39, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(160, 82, 45, 0.05) 0%, transparent 40%);
  pointer-events: none;
  z-index: 1;
}

.cover:hover {
  transform: translateY(-8px) scale(1.01) !important;
  box-shadow: 
    0 32px 80px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(201, 162, 39, 0.4) inset,
    0 0 100px rgba(201, 162, 39, 0.15) !important;
}

/* نصوص قصة الغلاف – النمط الفاتح: أسود */
.cover .badge,
.cover h1,
.cover p,
html:not([data-theme="dark"]) .hero .cover .badge,
html:not([data-theme="dark"]) .hero .cover h1,
html:not([data-theme="dark"]) .hero .cover p {
  color: #1a1a1a !important;
  -webkit-text-fill-color: #1a1a1a !important;
  background: none !important;
  background-clip: unset !important;
}

/* نصوص قصة الغلاف – النمط الداكن: أبيض */
[data-theme="dark"] .cover .badge,
[data-theme="dark"] .cover h1,
[data-theme="dark"] .cover p,
html[data-theme="dark"] .hero .cover .badge,
html[data-theme="dark"] .hero .cover h1,
html[data-theme="dark"] .hero .cover p {
  color: #f5f0e8 !important;
  -webkit-text-fill-color: #f5f0e8 !important;
  background: none !important;
  background-clip: unset !important;
}

/* شارة قصة الغلاف – فاتح */
.cover .badge,
html:not([data-theme="dark"]) .hero .cover .badge {
  background: rgba(201, 162, 39, 0.15) !important;
  border: 1px solid rgba(201, 162, 39, 0.4) !important;
  color: #8B6914 !important;
  -webkit-text-fill-color: #8B6914 !important;
  animation: badgePulse 3s ease-in-out infinite;
}

/* شارة قصة الغلاف – داكن */
[data-theme="dark"] .cover .badge,
html[data-theme="dark"] .hero .cover .badge {
  background: rgba(201, 162, 39, 0.2) !important;
  border: 1px solid rgba(201, 162, 39, 0.45) !important;
  color: #e8d68a !important;
  -webkit-text-fill-color: #e8d68a !important;
  animation: badgePulse 3s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(201, 162, 39, 0); }
}

.cover h1 {
  position: relative;
  animation: titleReveal 0.8s ease-out;
}

@keyframes titleReveal {
  from { 
    opacity: 0; 
    transform: translateY(20px); 
    filter: blur(4px);
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
    filter: blur(0);
  }
}

/* زر قصة الغلاف (لون الزر ثابت في النمطين) */
.cover .btn,
html:not([data-theme="dark"]) .hero .cover .btn,
[data-theme="dark"] .cover .btn,
html[data-theme="dark"] .hero .cover .btn {
  background: linear-gradient(135deg, #C9A227 0%, #A0522D 100%) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 20px rgba(201, 162, 39, 0.4);
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.cover .btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

.cover .btn:hover::before {
  left: 100%;
}

.cover .btn:hover {
  transform: translateY(-3px) scale(1.05) !important;
  box-shadow: 0 8px 30px rgba(201, 162, 39, 0.5) !important;
}

/* ========== المربعات الثلاث السفلى (اختيارات المحرر) – بيضاء ونص أسود دائماً في النمطين ========== */
.pick,
[data-theme="dark"] .pick,
html[data-theme="dark"] .editor-picks .pick,
html:not([data-theme="dark"]) .editor-picks .pick {
  background: #ffffff !important;
  border: 1px solid rgba(201, 162, 39, 0.25) !important;
  box-shadow: 
    0 8px 30px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.9) inset !important;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.pick::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 0;
  background: linear-gradient(180deg, #C9A227, #A0522D);
  transition: height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 0 0 0 4px;
}

.pick::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.03) 0%, transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pick:hover {
  transform: translateY(-6px) translateX(4px) scale(1.02) !important;
  border-color: rgba(201, 162, 39, 0.5) !important;
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(201, 162, 39, 0.3) inset,
    0 0 40px rgba(201, 162, 39, 0.1) !important;
}

.pick:hover::before {
  height: 100%;
}

.pick:hover::after {
  opacity: 1;
}

/* نصوص المربعات الثلاث السفلى – أسود دائماً في النمطين */
.pick strong,
.pick .muted,
[data-theme="dark"] .pick strong,
[data-theme="dark"] .pick .muted,
.editor-picks .pick strong,
.editor-picks .pick .muted,
html[data-theme="dark"] .editor-picks .pick strong,
html[data-theme="dark"] .editor-picks .pick .muted,
html:not([data-theme="dark"]) .editor-picks .pick strong,
html:not([data-theme="dark"]) .editor-picks .pick .muted {
  color: #1a1a1a !important;
  -webkit-text-fill-color: #1a1a1a !important;
}

.pick .muted,
[data-theme="dark"] .pick .muted,
html[data-theme="dark"] .editor-picks .pick .muted,
html:not([data-theme="dark"]) .editor-picks .pick .muted {
  color: #4a4238 !important;
  -webkit-text-fill-color: #4a4238 !important;
}

/* ========== أنيميشنات الدخول المتتالية ========== */
.editor-picks .pick {
  animation: pickSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.editor-picks .pick:nth-child(1) { animation-delay: 0.1s; }
.editor-picks .pick:nth-child(2) { animation-delay: 0.2s; }
.editor-picks .pick:nth-child(3) { animation-delay: 0.3s; }

@keyframes pickSlideIn {
  from {
    opacity: 0;
    transform: translateX(-40px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* ========== تأثير التوهج الذهبي المتحرك ========== */
.cover,
.pick {
  --glow-x: 50%;
  --glow-y: 50%;
}

/* توهج عند الـ hover – النمط الفاتح */
html:not([data-theme="dark"]) .cover:hover,
html:not([data-theme="dark"]) .pick:hover {
  background-image: radial-gradient(
    circle at var(--glow-x) var(--glow-y),
    rgba(201, 162, 39, 0.08) 0%,
    transparent 50%
  ) !important;
  background-color: #ffffff !important;
}

/* توهج عند الـ hover – النمط الداكن (قصة الغلاف فقط؛ المربعات الثلاث تبقى بيضاء) */
[data-theme="dark"] .cover:hover,
html[data-theme="dark"] .hero .cover:hover {
  background-image: radial-gradient(
    circle at var(--glow-x) var(--glow-y),
    rgba(201, 162, 39, 0.12) 0%,
    transparent 50%
  ) !important;
  background-color: #0d0d0d !important;
}

/* المربعات الثلاث السفلى – عند الـ hover تبقى بيضاء */
[data-theme="dark"] .pick:hover,
html[data-theme="dark"] .editor-picks .pick:hover {
  background-color: #ffffff !important;
  background-image: radial-gradient(
    circle at var(--glow-x) var(--glow-y),
    rgba(201, 162, 39, 0.06) 0%,
    transparent 50%
  ) !important;
}

/* ========== خط ذهبي متحرك أسفل العنوان ========== */
.cover h1 {
  position: relative;
  display: inline-block;
}

.cover h1::after {
  content: '';
  position: absolute;
  bottom: -4px;
  right: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, #C9A227, #A0522D, #C9A227);
  background-size: 200% 100%;
  animation: gradientMove 2s linear infinite;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 2px;
}

.cover:hover h1::after {
  width: 100%;
}

@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ========== نقاط زخرفية متحركة ========== */
.editor-picks {
  position: relative;
}

.editor-picks::before {
  content: '✦';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(201, 162, 39, 0.6);
  font-size: 1.2rem;
  animation: starFloat 3s ease-in-out infinite;
}

@keyframes starFloat {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(0deg); }
  50% { transform: translateX(-50%) translateY(-10px) rotate(180deg); }
}

/* ========== تأثير النبض للإطار ========== */
@keyframes borderPulse {
  0%, 100% { border-color: rgba(201, 162, 39, 0.25); }
  50% { border-color: rgba(201, 162, 39, 0.5); }
}

.pick {
  animation: pickSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards,
             borderPulse 4s ease-in-out infinite 1s;
}

/* ========== تعطيل الحركات لمن يفضلون ذلك ========== */
@media (prefers-reduced-motion: reduce) {
  .cover::before,
  .cover h1::after,
  .editor-picks::before {
    animation: none;
  }
  
  .cover,
  .pick {
    transition: none !important;
  }
  
  .pick {
    animation: none;
  }
}

/* ========== الجوال ========== */
@media (max-width: 640px) {
  .cover:hover {
    transform: translateY(-4px) !important;
  }
  
  .pick:hover {
    transform: translateY(-4px) translateX(2px) !important;
  }
  
  .editor-picks::before {
    display: none;
  }
}
