/* ==========================================================================
   STYLE.CSS — Bibyutatsu BookStore (Option 2: Storefront + Instant Grid)
   5 Themes · Sticky Sidebar Filter · Mobile Slide-in Drawer · Real 3D Books
   ========================================================================== */

/* === THEME VARIABLES === */
:root, [data-theme="dark"] {
  --bg: #06060f; 
  --surface: #0d0d1e; 
  --surface-2: #131326;
  --surface-hover: #1c1c36;
  --accent: oklch(72% 0.20 210); 
  --accent-2: oklch(63% 0.22 285);
  --text: #c2c7df; 
  --text-muted: #626685;
  --border: rgba(130, 140, 200, 0.1); 
  --border-hover: rgba(130, 140, 200, 0.28);
  --heading-color: #eaecf8; 
  --card-bg: #101021;
  --hero-grad: linear-gradient(135deg, #eaecf8 0%, oklch(82% 0.12 220) 40%, oklch(70% 0.22 285) 100%);
  --glow: 0 0 32px oklch(72% 0.20 210 / 0.22);
  --cursor-color: #ffffff; 
  --nav-blur: rgba(6, 6, 15, 0.92);
  --radius: 10px; 
  --radius-lg: 16px;
  --t: 0.25s; 
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --fmt-epub: #00ccff;
  --fmt-kfx: #f59e0b;
  --fmt-pdf: #ef4444;
  --fmt-mobi: #a855f7;
}

[data-theme="light"] {
  --bg: #f5f6fa; 
  --surface: #ffffff; 
  --surface-2: #edeff6;
  --surface-hover: #e3e6f2;
  --accent: oklch(48% 0.22 250); 
  --accent-2: oklch(50% 0.20 310);
  --text: #2c2e42; 
  --text-muted: #797c99;
  --border: rgba(50, 60, 120, 0.1); 
  --border-hover: rgba(50, 60, 120, 0.26);
  --heading-color: #16182a; 
  --card-bg: #ffffff;
  --hero-grad: linear-gradient(135deg, #16182a 0%, oklch(40% 0.22 250) 50%, oklch(45% 0.20 310) 100%);
  --glow: 0 4px 20px rgba(50, 60, 180, 0.12); 
  --cursor-color: #16182a; 
  --nav-blur: rgba(245, 246, 250, 0.94);

  --fmt-epub: #0284c7;
  --fmt-kfx: #d97706;
  --fmt-pdf: #dc2626;
  --fmt-mobi: #7c3aed;
}

[data-theme="batman"] {
  --bg: #000000; 
  --surface: #0a0a0a; 
  --surface-2: #141414;
  --surface-hover: #222222;
  --accent: #FFE919; 
  --accent-2: #ff3333;
  --text: #e0e0e0; 
  --text-muted: #888888;
  --border: rgba(255, 233, 25, 0.15); 
  --border-hover: rgba(255, 233, 25, 0.4);
  --heading-color: #FFE919; 
  --card-bg: #0a0a0a;
  --hero-grad: linear-gradient(135deg, #fff7a0 0%, #FFE919 50%, #ffb300 100%);
  --glow: 0 0 28px rgba(255, 233, 25, 0.35); 
  --cursor-color: #FFE919; 
  --nav-blur: rgba(0, 0, 0, 0.95);

  --fmt-epub: #FFE919;
  --fmt-kfx: #ffb300;
  --fmt-pdf: #ff3333;
  --fmt-mobi: #e0e0e0;
}

[data-theme="cyberpunk"] {
  --bg: #06000e; 
  --surface: #0f0020; 
  --surface-2: #180034;
  --surface-hover: #260050;
  --accent: #ff0080; 
  --accent-2: #00ffcc;
  --text: #e0c8f0; 
  --text-muted: #8866aa;
  --border: rgba(255, 0, 128, 0.15); 
  --border-hover: rgba(255, 0, 128, 0.38);
  --heading-color: #f0d0ff; 
  --card-bg: #0f0020;
  --hero-grad: linear-gradient(135deg, #ff0080 0%, #cc00ff 50%, #00ffcc 100%);
  --glow: 0 0 28px rgba(255, 0, 128, 0.35); 
  --cursor-color: #ff0080; 
  --nav-blur: rgba(6, 0, 14, 0.94);

  --fmt-epub: #00ffcc;
  --fmt-kfx: #ffe600;
  --fmt-pdf: #ff0080;
  --fmt-mobi: #cc00ff;
}

[data-theme="ocean"] {
  --bg: #010d1a; 
  --surface: #071a2e; 
  --surface-2: #0c2440;
  --surface-hover: #123258;
  --accent: #00e5b0; 
  --accent-2: #0099ff;
  --text: #b0d0e8; 
  --text-muted: #4a6a80;
  --border: rgba(0, 229, 176, 0.12); 
  --border-hover: rgba(0, 229, 176, 0.32);
  --heading-color: #d8f0f8; 
  --card-bg: #071a2e;
  --hero-grad: linear-gradient(135deg, #d8f0f8 0%, #00e5b0 40%, #0099ff 100%);
  --glow: 0 0 28px rgba(0, 229, 176, 0.28); 
  --cursor-color: #00e5b0; 
  --nav-blur: rgba(1, 13, 26, 0.94);

  --fmt-epub: #00e5b0;
  --fmt-kfx: #38bdf8;
  --fmt-pdf: #f43f5e;
  --fmt-mobi: #818cf8;
}

/* === RESET & BASE TYPOGRAPHY === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Hind Siliguri', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  transition: background var(--t), color var(--t);
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

button, select, input {
  font-family: inherit;
}

button {
  cursor: pointer;
}

/* === BATMAN THEME OVERRIDES === */
[data-theme="batman"] h1,
[data-theme="batman"] h2,
[data-theme="batman"] h3,
[data-theme="batman"] .stage-heading,
[data-theme="batman"] .sidebar-title {
  font-family: 'Bangers', 'Hind Siliguri', cursive !important;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* === CYBERPUNK GLITCH/NEON OVERRIDES === */
[data-theme="cyberpunk"] .stage-heading {
  text-shadow: 0 0 16px rgba(255, 0, 128, 0.4);
}
[data-theme="cyberpunk"] .nav-logo {
  text-shadow: 0 0 10px rgba(255, 0, 128, 0.5);
}

/* === SCROLL PROGRESS BAR === */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: linear-gradient(to right, var(--accent), var(--accent-2));
  transform-origin: left;
  z-index: 500;
  animation: progress auto linear;
  animation-timeline: scroll(root block);
}
@keyframes progress {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
@supports not (animation-timeline: scroll(root block)) {
  #progress-bar {
    width: 0%;
    transition: width 0.1s ease-out;
  }
}

/* === CUSTOM CURSOR === */
#cursor-dot, #cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  will-change: transform;
}
#cursor-dot {
  width: 7px;
  height: 7px;
  background: var(--cursor-color);
  transition: width 0.15s, height 0.15s, opacity 0.15s;
}
#cursor-ring {
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--cursor-color);
  opacity: 0.6;
  transition: width 0.25s var(--ease), height 0.25s var(--ease), opacity 0.25s, border-color 0.25s;
}
body.c-hover #cursor-dot { width: 4px; height: 4px; opacity: 0.7; }
body.c-hover #cursor-ring { width: 50px; height: 50px; opacity: 0.4; }
body.c-click #cursor-ring { width: 22px; height: 22px; opacity: 1; }
@media (hover: none) {
  #cursor-dot, #cursor-ring { display: none !important; }
}

/* Ambient Three.js Canvas */
#hero-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  transition: opacity 0.6s;
}

