/* ====================================================================
   BellerBooks — Main Stylesheet
   Warm bookstore aesthetic: cream backgrounds, serif headings, gold accents
   ==================================================================== */

/* ── CSS Variables ──────────────────────────────────────────────────── */
:root {
  /* Core palette */
  --bb-cream:        #faf8f5;
  --bb-cream-dark:   #f0ece5;
  --bb-dark:         #1a1a2e;
  --bb-dark-soft:    #2d2d44;
  --bb-gold:         #d4a853;
  --bb-gold-hover:   #c49843;
  --bb-gold-light:   rgba(212, 168, 83, 0.12);
  --bb-teal:         #0d9488;
  --bb-teal-hover:   #0b7f74;
  --bb-teal-light:   rgba(13, 148, 136, 0.10);
  --bb-text:         #1a1a2e;
  --bb-text-muted:   #555568;
  --bb-text-dim:     #888898;
  --bb-border:       #e2ddd5;
  --bb-border-light: #ece8e1;
  --bb-card-bg:      #ffffff;
  --bb-shadow-sm:    0 1px 3px rgba(26,26,46,0.06);
  --bb-shadow-md:    0 4px 16px rgba(26,26,46,0.08);
  --bb-shadow-lg:    0 8px 32px rgba(26,26,46,0.10);
  --bb-radius-sm:    6px;
  --bb-radius-md:    10px;
  --bb-radius-lg:    16px;
  --bb-transition:   0.2s ease;

  /* Typography */
  --bb-font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --bb-font-heading: Georgia, 'Times New Roman', serif;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--bb-font-body);
  background: var(--bb-cream);
  color: var(--bb-text);
  line-height: 1.6;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--bb-teal); text-decoration: none; transition: color var(--bb-transition); }
a:hover { color: var(--bb-teal-hover); }

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

/* ── Container ─────────────────────────────────────────────────────── */
.bb-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Navigation ────────────────────────────────────────────────────── */
.bb-nav {
  background: #fff;
  border-bottom: 1px solid var(--bb-border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--bb-shadow-sm);
}

.bb-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.bb-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--bb-font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--bb-dark);
  text-decoration: none;
}

.bb-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--bb-gold);
  border-radius: var(--bb-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  font-family: var(--bb-font-heading);
  font-weight: 700;
  line-height: 1;
}

.bb-nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.bb-nav-links a {
  color: var(--bb-text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  transition: color var(--bb-transition);
}

.bb-nav-links a:hover,
.bb-nav-links a.active {
  color: var(--bb-dark);
}

.bb-nav-links a.active {
  border-bottom: 2px solid var(--bb-gold);
  padding-bottom: 2px;
}

.bb-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: var(--bb-radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--bb-transition);
  text-decoration: none;
  line-height: 1.4;
}

.bb-btn-primary {
  background: var(--bb-gold);
  color: #fff;
}
.bb-btn-primary:hover {
  background: var(--bb-gold-hover);
  color: #fff;
}

.bb-btn-secondary {
  background: transparent;
  color: var(--bb-teal);
  border: 1px solid var(--bb-teal);
}
.bb-btn-secondary:hover {
  background: var(--bb-teal);
  color: #fff;
}

.bb-btn-outline {
  background: transparent;
  color: var(--bb-dark);
  border: 1px solid var(--bb-border);
}
.bb-btn-outline:hover {
  border-color: var(--bb-gold);
  color: var(--bb-gold);
}

/* Hamburger (mobile) */
.bb-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}
.bb-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--bb-dark);
  border-radius: 2px;
  transition: all var(--bb-transition);
}

/* ── Hero ──────────────────────────────────────────────────────────── */
.bb-hero {
  text-align: center;
  padding: 4.5rem 1rem 3.5rem;
  background: linear-gradient(180deg, #fff 0%, var(--bb-cream) 100%);
}

.bb-hero h1 {
  font-family: var(--bb-font-heading);
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--bb-dark);
  margin-bottom: 1rem;
  line-height: 1.2;
}

.bb-hero h1 em {
  font-style: italic;
  color: var(--bb-gold);
}

