/* ── Google Fonts — Cairo + Gulzar ── */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200..1000&family=Elms+Sans:wght@300&family=Gulzar&family=Noto+Kufi+Arabic:wght@100;200;300&display=swap');

/* ── Self-hosted Fonts (Legacy — disabled in favor of Cairo) ── */
/*
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
*/
@font-face {
  font-family: 'Noto Kufi Arabic';
  src: url('/fonts/noto-kufi-arabic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: 'Gulzar';
  src: url('/fonts/gulzar-arabic.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Gulzar';
  src: url('/fonts/gulzar-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Accessibility ── */
.skip-link {
  position: absolute; top: -100px; left: 16px;
  background: var(--ink, #0a0a0a); color: #fff;
  padding: 8px 16px; border-radius: 0 0 8px 8px;
  font-size: 14px; font-weight: 600; z-index: 9999;
  text-decoration: none; transition: top 0.2s ease;
}
.skip-link:focus { top: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens: Light ── */
:root {
  --font: "Cairo", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "Cairo", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-arabic: "Cairo", "Noto Kufi Arabic", sans-serif;
  --font-urdu: "Cairo", "Noto Nastaliq Urdu", sans-serif;
  --radius: 16px;
  --bg:       #ffffff;
  --surface:  #f5f5f7;
  --surface2: #ebebeb;
  --border:   #e0e0e0;
  --ink:      #1d1d1f;
  --muted:    #6e6e73;
  --nav-bg:   rgba(255,255,255,0.85);
  --toggle-bg:   #e8e8e8;
  --toggle-knob: #1d1d1f;
  --toggle-icon: #6e6e73;
  /* ── Brand palette — indigo-blue / purple ── */
  --accent:         #4f72f8;   /* indigo-blue, AA-contrast on white */
  --accent-hover:   #3a5ce0;
  --accent-2:       #7c5ce6;   /* purple, AA-contrast on white      */
  --accent-3:       #a0baff;   /* periwinkle, AA-contrast on white  */
  --accent-raw:     79, 114, 248;
  --accent-2-raw:   124, 92, 230;
  --accent-3-raw:   160, 186, 255;
  --card-shadow: 0 2px 12px rgba(0,0,0,0.06);
  --card-shadow-hover: 0 16px 48px rgba(0,0,0,0.14);
}

/* ── Tokens: Dark (deep navy — Buildly-style) ── */
[data-theme="dark"] {
  --bg:       #060c1a;
  --surface:  #0d1629;
  --surface2: #111d35;
  --border:   rgba(255,255,255,0.10);
  --ink:      #f0f4ff;
  --muted:    #9aa9c7;
  --nav-bg:   rgba(6,12,26,0.82);
  --toggle-bg:   #1a2540;
  --toggle-knob: #f0f4ff;
  --toggle-icon: #7c8fb0;
  /* ── Brand palette — indigo-blue / purple on deep navy ── */
  --accent:         #4f72f8;   /* indigo-blue  */
  --accent-hover:   #6b8bff;
  --accent-2:       #7c5ce6;   /* purple       */
  --accent-3:       #a0baff;   /* periwinkle   */
  --accent-raw:     79, 114, 248;
  --accent-2-raw:   124, 92, 230;
  --accent-3-raw:   160, 186, 255;
  --card-shadow:       0 2px 16px rgba(0,0,0,0.5);
  --card-shadow-hover: 0 20px 60px rgba(0,0,0,0.7);
  /* ── Glow colours for decorative effects ── */
  --glow-accent: rgba(79,114,248,0.18);
  --glow-2:      rgba(124,92,230,0.10);
}

/* ── Global ── */
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;                 /* prevent horizontal overflow on all viewports */
  transition: background 0.35s ease, color 0.35s ease;
}

/* ── Light theme: soft gradient canvas so glass cards have visible depth ── */
[data-theme="light"] body {
  background: linear-gradient(150deg, #eef2ff 0%, #f8f8ff 42%, #f3eeff 100%) fixed;
  min-height: 100vh;
}

/* ── Light theme: glassmorphism cards and surfaces ── */
[data-theme="light"] .card,
[data-theme="light"] .cat-card,
[data-theme="light"] .hadith-card,
[data-theme="light"] .bm-card {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.85);
  box-shadow: 0 2px 16px rgba(79,114,248,0.06), 0 1px 3px rgba(0,0,0,0.05);
}
[data-theme="light"] .cat-card:hover,
[data-theme="light"] .card:hover,
[data-theme="light"] .hadith-card:hover {
  background: rgba(255,255,255,0.88);
  border-color: rgba(79,114,248,0.18);
  box-shadow: 0 8px 36px rgba(79,114,248,0.10), 0 2px 8px rgba(0,0,0,0.06);
}
/* ── Dark theme: grid background ── */
[data-theme="dark"] body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.028) 1px, transparent 1px);
  background-size: 52px 52px;
  pointer-events: none;
  z-index: 0;
}

/* ── Dark theme: ambient radial glow (indigo + purple) ── */
[data-theme="dark"] body::after {
  content: '';
  position: fixed;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  background: radial-gradient(ellipse at center,
    rgba(79,114,248,0.18) 0%,
    rgba(124,92,230,0.10) 40%,
    transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Ensure all page content sits above the pseudo-element overlays */
[data-theme="dark"] nav,
[data-theme="dark"] main,
[data-theme="dark"] header,
[data-theme="dark"] section,
[data-theme="dark"] footer,
[data-theme="dark"] aside {
  position: relative;
  z-index: 1;
}

/* ── Dark theme: glassmorphism cards and surfaces ── */
[data-theme="dark"] .card,
[data-theme="dark"] .cat-card,
[data-theme="dark"] .hadith-card,
[data-theme="dark"] .bm-card {
  background: rgba(13,22,41,0.75);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

[data-theme="dark"] .cat-card:hover,
[data-theme="dark"] .card:hover,
[data-theme="dark"] .hadith-card:hover {
  background: rgba(13,22,41,0.92);
  border-color: rgba(79,114,248,0.30);
}

/* ── Display headings — Inter 800 ── */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.04em;
}
h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
}

/* ── Nav — 2026 Premium Rebuild ── */
nav.main-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
  height: 72px;                       /* 72px: premium height, passes 44 px touch target */
  background: var(--nav-bg);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease, border-color 0.3s ease;
  contain: layout style;              /* CLS guard */
}

/* Logo */
.nav-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo img {
  height: 40px; width: auto;         /* proportional to 72 px bar */
  display: block;
  transition: filter 0.3s ease, opacity 0.2s ease;
}
.nav-logo:hover img { opacity: 0.8; }
.footer-logo img { height: 34px; width: auto; display: block; }
[data-theme="dark"] .nav-logo img,
[data-theme="dark"] .footer-logo img { filter: brightness(0) invert(1); }

/* Center links */
.nav-links {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;                           /* gap handled by link padding below */
  list-style: none;
  margin: 0; padding: 0;
  flex: 1;
  justify-content: center;
}
.nav-links li { display: flex; align-items: center; }
.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;                  /* generous click target */
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  letter-spacing: -0.1px;
  transition: color 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}
.nav-links a:hover {
  color: var(--ink);
  background: var(--surface);
}
.nav-links a.nav-active {
  color: var(--ink);
  font-weight: 600;
}

/* Bookmark badge */
.bm-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--accent); color: #fff;
  border-radius: 100px; font-size: 10px; font-weight: 700;
  line-height: 1; margin-left: 3px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.bm-badge[data-count="0"] { opacity: 0; transform: scale(0.5); }

