/* ============================================
   BookSphere — style.css
   ============================================ */

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

:root {
  --cream: #F5F0E8;
  --warm-white: #FDFBF7;
  --ink: #1A1209;
  --brown: #6B4C2A;
  --amber: #D4820A;
  --amber-light: #F2A93B;
  --rust: #C1440E;
  --sage: #5C7A5C;
  --dust: #C9BBA8;
  --card-bg: #FFFDF8;
  --shadow: rgba(26,18,9,0.12);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  overflow-x: hidden;
}

/* ── NOISE OVERLAY ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4rem;
  height: 72px;
  background: rgba(245,240,232,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(107,76,42,0.12);
  transition: box-shadow 0.3s;
}
nav.scrolled { box-shadow: 0 4px 32px var(--shadow); }

.nav-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav-logo span { color: var(--amber); }

.nav-links { display: flex; gap: 2.5rem; list-style: none; }
.nav-links a {
  text-decoration: none;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.nav-links a:hover { opacity: 1; }

.nav-actions { display: flex; gap: 1rem; align-items: center; }
.btn-ghost {
  background: none; border: 1.5px solid var(--brown);
  padding: 0.5rem 1.25rem; border-radius: 50px;
  font-size: 0.875rem; font-weight: 500; color: var(--brown);
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}
.btn-ghost:hover { background: var(--brown); color: var(--cream); }
.btn-primary {
  background: var(--amber); border: none;
  padding: 0.5rem 1.25rem; border-radius: 50px;
  font-size: 0.875rem; font-weight: 600; color: var(--ink);
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}
.btn-primary:hover { background: var(--amber-light); transform: translateY(-1px); }

/* ── HERO ── */
.hero {
  min-height: 100vh;
  display: flex; align-items: center;
  padding: 6rem 4rem 4rem;
  position: relative;
  overflow: hidden;
}
.hero-bg-circle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, var(--amber-light) 0%, transparent 70%);
  opacity: 0.18;
  pointer-events: none;
}
.hero-bg-circle.c1 { width: 700px; height: 700px; top: -200px; right: -150px; }
.hero-bg-circle.c2 { width: 400px; height: 400px; bottom: -100px; left: 10%; opacity: 0.1; }

.hero-content { max-width: 620px; position: relative; z-index: 1; animation: fadeUp 0.9s ease both; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: rgba(212,130,10,0.12); border: 1px solid rgba(212,130,10,0.3);
  padding: 0.35rem 1rem; border-radius: 50px;
  font-size: 0.8rem; font-weight: 600; color: var(--amber);
  letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 1.5rem;
}
.hero-badge::before { content: '✦'; font-size: 0.6rem; }

.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(3rem, 6vw, 5.5rem);
  font-weight: 900; line-height: 1.05;
  letter-spacing: -0.03em; margin-bottom: 1.5rem;
}
.hero h1 em { font-style: italic; color: var(--amber); }
.hero p { font-size: 1.125rem; line-height: 1.75; opacity: 0.65; max-width: 480px; margin-bottom: 2.5rem; }

