/*
Theme Name:         Khedher Theme
Theme URI:          https://sas.smartsolutionsx.com
Description:        A modern, high-contrast Islamic knowledge theme designed for Prof. Dr. Mohamed Zaki Khedher. Features bilingual Arabic/English layout, RTL-first design, Islamic geometric aesthetics, and full Elementor compatibility.
Version:            2.5.4
Requires at least:  6.0
Tested up to:       6.7
Requires PHP:       7.4
Author:             Dr. Mohammad Abdallah Khamis
Author URI:         https://sas.smartsolutionsx.com
License:            GNU General Public License v2 or later
License URI:        https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:        khedher-theme
Domain Path:        /languages
Tags:               arabic, rtl, islamic, elementor, custom-colors, custom-menu, featured-images, full-width-template, threaded-comments, translation-ready
*/

/* ====================================================
   1. DESIGN TOKENS - BRIGHT ISLAMIC PALETTE
   ==================================================== */
:root {
  /* Primary palette - Bright, high-contrast Islamic Green */
  --clr-primary:       #0a5c38;   /* Deep Islamic Green */
  --clr-primary-light: #0e7a4e;
  --clr-primary-pale:  #e6f2ec;
  --clr-primary-rgb:   10, 92, 56;

  /* Accent - Rich Metallic Gold */
  --clr-accent:        #b8892a;
  --clr-accent-light:  #d4a843;
  --clr-accent-pale:   #fdf6e3;

  /* Neutral Background - Pure White / Ivory */
  --clr-bg:            #ffffff;
  --clr-bg-alt:        #f7f9f7;
  --clr-bg-warm:       #fdfaf4;
  --clr-card:          #ffffff;

  /* Text - Maximum contrast */
  --clr-text:          #111827;
  --clr-text-muted:    #4b5563;
  --clr-text-light:    #6b7280;

  /* Borders */
  --clr-border:        #d1e5da;
  --clr-border-strong: #9dc4b0;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(10, 92, 56, 0.08);
  --shadow-md:  0 4px 16px rgba(10, 92, 56, 0.12);
  --shadow-lg:  0 12px 40px rgba(10, 92, 56, 0.15);
  --shadow-xl:  0 24px 64px rgba(10, 92, 56, 0.18);

  /* Layout */
  --radius-sm:  6px;
  --radius-md:  14px;
  --radius-lg:  22px;
  --radius-xl:  32px;

  /* Typography */
  --font-sans:  'Cairo', 'Segoe UI', sans-serif;
  --font-serif: 'Amiri', 'Georgia', serif;

  /* Transition */
  --ease: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====================================================
   2. RESETS & GLOBAL BASE
   ==================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--clr-bg);
  color: var(--clr-text);
  direction: rtl;
  text-align: right;
  line-height: 1.7;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--clr-primary); text-decoration: none; transition: var(--ease); }
a:hover { color: var(--clr-accent); }

/* ====================================================
   3. NAVIGATION BAR
   ==================================================== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 2px solid var(--clr-primary-pale);
  padding: 0.85rem 2rem;
  transition: var(--ease);
  overflow: visible;
}

.navbar.scrolled {
  background: #ffffff;
  box-shadow: var(--shadow-md);
  padding: 0.6rem 2rem;
  border-bottom-color: var(--clr-border);
}

.navbar-container {
  max-width: 1260px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 3rem;
  overflow: visible;
}

/* Logo */
.nav-logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  max-width: 260px;
  overflow: hidden;
}

/* Old hardcoded img class (kept for compatibility) */
.nav-logo-img { width: 42px; height: 42px; object-fit: contain; }

/* WordPress custom_logo() output — always constrain size */
.custom-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.custom-logo {
  width: auto !important;
  height: 44px !important;
  max-height: 44px !important;
  max-width: 160px !important;
  object-fit: contain !important;
  display: block;
}

/* Scrolled state — slightly smaller logo */
.navbar.scrolled .custom-logo {
  height: 36px !important;
  max-height: 36px !important;
}

/* Footer logo — also constrain */
.footer .custom-logo {
  height: 36px !important;
  max-height: 36px !important;
  max-width: 140px !important;
}

.nav-logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--clr-primary);
  line-height: 1.2;
}
.nav-logo-text small {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--clr-accent);
  letter-spacing: 0.5px;
}
/* WordPress menu wrapper reset */
.menu-primary-container,
.menu-footer-container {
  display: contents;
}