/* Right-side cluster */
.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Widget pill — single container */
.nav-widgets {
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 30px;
  padding: 0 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  flex-shrink: 0;
  overflow: hidden;
  transition: background 0.3s ease, border-color 0.3s ease;
}
[data-theme="dark"] .nav-widgets {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}

/* Individual widget items — no own borders */
.nav-widget {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: default;
  line-height: 1;
}
.nav-widget svg { flex-shrink: 0; opacity: 0.5; }
.nav-widget strong { color: var(--ink); font-weight: 600; white-space: nowrap; }
.nav-widget .prayer-name { color: var(--accent); font-weight: 600; white-space: nowrap; }
.nav-widget .prayer-time { color: var(--ink); font-weight: 500; white-space: nowrap; }

/* Thin vertical separators inside pill */
.nav-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
  flex-shrink: 0;
  display: inline-block;
  opacity: 0.7;
}

/* Auth cluster */
.nav-auth {
  display: flex;
  align-items: center;
  gap: 6px;
}
#nav-auth-item { display: flex; align-items: center; gap: 6px; }
#btn-login {
  display: inline-flex; align-items: center;
  padding: 7px 16px;
  background: var(--accent); color: #fff;
  border-radius: 100px; font-size: 13px; font-weight: 500;
  border: none; cursor: pointer; font-family: var(--font);
  letter-spacing: -0.1px;
  transition: opacity 0.2s ease, background 0.3s ease;
  white-space: nowrap;
}
#btn-login:hover { opacity: 0.82; }
#btn-logout {
  display: none; background: transparent;
  border: 1px solid var(--border); padding: 6px 14px;
  border-radius: 100px; font-size: 12px; font-weight: 500;
  color: var(--muted); cursor: pointer; font-family: var(--font);
  transition: background 0.2s ease, color 0.2s ease;
}
#btn-logout:hover { background: var(--surface); color: var(--ink); }
#nav-avatar-wrap { display: none; align-items: center; cursor: pointer; }
.nav-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 11px;
  color: #fff; overflow: hidden; border: 1.5px solid var(--border);
  transition: border-color 0.2s ease;
}
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; display: none; }
.nav-avatar:hover { border-color: var(--accent); }