.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 3.5rem; }
.btn-lg {
  padding: 0.9rem 2rem; border-radius: 50px;
  font-size: 1rem; font-weight: 600;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: all 0.25s; text-decoration: none; display: inline-block;
}
.btn-lg.primary { background: var(--ink); color: var(--cream); border: none; }
.btn-lg.primary:hover { background: var(--brown); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(26,18,9,0.25); }
.btn-lg.secondary { background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.btn-lg.secondary:hover { background: var(--ink); color: var(--cream); }

.hero-stats { display: flex; gap: 2.5rem; }
.stat-num { font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 900; color: var(--ink); }
.stat-label { font-size: 0.8rem; opacity: 0.55; letter-spacing: 0.04em; text-transform: uppercase; }

.hero-books {
  position: absolute; right: 4rem; top: 50%;
  transform: translateY(-50%);
  display: flex; gap: 1.5rem; align-items: flex-end;
  animation: fadeLeft 0.9s 0.2s ease both;
}
.book-card-hero {
  width: 130px; border-radius: 8px;
  box-shadow: -6px 6px 24px rgba(26,18,9,0.2), 2px 2px 0 rgba(26,18,9,0.08);
  overflow: hidden; transition: transform 0.3s; cursor: pointer;
}
.book-card-hero:hover { transform: translateY(-12px) rotate(-2deg); }
.book-card-hero:nth-child(2) { transform: translateY(-24px); }
.book-card-hero:nth-child(2):hover { transform: translateY(-36px) rotate(2deg); }
.book-cover-placeholder {
  width: 100%; aspect-ratio: 2/3;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 1rem; text-align: center;
}
.book-cover-placeholder .cover-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.8rem; font-weight: 700;
  color: rgba(255,255,255,0.9); line-height: 1.3;
}
.book-cover-placeholder .cover-author { font-size: 0.65rem; margin-top: 0.4rem; color: rgba(255,255,255,0.6); }

/* ── SEARCH ── */
.search-section { padding: 3rem 4rem; background: var(--ink); position: relative; }
.search-section::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 1px; background: linear-gradient(90deg, transparent, var(--amber), transparent);
}
.search-inner { max-width: 800px; margin: 0 auto; text-align: center; }
.search-inner h2 { font-family: 'Playfair Display', serif; font-size: 1.75rem; color: var(--cream); margin-bottom: 1.5rem; }
.search-bar { display: flex; background: var(--warm-white); border-radius: 50px; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.search-bar input { flex: 1; padding: 1rem 1.5rem; border: none; outline: none; font-family: 'DM Sans', sans-serif; font-size: 1rem; background: transparent; color: var(--ink); }
.search-bar select { padding: 0 1rem; border: none; border-left: 1px solid var(--dust); font-family: 'DM Sans', sans-serif; font-size: 0.875rem; background: transparent; color: var(--brown); cursor: pointer; outline: none; }
.search-bar button { padding: 1rem 2rem; background: var(--amber); border: none; font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 0.9rem; color: var(--ink); cursor: pointer; transition: background 0.2s; }
.search-bar button:hover { background: var(--amber-light); }

/* ── SECTIONS ── */
section { padding: 5rem 4rem; }
.section-header { margin-bottom: 3rem; }
.section-label { display: inline-block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--amber); margin-bottom: 0.5rem; }
.section-title { font-family: 'Playfair Display', serif; font-size: clamp(2rem, 3.5vw, 3rem); font-weight: 900; letter-spacing: -0.02em; line-height: 1.1; }
.section-header-row { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.view-all { font-size: 0.875rem; font-weight: 600; color: var(--brown); text-decoration: none; border-bottom: 1.5px solid var(--brown); padding-bottom: 2px; transition: color 0.2s; }
.view-all:hover { color: var(--amber); border-color: var(--amber); }

/* ── BOOKS GRID ── */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2rem; }
.book-card { background: var(--card-bg); border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px var(--shadow); transition: transform 0.3s, box-shadow 0.3s; cursor: pointer; animation: fadeUp 0.5s ease both; }
.book-card:hover { transform: translateY(-6px); box-shadow: 0 12px 36px var(--shadow); }
.book-cover { aspect-ratio: 2/3; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.25rem; text-align: center; position: relative; }
.book-cover::after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 4px; background: rgba(0,0,0,0.15); }
.book-cover .title { font-family: 'Playfair Display', serif; font-size: 0.9rem; font-weight: 700; line-height: 1.3; color: rgba(255,255,255,0.95); }
.book-cover .author { font-size: 0.7rem; margin-top: 0.5rem; color: rgba(255,255,255,0.65); }
.book-info { padding: 1rem; }
.book-info .book-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.2rem; line-height: 1.3; }
.book-info .book-author { font-size: 0.775rem; opacity: 0.55; margin-bottom: 0.6rem; }
.book-meta { display: flex; align-items: center; justify-content: space-between; }
.rating { display: flex; align-items: center; gap: 0.25rem; font-size: 0.775rem; font-weight: 600; color: var(--amber); }
.genre-tag { font-size: 0.65rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; background: rgba(107,76,42,0.1); color: var(--brown); padding: 0.2rem 0.5rem; border-radius: 50px; }
.wishlist-btn { background: none; border: none; cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0.25rem; transition: transform 0.2s; }
.wishlist-btn:hover { transform: scale(1.25); }

