*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; max-width: 100%; }
body {
  background: #F6F0E4;
  color: #1C1810;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100%;
}
::selection { background: rgba(184,144,63,0.25); }

/* Mobile menu scroll cap — vh fallback first, dvh for modern browsers (Android compat) */
.mobile-menu-scroll {
  max-height: calc(100vh - 110px);
  max-height: calc(100dvh - 110px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.bismillah-text { white-space: nowrap; }

/* Mobile nav */
@media (max-width: 1100px) {
  .desktop-nav { display: none !important; }
  .mobile-menu-btn { display: flex !important; }
}
@media (max-width: 768px) {
  section div[style*="grid-template-columns: 1fr 1fr"],
  section div[style*="grid-template-columns: 360px 1fr"],
  section div[style*="grid-template-columns: 1fr 380px"],
  section div[style*="grid-template-columns: 1fr 440px"],
  section div[style*="grid-template-columns: 400px 1fr"],
  section div[style*="grid-template-columns: repeat(3, 1fr)"],
  section div[style*="grid-template-columns: 1fr auto 1fr"],
  section div[style*="grid-template-columns: 1fr 420px"],
  section div[style*="grid-template-columns: 420px 1fr"],
  section div[style*="grid-template-columns: 220px 1fr"],
  section div[style*="grid-template-columns: 120px 1fr"],
  section div[style*="grid-template-columns: repeat(auto-fill, minmax(340px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }
  section div[style*="grid-template-columns: 1fr 140px"] {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  .bismillah-rule { display: none !important; }
  [style*="padding-top: 108px"] { padding-top: 84px !important; }
  .fth-stack-mobile { grid-template-columns: 1fr !important; }
  .fth-stack-reverse > :first-child { order: 2; }
  .fth-stack-reverse > :last-child { order: 1; }
  .course-cta-card {
    grid-template-columns: 1fr !important;
    padding: 32px 24px !important;
  }
  .course-cta-card a {
    justify-self: start;
  }
  /* Mobile nav + footer hardening */
  .nav-topbar { padding: 6px 16px !important; gap: 16px !important; flex-wrap: wrap; justify-content: center !important; }
  .nav-topbar a { white-space: nowrap; }
  .nav-main { padding: 8px 16px !important; min-height: 60px !important; }
  .nav-logo { height: 44px !important; }
  .nav-wordmark { font-size: 18px !important; }
  .footer-newsletter { grid-template-columns: 1fr !important; padding: 28px 22px !important; }
  .footer-cols { grid-template-columns: 1fr !important; gap: 32px !important; }
  footer a[href^="mailto:"] { overflow-wrap: anywhere; word-break: break-word; }
  .hikma-banner { min-height: 500px !important; }
  .hikma-banner > div:first-of-type { position: absolute !important; inset: 0 !important; height: 100% !important; aspect-ratio: auto !important; }
}

/* Smooth page transitions */
.page-enter { animation: fadeUp 0.45s ease forwards; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Blog hero geometric ornament — animated golden Islamic pattern */
@keyframes fthGeomSpin       { from { transform: rotate(0deg);    } to { transform: rotate(360deg);  } }
@keyframes fthGeomSpinSlow   { from { transform: rotate(0deg);    } to { transform: rotate(360deg);  } }
@keyframes fthGeomSpinRev    { from { transform: rotate(360deg);  } to { transform: rotate(0deg);    } }
@keyframes fthGeomSpinRevFast{ from { transform: rotate(360deg);  } to { transform: rotate(0deg);    } }
@keyframes fthGeomPulse {
  0%, 100% { transform: scale(1);   opacity: 0.9; }
  50%      { transform: scale(1.35); opacity: 1;   }
}
@keyframes fthKabahGlow {
  0%, 100% { opacity: 0.9; filter: brightness(1); }
  50%      { opacity: 1;   filter: brightness(1.15); }
}
@keyframes fthStarPulse {
  0%, 100% { transform: scale(1);    opacity: 0.9; }
  50%      { transform: scale(1.18); opacity: 1;   }
}
@keyframes fthCrescentDrift {
  0%, 100% { transform: rotate(-3deg) translateY(0); }
  50%      { transform: rotate(2deg)  translateY(-2px); }
}
@keyframes fthTwinkle {
  0%, 100% { opacity: 1;   }
  40%      { opacity: 0.35; }
  70%      { opacity: 0.9; }
}
@keyframes fthTwinkleAlt {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1;   }
}
@media (prefers-reduced-motion: reduce) {
  [style*="fthGeomSpin"], [style*="fthGeomPulse"], [style*="fthKabahGlow"], [style*="fthStarPulse"], [style*="fthCrescentDrift"], [style*="fthTwinkle"] { animation: none !important; }
}

/* Blog hero: hide astrolabe + drop reserved padding on narrow viewports */
@media (max-width: 640px) {
  .blog-hero-ornament { display: none !important; }
  .blog-hero-content  { padding-right: 0 !important; }
}

/* Tweaks panel */
#tweaks-panel {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: #2B4840; color: #F6F0E4;
  padding: 20px 24px; min-width: 260px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  border-top: 2px solid #B8903F;
  font-family: 'DM Sans', sans-serif;
  display: none;
}
#tweaks-panel.visible { display: block; }
#tweaks-panel label { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: #D4AC6A; display: block; margin-bottom: 6px; margin-top: 14px; }
#tweaks-panel select, #tweaks-panel input[type=range] { width: 100%; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); color: #F6F0E4; padding: 6px 10px; font-size: 13px; font-family: inherit; }
#tweaks-panel input[type=range] { padding: 4px 0; accent-color: #B8903F; }
#tweaks-panel .tweak-title { font-size: 12px; letter-spacing: 0.15em; text-transform: uppercase; color: #B8903F; font-weight: 500; margin-bottom: 4px; }