.nav-cta {
  display: inline-flex; align-items: center;
  justify-content: center; padding: 7px 16px;
  background: var(--accent); color: #fff;
  border-radius: 100px; font-size: 13px; font-weight: 500;
  letter-spacing: -0.1px; text-decoration: none;
  transition: opacity 0.2s ease, background 0.3s ease;
}
.nav-cta:hover { opacity: 0.82; }

/* Hamburger */
.nav-hamburger {
  display: none; flex-direction: column;
  justify-content: center; gap: 5px;
  width: 44px; height: 44px; background: none;
  border: none; cursor: pointer; padding: 10px;
  border-radius: 10px; transition: background 0.2s ease;
  flex-shrink: 0;
}
.nav-hamburger:hover { background: var(--surface); }
.nav-hamburger span {
  display: block; width: 100%; height: 1.5px;
  background: var(--ink); border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease, background 0.3s ease;
}

/* Mobile drawer — offset matches new 56px height */
.nav-drawer {
  display: none; position: fixed;
  top: 72px; left: 0; right: 0;
  background: var(--bg); border-bottom: 1px solid var(--border);
  padding: 12px 20px 20px; z-index: 199;
  flex-direction: column; gap: 2px;
  transition: background 0.3s ease;
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
  font-size: 15px; font-weight: 500; color: var(--muted);
  text-decoration: none; padding: 11px 8px;
  border-bottom: 1px solid var(--border); transition: color 0.2s ease;
  border-radius: 0;
}
.nav-drawer a:hover { color: var(--ink); }
.nav-drawer a.nav-active { color: var(--ink); font-weight: 600; }
.nav-drawer a:last-of-type { border-bottom: none; }
.nav-drawer .drawer-cta {
  margin-top: 10px; padding: 13px;
  background: var(--accent); color: #fff;
  border-radius: 12px; text-align: center;
  font-weight: 500; border-bottom: none !important;
  transition: opacity 0.2s ease;
}
.nav-drawer .drawer-cta:hover { opacity: 0.82; }