/* Nav Links */
.nav-links {
  display: flex;
  list-style: none;
  align-items: center;
  gap: 0.25rem;
}
.nav-links li {
  position: relative;
}
.nav-links a {
  display: block;
  padding: 0.45rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--clr-text);
  border-radius: var(--radius-sm);
  transition: var(--ease);
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active {
  background: var(--clr-primary-pale);
  color: var(--clr-primary);
}

/* Dropdown Sub-menu Styling */
.nav-links .sub-menu {
  position: absolute;
  top: 100%;
  right: 0;
  left: auto;
  background: #ffffff;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-sm);
  min-width: 200px;
  display: none;
  z-index: 1010;
  padding: 0.5rem 0;
  list-style: none;
  border: 1px solid var(--clr-border);
  margin-top: 0.5rem;
  animation: fadeSlide 0.2s ease forwards;
}
.nav-links li:hover > .sub-menu,
.nav-links li.focus-within > .sub-menu,
.nav-links li.focus > .sub-menu {
  display: block;
}
.nav-links .sub-menu li {
  width: 100%;
  margin: 0;
}
.nav-links .sub-menu a {
  display: block;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--clr-text-muted);
  border-radius: 0;
  transition: var(--ease);
  text-align: right;
  white-space: nowrap;
}
.nav-links .sub-menu a:hover {
  background: var(--clr-primary-pale);
  color: var(--clr-primary);
}


/* Mobile Menu Button */
.nav-mobile-btn {
  display: none;
  background: none;
  border: none;
  width: 40px; height: 40px;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}
.nav-mobile-btn span {
  display: block;
  width: 24px; height: 2px;
  background: var(--clr-primary);
  border-radius: 2px;
  transition: var(--ease);
}

/* ====================================================
   4. HERO / HEADER SECTION
   ==================================================== */
.hero {
  padding: 8.5rem 2rem 5rem;
  background:
    radial-gradient(ellipse at 0% 0%, var(--clr-primary-pale) 0%, transparent 60%),
    radial-gradient(ellipse at 100% 100%, var(--clr-accent-pale) 0%, transparent 60%),
    var(--clr-bg-warm);
  position: relative;
  overflow: visible;          /* was hidden — was clipping portrait badge and bottom content */
  min-height: 600px;
}

/* Clip only the decorative overlay, not the content */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

/* Islamic geometric pattern overlay */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%230a5c38' stroke-opacity='0.04' stroke-width='1'%3E%3Cpath d='M40 0 L80 40 L40 80 L0 40 Z'/%3E%3Cpath d='M40 10 L70 40 L40 70 L10 40 Z'/%3E%3C/g%3E%3C/svg%3E");
  opacity: 1;
  pointer-events: none;
}

.hero-container {
  max-width: 1260px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 5rem;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--clr-primary-pale);
  color: var(--clr-primary);
  border: 1px solid var(--clr-border);
  padding: 0.4rem 1rem;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}
.hero-label i { color: var(--clr-accent); }

.hero-name {
  font-size: 3.2rem;
  font-weight: 900;
  color: var(--clr-primary);
  line-height: 1.15;
  margin-bottom: 0.5rem;
}
.hero-name span { color: var(--clr-accent); }

.hero-title-text {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  margin-bottom: 1.25rem;
  border-right: 4px solid var(--clr-accent);
  padding-right: 1rem;
}

.hero-bio {
  font-size: 1.05rem;
  color: var(--clr-text-muted);
  line-height: 1.8;
  max-width: 520px;
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}
.hero-stat {
  text-align: center;
}
.hero-stat-num {
  font-size: 2rem;
  font-weight: 900;
  color: var(--clr-primary);
  line-height: 1;
}
.hero-stat-label {
  font-size: 0.8rem;
  color: var(--clr-text-muted);
  font-weight: 600;
  margin-top: 0.25rem;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--ease);
  border: 2px solid transparent;
  text-align: center;
  white-space: nowrap;
  font-family: var(--font-sans);
}
.btn-primary {
  background: var(--clr-primary);
  color: #fff !important;
  border-color: var(--clr-primary);
  box-shadow: var(--shadow-md);
}
.btn-primary:hover {
  background: var(--clr-primary-light);
  border-color: var(--clr-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: #fff !important;
}
.btn-outline {
  background: transparent;
  color: var(--clr-primary) !important;
  border-color: var(--clr-primary);
}
.btn-outline:hover {
  background: var(--clr-primary-pale);
  transform: translateY(-2px);
}

/* Hero Visual - Profile image */
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}
.hero-portrait-wrap {
  position: relative;
  width: 400px;
  height: 460px;
}
.hero-portrait-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--clr-primary) 0%, var(--clr-accent) 100%);
  border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%;
  animation: morphing 10s ease-in-out infinite alternate;
}
.hero-portrait-img {
  position: absolute;
  inset: 4px;
  border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%;
  object-fit: cover;
  object-position: top center;
  animation: morphing 10s ease-in-out infinite alternate;
  background: var(--clr-bg-warm);
}
/* Badge on portrait */
.hero-portrait-badge {
  position: absolute;
  bottom: 2rem;
  right: -1.5rem;
  background: #fff;
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  z-index: 5;
}
.hero-portrait-badge-icon { font-size: 1.5rem; color: var(--clr-accent); }
.hero-portrait-badge-label { font-size: 0.7rem; color: var(--clr-text-muted); font-weight: 600; }
.hero-portrait-badge-value { font-size: 1rem; font-weight: 800; color: var(--clr-primary); }

