/* ============================================================
   ESHOP EBOOKS  –  Global Stylesheet
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

/* ---------- Variables ---------- */
:root {
  --bg:            #0a0a14;
  --bg-surface:    #12122a;
  --bg-card:       #1a1a38;
  --bg-card-hover: #20204a;

  --accent:        #7c3aed;
  --accent-hover:  #6d28d9;
  --accent-glow:   rgba(124,58,237,.35);
  --gold:          #f59e0b;
  --gold-hover:    #d97706;

  --cat-nf:        #3b82f6;   /* non-fiction */
  --cat-fi:        #8b5cf6;   /* fiction     */
  --cat-as:        #10b981;   /* assets      */

  --text:          #f1f5f9;
  --text-muted:    #94a3b8;
  --text-dim:      #64748b;

  --border:        #2a2a4a;
  --border-hover:  #4a4a7a;

  --radius-sm:  8px;
  --radius:    12px;
  --radius-lg: 20px;
  --trans:     .22s ease;
  --shadow:    0 4px 24px rgba(0,0,0,.5);
  --shadow-glow: 0 6px 40px var(--accent-glow);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a  { color: inherit; text-decoration: none; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: 'Playfair Display', serif;
  line-height: 1.2;
}
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; }
p  { color: var(--text-muted); }

/* ---------- Utility ---------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.section { padding: 5rem 0; }
.section-title {
  text-align: center;
  margin-bottom: 3rem;
}
.section-title h2 { margin-bottom: .5rem; }
.section-title p   { max-width: 560px; margin: 0 auto; }

.badge {
  display: inline-block;
  padding: .2rem .7rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-nf  { background: rgba(59,130,246,.15); color: #93c5fd; border-color: rgba(59,130,246,.3); }
.badge-fi  { background: rgba(139,92,246,.15);  color: #c4b5fd; border-color: rgba(139,92,246,.3); }
.badge-as  { background: rgba(16,185,129,.15);  color: #6ee7b7; border-color: rgba(16,185,129,.3); }
.badge-featured { background: rgba(245,158,11,.15); color: #fcd34d; border-color: rgba(245,158,11,.3); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .7rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--trans), transform var(--trans), box-shadow var(--trans);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--bg-card);
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, #f97316 100%);
  color: #000;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(245,158,11,.25);
}
.btn-gold::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.35) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform .55s ease;
  pointer-events: none;
}
.btn-gold:hover::after {
  transform: translateX(100%);
}
.btn-gold:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  transform: translateY(-3px);
  box-shadow: 0 8px 40px rgba(245,158,11,.55), 0 0 0 1px rgba(245,158,11,.2);
}

/* Lemon Squeezy overlay – wider window */
.lemonsqueezy-spinner-overlay iframe,
#ls-checkout-overlay iframe {
  width: min(960px, 96vw) !important;
  max-width: 960px !important;
}
.btn-lg { padding: .9rem 2rem; font-size: 1.05rem; }
.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,20,.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.nav-logo > span > span { color: var(--accent); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}
.nav-links a {
  font-size: .9rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: color var(--trans);
  position: relative;
  padding-bottom: 2px;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width var(--trans);
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); }
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }

.nav-logo img { height: 30px; width: auto; flex-shrink: 0; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text); }

/* ---------- Hero ---------- */
.hero {
  padding: 7rem 0 5rem;
  text-align: center;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(124,58,237,.25), transparent);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%237c3aed' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero-eyebrow {
  display: inline-block;
  background: rgba(124,58,237,.15);
  border: 1px solid rgba(124,58,237,.35);
  color: #c4b5fd;
  padding: .3rem 1rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}