/* ── Theme Toggle — icon circle (no sliding knob) ── */
.theme-toggle {
  width: 34px; height: 34px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 50%; cursor: pointer; position: relative;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease; outline: none;
}
.theme-toggle:hover { background: var(--surface2); border-color: var(--muted); }
.theme-toggle:focus-visible { box-shadow: 0 0 0 2px var(--accent); outline: none; }
.theme-toggle::after { display: none; }             /* no sliding knob */
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 15px; height: 15px; transition: opacity 0.2s ease;
  stroke: var(--ink); fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; }
[data-theme="light"] .theme-toggle .icon-sun  { opacity: 1; }
[data-theme="dark"]  .theme-toggle .icon-sun  { opacity: 0; }
[data-theme="dark"]  .theme-toggle .icon-moon { opacity: 1; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border); padding: 44px 40px;
  transition: border-color 0.35s ease, background 0.35s ease;
}
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 24px;
}
.footer-logo {
  display: inline-flex; align-items: center; text-decoration: none;
}
.footer-logo img {
  height: 24px; width: auto; transition: filter 0.35s ease;
}
.footer-links {
  display: flex; flex-wrap: wrap; gap: 12px 24px; list-style: none; justify-content: center;
}
.footer-links a {
  font-size: 13px; color: var(--muted); text-decoration: none;
  letter-spacing: -0.1px; transition: color 0.2s ease; white-space: nowrap;
}
.footer-links a:hover { color: var(--ink); }
.footer-copy {
  font-size: 12px; color: var(--muted); letter-spacing: -0.1px; text-align: right;
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .footer-inner { grid-template-columns: 1fr; text-align: center; }
  .footer-copy { text-align: center; }
  .footer-links { justify-content: center; }
}
/* Tablet + mobile: collapse nav links, show hamburger */
@media (max-width: 1024px) {
  nav.main-nav { padding: 0 20px; gap: 8px; }
  .nav-links { display: none; }
  .nav-right { gap: 4px; }
  .nav-widgets { display: none; }       /* hide info pill on tablet/mobile */
  .nav-hamburger { display: flex; }
  #btn-login { display: none; }         /* sign-in lives in drawer instead */
  #btn-logout { display: none; }        /* logout lives in drawer instead */
}
/* Mobile-only extras */
@media (max-width: 768px) {
  nav.main-nav { padding: 0 16px; }
  footer { padding: 32px 20px; }
}

/* ──────────────────────────────────────────────────────────
   Dark-mode polish pass (spacing, contrast, focus, scrollbar)
   Applies only in dark mode so light theme is untouched.
   ────────────────────────────────────────────────────────── */

/* Slightly lifted card elevation + softer border in dark mode */
[data-theme="dark"] .card,
[data-theme="dark"] .cat-card,
[data-theme="dark"] .hadith-card,
[data-theme="dark"] .bm-card {
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset,
              0 10px 40px rgba(0,0,0,0.35);
}

/* More breathing room for sections in dark mode so the
   ambient radial glow and grid background can breathe */
[data-theme="dark"] .featured-section { margin: 72px auto; }
[data-theme="dark"] .cards-section { padding-top: 56px; padding-bottom: 96px; }

/* Softer nav border in dark mode so the bar floats cleanly */
[data-theme="dark"] nav.main-nav {
  border-bottom-color: rgba(255,255,255,0.06);
}

/* Footer separator looks cleaner in dark mode */
[data-theme="dark"] footer {
  border-top-color: rgba(255,255,255,0.06);
}

/* Crisper focus ring in dark mode — default outline
   can disappear against the deep navy background */
[data-theme="dark"] :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
[data-theme="dark"] .theme-toggle:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
  outline: none;
}

/* Custom scrollbar in dark mode so the default bright
   scrollbar doesn't flash against the deep navy canvas */
[data-theme="dark"] {
  scrollbar-color: rgba(255,255,255,0.12) transparent;
  scrollbar-width: thin;
}
[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: transparent; }
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.10);
  border-radius: 100px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.20);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* Selection highlight — indigo tint in dark mode */
[data-theme="dark"] ::selection {
  background: rgba(79,114,248,0.35);
  color: #fff;
}