/* ====================================================
   5. BISMILLAH / QUOTE BANNER
   ==================================================== */
.bismillah-banner {
  background: var(--clr-primary);
  color: #fff;
  text-align: center;
  padding: 3rem 2rem;
  position: relative;
  overflow: hidden;
}
.bismillah-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.05' stroke-width='1'%3E%3Cpath d='M40 0 L80 40 L40 80 L0 40 Z'/%3E%3C/g%3E%3C/svg%3E");
}
.bismillah-text {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  line-height: 1.5;
  color: var(--clr-accent-light);
  position: relative;
  z-index: 1;
  margin-bottom: 0.5rem;
}
.bismillah-sub {
  font-size: 1rem;
  color: rgba(255,255,255,0.75);
  position: relative;
  z-index: 1;
}

/* ====================================================
   6. SECTION LAYOUT
   ==================================================== */
.section { padding: 6rem 2rem; }
.section-alt { background: var(--clr-bg-alt); }
.section-warm { background: var(--clr-bg-warm); }
.section-green { background: var(--clr-primary); color: #fff; }

.section-head {
  text-align: center;
  margin: 0 auto 3.5rem;
  max-width: 750px;
}
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--clr-accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.75rem;
}
.section-kicker::before,
.section-kicker::after {
  content: '';
  display: inline-block;
  width: 28px;
  height: 2px;
  background: var(--clr-accent);
}
.section-heading {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--clr-primary);
  line-height: 1.25;
  margin-bottom: 0.75rem;
}
.section-green .section-heading { color: var(--clr-accent-light); }
.section-desc {
  font-size: 1.05rem;
  color: var(--clr-text-muted);
  line-height: 1.7;
}
.section-green .section-desc { color: rgba(255,255,255,0.8); }

/* ====================================================
   7. BIOGRAPHY TIMELINE
   ==================================================== */
.timeline-wrap {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  padding-bottom: 2rem;
  padding-right: 3.5rem;
}
.timeline-wrap::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  right: 1.625rem;
  width: 4px;
  background: linear-gradient(to bottom, var(--clr-primary-pale), var(--clr-border-strong), var(--clr-primary-pale));
  border-radius: 2px;
}

.tl-item {
  display: flex;
  margin-bottom: 2.5rem;
  position: relative;
}

.tl-content {
  width: 100%;
  background: var(--clr-card);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--ease);
  position: relative;
}

.tl-content::after {
  content: '';
  position: absolute;
  top: 1.65rem;
  right: -8px;
  width: 14px; height: 14px;
  background: var(--clr-card);
  border-right: 1.5px solid var(--clr-border);
  border-top: 1.5px solid var(--clr-border);
  transform: rotate(45deg);
  transition: var(--ease);
}

.tl-content:hover {
  border-color: var(--clr-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.tl-content:hover::after {
  border-color: var(--clr-accent);
}

.tl-dot-col {
  position: absolute;
  right: -3.5rem;
  top: 0.85rem;
  width: 3.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
  pointer-events: none;
}
.tl-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 4.5px solid var(--clr-primary);
  transition: var(--ease);
  box-shadow: 0 0 0 4px var(--clr-primary-pale);
}
.tl-item.open .tl-dot {
  background: var(--clr-accent);
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 6px var(--clr-accent-pale);
  transform: scale(1.25);
}

.tl-year {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: var(--clr-accent);
  padding: 0.25rem 0.85rem;
  border-radius: 30px;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-sm);
}
.tl-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--clr-primary);
  margin-bottom: 0.4rem;
}
.tl-preview {
  font-size: 0.95rem;
  color: var(--clr-text-muted);
  line-height: 1.65;
}
.tl-expand {
  font-size: 0.92rem;
  color: var(--clr-text-muted);
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--clr-border);
  display: none;
  line-height: 1.7;
  animation: fadeSlide 0.3s ease;
}
.tl-item.open .tl-expand { display: block; }

