/* ============================================================
   FaneliaBooks — Premium Ebook Storefront Styles
   Inspired by Everand / Scribd + Gumroad product pages
   ============================================================ */

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

:root {
  --bg: #0f0f13;
  --bg-2: #16161e;
  --bg-3: #1e1e2a;
  --bg-4: #252535;
  --surface: #1d1d28;
  --surface-2: #262636;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.15);

  --purple: #7c3aed;
  --purple-light: #9d5cf0;
  --purple-dark: #5b21b6;
  --indigo: #4f46e5;
  --pink: #ec4899;
  --teal: #14b8a6;
  --amber: #f59e0b;

  --text: #f0f0f6;
  --text-2: #c0c0d0;
  --text-3: #808099;
  --text-4: #555570;

  --card-radius: 14px;
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
  --transition-slow: 0.4s cubic-bezier(0.4,0,0.2,1);

  --shadow-card: 0 4px 24px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);
  --shadow-hover: 0 12px 48px rgba(0,0,0,0.6), 0 4px 16px rgba(124,58,237,0.2);
  --shadow-modal: 0 32px 80px rgba(0,0,0,0.8);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(15,15,19,0.85);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), box-shadow var(--transition);
}
.nav-header.scrolled { background: rgba(15,15,19,0.96); box-shadow: 0 2px 24px rgba(0,0,0,0.5); }

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.logo-icon { width: 32px; height: 32px; border-radius: 8px; }
.logo-text { font-size: 1.2rem; font-weight: 700; background: linear-gradient(135deg, #a78bfa, #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; letter-spacing: -0.02em; }

.nav-search-wrap { flex: 1; max-width: 480px; }
.nav-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 10px 18px;
  transition: border-color var(--transition), background var(--transition);
}
.nav-search:focus-within { border-color: var(--purple); background: var(--bg-4); }
.search-icon { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.nav-search input { background: none; border: none; outline: none; color: var(--text); font-size: 0.9rem; width: 100%; }
.nav-search input::placeholder { color: var(--text-3); }

.nav-links { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-link { color: var(--text-2); text-decoration: none; font-size: 0.9rem; font-weight: 500; padding: 8px 14px; border-radius: var(--radius-sm); transition: color var(--transition), background var(--transition); }
.nav-link:hover { color: var(--text); background: var(--bg-3); }

.btn-cta {
  background: linear-gradient(135deg, var(--purple), var(--indigo));
  color: white;
  border: none;
  border-radius: 50px;
  padding: 10px 22px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn-cta:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 20px rgba(124,58,237,0.4); }

.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; margin-left: auto; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text-2); border-radius: 2px; transition: all var(--transition); }

.mobile-menu { display: none; padding: 12px 24px 20px; border-top: 1px solid var(--border); }
.mobile-menu.open { display: block; }
.mobile-search { display: flex; align-items: center; gap: 10px; background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 12px; }
.mobile-search input { background: none; border: none; outline: none; color: var(--text); font-size: 0.9rem; width: 100%; }
.mobile-nav-link { display: block; color: var(--text-2); text-decoration: none; padding: 10px 4px; font-weight: 500; border-bottom: 1px solid var(--border); }
.mobile-nav-link:last-child { border-bottom: none; }

@media (max-width: 768px) {
  .nav-search-wrap, .nav-links { display: none; }
  .hamburger { display: flex; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 90vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 80px 24px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124,58,237,0.12) 0%, transparent 70%),
              radial-gradient(ellipse 60% 50% at 80% 50%, rgba(79,70,229,0.08) 0%, transparent 60%);
}
.hero-orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.4; animation: float 8s ease-in-out infinite; }
.hero-orb-1 { width: 500px; height: 500px; background: radial-gradient(circle, rgba(124,58,237,0.3), transparent 70%); top: -100px; left: -100px; animation-delay: 0s; }
.hero-orb-2 { width: 400px; height: 400px; background: radial-gradient(circle, rgba(79,70,229,0.25), transparent 70%); bottom: -50px; right: 20%; animation-delay: -3s; }
.hero-orb-3 { width: 300px; height: 300px; background: radial-gradient(circle, rgba(236,72,153,0.15), transparent 70%); top: 30%; right: 10%; animation-delay: -5s; }

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.05); }
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 640px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 50px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #a78bfa;
  margin-bottom: 28px;
  animation: fadeInUp 0.6s ease;
}