/* Improve dark-mode link/code contrast on privacy & terms pages */
[data-theme="dark"] p,
[data-theme="dark"] li {
  color: var(--muted);
}
[data-theme="dark"] a {
  color: var(--accent-3);
}
[data-theme="dark"] a:hover { color: #c7d6ff; }

/* Hamburger lines were using var(--ink) which is fine, but add
   a small hover bg that matches dark surfaces */
[data-theme="dark"] .nav-hamburger:hover {
  background: rgba(255,255,255,0.06);
}

/* Reduce transition flicker when switching themes by locking
   critical element transitions to transform/opacity only */
[data-theme="dark"] .hero-mark img,
[data-theme="dark"] .nav-avatar img {
  transition: transform 0.2s ease;
}

/* Drawer polish in dark mode */
[data-theme="dark"] .nav-drawer {
  border-bottom-color: rgba(255,255,255,0.06);
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
[data-theme="dark"] .nav-drawer a {
  border-bottom-color: rgba(255,255,255,0.06);
}

/* ──────────────────────────────────────────────────────────
   Hadith permalink deep-link highlight + internal link block
   ────────────────────────────────────────────────────────── */

/* Flash a card when a visitor lands via ?h=<id> */
@keyframes hadith-card-flash-kf {
  0%   { box-shadow: 0 0 0 0 rgba(79,114,248,0.55), 0 16px 48px rgba(79,114,248,0.25); }
  50%  { box-shadow: 0 0 0 6px rgba(79,114,248,0.25), 0 20px 60px rgba(79,114,248,0.30); }
  100% { box-shadow: 0 0 0 0 rgba(79,114,248,0.0), var(--card-shadow); }
}
.hadith-card-flash {
  animation: hadith-card-flash-kf 2.2s ease-out 1;
  scroll-margin-top: 90px;
}
.hadith-card {
  scroll-margin-top: 90px;
}

/* SEO internal link block — a compact index of every hadith
   in the current category with crawlable permalink anchors. */
.hadith-index-block {
  display: none;
  max-width: 1100px;
  margin: 48px auto 72px;
  padding: 28px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  transition: background 0.35s ease, border-color 0.35s ease;
}
[data-theme="light"] .hadith-index-block {
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-color: rgba(255,255,255,0.80);
}
[data-theme="dark"] .hadith-index-block {
  background: rgba(13,22,41,0.60);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: rgba(255,255,255,0.08);
}
.hadith-index-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 6px;
}
.hadith-index-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 18px;
  letter-spacing: -0.1px;
}
.hadith-index-list {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 14px;
}
.hadith-index-list li { margin: 0; padding: 0; }
.hadith-index-list a {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: -0.05px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease, color 0.15s ease;
}
.hadith-index-list a:hover {
  background: var(--surface2);
  color: var(--ink);
}
[data-theme="dark"] .hadith-index-list a:hover {
  background: rgba(79,114,248,0.12);
  color: var(--ink);
}
@media (max-width: 680px) {
  .hadith-index-block { margin: 32px 16px 56px; padding: 22px 20px; border-radius: 14px; }
  .hadith-index-list { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ──────────────────────────────────────────────────────────────
   Arabic typography — Noto Kufi Arabic (global)
   Applies to every Arabic surface: hadith body, modal, featured,
   search matches, any [lang="ar"] or [dir="rtl"] container, and
   the legacy .arabic-text / .hadith-arabic / .modal-hadith-arabic
   / .featured-hadith-arabic classes. Font-feature-settings enable
   proper Arabic ligatures and contextual forms.
   ────────────────────────────────────────────────────────────── */
:lang(ar),
[lang="ar"],
[dir="rtl"],
.arabic-text,
.hadith-arabic,
.modal-hadith-arabic,
.featured-hadith-arabic,
.category-arabic,
.book-title-ar,
.fc-arabic,
[data-arabic],
p[dir="rtl"],
span[dir="rtl"],
div[dir="rtl"] {
  font-family: var(--font-arabic) !important;
  font-size: 1rem !important;
  font-weight: 450 !important;
  font-feature-settings: "kern", "liga", "calt", "ss01";
  font-variant-ligatures: common-ligatures contextual;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 2.2;
  color: #1ea64a !important;
  letter-spacing: 0;
}

.arabic-text,
.hadith-arabic,
.modal-hadith-arabic,
.featured-hadith-arabic {
  direction: rtl;
  text-align: right;
}

/* ═══════════════════════════�

/* ══════════════════════════════════════════════════════════════
   English hadith card text — Elms Sans light
   ══════════════════════════════════════════════════════════════ */
.english-text,
.quick-read-text {
  font-family: 'Elms Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--ink);
}

/* ══════════════════════════════════════════════════════════════
   Urdu Translation — Inline Accordion
   ══════════════════════════════════════════════════════════════ */

/* Button */
.urdu-trans-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(79, 114, 248, 0.07);
  border: 1px solid rgba(79, 114, 248, 0.22);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  font-family: "Cairo", "Noto Kufi Arabic", sans-serif;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
  margin-left: auto;
  margin-top: 16px;
  line-height: 1.3;
}
.urdu-trans-btn:hover {
  background: rgba(79, 114, 248, 0.13);
  border-color: rgba(79, 114, 248, 0.45);
}
.urdu-trans-btn.open {
  background: rgba(79, 114, 248, 0.13);
  border-color: rgba(79, 114, 248, 0.45);
}
.urdu-trans-btn::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  margin-left: 2px;
}
.urdu-trans-btn.open::after {
  transform: rotate(-135deg) translateY(-2px);
}