/* ====================================================
   8. WISDOM / QUOTE WIDGET
   ==================================================== */
.wisdom-section {
  background: linear-gradient(135deg, var(--clr-primary) 0%, #0e7a4e 100%);
  padding: 5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.wisdom-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.04' stroke-width='1'%3E%3Cpolygon points='50,5 95,25 95,75 50,95 5,75 5,25'/%3E%3Cpolygon points='50,15 85,30 85,70 50,85 15,70 15,30'/%3E%3C/g%3E%3C/svg%3E");
}
.wisdom-inner {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
}
.wisdom-decor {
  font-size: 4rem;
  color: var(--clr-accent-light);
  line-height: 1;
  margin-bottom: 1.5rem;
  font-family: serif;
}
.wisdom-text {
  font-family: var(--font-serif);
  font-size: 2rem;
  line-height: 1.65;
  color: #fff;
  margin-bottom: 1.5rem;
  transition: opacity 0.3s ease;
}
.wisdom-source {
  font-size: 0.95rem;
  color: var(--clr-accent-light);
  font-weight: 700;
  margin-bottom: 2rem;
}
.wisdom-refresh {
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 0.6rem 1.75rem;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--ease);
  font-family: var(--font-sans);
}
.wisdom-refresh:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.5);
}

/* ====================================================
   9. LIBRARY - BOOKS & WRITINGS
   ==================================================== */
.lib-toolbar {
  max-width: 1260px;
  margin: 0 auto 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.lib-search-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
}
.lib-search {
  width: 100%;
  padding: 0.9rem 1.25rem 0.9rem 3rem;
  border: 2px solid var(--clr-border);
  border-radius: 30px;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--clr-text);
  background: #fff;
  outline: none;
  transition: var(--ease);
}
.lib-search:focus { border-color: var(--clr-primary); box-shadow: 0 0 0 3px var(--clr-primary-pale); }
.lib-search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--clr-text-light);
  font-size: 1rem;
  pointer-events: none;
}

.lib-filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}
.lib-filter {
  padding: 0.5rem 1.25rem;
  border-radius: 30px;
  border: 1.5px solid var(--clr-border);
  background: #fff;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  cursor: pointer;
  transition: var(--ease);
}
.lib-filter:hover { border-color: var(--clr-primary); color: var(--clr-primary); background: var(--clr-primary-pale); }
.lib-filter.active { background: var(--clr-primary); border-color: var(--clr-primary); color: #fff; box-shadow: var(--shadow-sm); }

.book-grid {
  max-width: 1260px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.75rem;
}

/* Cards hidden beyond initial page */
.book-card.book-hidden {
  display: none !important;
}

/* Show More wrapper */
.lib-showmore-wrap {
  text-align: center;
  margin-top: 2.5rem;
  display: none;        /* JS will show when there are hidden cards */
}
.lib-showmore-wrap.is-visible {
  display: block;
}

/* Show More button */
.lib-showmore-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 2.5rem;
  background: transparent;
  color: var(--clr-primary);
  border: 2px solid var(--clr-primary);
  border-radius: 30px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--ease);
}
.lib-showmore-btn:hover {
  background: var(--clr-primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.lib-showmore-btn i {
  font-size: 1.1rem;
  transition: var(--ease);
}
.lib-showmore-btn:hover i {
  transform: scale(1.2);
}
.lib-showmore-count {
  background: var(--clr-primary-pale);
  color: var(--clr-primary);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  min-width: 1.8rem;
  text-align: center;
  transition: var(--ease);
}
.lib-showmore-btn:hover .lib-showmore-count {
  background: rgba(255,255,255,0.25);
  color: #fff;
}


.book-card {
  background: #fff;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--ease);
}
.book-card:hover {
  border-color: var(--clr-accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-5px);
}

.book-cover-wrap {
  aspect-ratio: 3/2;
  overflow: hidden;
  position: relative;
  background: var(--clr-bg-alt);
}
.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.book-card:hover .book-cover-img { transform: scale(1.05); }

.book-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--clr-primary-pale), var(--clr-accent-pale));
  font-size: 3rem;
  color: var(--clr-primary);
}

