/* ==============================================
   MUSTAFA BOOKS — Design System 2026
   Scholarly • Premium • Islamic Heritage
   ============================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,500;1,600;1,700&family=Inter:wght@300;400;500;600;700&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700&family=Amiri:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* ── Light Mode (Default) ── */
:root {
  /* Brand Colors */
  --navy: #1A3A5C;
  --navy-light: #234B73;
  --navy-dark: #0F2640;
  --gold: #C8A96E;
  --gold-light: #D4B87E;
  --gold-dark: #B8975A;
  --gold-muted: rgba(200, 169, 110, 0.12);

  /* Light Mode */
  --bg-primary: #F5F0E8;
  --bg-secondary: #EFEAD9;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FDFCFA;
  --bg-elevated: #FFFFFF;
  --bg-hero: linear-gradient(135deg, #1A3A5C 0%, #0F2640 50%, #1A3A5C 100%);

  --text-primary: #1E1E1E;
  --text-secondary: #4A4A4A;
  --text-muted: #7A7A7A;
  --text-on-dark: #F5F0E8;
  --text-on-navy: #E8E0D4;

  --border-color: rgba(30, 30, 30, 0.08);
  --border-strong: rgba(30, 30, 30, 0.15);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.08);
  --shadow-xl: 0 24px 64px rgba(0,0,0,0.12);
  --shadow-gold: 0 4px 16px rgba(200, 169, 110, 0.25);

  /* Paper texture for flipbook */
  --paper-bg: #FDFCF7;
  --paper-shadow: rgba(0,0,0,0.15);

  --mode: 'light';
}

/* ── Dark Mode ── */
[data-theme="dark"] {
  --bg-primary: #1A1A1A;
  --bg-secondary: #222222;
  --bg-card: #2C2C2C;
  --bg-card-hover: #333333;
  --bg-elevated: #2C2C2C;

  --text-primary: #E8E0D4;
  --text-secondary: #B8B0A4;
  --text-muted: #8A8279;

  --border-color: rgba(232, 224, 212, 0.08);
  --border-strong: rgba(232, 224, 212, 0.15);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.25);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.35);
  --shadow-xl: 0 24px 64px rgba(0,0,0,0.45);

  --paper-bg: #2A2A2A;
  --paper-shadow: rgba(0,0,0,0.4);

  --mode: 'dark';
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
}

/* ── Typography ── */
h1, h2, h3, h4, h5 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-primary);
}

.serif { font-family: 'Playfair Display', Georgia, serif; }
.reading-font { font-family: 'Merriweather', Georgia, serif; }
.arabic-font { font-family: 'Amiri', serif; direction: rtl; }

/* ── Islamic Geometric Pattern (SVG) ── */
.geo-pattern {
  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='%23C8A96E' stroke-width='0.4' opacity='0.12'%3E%3Cpath d='M40 0L80 40L40 80L0 40Z'/%3E%3Cpath d='M40 10L70 40L40 70L10 40Z'/%3E%3Cpath d='M40 20L60 40L40 60L20 40Z'/%3E%3Ccircle cx='40' cy='40' r='8'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
}

[data-theme="dark"] .geo-pattern {
  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='%23C8A96E' stroke-width='0.4' opacity='0.06'%3E%3Cpath d='M40 0L80 40L40 80L0 40Z'/%3E%3Cpath d='M40 10L70 40L40 70L10 40Z'/%3E%3Cpath d='M40 20L60 40L40 60L20 40Z'/%3E%3Ccircle cx='40' cy='40' r='8'/%3E%3C/g%3E%3C/svg%3E");
}

.geo-border-top {
  border-top: 1px solid var(--border-color);
  position: relative;
}
.geo-border-top::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
}

/* ── Spacing (8px grid) ── */
.sp-1 { margin: 8px; }
.sp-2 { margin: 16px; }
.sp-3 { margin: 24px; }
.sp-4 { margin: 32px; }
.sp-5 { margin: 40px; }
.sp-6 { margin: 48px; }
.sp-8 { margin: 64px; }

/* ── Navbar ── */
.mb-navbar {
  background: var(--navy);
  padding: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: background 0.3s ease;
}

[data-theme="dark"] .mb-navbar {
  background: #111111;
  border-bottom-color: rgba(255,255,255,0.04);
}

.mb-navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.mb-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.mb-brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(200, 169, 110, 0.25);
}

.mb-brand-icon i { color: var(--navy-dark); font-size: 20px; }