/* Accordion body */
.urdu-inline-body {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: 0;
  transition: grid-template-rows 0.45s cubic-bezier(0.23, 1, 0.32, 1),
              opacity 0.35s cubic-bezier(0.23, 1, 0.32, 1),
              margin-top 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}
.urdu-inline-body > .urdu-inline-inner {
  overflow: hidden;
}
.urdu-inline-body.open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 14px;
}
.urdu-inline-inner {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 14px;
  transform: translateY(-8px);
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
[data-theme="dark"] .urdu-inline-inner {
  border-top-color: rgba(255, 255, 255, 0.1);
}
.urdu-inline-body.open > .urdu-inline-inner {
  transform: translateY(0);
}
.urdu-inline-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  font-family: "Cairo", sans-serif;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
}
.urdu-inline-body.open .urdu-inline-label {
  opacity: 1;
  transform: translateY(0);
}
.urdu-inline-text,
.urdu-inline-empty {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 2.2;
  color: rgb(89, 133, 225);
  direction: rtl;
  text-align: right;
  margin: 0;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.35s ease 0.15s, transform 0.35s ease 0.15s;
}
.urdu-inline-empty {
  color: var(--muted);
  font-size: 18px;
}
.urdu-inline-body.open .urdu-inline-text,
.urdu-inline-body.open .urdu-inline-empty {
  opacity: 1;
  transform: translateY(0);
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE SYSTEM — 5 breakpoints
   375 mobile · 600 small-phone · 744 tablet · 1128 laptop · 1280 desktop · 1440 wide
   ══════════════════════════════════════════════════════════════ */

/* ── Wide (> 1440px): cap content width ── */
@media (min-width: 1440px) {
  .cards-section,
  .hadith-list,
  .featured-section,
  .page-wrap,
  .hadith-index-block {
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
  }
  /* Editorial / blog content narrower cap */
  .blog-content,
  .about-content,
  .page-prose {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ── Desktop (1128–1440px): full nav, 6-col category grid ── */
@media (min-width: 1128px) {
  .cards-track {
    grid-template-columns: repeat(6, 1fr);
    gap: 18px;
  }
  nav.main-nav {
    padding: 0 40px;
  }
  .nav-links { display: flex; }
  .nav-hamburger { display: none; }
  .nav-widgets { display: flex; }
  #btn-login { display: inline-flex; }
  #btn-logout { display: inline-flex; }
  .search-wrap { max-width: 680px; margin: 0 auto; }
}

/* ── Laptop (744–1128px): 2-up hadith cards, 3-col category ── */
@media (min-width: 744px) and (max-width: 1127px) {
  .cards-track {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  .search-wrap { max-width: 520px; margin: 0 auto; }
  nav.main-nav { padding: 0 24px; }
}

/* ── Tablet (744px): hamburger threshold ── */
@media (max-width: 743px) {
  /* Nav — hamburger only */
  nav.main-nav { padding: 0 16px; gap: 8px; }
  .nav-links { display: none; }
  .nav-right { gap: 4px; }
  .nav-widgets { display: none; }
  .nav-hamburger { display: flex; }
  #btn-login { display: none; }
  #btn-logout { display: none; }

  /* Search collapses to full-width pill */
  .search-wrap { max-width: 100%; padding: 0 16px; }
  .search-bar {
    border-radius: 100px;
    padding: 0 16px;
  }
  .search-btn-label { display: none; }

  /* Cards — 2-up on small tablet / large phone */
  .cards-track {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  /* Hadith list — single column */
  .hadith-list { padding: 0 12px; }

  /* Page sections breathe less on mobile */
  .cards-section { padding: 24px 16px 48px; }
  .featured-section { margin: 32px 16px; }
}

/* ── Small phone (< 600px): 1-up cards ── */
@media (max-width: 599px) {
  .cards-track {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .cat-card { border-radius: 16px !important; }
  .search-bar { font-size: 15px; }

  /* Pagination dots smaller */
  .pagination-dots { gap: 6px; }

  /* Sticky bottom bar for key CTA on mobile */
  .mobile-sticky-bar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    z-index: 900;
    gap: 10px;
  }
}

/* ── Mobile (< 375px): micro adjustments ── */
@media (max-width: 374px) {
  nav.main-nav { padding: 0 12px; }
  .cards-section { padding: 16px 10px 40px; }
  .search-wrap { padding: 0 10px; }
  .hadith-list { padding: 0 8px; }
}

/* Mobile header refinement */
@media (max-width: 743px) {
  nav.main-nav {
    height: 64px;
    padding: 0 16px;
    gap: 10px;
  }

  .nav-logo img {
    height: 30px;
    width: auto;
  }

  .nav-links,
  .nav-widgets,
  .nav-auth,
  #btn-login,
  #btn-logout {
    display: none !important;
  }

  .nav-right {
    margin-left: auto;
    gap: 8px;
  }

  .theme-toggle,
  .nav-hamburger {
    width: 40px;
    height: 40px;
  }

  .theme-toggle {
    background: transparent;
    border-color: var(--border);
  }

  .nav-hamburger {
    padding: 9px;
  }

  .nav-drawer {
    top: 64px;
  }
}

@media (max-width: 374px) {
  nav.main-nav {
    padding: 0 12px;
  }

  .nav-logo img {
    height: 28px;
  }

  .theme-toggle,
  .nav-hamburger {
    width: 38px;
    height: 38px;
  }
}

/* Mobile header refinement */
@media (max-width: 743px) {
  nav.main-nav {
    height: 64px;
    padding: 0 16px;
    gap: 10px;
  }
  .nav-logo img {
    height: 30px;
    width: auto;
  }
  .nav-links,
  .nav-widgets,
  .nav-auth,
  #btn-login,
  #btn-logout {
    display: none !important;
  }
  .nav-right {
    margin-left: auto;
    gap: 8px;
  }
  .theme-toggle,
  .nav-hamburger {
    width: 40px;
    height: 40px;
  }
  .theme-toggle {
    background: transparent;
    border-color: var(--border);
  }
  .nav-hamburger {
    padding: 9px;
  }
  .nav-drawer {
    top: 64px;
  }
}
@media (max-width: 374px) {
  nav.main-nav {
    padding: 0 12px;
  }
  .nav-logo img {
    height: 28px;
  }
  .theme-toggle,
  .nav-hamburger {
    width: 38px;
    height: 38px;
  }
}