.book-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--clr-primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}

.book-body {
  padding: 1.25rem 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.book-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--clr-primary);
  line-height: 1.4;
}
.book-excerpt {
  font-size: 0.88rem;
  color: var(--clr-text-muted);
  line-height: 1.5;
  flex-grow: 1;
}

.book-foot {
  padding: 0.85rem 1.5rem;
  background: var(--clr-bg-alt);
  border-top: 1px solid var(--clr-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.book-date-txt { font-size: 0.82rem; color: var(--clr-text-light); flex-shrink: 0; }

/* Shared container for View + Download buttons */
.book-foot-actions,
.book-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.book-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  background: var(--clr-primary);
  color: #fff !important;
  font-size: 0.82rem;
  font-weight: 700;
  transition: var(--ease);
  border: 1.5px solid var(--clr-primary);
  cursor: pointer;
  white-space: nowrap;
}
.book-dl-btn:hover {
  background: var(--clr-accent);
  border-color: var(--clr-accent);
  transform: translateY(-1px);
}

.book-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  border: 1.5px solid var(--clr-primary);
  background: transparent;
  color: var(--clr-primary) !important;
  font-size: 0.82rem;
  font-weight: 700;
  transition: var(--ease);
  cursor: pointer;
  white-space: nowrap;
}
.book-view-btn:hover {
  background: var(--clr-primary-pale);
  transform: translateY(-1px);
}

.book-title a {
  color: var(--clr-primary);
  transition: var(--ease);
}
.book-title a:hover {
  color: var(--clr-accent);
}

/* ====================================================
   10. VIDEO GALLERY
   ==================================================== */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
  max-width: 1260px;
  margin: 0 auto;
}
.video-card {
  background: #fff;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--ease);
}
.video-card:hover {
  border-color: var(--clr-accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-5px);
}
.video-thumb-wrap {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #111;
}
.video-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
  transition: transform 0.4s ease, opacity 0.3s;
}
.video-card:hover .video-thumb-img { transform: scale(1.05); opacity: 0.7; }
.video-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-play-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--clr-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.75rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  transition: var(--ease);
}
.video-card:hover .video-play-btn {
  background: var(--clr-accent);
  transform: scale(1.1);
}
.video-info { padding: 1.25rem; }
.video-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--clr-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}
.video-title-txt {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--clr-text);
  line-height: 1.4;
}

/* ====================================================
   11. LIGHTBOX MODAL
   ==================================================== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.lightbox-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-box {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.lightbox-overlay.open .lightbox-box { transform: scale(1); }
.lightbox-close {
  position: absolute;
  top: -3rem; left: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
.lightbox-close:hover { color: var(--clr-accent-light); }
.lightbox-frame {
  width: 100%; height: 100%;
  border: none;
}

/* ====================================================
   12. CONTACT SECTION
   ==================================================== */
.contact-grid {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  border: 1.5px solid var(--clr-border);
}

.contact-left {
  background: var(--clr-primary);
  padding: 3rem 2.5rem;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.contact-left-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--clr-accent-light);
  margin-bottom: -0.5rem;
}
.contact-left-desc { font-size: 0.95rem; color: rgba(255,255,255,0.8); line-height: 1.7; }

.contact-info-list { list-style: none; display: flex; flex-direction: column; gap: 1.25rem; }
.contact-info-item { display: flex; align-items: center; gap: 1rem; }
.contact-info-ico {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--clr-accent-light);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.contact-info-txt { font-size: 0.95rem; }