.hero-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 20px;
  animation: fadeInUp 0.6s ease 0.1s both;
}
.hero-title em { font-style: italic; background: linear-gradient(135deg, #a78bfa, #818cf8, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.hero-subtitle { font-size: 1.15rem; color: var(--text-2); line-height: 1.7; margin-bottom: 36px; max-width: 520px; animation: fadeInUp 0.6s ease 0.2s both; }

.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 32px; animation: fadeInUp 0.6s ease 0.3s both; }

.btn-hero-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--purple), var(--indigo));
  color: white;
  text-decoration: none;
  border-radius: 50px;
  padding: 16px 36px;
  font-size: 1.05rem;
  font-weight: 600;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  box-shadow: 0 8px 32px rgba(124,58,237,0.35);
}
.btn-hero-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(124,58,237,0.5); opacity: 0.92; }
.btn-hero-primary::after { content: '→'; }

.hero-stats { display: flex; align-items: center; gap: 20px; }
.hero-stat { display: flex; flex-direction: column; align-items: center; }
.hero-stat strong { font-size: 1.4rem; font-weight: 700; color: var(--text); line-height: 1; }
.hero-stat span { font-size: 0.75rem; color: var(--text-3); margin-top: 2px; }
.hero-stat-divider { width: 1px; height: 28px; background: var(--border); }

.hero-books-preview {
  position: absolute;
  right: 6%;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-stack { position: relative; width: 240px; height: 340px; }
.preview-book { position: absolute; width: 190px; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,0.7); transition: transform 0.3s ease; }
.preview-book-back  { top: 0; left: 0; transform: rotate(-8deg) scale(0.85); opacity: 0.5; filter: blur(1px); }
.preview-book-mid   { top: 20px; left: 20px; transform: rotate(-3deg) scale(0.92); opacity: 0.75; }
.preview-book-front { top: 40px; left: 40px; transform: rotate(2deg); opacity: 1; animation: bookFloat 5s ease-in-out infinite; }
@keyframes bookFloat { 0%,100%{transform:rotate(2deg) translateY(0)} 50%{transform:rotate(2deg) translateY(-12px)} }

@media (max-width: 1024px) { .hero-books-preview { display: none; } }
@media (max-width: 600px) {
  .hero { min-height: 80vh; padding: 60px 20px; }
  .hero-stats { gap: 16px; }
}

/* ============================================================
   CATEGORY TABS
   ============================================================ */
.categories-section {
  padding: 32px 0 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.category-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 0;
}
.category-scroll::-webkit-scrollbar { display: none; }

.cat-tab {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 12px 20px;
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color var(--transition), background var(--transition);
  position: relative;
  font-family: 'Inter', sans-serif;
}
.cat-tab::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--purple);
  transform: scaleX(0);
  transition: transform var(--transition);
  border-radius: 2px 2px 0 0;
}
.cat-tab:hover { color: var(--text-2); background: var(--bg-3); }
.cat-tab.active { color: var(--text); background: var(--bg-3); }
.cat-tab.active::after { transform: scaleX(1); }

/* ============================================================
   BOOKS SECTION
   ============================================================ */
.books-section { padding: 48px 0 80px; background: var(--bg-2); }

.books-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}
.books-title { font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.books-count { font-size: 1rem; font-weight: 400; color: var(--text-3); margin-left: 6px; }

.sort-select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.87rem;
  padding: 8px 14px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color var(--transition);
}
.sort-select:focus { border-color: var(--purple); }

/* BOOKS GRID */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 24px;
}

@media (max-width: 480px) { .books-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; } }

/* BOOK CARD */
.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  animation: fadeInUp 0.5s ease both;
  display: flex;
  flex-direction: column;
  position: relative;
}
.book-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); border-color: var(--border-hover); }
.book-card:hover .book-cover-img { transform: scale(1.04); }
.book-card:hover .book-overlay { opacity: 1; }

.book-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--bg-4);
  flex-shrink: 0;
}
.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.book-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 60%);
  opacity: 0;
  transition: opacity var(--transition);
  display: flex;
  align-items: flex-end;
  padding: 16px;
}
.book-overlay-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--purple), var(--indigo));
  color: white;
  border: none;
  border-radius: 50px;
  padding: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}

