/* ============================================================
   Primal Philosophy — Barakah Qalam template port (static)
   Design tokens cloned from mesalex/barakahqalam.com globals.css
   ============================================================ */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #fef9f3;
  --bg-card: #ffffff;
  --bg-nav: #ffffff;
  --bg-footer: #1e293b;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #d97706;
  --accent-light: #fbbf24;
  --accent-bg: #fef3c7;
  --accent-text: #92400e;
  --border: #e2e8f0;
  --shadow: rgba(0, 0, 0, 0.06);
  --gradient-warm: linear-gradient(135deg, #fef9f3 0%, #fef3c7 100%);
  --gradient-section: linear-gradient(180deg, #ffffff 0%, #fef9f3 100%);
}

.dark {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-nav: #0f172a;
  --bg-footer: #020617;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --accent: #fbbf24;
  --accent-light: #fde68a;
  --accent-bg: #78350f;
  --accent-text: #fde68a;
  --border: #334155;
  --shadow: rgba(0, 0, 0, 0.3);
  --gradient-warm: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --gradient-section: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { overflow-x: hidden; width: 100%; }

body {
  color: var(--text-primary);
  background: var(--bg-primary);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  line-height: 1.6;
  transition: background 0.25s ease, color 0.25s ease;
}

img, video, iframe, embed, object { max-width: 100%; height: auto; }

/* ===== LINKS — always amber, never blue ===== */
a { color: var(--accent); transition: color 0.2s ease; }
a:hover { color: var(--accent-light); }

/* ===== NAVIGATION ===== */
.navbar {
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  max-width: 100vw;
  transition: background 0.25s ease;
}

.nav-inner {
  max-width: 80rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--accent-light); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  transition: color 0.2s ease;
  white-space: nowrap;
  font-size: 0.95rem;
}
.nav-link:hover { color: var(--accent); }

/* ===== THEME TOGGLE (moon in light mode = click to dark) ===== */
.theme-btn {
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  background: #f3f4f6;
  color: var(--text-primary);
  transition: background 0.2s ease;
}
.theme-btn:hover { background: #e5e7eb; }
.dark .theme-btn { background: #1f2937; }
.dark .theme-btn:hover { background: #374151; }

/* ===== HERO ===== */
.hero {
  background: var(--gradient-warm);
  padding: 4.5rem 1.5rem 4rem;
  text-align: center;
  transition: background 0.25s ease;
}
.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}
.hero .tagline {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 42rem;
  margin: 0 auto 1.75rem;
}
.btn {
  display: inline-block;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  padding: 0.7rem 1.6rem;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}
.btn:hover { background: var(--accent-light); color: var(--accent-text); }
.dark .btn { color: #ffffff; }
.dark .btn:hover { color: var(--accent-text); }

/* ===== SECTIONS ===== */
.section { padding: 3.5rem 1.5rem; }
.section-alt { background: var(--bg-secondary); transition: background 0.25s ease; }
.section-inner { max-width: 80rem; margin: 0 auto; }
.section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text-primary);
}
.section .lede {
  text-align: center;
  color: var(--text-secondary);
  max-width: 42rem;
  margin: 0 auto 2.25rem;
}

/* ===== CARD GRID ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 2px 8px var(--shadow);
  transition: background 0.25s ease, border 0.25s ease;
}
.card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; color: var(--text-primary); }
.card p { color: var(--text-secondary); font-size: 0.95rem; }

/* ===== PROSE (lorem pages) ===== */
.prose { max-width: 44rem; margin: 0 auto; color: var(--text-secondary); }
.prose h1 { font-size: 2rem; font-weight: 800; color: var(--text-primary); margin-bottom: 1.5rem; }
.prose h2 { font-size: 1.35rem; font-weight: 700; color: var(--text-primary); margin: 2rem 0 0.75rem; text-align: left; }
.prose p { margin-bottom: 1.25rem; }
.prose ul { margin: 0 0 1.25rem 1.5rem; }
.prose li { margin-bottom: 0.35rem; }

/* ===== FOOTER ===== */
.footer {
  background: var(--bg-footer);
  color: #cbd5e1;
  padding: 1.5rem 1rem;
  transition: background 0.25s ease;
}
.footer-inner {
  max-width: 80rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
@media (min-width: 768px) { .footer-inner { flex-direction: row; } }
.footer .brand { font-size: 1.1rem; }
.footer-note { color: var(--text-muted); font-size: 0.85rem; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.5rem; font-size: 0.9rem; }
.footer-links a { color: #cbd5e1; text-decoration: none; }
.footer-links a:hover { color: var(--accent-light); }
.footer-copy { font-size: 0.8rem; color: #64748b; }

/* ===== CAROUSEL / FEATURED (template hero-carousel port) ===== */
.carousel-wrap {
  background: linear-gradient(to bottom right, var(--bg-secondary), var(--bg-primary), var(--bg-secondary));
  overflow: hidden;
}
.carousel-max { max-width: 72rem; margin: 0 auto; padding: 1rem 1rem 2.5rem; }
@media (min-width: 768px) { .carousel-max { padding: 4rem 2rem 5rem; } }

/* --- Mobile: stacked slides, one visible --- */
.carousel-mobile { position: relative; display: block; }
@media (min-width: 768px) { .carousel-mobile { display: none; } }
.carousel-viewport { position: relative; min-height: 440px; }
.c-slide {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  opacity: 0; transform: translateX(3rem); transition: opacity 0.7s ease, transform 0.7s ease;
  pointer-events: none;
}
.c-slide.is-active { opacity: 1; transform: translateX(0); z-index: 10; pointer-events: auto; }
.c-slide.prev { transform: translateX(-3rem); }
.c-cover {
  position: relative; width: 100%; aspect-ratio: 1/1; max-width: 26rem;
  overflow: hidden; border-radius: 1rem;
  background: linear-gradient(to bottom right, var(--accent-bg), var(--accent-light));
  box-shadow: 0 20px 45px -15px rgba(0,0,0,0.25);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.c-cover:hover { transform: scale(1.02); box-shadow: 0 25px 50px -12px rgba(217,119,6,0.35); }
.c-cover img { width: 100%; height: 100%; object-fit: contain; display: block; }
.c-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0); transition: background 0.3s ease;
}
.c-overlay span {
  background: rgba(217,119,6,0.9); color: #fff; padding: 0.5rem 1rem; border-radius: 0.5rem;
  font-size: 0.8rem; font-weight: 600; opacity: 0; transition: opacity 0.3s ease;
}
.c-cover:hover .c-overlay { background: rgba(0,0,0,0.05); }
.c-cover:hover .c-overlay span { opacity: 1; }
.c-slide h2 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); text-align: center; line-height: 1.25; margin: 0; }
@media (min-width: 640px) { .c-slide h2 { font-size: 1.875rem; } }

/* Nav buttons */
.c-btn {
  position: absolute; top: 35%; transform: translateY(-50%);
  z-index: 20; background: rgba(255,255,255,0.95); border: none; cursor: pointer;
  padding: 0.5rem 0.75rem; border-radius: 9999px; box-shadow: 0 10px 20px -8px rgba(0,0,0,0.2);
  transition: transform 0.2s ease, background 0.2s ease;
}
.c-btn:hover { transform: translateY(-50%) scale(1.1); }
.c-btn svg { width: 1.15rem; height: 1.15rem; stroke: var(--text-primary); display: block; }
.c-btn-prev { left: 0.25rem; }
.c-btn-next { right: 0.25rem; }
.dark .c-btn { background: rgba(30,41,59,0.95); }

/* Indicators */
.c-dots { display: flex; justify-content: center; gap: 0.5rem; margin-top: 1.5rem; }
.c-dot {
  height: 0.5rem; border-radius: 9999px; border: none; cursor: pointer; padding: 0;
  width: 0.5rem; background: #d1d5db; transition: all 0.3s ease;
}
.c-dot.is-active { width: 2rem; background: #f59e0b; }
.dark .c-dot { background: #4b5563; }
.dark .c-dot.is-active { background: #f59e0b; }
.c-dot:hover { background: #9ca3af; }

/* --- Desktop: 3-column featured grid --- */
.carousel-desktop { display: none; }
@media (min-width: 768px) { .carousel-desktop { display: block; } }
.carousel-caption { text-align: center; margin-bottom: 2.5rem; }
.carousel-caption h1 { font-size: 2.5rem; font-weight: 800; color: var(--text-primary); margin: 0 0 0.75rem; }
@media (min-width: 1024px) { .carousel-caption h1 { font-size: 3.5rem; } }
.carousel-caption p { font-size: 1.05rem; color: var(--text-secondary); max-width: 42rem; margin: 0 auto; }
.c-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (min-width: 1024px) { .c-grid { gap: 2rem; } }
.c-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: var(--bg-primary); border: 1px solid var(--border); border-radius: 1rem;
  padding: 1.5rem; box-shadow: 0 6px 18px -6px var(--shadow);
  transition: all 0.3s ease; text-decoration: none;
}
.c-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px -12px rgba(217,119,6,0.18); }
.c-card .c-cover { max-width: 17.5rem; margin-bottom: 1.25rem; }
.c-card h3 { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin: 0 0 0.5rem; transition: color 0.3s ease; }
.c-card:hover h3 { color: #d97706; }
.dark .c-card:hover h3 { color: #fbbf24; }
.c-card p { font-size: 0.875rem; color: var(--text-secondary); margin: 0 0 1rem; line-height: 1.5; }
.c-card .btn { margin-top: auto; display: inline-flex; align-items: center; gap: 0.5rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.9rem; }
  .nav-inner { flex-direction: column; gap: 0.5rem; }
}