/* ============================================================
   eStore Books — Global Stylesheet
   Aesthetic: Warm editorial bookstore — aged paper, ink, gold
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,700;1,400;1,500&family=Crimson+Pro:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=DM+Mono:wght@300;400&display=swap');

/* ---- Variables ------------------------------------------- */
:root {
  --ink:        #1a120b;
  --ink-light:  #3d2f20;
  --paper:      #faf8f4;
  --paper-warm: #f4efe6;
  --cream:      #ede3d0;
  --warm:       #c8a97e;
  --warm-deep:  #a07848;
  --gold:       #b8972a;
  --muted:      #8a7060;
  --faint:      #b8ad9e;
  --border:     #ddd5c4;
  --border-soft:#e8e2d8;
  --white:      #ffffff;
  --danger:     #9b1c1c;
  --success:    #065f46;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Crimson Pro', Georgia, serif;
  --font-mono:    'DM Mono', monospace;

  --radius:   4px;
  --radius-lg:8px;
  --shadow:   0 2px 16px rgba(26,18,11,.08);
  --shadow-lg:0 8px 40px rgba(26,18,11,.14);

  --header-h: 64px;
  --max-w:    1200px;
}

/* ---- Reset ----------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--warm-deep); }
button { cursor: pointer; font-family: var(--font-body); }
ul, ol { list-style: none; }
main { flex: 1; }

/* ---- Container ------------------------------------------- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Header ---------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--ink);
  border-bottom: 1px solid rgba(200,169,126,.2);
  height: var(--header-h);
}
.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 32px;
}

/* Logo */
.logo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: #f0e8da;
  text-decoration: none;
  letter-spacing: .02em;
  white-space: nowrap;
  flex-shrink: 0;
}
.logo em { color: var(--warm); font-style: normal; }

/* Nav */
.main-nav { display: flex; gap: 24px; align-items: center; flex: 1; }
.main-nav a {
  font-size: 14px;
  color: #c8bcac;
  letter-spacing: .03em;
  transition: color .15s;
  white-space: nowrap;
}
.main-nav a:hover, .main-nav a.active { color: var(--warm); }

/* Search bar */
.header-search {
  flex: 1;
  max-width: 360px;
  position: relative;
}
.header-search input {
  width: 100%;
  padding: 8px 40px 8px 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(200,169,126,.25);
  border-radius: 3px;
  color: #f0e8da;
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: background .15s, border-color .15s;
}
.header-search input::placeholder { color: rgba(200,188,172,.5); }
.header-search input:focus {
  background: rgba(255,255,255,.12);
  border-color: var(--warm);
}
.header-search button {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--warm);
  font-size: 16px;
  padding: 0;
  line-height: 1;
}

/* Header actions */
.header-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.header-actions a {
  color: #c8bcac;
  font-size: 13px;
  letter-spacing: .03em;
  transition: color .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-actions a:hover { color: var(--warm); }
.cart-link { position: relative; }
.cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background: var(--warm);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #c8bcac;
  font-size: 22px;
  padding: 4px;
}

/* ---- Breadcrumb ------------------------------------------ */
.breadcrumb {
  padding: 12px 0;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--border-soft);
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb span { margin: 0 6px; }

/* ---- Flash messages -------------------------------------- */
.flash-wrap { padding: 12px 0 0; }
.flash-msg {
  padding: 12px 18px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  font-size: 14px;
  font-family: var(--font-body);
}
.flash-success { background: #ecfdf5; border-left: 3px solid #10b981; color: var(--success); }
.flash-error   { background: #fef2f2; border-left: 3px solid #ef4444; color: var(--danger); }
.flash-info    { background: #eff6ff; border-left: 3px solid #3b82f6; color: #1e40af; }
.flash-warning { background: #fffbeb; border-left: 3px solid #f59e0b; color: #92400e; }

/* ---- Buttons --------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 15px;
  letter-spacing: .03em;
  border: none;
  transition: background .15s, color .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--ink); color: var(--cream); }
.btn-primary:hover { background: #2e1e12; color: var(--cream); }
.btn-warm { background: var(--warm); color: var(--ink); }
.btn-warm:hover { background: var(--warm-deep); color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--ink); }
.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 17px; }
.btn-full { width: 100%; justify-content: center; }

/* ---- Book card ------------------------------------------- */
.book-card {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
}
.book-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.book-card-cover {
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--cream);
  position: relative;
}
.book-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.book-card:hover .book-card-cover img { transform: scale(1.04); }
.book-card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--ink);
  color: var(--cream);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
}
.book-card-badge.digital { background: var(--warm); color: var(--ink); }
.book-card-badge.featured { background: var(--gold); color: var(--ink); }

.book-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.book-card-category {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--warm-deep);
}
.book-card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
}
.book-card-author {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}
.book-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.book-price {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
}
.book-price-old {
  font-size: 13px;
  color: var(--muted);
  text-decoration: line-through;
  margin-right: 4px;
}
.btn-cart {
  background: var(--ink);
  color: var(--cream);
  border: none;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-body);
  transition: background .15s;
}
.btn-cart:hover { background: var(--warm-deep); }

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