.bb-hero p {
  font-size: 1.15rem;
  color: var(--bb-text-muted);
  max-width: 640px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.bb-hero-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.bb-hero-stat {
  text-align: center;
}

.bb-hero-stat strong {
  display: block;
  font-size: 1.6rem;
  font-family: var(--bb-font-heading);
  color: var(--bb-dark);
}

.bb-hero-stat span {
  font-size: 0.85rem;
  color: var(--bb-text-dim);
}

/* ── Section Headings ──────────────────────────────────────────────── */
.bb-section {
  padding: 3rem 0;
}

.bb-section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.bb-section-header h2 {
  font-family: var(--bb-font-heading);
  font-size: 1.8rem;
  color: var(--bb-dark);
  margin-bottom: 0.5rem;
}

.bb-section-header p {
  color: var(--bb-text-muted);
  font-size: 1rem;
  max-width: 520px;
  margin: 0 auto;
}

/* ── Book Grid ─────────────────────────────────────────────────────── */
.bb-book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}

.bb-book-card {
  background: var(--bb-card-bg);
  border: 1px solid var(--bb-border-light);
  border-radius: var(--bb-radius-md);
  overflow: hidden;
  transition: transform var(--bb-transition), box-shadow var(--bb-transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.bb-book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--bb-shadow-md);
}

.bb-book-cover {
  width: 100%;
  min-height: 320px;
  background: var(--bb-cream-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--bb-text-dim);
  overflow: hidden;
  position: relative;
}

.bb-book-cover img,
.bb-book-cover svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bb-book-cover--loaded {
  background: transparent;
}

.bb-book-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.bb-book-genre {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--bb-gold-light);
  color: var(--bb-gold-hover);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
  width: fit-content;
}

.bb-book-title {
  font-family: var(--bb-font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--bb-dark);
}

.bb-book-author {
  font-size: 0.82rem;
  color: var(--bb-text-muted);
  margin-bottom: 0.3rem;
}

.bb-book-meta {
  font-size: 0.75rem;
  color: var(--bb-text-dim);
  margin-bottom: 0.5rem;
}

.bb-book-desc {
  font-size: 0.82rem;
  color: var(--bb-text-dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.6rem;
  flex: 1;
}

.bb-book-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.bb-book-price {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--bb-teal);
}

.bb-book-rating {
  font-size: 0.82rem;
  color: var(--bb-gold);
}

/* ── Categories ────────────────────────────────────────────────────── */
.bb-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
}

.bb-category-card {
  background: var(--bb-card-bg);
  border: 1px solid var(--bb-border-light);
  border-radius: var(--bb-radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  transition: all var(--bb-transition);
  cursor: pointer;
  text-decoration: none;
  color: var(--bb-dark);
}

.bb-category-card:hover {
  border-color: var(--bb-gold);
  box-shadow: var(--bb-shadow-sm);
  transform: translateY(-2px);
  color: var(--bb-dark);
}

.bb-category-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.bb-category-name {
  font-family: var(--bb-font-heading);
  font-size: 1rem;
  font-weight: 600;
}

.bb-category-count {
  font-size: 0.8rem;
  color: var(--bb-text-dim);
  margin-top: 0.2rem;
}

/* ── Author Promo ──────────────────────────────────────────────────── */
.bb-author-promo {
  background: var(--bb-dark);
  color: #fff;
  border-radius: var(--bb-radius-lg);
  padding: 3.5rem 2.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.bb-author-promo h2 {
  font-family: var(--bb-font-heading);
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: #fff;
}

.bb-author-promo p {
  color: rgba(255,255,255,0.8);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.bb-pipeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bb-pipeline-step {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255,255,255,0.08);
  border-radius: var(--bb-radius-sm);
  border-left: 3px solid var(--bb-gold);
}

.bb-pipeline-step .step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bb-gold);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.bb-pipeline-step .step-text strong {
  display: block;
  font-size: 0.92rem;
  color: #fff;
  margin-bottom: 0.15rem;
}

.bb-pipeline-step .step-text span {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.65);
}

/* ── Search Bar (browse page) ──────────────────────────────────────── */
.bb-search-bar {
  display: flex;
  gap: 0.5rem;
  max-width: 560px;
  margin: 0 auto 2rem;
}

.bb-search-bar input {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius-sm);
  background: #fff;
  color: var(--bb-text);
  font-size: 0.95rem;
  font-family: var(--bb-font-body);
}

.bb-search-bar input::placeholder {
  color: var(--bb-text-dim);
}

.bb-search-bar input:focus {
  outline: none;
  border-color: var(--bb-gold);
  box-shadow: 0 0 0 3px rgba(212,168,83,0.15);
}