.book-cat-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50px;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.book-info { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.book-title { font-size: 0.87rem; font-weight: 600; color: var(--text); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-excerpt { font-size: 0.78rem; color: var(--text-3); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.book-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.book-price { font-size: 1rem; font-weight: 700; color: var(--purple-light); }
.book-format { font-size: 0.7rem; color: var(--text-4); background: var(--bg-4); border-radius: 4px; padding: 3px 7px; }

/* NO RESULTS */
.no-results { text-align: center; padding: 80px 20px; color: var(--text-3); }
.no-results-icon { font-size: 3rem; margin-bottom: 16px; }
.no-results p { font-size: 1rem; }

/* ============================================================
   TRUST SECTION
   ============================================================ */
.trust-section {
  background: var(--bg);
  padding: 72px 0;
  border-top: 1px solid var(--border);
}
.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px;
}
.trust-item { text-align: center; padding: 32px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius); transition: border-color var(--transition), transform var(--transition); }
.trust-item:hover { border-color: var(--border-hover); transform: translateY(-4px); }
.trust-icon { font-size: 2.2rem; margin-bottom: 16px; display: block; }
.trust-item h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.trust-item p { font-size: 0.88rem; color: var(--text-3); line-height: 1.6; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { background: var(--bg); border-top: 1px solid var(--border); padding: 60px 0 0; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 48px; margin-bottom: 48px; }
@media (max-width: 600px) { .footer-inner { grid-template-columns: 1fr; } }

.footer-brand .logo { margin-bottom: 12px; display: inline-flex; }
.footer-tagline { font-size: 0.88rem; color: var(--text-3); margin-top: 8px; }

.footer-cols { display: flex; gap: 48px; }
.footer-col h4 { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 16px; }
.footer-col a { display: block; color: var(--text-2); text-decoration: none; font-size: 0.88rem; margin-bottom: 10px; transition: color var(--transition); cursor: pointer; }
.footer-col a:hover { color: var(--text); }

.footer-bottom { border-top: 1px solid var(--border); padding: 20px 0; }
.footer-bottom p { font-size: 0.82rem; color: var(--text-4); }
.footer-bottom a { color: var(--text-3); text-decoration: none; }
.footer-bottom a:hover { color: var(--text); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  position: relative;
  animation: modalSlideIn 0.3s cubic-bezier(0.4,0,0.2,1);
}
.modal::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-track { background: transparent; }
.modal::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }

@keyframes modalSlideIn { from { opacity: 0; transform: scale(0.95) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  z-index: 10;
}
.modal-close svg { width: 16px; height: 16px; color: var(--text-2); }
.modal-close:hover { background: var(--surface-2); border-color: var(--border-hover); }

.modal-inner {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
}
@media (max-width: 600px) { .modal-inner { grid-template-columns: 1fr; } }

.modal-cover-wrap {
  position: relative;
  background: var(--bg-4);
  border-radius: 20px 0 0 20px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
@media (max-width: 600px) { .modal-cover-wrap { border-radius: 20px 20px 0 0; padding: 32px 24px; max-height: 280px; } }

.modal-cover { width: 100%; max-width: 180px; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); position: relative; z-index: 1; }
.modal-cover-glow { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(124,58,237,0.15), transparent 70%); }

.modal-content { padding: 40px 36px; }
@media (max-width: 600px) { .modal-content { padding: 28px 24px; } }

.modal-category { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--purple-light); margin-bottom: 10px; }
.modal-title { font-family: 'Playfair Display', Georgia, serif; font-size: 1.7rem; font-weight: 700; color: var(--text); line-height: 1.2; margin-bottom: 16px; }
.modal-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.modal-price { font-size: 1.8rem; font-weight: 800; color: var(--text); }
.modal-badge { background: rgba(20,184,166,0.12); border: 1px solid rgba(20,184,166,0.25); border-radius: 50px; padding: 5px 12px; font-size: 0.78rem; font-weight: 500; color: var(--teal); }
.modal-desc { color: var(--text-2); font-size: 0.93rem; line-height: 1.75; margin-bottom: 24px; }

.modal-perks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 28px; }
.perk { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; color: var(--text-2); }
.perk span { font-size: 1rem; }

.btn-buy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(135deg, var(--purple), var(--indigo));
  color: white;
  text-decoration: none;
  border-radius: 50px;
  padding: 16px 32px;
  font-size: 1.05rem;
  font-weight: 700;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  box-shadow: 0 6px 24px rgba(124,58,237,0.35);
  margin-bottom: 12px;
}
.btn-buy:hover { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(124,58,237,0.5); opacity: 0.92; }

.modal-guarantee { text-align: center; font-size: 0.8rem; color: var(--text-3); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.book-card:nth-child(1)  { animation-delay: 0.02s; }
.book-card:nth-child(2)  { animation-delay: 0.04s; }
.book-card:nth-child(3)  { animation-delay: 0.06s; }
.book-card:nth-child(4)  { animation-delay: 0.08s; }
.book-card:nth-child(5)  { animation-delay: 0.10s; }
.book-card:nth-child(6)  { animation-delay: 0.12s; }
.book-card:nth-child(7)  { animation-delay: 0.14s; }
.book-card:nth-child(8)  { animation-delay: 0.16s; }
.book-card:nth-child(9)  { animation-delay: 0.18s; }
.book-card:nth-child(10) { animation-delay: 0.20s; }