.contact-right { background: #fff; padding: 3rem 2.5rem; }

.form-row { margin-bottom: 1.35rem; }
.form-lbl {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--clr-text);
  margin-bottom: 0.45rem;
}
.form-input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--clr-text);
  background: var(--clr-bg-alt);
  outline: none;
  transition: var(--ease);
}
.form-input:focus { border-color: var(--clr-primary); background: #fff; box-shadow: 0 0 0 3px var(--clr-primary-pale); }
textarea.form-input { resize: vertical; min-height: 130px; }

/* ====================================================
   13. FOOTER
   ==================================================== */
.footer {
  background: var(--clr-primary);
  color: rgba(255,255,255,0.85);
  padding: 5rem 2rem 0;
}
.footer-grid {
  max-width: 1260px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 4rem;
  padding-bottom: 4rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.footer-brand .nav-logo-text { color: #fff; }
.footer-brand .nav-logo-text small { color: var(--clr-accent-light); }
.footer-brand-desc { font-size: 0.92rem; line-height: 1.7; color: rgba(255,255,255,0.7); margin-top: 1rem; }
.footer-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--clr-accent-light);
  margin-bottom: 1.25rem;
}
.footer-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.footer-list a {
  color: rgba(255,255,255,0.7);
  font-size: 0.92rem;
  transition: var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.footer-list a:hover { color: var(--clr-accent-light); padding-right: 4px; }
.footer-list a i { font-size: 0.75rem; }

.social-row { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.social-ico {
  width: 40px; height: 40px;
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.75);
  font-size: 1rem;
  transition: var(--ease);
}
.social-ico:hover { background: var(--clr-accent); border-color: var(--clr-accent); color: #fff; transform: translateY(-2px); }

.footer-bottom {
  max-width: 1260px;
  margin: 0 auto;
  padding: 1.75rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.87rem;
  color: rgba(255,255,255,0.55);
}

/* ====================================================
   14. ANIMATIONS
   ==================================================== */
@keyframes morphing {
  0%   { border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%; }
  50%  { border-radius: 60% 40% 40% 60% / 40% 60% 40% 60%; }
  100% { border-radius: 50% 50% 60% 40% / 60% 50% 50% 40%; }
}
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ====================================================
   15. RESPONSIVENESS
   ==================================================== */
@media (max-width: 1080px) {
  .hero-container { grid-template-columns: 1fr; gap: 3rem; }
  .hero-content { order: 1; }   /* text + buttons FIRST on tablet */
  .hero-visual  { order: 2; }   /* portrait SECOND */
  .hero-name { font-size: 2.5rem; }
  .hero-portrait-wrap { width: 300px; height: 340px; }
  .hero-portrait-badge { right: 0; bottom: -0.5rem; }  /* prevent clipping */
  .hero-cta { justify-content: flex-start; }
  .timeline-wrap { padding-right: 2.5rem; }
  .timeline-wrap::before { right: 1.125rem; }
  .tl-item { flex-direction: row; }
  .tl-dot-col { right: -2.5rem; width: 2.5rem; }
  .tl-content { width: 100%; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 3rem; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-mobile-btn { display: flex; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 65px; left: 0; right: 0;
    background: #fff;
    border-bottom: 2px solid var(--clr-primary-pale);
    padding: 1rem;
    box-shadow: var(--shadow-md);
    z-index: 999;
    max-height: calc(100vh - 65px);
    overflow-y: auto;
  }
  .nav-links li {
    width: 100%;
  }
  .nav-links .sub-menu {
    position: static;
    display: none;
    box-shadow: none;
    background: var(--clr-bg-alt);
    padding: 0.25rem 1rem 0.25rem 0;
    margin-top: 0.25rem;
    border: none;
    border-right: 3px solid var(--clr-primary-pale);
    min-width: 100%;
  }
  .nav-links li:hover > .sub-menu,
  .nav-links li.focus-within > .sub-menu,
  .nav-links li.focus > .sub-menu {
    display: block;
  }
  .nav-links .sub-menu a {
    text-align: right;
    padding: 0.5rem 1rem;
  }
  .hero { padding: 6.5rem 1.25rem 4rem; min-height: auto; }
  .hero-name { font-size: 2rem; }
  .hero-portrait-wrap { width: 260px; height: 300px; margin: 0 auto; }
  .hero-cta { flex-direction: column; align-items: flex-start; }
  .hero-cta .btn { width: 100%; justify-content: center; }
  .section { padding: 4rem 1.25rem; }
  .section-heading { font-size: 1.9rem; }
  .wisdom-text { font-size: 1.5rem; }
  .bismillah-text { font-size: 1.8rem; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .book-grid { grid-template-columns: 1fr; }
  .video-grid { grid-template-columns: 1fr; }
}

/* Spacing and padding fix for Nour AI Chatbot */
.nour-chat-section,
.nadb-chatbot-section {
  margin: 4rem auto !important;
  padding: 0 !important;
}
@media (max-width: 960px) {
  .nour-chat-section,
  .nadb-chatbot-section {
    margin: 4rem 1.5rem !important;
  }
}
@media (max-width: 768px) {
  .nour-chat-section,
  .nadb-chatbot-section {
    margin: 2.5rem 1rem !important;
  }
}

