/* ==========================================================================
   BOOKERA (bookstore.cc) — Modern Digital Bookstore Stylesheet
   Aesthetic: Editorial Bookstore, Warm Tactile Cream, Swiss Sans + Classic Serif,
   Stripe-Secured Elements & Young Readers Corner.
   ========================================================================== */

:root {
  --bg-primary: #FFFFFF;
  --bg-secondary: #FAFAF8;
  --bg-tertiary: #F4F1EA;
  --bg-hover: #EFECE6;
  --bg-paper: #FBF9F5;
  --border-hairline: #E8E5DF;
  --border-subtle: #D8D4CC;
  --border-dark: #191817;
  --text-primary: #121110;
  --text-secondary: #585550;
  --text-muted: #8E8A82;
  --accent-black: #121110;
  --accent-white: #FFFFFF;
  --accent-gold: #C5A880;
  --accent-gold-dark: #9A7B4F;
  --stripe-blurple: #635BFF;
  --stripe-blurple-dark: #4B45C6;
  --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.03), 0 10px 24px -6px rgba(0, 0, 0, 0.05);
  --card-shadow-hover: 0 16px 36px -8px rgba(0, 0, 0, 0.1), 0 3px 8px rgba(0, 0, 0, 0.04);
}

/* Base resets & typography */
html {
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

.font-serif-editorial {
  font-family: 'Playfair Display', Georgia, Cambria, serif;
}

.font-mono-code {
  font-family: 'JetBrains Mono', monospace;
}

/* Custom subtle scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-paper);
}

::-webkit-scrollbar-thumb {
  background: #D5D1C8;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #A8A399;
}

/* Tactile 3D Book Presentation */
.book-cover-container {
  perspective: 1100px;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.book-cover-wrapper {
  position: relative;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 
    -2px 4px 10px rgba(0, 0, 0, 0.08),
    -8px 16px 30px rgba(0, 0, 0, 0.06),
    0 1px 3px rgba(0, 0, 0, 0.05);
  transform-style: preserve-3d;
}

.book-card:hover .book-cover-wrapper {
  transform: translateY(-7px) rotateY(-5deg) rotateX(2deg);
  box-shadow: 
    -5px 10px 20px rgba(0, 0, 0, 0.12),
    -14px 28px 44px rgba(0, 0, 0, 0.09),
    0 2px 5px rgba(0, 0, 0, 0.06);
}

/* Real Book spine simulated edge line */
.book-cover-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 7px;
  height: 100%;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.4) 0%, rgba(0, 0, 0, 0.18) 65%, rgba(255, 255, 255, 0.1) 100%);
  pointer-events: none;
  z-index: 2;
  border-top-left-radius: inherit;
  border-bottom-left-radius: inherit;
}

/* Book page edge simulated deckle trim on right */
.book-cover-wrapper::after {
  content: '';
  position: absolute;
  top: 3px;
  right: -4px;
  width: 4px;
  height: calc(100% - 6px);
  background: repeating-linear-gradient(
    to bottom,
    #F7F4EE,
    #F7F4EE 1px,
    #E8E3D7 1px,
    #E8E3D7 2px
  );
  border-radius: 0 1px 1px 0;
  box-shadow: 1px 0 2px rgba(0, 0, 0, 0.08);
  pointer-events: none;
}

/* Buttons */
.btn-primary {
  background-color: var(--accent-black);
  color: var(--accent-white);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:hover {
  background-color: #2D2B28;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: #FFFFFF;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-secondary:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-dark);
}

/* Active Filter Pills */
.filter-pill {
  transition: all 0.2s ease;
}

.filter-pill.active {
  background-color: var(--accent-black);
  color: var(--accent-white);
  border-color: var(--accent-black);
}

.kids-age-pill {
  transition: all 0.2s ease;
}

.kids-age-pill.active {
  background-color: #9A7B4F;
  color: #FFFFFF;
  border-color: #9A7B4F;
}

/* Audio Player Animation */
@keyframes audioWave {
  0%, 100% { height: 4px; }
  50% { height: 16px; }
}

.audio-bar-anim:nth-child(1) { animation: audioWave 1.2s ease-in-out infinite; }
.audio-bar-anim:nth-child(2) { animation: audioWave 0.9s ease-in-out infinite 0.2s; }
.audio-bar-anim:nth-child(3) { animation: audioWave 1.4s ease-in-out infinite 0.4s; }
.audio-bar-anim:nth-child(4) { animation: audioWave 1.1s ease-in-out infinite 0.1s; }
.audio-bar-anim:nth-child(5) { animation: audioWave 1.3s ease-in-out infinite 0.3s; }

/* Look Inside Reader Themes */
.reader-canvas-light {
  background-color: #FFFFFF;
  color: #171717;
}

.reader-canvas-paper {
  background-color: #F8F5EE;
  color: #2C2825;
}

.reader-canvas-night {
  background-color: #161514;
  color: #ECE9E4;
}

.reader-drop-cap::first-letter {
  font-family: 'Playfair Display', serif;
  font-size: 3.6em;
  float: left;
  line-height: 0.8;
  margin-right: 0.15em;
  margin-top: 0.05em;
  color: inherit;
  font-weight: 700;
}

/* Badge minimal */
.badge-minimal {
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.badge-kids {
  background: #FFF8EE;
  color: #935B1D;
  border: 1px solid #F3E3C8;
}

.badge-digital {
  background: #F0FDF4;
  color: #15803D;
  border: 1px solid #DCFCE7;
}

/* Stripe Form Styling */
.stripe-input-box {
  border: 1px solid #D8D4CC;
  border-radius: 10px;
  background: #FFFFFF;
  transition: all 0.2s ease;
}

.stripe-input-box:focus-within {
  border-color: var(--stripe-blurple);
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.12);
}

.btn-stripe-pay {
  background-color: var(--stripe-blurple);
  color: #FFFFFF;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-stripe-pay:hover {
  background-color: var(--stripe-blurple-dark);
  box-shadow: 0 4px 12px rgba(99, 91, 255, 0.25);
  transform: translateY(-1px);
}

.btn-stripe-pay:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Stripe Processing Spinner */
@keyframes stripeSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.stripe-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: stripeSpin 0.7s linear infinite;
}

/* Test card helper pill */
.test-card-pill {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px dashed #D8D4CC;
  background: #FAF8F5;
  color: #6B665E;
  cursor: pointer;
  transition: all 0.15s ease;
}

.test-card-pill:hover {
  border-color: var(--stripe-blurple);
  color: var(--stripe-blurple);
  background: #F4F3FF;
}

/* Kids Corner banner subtle playful touches */
.kids-corner-decor {
  background: radial-gradient(circle at 10% 20%, rgba(243, 227, 200, 0.35) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(224, 236, 222, 0.4) 0%, transparent 45%);
}

/* Line clamps */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