.mb-brand-text {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.mb-nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mb-nav-links a {
  color: rgba(255,255,255,0.65);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.mb-nav-links a:hover,
.mb-nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

/* Dark/Light Toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s ease;
  margin-left: 8px;
}

.theme-toggle:hover {
  background: rgba(200, 169, 110, 0.15);
  border-color: var(--gold);
}

/* Mobile nav */
.mb-nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.mb-mobile-nav {
  display: none;
  background: var(--navy-dark);
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

[data-theme="dark"] .mb-mobile-nav { background: #111; }

.mb-mobile-nav.open { display: block; }

.mb-mobile-nav a {
  display: block;
  color: rgba(255,255,255,0.7);
  padding: 12px 0;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.mb-mobile-nav a:hover { color: var(--gold); }

@media (max-width: 768px) {
  .mb-nav-links { display: none; }
  .mb-nav-toggle { display: flex; }
}

/* ── Hero Section ── */
.mb-hero {
  background: var(--bg-hero);
  position: relative;
  overflow: hidden;
  padding: 80px 0 100px;
  min-height: 600px;
  display: flex;
  align-items: center;
}

[data-theme="dark"] .mb-hero {
  background: linear-gradient(135deg, #0A0A0A 0%, #1A1A1A 50%, #0A0A0A 100%);
}

.mb-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23C8A96E' stroke-width='0.3' opacity='0.08'%3E%3Cpath d='M60 0L120 60L60 120L0 60Z'/%3E%3Cpath d='M60 15L105 60L60 105L15 60Z'/%3E%3Cpath d='M60 30L90 60L60 90L30 60Z'/%3E%3Ccircle cx='60' cy='60' r='12'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.mb-hero .container {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.mb-hero-tagline {
  display: inline-block;
  background: rgba(200, 169, 110, 0.12);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 20px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 24px;
  border: 1px solid rgba(200, 169, 110, 0.2);
}

.mb-hero-title {
  font-family: 'Playfair Display', serif;
  font-size: 56px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 20px;
}

.mb-hero-desc {
  font-size: 17px;
  color: rgba(232, 224, 212, 0.7);
  line-height: 1.8;
  max-width: 480px;
  margin-bottom: 36px;
}

.mb-hero-quote {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 18px;
  color: var(--gold);
  opacity: 0.8;
  margin-top: 32px;
  padding-left: 24px;
  border-left: 3px solid var(--gold);
}

/* Hero Book Cover (3D tilt) */
.mb-hero-book {
  position: relative;
  perspective: 1200px;
}

.mb-hero-book img {
  width: 320px;
  height: auto;
  border-radius: 4px 12px 12px 4px;
  transform: rotateY(-12deg) rotateX(2deg);
  transition: transform 0.4s ease;
  box-shadow:
    -20px 20px 60px rgba(0,0,0,0.4),
    -5px 5px 20px rgba(0,0,0,0.25),
    inset 0 0 0 1px rgba(255,255,255,0.05);
}

.mb-hero-book:hover img {
  transform: rotateY(-6deg) rotateX(1deg) translateY(-8px);
}

/* Book spine effect */
.mb-hero-book::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 8px;
  width: 16px;
  height: calc(100% - 16px);
  background: linear-gradient(90deg, #8B7355, #A68B6B, #8B7355);
  border-radius: 4px 0 0 4px;
  transform: rotateY(-12deg);
  box-shadow: -4px 4px 12px rgba(0,0,0,0.3);
}

/* ── Buttons ── */
.btn-gold {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--navy-dark);
  padding: 14px 32px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-gold);
  letter-spacing: 0.3px;
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(200, 169, 110, 0.35);
  color: var(--navy-dark);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: rgba(255,255,255,0.8);
  padding: 13px 28px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-outline:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}

/* ── Book Cards ── */
.mb-book-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.mb-book-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.mb-book-card .card-img-wrap {
  overflow: hidden;
  position: relative;
  background: var(--bg-secondary);
}

.mb-book-card .card-img-wrap img {
  width: 100%;
  height: 340px;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.mb-book-card:hover .card-img-wrap img {
  transform: scale(1.06);
}

.mb-book-card .card-img-wrap::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(transparent, rgba(0,0,0,0.04));
  pointer-events: none;
}

.mb-book-card .card-content {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mb-book-card .card-category {
  display: inline-block;
  background: var(--gold-muted);
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  align-self: flex-start;
}

[data-theme="dark"] .mb-book-card .card-category {
  color: var(--gold);
}

.mb-book-card .card-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.mb-book-card .card-author {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.mb-book-card .card-actions {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.btn-read {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--navy);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  width: 100%;
  justify-content: center;
}

[data-theme="dark"] .btn-read {
  background: var(--gold);
  color: var(--navy-dark);
}

.btn-read:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(26, 58, 92, 0.3);
  color: #fff;
}

[data-theme="dark"] .btn-read:hover {
  box-shadow: var(--shadow-gold);
  color: var(--navy-dark);
}

/* ── Featured Book (single book layout) ── */
.mb-featured {
  padding: 80px 0;
  background: var(--bg-primary);
}

.mb-featured .featured-cover {
  perspective: 1000px;
}

.mb-featured .featured-cover img {
  width: 100%;
  max-width: 380px;
  border-radius: 4px 12px 12px 4px;
  transform: rotateY(-8deg);
  transition: transform 0.4s ease;
  box-shadow:
    -16px 16px 48px rgba(0,0,0,0.15),
    -4px 4px 16px rgba(0,0,0,0.08);
}

[data-theme="dark"] .mb-featured .featured-cover img {
  box-shadow:
    -16px 16px 48px rgba(0,0,0,0.4),
    -4px 4px 16px rgba(0,0,0,0.25);
}

.mb-featured .featured-cover:hover img {
  transform: rotateY(-3deg) translateY(-4px);
}

/* ── Sections ── */
.mb-section {
  padding: 80px 0;
}

.mb-section-alt {
  background: var(--bg-secondary);
}

.mb-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.mb-section-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 500px;
}

/* ── Gold Divider ── */
.gold-divider {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 2px;
  margin: 16px 0;
}

.gold-divider-center {
  margin-left: auto;
  margin-right: auto;
}

/* ── Footer ── */
.mb-footer {
  background: var(--navy-dark);
  color: rgba(232, 224, 212, 0.6);
  padding: 64px 0 32px;
  position: relative;
}

[data-theme="dark"] .mb-footer {
  background: #0A0A0A;
}

.mb-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.3;
}

.mb-footer h6 {
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 20px;
}

.mb-footer a {
  color: rgba(232, 224, 212, 0.5);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s ease;
}

.mb-footer a:hover { color: var(--gold); }

.mb-footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.04);
  padding-top: 24px;
  margin-top: 48px;
  font-size: 13px;
  color: rgba(232, 224, 212, 0.35);
}