/* === GLOBAL STICKY HEADER === */
.store-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  background: var(--nav-blur);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 200;
  display: flex;
  align-items: center;
}
.header-inner {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 clamp(16px, 2.5vw, 36px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Brand Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.logo-emoji { font-size: 1.35rem; }
.logo-text-group { display: flex; flex-direction: column; }
.logo-main {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--heading-color);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.logo-accent { color: var(--accent); }
.dot { color: var(--accent); }
.logo-sub {
  font-family: 'Hind Siliguri', sans-serif;
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Central Global Search Input */
.header-search-wrap {
  position: relative;
  flex: 1;
  max-width: 540px;
  margin: 0 12px;
}
.header-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}
.header-search-input {
  width: 100%;
  padding: 10px 38px 10px 42px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 30px;
  color: var(--heading-color);
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}
.header-search-input:focus {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: var(--glow);
}
.header-search-input::placeholder {
  color: var(--text-muted);
  font-size: 0.82rem;
}
.header-clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 2px 6px;
  border-radius: 50%;
}
.header-clear-btn:hover { color: var(--accent); }

/* Header Actions Right */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.mobile-filter-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--heading-color);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.2s;
}
.mobile-filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.store-stat-pill {
  font-family: 'Fira Code', monospace;
  font-size: 0.72rem;
  color: var(--heading-color);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s infinite ease-in-out;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

/* Theme Selector */
.theme-wrap { position: relative; }
.theme-icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-family: 'Fira Code', monospace;
  transition: border-color 0.2s, color 0.2s;
}
.theme-icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.theme-icon-btn svg { width: 14px; height: 14px; }
.theme-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 130px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px) scale(0.96);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  z-index: 300;
}
.theme-popover.open { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
.theme-opt {
  background: none;
  border: none;
  border-radius: 6px;
  padding: 7px 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: 'Fira Code', monospace;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, color 0.15s;
}
.theme-opt:hover { background: var(--surface-2); color: var(--heading-color); }
.theme-opt.active { color: var(--accent); }
.theme-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-ext-links {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-link {
  font-family: 'Fira Code', monospace;
  font-size: 0.74rem;
  color: var(--text-muted);
  transition: color 0.2s;
}
.header-link:hover { color: var(--accent); }

/* === STOREFRONT 2-COLUMN CONTAINER === */
.storefront-container {
  max-width: 1480px;
  margin: 0 auto;
  padding: 92px clamp(16px, 2.5vw, 36px) 60px;
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 32px;
  align-items: start;
  position: relative;
}

/* === LEFT COLUMN: STICKY FILTER SIDEBAR === */
.store-sidebar {
  position: sticky;
  top: 88px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.store-sidebar::-webkit-scrollbar { width: 4px; }
.store-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
}
.sidebar-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--heading-color);
  letter-spacing: -0.01em;
}
.drawer-close-btn {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  color: var(--heading-color);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.drawer-close-btn:hover,
.drawer-close-btn:active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-label {
  font-family: 'Fira Code', monospace;
  font-size: 0.72rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

/* Trending tags inside sidebar */
.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.side-tag {
  font-family: 'Fira Code', 'Hind Siliguri', monospace;
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all 0.2s;
}
.side-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* Format Chips */
.format-chips-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.side-fmt-btn {
  padding: 7px 12px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-family: 'Fira Code', monospace;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}
.side-fmt-btn:hover {
  background: var(--surface-hover);
  color: var(--heading-color);
}
.side-fmt-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}
.dot-epub { color: var(--fmt-epub); }
.dot-kfx  { color: var(--fmt-kfx); }
.dot-pdf  { color: var(--fmt-pdf); }
.dot-mobi { color: var(--fmt-mobi); }
.side-fmt-btn.active .dot-epub,
.side-fmt-btn.active .dot-kfx,
.side-fmt-btn.active .dot-pdf,
.side-fmt-btn.active .dot-mobi { color: var(--bg); }

/* Author Select in Sidebar */
.sidebar-select-wrap { position: relative; }
.sidebar-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 30px 8px 12px;
  font-size: 0.78rem;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.sidebar-select:focus { border-color: var(--accent); }
.sidebar-select-wrap::after {
  content: '▼';
  font-size: 0.5rem;
  color: var(--accent);
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Department / Genre List */
.sidebar-genre-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}
.genre-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.78rem;
  font-family: 'Hind Siliguri', 'Inter', sans-serif;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.genre-item:hover {
  background: var(--surface-2);
  color: var(--heading-color);
}
.genre-item.active {
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 600;
  border-left: 2px solid var(--accent);
}
.genre-badge {
  font-family: 'Fira Code', monospace;
  font-size: 0.66rem;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 10px;
}
.genre-item.active .genre-badge {
  background: var(--accent);
  color: var(--bg);
}

/* Reset Button */
.sidebar-reset-btn {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: none;
  color: var(--accent);
  border-radius: 20px;
  font-family: 'Fira Code', monospace;
  font-size: 0.74rem;
  transition: all 0.2s;
}
.sidebar-reset-btn:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* === RIGHT COLUMN: MAIN BOOKS STAGE (Above the Fold!) === */
.store-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Stage Controls Bar */
.stage-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.stage-meta-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.stage-heading {
  font-family: 'Space Grotesk', 'Hind Siliguri', sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--heading-color);
  letter-spacing: -0.015em;
}
.stage-count {
  font-family: 'Fira Code', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.stage-count strong { color: var(--accent); }

.stage-controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sort-select-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.sort-label {
  font-family: 'Fira Code', monospace;
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
}
.stage-sort-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 28px 6px 12px;
  font-size: 0.78rem;
  color: var(--text);
  outline: none;
  cursor: pointer;
}
.stage-sort-select:focus { border-color: var(--accent); }
.sort-select-wrapper::after {
  content: '▼';
  font-size: 0.5rem;
  color: var(--accent);
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* === BOOKS GRID (REAL 3D BOOK CARDS) === */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.book-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  will-change: transform;
  cursor: pointer;
  position: relative;
}
.book-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), var(--glow);
  transform: translateY(-6px);
}