/* ---- Section headings ------------------------------------ */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  color: var(--ink);
}
.section-title em { font-style: italic; color: var(--warm-deep); }
.section-link {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
}
.section-link:hover { color: var(--ink); border-color: var(--ink); }

/* ---- Divider --------------------------------------------- */
.divider {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 40px 0;
}
.ornament {
  text-align: center;
  color: var(--faint);
  font-size: 18px;
  letter-spacing: .3em;
  margin: 32px 0;
}

/* ---- Pagination ------------------------------------------ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 0;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink);
  transition: all .15s;
}
.pagination a:hover { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.pagination .active { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.pagination .dots { border: none; color: var(--muted); width: auto; }

/* ---- Tags / badges --------------------------------------- */
.tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--paper-warm);
}
.tag:hover { border-color: var(--ink); color: var(--ink); }

/* ---- Forms (global) -------------------------------------- */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  border-color: var(--warm);
  box-shadow: 0 0 0 3px rgba(200,169,126,.12);
}
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a7060' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* ---- Alert ----------------------------------------------- */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
}
.alert-error   { background: #fef2f2; border-left: 3px solid #ef4444; color: var(--danger); }
.alert-success { background: #ecfdf5; border-left: 3px solid #10b981; color: var(--success); }
.alert-info    { background: #eff6ff; border-left: 3px solid #3b82f6; color: #1e40af; }

/* ---- Footer ---------------------------------------------- */
.site-footer {
  background: var(--ink);
  color: #c8bcac;
  padding: 56px 0 24px;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(200,169,126,.15);
}
.footer-brand .logo { font-size: 22px; margin-bottom: 14px; display: block; }
.footer-brand p { font-size: 14px; line-height: 1.7; color: #9e9080; max-width: 260px; }
.footer-col h4 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: #f0e8da;
  letter-spacing: .04em;
  margin-bottom: 16px;
}
.footer-col a {
  display: block;
  font-size: 13px;
  color: #9e9080;
  margin-bottom: 9px;
  transition: color .15s;
}
.footer-col a:hover { color: var(--warm); }
.footer-contact p { font-size: 13px; color: #9e9080; margin-bottom: 8px; line-height: 1.6; }
.footer-contact strong { color: #c8bcac; }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  font-size: 12px;
  color: #6e6050;
}
.footer-bottom a { color: #6e6050; }
.footer-bottom a:hover { color: var(--warm); }

/* ---- Toast notification ---------------------------------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: var(--cream);
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transform: translateY(80px);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-icon { font-size: 18px; flex-shrink: 0; }

/* ---- Skeleton loader ------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--paper-warm) 25%, var(--cream) 50%, var(--paper-warm) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---- Utilities ------------------------------------------- */
.text-center { text-align: center; }
.text-muted   { color: var(--muted); }
.text-warm    { color: var(--warm-deep); }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.py-24 { padding-top: 24px; padding-bottom: 24px; }
.py-48 { padding-top: 48px; padding-bottom: 48px; }
.py-64 { padding-top: 64px; padding-bottom: 64px; }

/* ---- Animations ------------------------------------------ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .5s ease both; }
.delay-1 { animation-delay: .1s; }
.delay-2 { animation-delay: .2s; }
.delay-3 { animation-delay: .3s; }
.delay-4 { animation-delay: .4s; }

/* ---- Responsive ------------------------------------------ */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .books-grid  { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 768px) {
  .main-nav { display: none; }
  .main-nav.open { display: flex; flex-direction: column; position: absolute; top: var(--header-h); left: 0; right: 0; background: var(--ink); padding: 16px 24px 24px; gap: 16px; border-bottom: 1px solid rgba(200,169,126,.2); z-index: 199; }
  .menu-toggle { display: block; }
  .header-search { max-width: 200px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
}
@media (max-width: 480px) {
  .header-search { display: none; }
  .books-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .footer-grid { grid-template-columns: 1fr; }
}