/* ── Filter Buttons ── */
.mb-filter-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 22px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-block;
  margin: 4px;
  font-family: 'Inter', sans-serif;
}

.mb-filter-btn:hover {
  border-color: var(--gold);
  color: var(--gold-dark);
}

.mb-filter-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  box-shadow: 0 4px 12px rgba(26, 58, 92, 0.25);
}

[data-theme="dark"] .mb-filter-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy-dark);
}

/* ── Search ── */
.mb-search {
  position: relative;
}

.mb-search input {
  width: 100%;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 14px 20px 14px 48px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
  outline: none;
}

.mb-search input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-muted);
}

.mb-search input::placeholder { color: var(--text-muted); }

.mb-search i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
}

/* ── Newsletter ── */
.mb-newsletter {
  background: var(--navy);
  border-radius: 16px;
  padding: 48px;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .mb-newsletter {
  background: #1A1A1A;
  border: 1px solid rgba(200, 169, 110, 0.1);
}

.mb-newsletter::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='%23C8A96E' stroke-width='0.3' opacity='0.06'%3E%3Cpath d='M40 0L80 40L40 80L0 40Z'/%3E%3Cpath d='M40 15L65 40L40 65L15 40Z'/%3E%3Ccircle cx='40' cy='40' r='8'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

/* ── About Strip ── */
.mb-about-strip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 48px;
}

/* ── Pagination ── */
.mb-pagination .page-link {
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 8px;
  margin: 0 3px;
  transition: all 0.2s ease;
  background: transparent;
}

.mb-pagination .page-item.active .page-link {
  background: var(--navy);
  color: #fff;
}

[data-theme="dark"] .mb-pagination .page-item.active .page-link {
  background: var(--gold);
  color: var(--navy-dark);
}

.mb-pagination .page-link:hover {
  background: var(--gold-muted);
  color: var(--gold-dark);
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease both;
}

.fade-in-up-delay-1 { animation-delay: 0.1s; }
.fade-in-up-delay-2 { animation-delay: 0.2s; }
.fade-in-up-delay-3 { animation-delay: 0.3s; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .mb-hero { padding: 48px 0 64px; min-height: auto; }
  .mb-hero-title { font-size: 36px; }
  .mb-hero-book img { width: 220px; }
  .mb-section { padding: 48px 0; }
  .mb-section-title { font-size: 28px; }
  .mb-newsletter { padding: 32px 24px; }
  .mb-about-strip { padding: 32px 24px; }
}

/* ── Utility ── */
.container-lg {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.text-gold { color: var(--gold); }
.bg-gold-muted { background: var(--gold-muted); }