/* Realistic 3D Paperback Book Cover Wrap */
.book-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}
.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s var(--ease);
}
.book-card:hover .book-cover { transform: scale(1.04); }

/* Realistic Left Spine Crease Shadow */
.book-cover-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 16px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.68) 0%, rgba(0, 0, 0, 0.2) 60%, transparent 100%);
  z-index: 2;
  pointer-events: none;
}
/* Right Edge Page Trim Simulation */
.book-cover-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 3px;
  background: rgba(255, 255, 255, 0.14);
  z-index: 2;
  pointer-events: none;
}

.cover-fallback {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
}
.cover-fallback-icon { font-size: 2.4rem; margin-bottom: 8px; }
.cover-fallback-title {
  font-family: 'Space Grotesk', 'Hind Siliguri', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--heading-color);
  line-height: 1.3;
}

.card-badges {
  position: absolute;
  top: 8px;
  left: 12px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  gap: 4px;
  z-index: 5;
}
.series-tag {
  font-family: 'Fira Code', 'Hind Siliguri', monospace;
  font-size: 0.6rem;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(6, 6, 15, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  color: var(--accent);
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.format-tags-list { display: flex; gap: 3px; }
.badge-fmt {
  font-family: 'Fira Code', monospace;
  font-size: 0.55rem;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(6, 6, 15, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  letter-spacing: 0.05em;
}
.badge-fmt.epub { color: var(--fmt-epub); border-color: rgba(0, 204, 255, 0.3); }
.badge-fmt.kfx  { color: var(--fmt-kfx);  border-color: rgba(245, 158, 11, 0.3); }
.badge-fmt.pdf  { color: var(--fmt-pdf);  border-color: rgba(239, 68, 68, 0.3); }
.badge-fmt.mobi { color: var(--fmt-mobi); border-color: rgba(168, 85, 247, 0.3); }

/* Book Card Content */
.book-info {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.book-title {
  font-family: 'Hind Siliguri', 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--heading-color);
  line-height: 1.32;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.book-title-en {
  font-family: 'Fira Code', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-author {
  font-family: 'Hind Siliguri', sans-serif;
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-actions {
  margin-top: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}
.download-btn {
  flex: 1;
  padding: 7px 10px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 18px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.download-btn:hover {
  box-shadow: var(--glow);
  transform: translateY(-2px);
}
.details-btn {
  padding: 6px 10px;
  border: 1px solid var(--border-hover);
  background: none;
  color: var(--text);
  border-radius: 18px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  transition: all 0.2s;
}
.details-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 520px;
  margin: 40px auto;
}
.empty-icon { font-size: 3.2rem; margin-bottom: 14px; }
.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  color: var(--heading-color);
  margin-bottom: 8px;
}
.empty-state p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 20px;
  line-height: 1.55;
}
.btn-primary {
  padding: 9px 22px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 30px;
  border: none;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.84rem;
  transition: box-shadow 0.2s, transform 0.2s;
}
.btn-primary:hover {
  box-shadow: var(--glow);
  transform: translateY(-2px);
}

/* === BOOKSTORE PAGINATION === */
.pagination-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 24px 0 60px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.pagination-info {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.88rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.pagination-info strong {
  color: var(--accent);
  font-weight: 700;
}

.pagination-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.pagination-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  user-select: none;
}

.pagination-btn:hover:not(:disabled):not(.active) {
  border-color: var(--border-hover);
  color: var(--heading-color);
  background: var(--surface-2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.pagination-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: var(--glow);
  cursor: default;
}

[data-theme="light"] .pagination-btn.active {
  color: #fff;
}

.pagination-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.pagination-btn.nav-step {
  font-size: 1.1rem;
  padding: 0 14px;
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 40px;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 2px;
  user-select: none;
}

@media (max-width: 640px) {
  .pagination-controls {
    gap: 4px;
  }
  .pagination-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    font-size: 0.82rem;
  }
  .pagination-btn.nav-step {
    padding: 0 10px;
    font-size: 1rem;
  }
}

/* === BOOK DETAIL MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0.25s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), var(--glow);
  transform: scale(0.94) translateY(20px);
  transition: transform 0.25s var(--ease);
}
.modal-overlay.active .modal-card { transform: scale(1) translateY(0); }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}
.modal-close:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.modal-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  padding: 32px;
}
.modal-cover-wrap {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 2px 7px 7px 2px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: -6px 14px 32px rgba(0, 0, 0, 0.5), inset 6px 0 10px rgba(0, 0, 0, 0.7);
  position: relative;
}
.modal-cover-wrap::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 16px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.6), transparent);
  pointer-events: none;
  z-index: 2;
}
.modal-cover { width: 100%; height: 100%; object-fit: cover; }
.modal-info { display: flex; flex-direction: column; }
.modal-title {
  font-family: 'Space Grotesk', 'Hind Siliguri', sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--heading-color);
  line-height: 1.25;
  margin-bottom: 3px;
}
.modal-title-en {
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.modal-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.modal-author-link {
  font-family: 'Hind Siliguri', sans-serif;
  font-size: 0.92rem;
  color: var(--accent);
  cursor: pointer;
  transition: text-decoration 0.2s;
}
.modal-author-link:hover { text-decoration: underline; }
.modal-series-badge,
.modal-year-badge {
  font-family: 'Fira Code', monospace;
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.modal-genres { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.modal-genre-tag {
  font-family: 'Fira Code', 'Hind Siliguri', monospace;
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.modal-translit-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.modal-translit-label {
  font-family: 'Fira Code', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.modal-translit-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.translit-pill {
  font-family: 'Fira Code', monospace;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.translit-pill:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}
.modal-desc {
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 22px;
  max-height: 160px;
  overflow-y: auto;
  padding-right: 6px;
}
.modal-downloads-section h4 {
  font-family: 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.modal-download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.modal-dl-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent-2);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  transition: transform var(--t), border-color var(--t);
  will-change: transform;
}
.modal-dl-card:hover {
  transform: translateX(4px);
  border-color: var(--border-hover);
  border-left-color: var(--accent);
  box-shadow: var(--glow);
}
.modal-dl-format {
  font-family: 'Fira Code', monospace;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 2px;
}
.modal-dl-size {
  font-family: 'Fira Code', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.modal-dl-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: auto;
}

/* === FOOTER === */
.store-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 36px 0 28px;
  position: relative;
  z-index: 10;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-brand-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heading-color);
  display: block;
  margin-bottom: 4px;
}
.footer-brand p {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 420px;
}
.footer-links {
  display: flex;
  gap: 16px;
}
.footer-link {
  font-family: 'Fira Code', monospace;
  font-size: 0.74rem;
  color: var(--text-muted);
  transition: color 0.2s;
}
.footer-link:hover { color: var(--accent); }
.footer-copy {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* === MOBILE SLIDE-IN DRAWER & RESPONSIVE RULES === */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}
.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 992px) {
  .storefront-container {
    grid-template-columns: 1fr;
    padding-top: 84px;
  }
  
  .mobile-filter-btn {
    display: inline-flex;
  }
  .nav-ext-links {
    display: none;
  }

  /* Sidebar becomes Slide-in Drawer from Left */
  .store-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    max-width: 86vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    z-index: 1000;
    background: var(--surface);
    border-radius: 0;
    border-right: 1px solid var(--border-hover);
    border-left: none;
    border-top: none;
    border-bottom: none;
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 18px 0 50px rgba(0, 0, 0, 0.7);
    padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .store-sidebar.drawer-open {
    transform: translateX(0);
  }
  .drawer-close-btn {
    display: flex;
  }

  /* Mobile Drawer Bottom Action */
  .drawer-mobile-footer {
    display: block;
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
  }
  .drawer-done-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  }
  .drawer-done-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
  }

  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
  }
  .modal-body {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 24px;
  }
  .modal-cover-wrap {
    max-width: 200px;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  .header-inner {
    padding: 0 12px;
    gap: 8px;
  }
  .logo {
    gap: 6px;
    flex-shrink: 0;
  }
  .logo-text {
    font-size: 0.92rem;
  }
  .logo-sub { display: none; }
  
  .header-search-wrap {
    margin: 0;
    min-width: 110px;
    flex: 1;
  }
  .header-search-input {
    font-size: 0.8rem;
    padding: 7px 26px 7px 30px;
  }
  .header-search-icon { left: 9px; }
  .header-search-icon svg { width: 14px; height: 14px; }
  .header-clear-btn { right: 8px; font-size: 0.8rem; }
  
  .header-actions {
    gap: 6px;
    flex-shrink: 0;
  }
  .mobile-filter-btn {
    padding: 6px 10px;
    font-size: 0.74rem;
    gap: 4px;
  }
  .mobile-filter-btn svg {
    width: 14px;
    height: 14px;
  }
  .store-stat-pill { display: none; }
  .theme-icon-btn {
    padding: 6px 8px;
  }
  .theme-label { display: none; }
  
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .book-info { padding: 8px; }
  .book-title { font-size: 0.85rem; }
  .book-title-en { font-size: 0.62rem; }
  .book-author { font-size: 0.72rem; margin-bottom: 6px; }
  .card-actions { flex-direction: column; gap: 4px; }
  .download-btn, .details-btn { width: 100%; padding: 5px 8px; font-size: 0.68rem; }
  .stage-controls-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .footer-inner { flex-direction: column; text-align: center; gap: 12px; }
}

@media (max-width: 440px) {
  .logo-text {
    display: none;
  }
  .logo-emoji {
    font-size: 1.35rem;
  }
  .header-search-input {
    font-size: 0.76rem;
    padding: 6px 24px 6px 26px;
  }
  .mobile-filter-btn {
    padding: 6px 8px;
  }
  .mobile-filter-btn span {
    display: none;
  }
}