/* ── CATEGORIES ── */
.categories-section { background: var(--warm-white); }
.categories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1.25rem; }
.category-card { border-radius: 16px; padding: 1.5rem 1rem; text-align: center; cursor: pointer; transition: transform 0.25s, box-shadow 0.25s; box-shadow: 0 2px 8px var(--shadow); }
.category-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px var(--shadow); }
.cat-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.cat-name { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.25rem; }
.cat-count { font-size: 0.75rem; opacity: 0.55; }

/* ── FEATURED ── */
.featured-section { background: var(--ink); color: var(--cream); }
.featured-section .section-title { color: var(--cream); }
.featured-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; }
.featured-cover { aspect-ratio: 2/3; max-width: 280px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; text-align: center; box-shadow: -12px 12px 48px rgba(0,0,0,0.5); }
.featured-cover .title { font-family: 'Playfair Display', serif; font-size: 1.5rem; font-weight: 900; color: #fff; line-height: 1.2; }
.featured-cover .author { font-size: 0.875rem; color: rgba(255,255,255,0.65); margin-top: 0.75rem; }
.featured-info .section-label { color: var(--amber-light); }
.featured-info h3 { font-family: 'Playfair Display', serif; font-size: 2.25rem; font-weight: 900; line-height: 1.1; margin-bottom: 1rem; }
.featured-info p { opacity: 0.65; line-height: 1.8; margin-bottom: 1.5rem; font-size: 0.95rem; }
.featured-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 2rem; }
.tag { padding: 0.35rem 0.9rem; border-radius: 50px; font-size: 0.775rem; font-weight: 500; border: 1px solid rgba(245,240,232,0.2); color: var(--cream); }
.featured-rating { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.stars { color: var(--amber); font-size: 1.1rem; letter-spacing: 2px; }
.rating-text { font-size: 0.875rem; opacity: 0.6; }

/* ── TESTIMONIALS ── */
.testimonials-section { background: var(--cream); }
.testimonials-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.testimonial-card { background: var(--card-bg); border-radius: 16px; padding: 2rem; box-shadow: 0 2px 12px var(--shadow); position: relative; }
.testimonial-card::before { content: '❝'; font-size: 3rem; color: var(--amber); opacity: 0.2; line-height: 1; position: absolute; top: 1rem; right: 1.25rem; }
.testimonial-text { font-size: 0.9rem; line-height: 1.75; opacity: 0.75; margin-bottom: 1.25rem; }
.testimonial-author { display: flex; align-items: center; gap: 0.75rem; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.875rem; color: white; flex-shrink: 0; }
.author-name { font-weight: 600; font-size: 0.875rem; }
.author-role { font-size: 0.75rem; opacity: 0.5; }

/* ── NEWSLETTER ── */
.newsletter-section { background: linear-gradient(135deg, var(--brown) 0%, var(--ink) 100%); text-align: center; padding: 5rem 4rem; }
.newsletter-section h2 { font-family: 'Playfair Display', serif; font-size: 2.5rem; color: var(--cream); margin-bottom: 1rem; }
.newsletter-section p { color: rgba(245,240,232,0.65); margin-bottom: 2rem; font-size: 1rem; }
.newsletter-form { display: flex; max-width: 480px; margin: 0 auto; border-radius: 50px; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.newsletter-form input { flex: 1; padding: 1rem 1.5rem; border: none; outline: none; font-family: 'DM Sans', sans-serif; font-size: 0.95rem; background: var(--warm-white); }
.newsletter-form button { padding: 1rem 1.75rem; background: var(--amber); border: none; font-family: 'DM Sans', sans-serif; font-weight: 700; color: var(--ink); cursor: pointer; font-size: 0.9rem; transition: background 0.2s; white-space: nowrap; }
.newsletter-form button:hover { background: var(--amber-light); }

/* ── FOOTER ── */
footer { background: var(--ink); color: var(--cream); padding: 4rem 4rem 2rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 3rem; margin-bottom: 3rem; }
.footer-brand .nav-logo { display: block; margin-bottom: 1rem; color: var(--cream); font-size: 1.75rem; }
.footer-brand p { font-size: 0.875rem; opacity: 0.5; line-height: 1.7; max-width: 240px; }
.footer-col h4 { font-weight: 600; font-size: 0.875rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--amber); margin-bottom: 1.25rem; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.footer-col a { text-decoration: none; color: rgba(245,240,232,0.55); font-size: 0.875rem; transition: color 0.2s; }
.footer-col a:hover { color: var(--cream); }
.footer-bottom { border-top: 1px solid rgba(245,240,232,0.1); padding-top: 1.5rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.footer-bottom p { font-size: 0.8rem; opacity: 0.4; }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; z-index: 500; background: rgba(26,18,9,0.7); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 2rem; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--warm-white); border-radius: 20px; max-width: 600px; width: 100%; padding: 2.5rem; transform: translateY(20px); transition: transform 0.3s; max-height: 90vh; overflow-y: auto; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; opacity: 0.4; line-height: 1; transition: opacity 0.2s; }
.modal-close:hover { opacity: 1; }
.modal-book-row { display: flex; gap: 2rem; margin-bottom: 2rem; }
.modal-cover { width: 120px; flex-shrink: 0; border-radius: 8px; aspect-ratio: 2/3; display: flex; align-items: center; justify-content: center; padding: 1rem; text-align: center; }
.modal-cover .title { font-family: 'Playfair Display', serif; font-size: 0.9rem; font-weight: 700; color: #fff; }
.modal-details .by { opacity: 0.55; font-size: 0.875rem; margin-bottom: 1rem; }
.modal-details p { font-size: 0.9rem; line-height: 1.8; opacity: 0.7; }
.modal-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.modal-actions button { padding: 0.75rem 1.5rem; border-radius: 50px; font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: all 0.2s; }
.btn-read { background: var(--ink); color: var(--cream); border: none; }
.btn-read:hover { background: var(--brown); }
.btn-wish { background: none; color: var(--brown); border: 2px solid var(--brown); }
.btn-wish:hover { background: var(--brown); color: var(--cream); }

/* ── TOAST ── */
.toast { position: fixed; bottom: 2rem; right: 2rem; z-index: 999; background: var(--ink); color: var(--cream); padding: 1rem 1.5rem; border-radius: 12px; font-size: 0.875rem; font-weight: 500; transform: translateY(100px); opacity: 0; transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.toast.show { transform: translateY(0); opacity: 1; }

/* ── ANIMATIONS ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeLeft { from { opacity: 0; transform: translateX(40px) translateY(-50%); } to { opacity: 1; transform: translateX(0) translateY(-50%); } }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  nav { padding: 0 1.5rem; }
  .nav-links { display: none; }
  section, .hero, .search-section, .newsletter-section, footer { padding-left: 1.5rem; padding-right: 1.5rem; }
  .hero-books { display: none; }
  .hero { min-height: auto; padding-top: 8rem; padding-bottom: 4rem; }
  .featured-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr; }
  .newsletter-form { flex-direction: column; border-radius: 16px; }
  .newsletter-form input, .newsletter-form button { border-radius: 12px; }
  .modal-book-row { flex-direction: column; }
}