/* ============================================
   Dreamcrest Publishing — Custom Styles
   ============================================ */

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0a0a0f; }
::-webkit-scrollbar-thumb { background: #2a2a3a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #d4a574; }

/* Base */
html { scroll-behavior: smooth; }
body {
  background: #0a0a0f;
  color: #e8e8f0;
  font-family: 'Inter', system-ui, sans-serif;
  overflow-x: hidden;
}

/* ========================
   ANIMATIONS
   ======================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(212, 165, 116, 0.1); }
  50% { box-shadow: 0 0 40px rgba(212, 165, 116, 0.25); }
}
@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0); }
  50% { opacity: 1; transform: scale(1); }
}
@keyframes drift {
  0% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(10px, -20px) rotate(90deg); }
  50% { transform: translate(-5px, -40px) rotate(180deg); }
  75% { transform: translate(-15px, -20px) rotate(270deg); }
  100% { transform: translate(0, 0) rotate(360deg); }
}
@keyframes gradient-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.animate-fade-in-up {
  animation: fadeInUp 0.8s ease-out forwards;
  opacity: 0;
}
.animate-fade-in {
  animation: fadeIn 0.6s ease-out forwards;
  opacity: 0;
}
.animate-float { animation: float 6s ease-in-out infinite; }
.animate-pulse-glow { animation: pulse-glow 3s ease-in-out infinite; }

/* Stagger delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }

/* Scroll-triggered animations */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========================
   SPARKLE EFFECT (Homepage Hero)
   ======================== */
.sparkle-container {
  position: relative;
  overflow: hidden;
}
.sparkle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #d4a574;
  animation: sparkle 4s ease-in-out infinite;
  pointer-events: none;
}
.sparkle:nth-child(odd) {
  background: rgba(212, 165, 116, 0.6);
  width: 2px;
  height: 2px;
}
.sparkle:nth-child(3n) {
  background: rgba(255, 255, 255, 0.4);
  width: 2px;
  height: 2px;
}

/* ========================
   BACKGROUND ORBS (Floating ambient lights)
   ======================== */
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  pointer-events: none;
  animation: glow-pulse 8s ease-in-out infinite;
}

/* ========================
   GOLD SHIMMER TEXT
   ======================== */
.text-shimmer {
  background: linear-gradient(90deg, #d4a574, #e8c9a0, #d4a574, #c09060);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s linear infinite;
}

/* ========================
   AUTHOR CARDS (Homepage)
   ======================== */
.author-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  cursor: pointer;
}
.author-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.author-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(212,165,116,0.3), transparent, rgba(212,165,116,0.1));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.author-card:hover::before {
  opacity: 0.6;
}

/* ========================
   BOOK COVER CARDS
   ======================== */
.book-card {
  transition: box-shadow 0.3s ease;
  border-radius: 8px;
  overflow: hidden;
  will-change: transform;
}
.book-card:hover {
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 30px rgba(var(--glow-rgb, 212,165,116), 0.15);
}
.book-card img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  aspect-ratio: 2/3;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.book-card:hover img {
  transform: scale(1.03);
}

/* Per-theme book glow */
.theme-luna .book-card:hover { box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 30px rgba(139,92,246,0.2); }
.theme-cassie .book-card:hover { box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 30px rgba(245,158,11,0.2); }
.theme-harley .book-card:hover { box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 30px rgba(16,185,129,0.2); }
.theme-sarah .book-card:hover { box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 30px rgba(6,182,212,0.2); }
.theme-amelia .book-card:hover { box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 30px rgba(59,130,246,0.2); }
.theme-sabine .book-card:hover { box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 30px rgba(220,38,38,0.2); }

/* Cover placeholder for missing images */
.cover-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
}

/* ========================
   FREE BOOK SECTION — Animated Border
   ======================== */
.free-book-glow {
  position: relative;
}
.free-book-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  background: conic-gradient(
    from 0deg,
    var(--accent-color, #d4a574),
    transparent,
    var(--accent-color, #d4a574),
    transparent,
    var(--accent-color, #d4a574)
  );
  animation: gradient-rotate 8s linear infinite;
  opacity: 0.3;
  z-index: -1;
}

/* ========================
   NEWSLETTER FORM
   ======================== */
.newsletter-form input[type="email"] {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 14px 18px;
  color: #e8e8f0;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  width: 100%;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  outline: none;
}
.newsletter-form input[type="email"]:focus {
  border-color: var(--accent-color, #d4a574);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.15);
}
.newsletter-form input[type="email"]::placeholder {
  color: #6b6b80;
}

.btn-subscribe {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: #0a0a0f;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  width: 100%;
}
.btn-subscribe:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.btn-subscribe:active {
  transform: translateY(0);
}
.btn-subscribe:disabled {
  opacity: 0.7;
  cursor: wait;
}

.btn-buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  color: #0a0a0f;
}
.btn-buy:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

/* ========================
   DIVIDERS & DECORATIVE
   ======================== */
.section-divider {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #d4a574, transparent);
  margin: 0 auto;
}

/* ========================
   MOBILE NAV
   ======================== */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,10,15,0.98);
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}
.mobile-menu.active { display: flex; }

/* ========================
   HERO GRADIENT & BACKGROUND
   ======================== */
.hero-gradient {
  background: radial-gradient(ellipse at center top, var(--hero-glow, rgba(212,165,116,0.08)) 0%, transparent 60%),
              linear-gradient(to bottom, #0a0a0f, #0f0f18, #0a0a0f);
}

/* Per-author accent color variables */
.theme-luna { --accent-color: #8B5CF6; --accent-light: #A78BFA; --hero-glow: rgba(139,92,246,0.08); }
.theme-cassie { --accent-color: #F59E0B; --accent-light: #FCD34D; --hero-glow: rgba(245,158,11,0.08); }
.theme-harley { --accent-color: #10B981; --accent-light: #6EE7B7; --hero-glow: rgba(16,185,129,0.08); }
.theme-sarah { --accent-color: #06B6D4; --accent-light: #67E8F9; --hero-glow: rgba(6,182,212,0.08); }
.theme-amelia { --accent-color: #3B82F6; --accent-light: #93C5FD; --hero-glow: rgba(59,130,246,0.08); }
.theme-sabine { --accent-color: #DC2626; --accent-light: #FCA5A5; --hero-glow: rgba(220,38,38,0.08); }

/* ========================
   HERO BACKGROUND IMAGE SUPPORT
   ======================== */
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  opacity: 0.85;
  pointer-events: none;
  z-index: 0;
}
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(10,10,15,0.15) 50%, #0a0a0f 90%);
}

/* Ensure hero content sits above background */
.hero-content {
  position: relative;
  z-index: 2;
}

/* ========================
   FORM SUCCESS
   ======================== */
.form-success {
  display: none;
  text-align: center;
  padding: 1.5rem;
}
.form-success.show {
  display: block;
  animation: fadeInUp 0.5s ease-out forwards;
}

/* Series header decorative line */
.series-accent {
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent-color, #d4a574);
}

/* ========================
   BACK TO TOP
   ======================== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(212,165,116,0.9);
  color: #0a0a0f;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 50;
  border: none;
  font-size: 1.2rem;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}
.back-to-top:hover {
  background: #e8c9a0;
  transform: translateY(-2px);
}

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 768px) {
  .book-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .bg-orb { display: none; }
}
@media (max-width: 480px) {
  .book-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