.bb-search-bar button {
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: var(--bb-radius-sm);
  background: var(--bb-gold);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background var(--bb-transition);
}

.bb-search-bar button:hover {
  background: var(--bb-gold-hover);
}

/* ── Filter Tabs ───────────────────────────────────────────────────── */
.bb-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.bb-filter-tab {
  padding: 0.4rem 1rem;
  border: 1px solid var(--bb-border);
  border-radius: 999px;
  background: transparent;
  color: var(--bb-text-muted);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--bb-transition);
  font-family: var(--bb-font-body);
}

.bb-filter-tab:hover {
  border-color: var(--bb-gold);
  color: var(--bb-dark);
}

.bb-filter-tab.active {
  background: var(--bb-gold);
  border-color: var(--bb-gold);
  color: #fff;
}

/* ── Toolbar (sort/count) ──────────────────────────────────────────── */
.bb-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bb-toolbar .result-count {
  color: var(--bb-text-muted);
  font-size: 0.9rem;
}

.bb-toolbar select {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius-sm);
  background: #fff;
  color: var(--bb-text);
  font-size: 0.85rem;
  font-family: var(--bb-font-body);
}

/* ── Pagination ────────────────────────────────────────────────────── */
.bb-pagination {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 2rem 0 3rem;
}

.bb-page-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius-sm);
  background: #fff;
  color: var(--bb-text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--bb-transition);
  font-family: var(--bb-font-body);
}

.bb-page-btn:hover { border-color: var(--bb-gold); }

.bb-page-btn.active {
  background: var(--bb-gold);
  border-color: var(--bb-gold);
  color: #fff;
}

.bb-page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── Loading / Empty ───────────────────────────────────────────────── */
.bb-loading {
  text-align: center;
  padding: 3rem;
  color: var(--bb-text-dim);
}

.bb-loading .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--bb-border);
  border-top-color: var(--bb-gold);
  border-radius: 50%;
  animation: bb-spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes bb-spin { to { transform: rotate(360deg); } }

.bb-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--bb-text-dim);
}

.bb-empty p {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

/* ── Footer ────────────────────────────────────────────────────────── */
.bb-footer {
  background: var(--bb-dark);
  color: rgba(255,255,255,0.7);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
}

.bb-footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
}

.bb-footer-brand {
  font-family: var(--bb-font-heading);
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 0.75rem;
}

.bb-footer-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 300px;
}

.bb-footer h4 {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bb-footer ul {
  list-style: none;
}

.bb-footer ul li {
  margin-bottom: 0.4rem;
}

.bb-footer ul a {
  color: rgba(255,255,255,0.6);
  font-size: 0.85rem;
  transition: color var(--bb-transition);
}

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

.bb-footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 2rem;
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bb-footer-bottom a {
  color: rgba(255,255,255,0.5);
}

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

/* ── Toast ─────────────────────────────────────────────────────────── */
.bb-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .bb-author-promo {
    grid-template-columns: 1fr;
    padding: 2.5rem 2rem;
  }
}

@media (max-width: 768px) {
  .bb-hamburger { display: flex; }

  .bb-nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 1rem 1.5rem;
    gap: 0.75rem;
    border-bottom: 1px solid var(--bb-border);
    box-shadow: var(--bb-shadow-md);
  }

  .bb-nav-links.open { display: flex; }

  .bb-hero h1 { font-size: 2rem; }
  .bb-hero p { font-size: 1rem; }
  .bb-hero-stats { gap: 1.5rem; }

  .bb-book-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }

  .bb-book-cover { min-height: 240px; }

  .bb-categories {
    grid-template-columns: repeat(3, 1fr);
  }

  .bb-search-bar { flex-direction: column; }

  .bb-footer-inner {
    grid-template-columns: 1fr 1fr;
  }

  .bb-toolbar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 480px) {
  .bb-hero { padding: 3rem 0.5rem 2rem; }
  .bb-hero h1 { font-size: 1.6rem; }

  .bb-book-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .bb-book-cover { min-height: 200px; }
  .bb-book-body { padding: 0.75rem; }
  .bb-book-title { font-size: 0.9rem; }

  .bb-categories {
    grid-template-columns: repeat(2, 1fr);
  }

  .bb-footer-inner {
    grid-template-columns: 1fr;
  }

  .bb-filter-tabs { gap: 0.3rem; }
  .bb-filter-tab { font-size: 0.78rem; padding: 0.3rem 0.75rem; }
}