.hero h1 { margin-bottom: 1.25rem; max-width: 750px; margin-left: auto; margin-right: auto; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p  { font-size: 1.1rem; max-width: 560px; margin: 0 auto 2.25rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Stats bar ---------- */
.stats-bar {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  text-align: center;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
}
.stat-label { font-size: .82rem; color: var(--text-muted); }

/* ---------- Category Cards ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: border-color var(--trans), transform var(--trans), box-shadow var(--trans);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.cat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.cat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
}
.cat-card h3 { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1.15rem; }
.cat-card p  { font-size: .9rem; flex: 1; }
.cat-card .btn { align-self: flex-start; }

/* ---------- Product Grid ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--trans), transform var(--trans), box-shadow var(--trans);
  cursor: pointer;
}
.product-card:hover {
  border-color: var(--accent);
  transform: translateY(-5px);
  box-shadow: var(--shadow-glow);
}
.product-cover {
  aspect-ratio: 4/5.6;
  overflow: hidden;
  background: var(--bg-surface);
  position: relative;
}
.product-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.product-card:hover .product-cover img { transform: scale(1.05); }

.badge-preview {
  background: rgba(16,185,129,.15);
  color: #6ee7b7;
  border-color: rgba(16,185,129,.3);
}
.product-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex: 1;
}
.product-cat { margin-bottom: .2rem; }
.product-title {
  font-weight: 700;
  font-size: .97rem;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-author { font-size: .82rem; color: var(--text-dim); }
.product-meta   { font-size: .8rem;  color: var(--text-dim); display: flex; gap: .75rem; flex-wrap: wrap; }
.product-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: .75rem;
  border-top: 1px solid var(--border);
}
.product-price { font-size: 1.1rem; font-weight: 700; color: var(--gold); }
.product-rating { font-size: .8rem; color: var(--text-dim); }
.product-rating .stars { color: #fbbf24; }

/* ---------- Skeleton Loader ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Category Page Hero ---------- */
.cat-hero {
  padding: 4rem 0 3rem;
  background: radial-gradient(ellipse 70% 80% at 50% 0%, rgba(var(--cat-rgb),.2), transparent);
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.cat-hero .cat-icon-lg {
  width: 72px; height: 72px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 1.25rem;
}
.cat-hero h1 { margin-bottom: .75rem; }

/* ---------- Filters Bar ---------- */
.filters-bar {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.25rem 0; flex-wrap: wrap;
}
.filters-bar label { font-size: .85rem; color: var(--text-muted); }
.filters-bar select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .45rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  cursor: pointer;
  transition: border-color var(--trans);
}
.filters-bar select:hover { border-color: var(--border-hover); }

/* ---------- Product Detail Page ---------- */
.product-detail {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 3.5rem;
  padding: 3.5rem 0;
  align-items: start;
}
.product-detail-cover {
  position: sticky; top: 84px;
}
.product-detail-cover img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.product-detail-info { display: flex; flex-direction: column; gap: 1.5rem; }
.product-detail-header .product-price-lg {
  font-size: 2rem; font-weight: 700; color: var(--gold);
}
.product-detail-meta {
  display: flex; flex-wrap: wrap; gap: .75rem;
}
.meta-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .4rem .85rem;
  font-size: .82rem;
  color: var(--text-muted);
  display: flex; align-items: center; gap: .4rem;
}
.meta-chip strong { color: var(--text); }
.product-description {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  font-size: .95rem;
}
.product-description p   { margin-bottom: .75rem; }
.product-description p:last-child { margin-bottom: 0; }

/* Consent box */
.consent-box {
  background: rgba(239,68,68,.07);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.consent-box h4 {
  font-family: 'Inter', sans-serif;
  font-size: .92rem;
  font-weight: 700;
  color: #fca5a5;
  margin-bottom: .65rem;
  display: flex; align-items: center; gap: .5rem;
}
.consent-label {
  display: flex; align-items: flex-start; gap: .75rem;
  cursor: pointer;
  font-size: .88rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.consent-label input[type=checkbox] {
  width: 18px; height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}
.consent-label a { color: var(--accent); text-decoration: underline; }

/* Tags */
.product-tags { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .25rem .7rem;
  font-size: .78rem;
  color: var(--text-muted);
  transition: border-color var(--trans), color var(--trans);
}
.tag:hover { border-color: var(--accent); color: var(--text); }

/* Rating stars display */
.rating-display {
  display: flex; align-items: center; gap: .5rem;
}
.rating-display .stars { color: #fbbf24; font-size: 1.1rem; }
.rating-display span   { font-size: .85rem; color: var(--text-muted); }

/* ---------- SVG inline icons ---------- */
.icon { display:inline-block; width:1em; height:1em; vertical-align:-.15em; flex-shrink:0; }
.cat-icon svg, .cat-icon-lg svg { display:block; }
.cat-icon svg { width:28px; height:28px; }
.cat-icon-lg svg { width:42px; height:42px; }
.empty-state .emoji svg { width:3rem; height:3rem; display:block; margin:0 auto; }
.stat-value svg { width:1.6rem; height:1.6rem; vertical-align:-.25em; }

/* ---------- Format tabs (product page) ---------- */
.format-tab {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: border-color var(--trans), background var(--trans);
  min-width: 200px;
}
.format-tab:hover { border-color: var(--border-hover); }
.format-tab-active {
  border-color: var(--accent) !important;
  background: rgba(124,58,237,.1) !important;
}


.legal-page { max-width: 780px; margin: 0 auto; padding: 4rem 1.25rem; }
.legal-page h1 { margin-bottom: .5rem; }
.legal-page .last-updated { font-size: .85rem; color: var(--text-dim); margin-bottom: 2.5rem; }
.legal-section { margin-bottom: 2.5rem; }
.legal-section h2 {
  font-size: 1.25rem;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  margin-bottom: .75rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
}
.legal-section p, .legal-section li { font-size: .95rem; margin-bottom: .6rem; color: var(--text-muted); }
.legal-section ul, .legal-section ol { padding-left: 1.5rem; }
.legal-highlight {
  background: rgba(239,68,68,.08);
  border-left: 4px solid #ef4444;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.legal-highlight p { color: #fca5a5; margin: 0; font-weight: 500; }

/* ---------- Notice Banner (visible ToS link) ---------- */
.tos-notice {
  background: rgba(124,58,237,.12);
  border: 1px solid rgba(124,58,237,.35);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex; align-items: flex-start; gap: 1rem;
  font-size: .9rem;
}
.tos-notice .icon { font-size: 1.4rem; flex-shrink: 0; }
.tos-notice p { color: var(--text-muted); margin: 0; }
.tos-notice a { color: #c4b5fd; text-decoration: underline; font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2rem;
}
.footer-brand p { font-size: .88rem; margin-top: .6rem; }
.footer-col h4 {
  font-family: 'Inter', sans-serif;
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  margin-bottom: .9rem;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: .55rem; }
.footer-col a  { font-size: .88rem; color: var(--text-muted); transition: color var(--trans); }
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .82rem;
  color: var(--text-dim);
  flex-wrap: wrap; gap: .5rem;
}
.footer-bottom a { color: var(--accent); text-decoration: underline; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  grid-column: 1/-1;
}
.empty-state .emoji { font-size: 3rem; margin-bottom: 1rem; }

/* ---------- Loading spinner ---------- */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .product-detail {
    grid-template-columns: 1fr;
  }
  .product-detail-cover {
    position: static;
    max-width: 320px;
    margin: 0 auto;
  }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg-surface); border-bottom: 1px solid var(--border); padding: 1.5rem; gap: 1.25rem; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .hero { padding: 4rem 0 3rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* ===== DOWNLOAD BANNER ===== */
.download-banner {
  background: rgba(124,58,237,.08);
  border-top: 1px solid rgba(124,58,237,.25);
  border-bottom: 1px solid rgba(124,58,237,.25);
  padding: .75rem 0;
  font-size: .9rem;
  color: var(--text-muted);
  text-align: center;
}
.download-banner svg { vertical-align: -.2em; margin-right: .4em; color: var(--accent); }
.download-banner a { color: var(--accent); font-weight: 600; text-decoration: underline; }
