/* ============================================
   IEPub - Digital Publishing Community
   Modern creative tech style
   ============================================ */

:root {
  /* Light theme */
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --secondary: #22C55E;
  --accent: #F59E0B;
  --bg: #F8FAFC;
  --bg-soft: #F1F5F9;
  --surface: #FFFFFF;
  --text: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --gradient-hero: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 30%, #A5B4FC 60%, #818CF8 100%);
  --gradient-card: linear-gradient(145deg, #FFFFFF 0%, #F8FAFC 100%);
  --shadow-sm: 0 1px 2px rgba(79, 70, 229, 0.06);
  --shadow-md: 0 4px 12px rgba(79, 70, 229, 0.1);
  --shadow-lg: 0 12px 40px rgba(79, 70, 229, 0.15);
  --shadow-book: 4px 6px 16px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] {
  --primary: #818CF8;
  --primary-dark: #6366F1;
  --secondary: #34D399;
  --accent: #FBBF24;
  --bg: #0F172A;
  --bg-soft: #1E293B;
  --surface: #1E293B;
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --border: #334155;
  --gradient-hero: linear-gradient(135deg, #1E1B4B 0%, #312E81 40%, #3730A3 70%, #4F46E5 100%);
  --gradient-card: linear-gradient(145deg, #1E293B 0%, #0F172A 100%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-book: 4px 6px 20px rgba(0, 0, 0, 0.4);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.3s ease;
}

h1, h2, h3, h4 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== Header ========== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s, border-color 0.3s;
}

[data-theme="dark"] .header {
  background: rgba(15, 23, 42, 0.9);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text);
}

.logo i {
  color: var(--primary);
  font-size: 1.75rem;
}

.nav {
  display: flex;
  gap: 32px;
}

.nav a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav a:hover {
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

[data-theme="dark"] .theme-toggle i.fa-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle i.fa-sun {
  display: inline-block;
}

.theme-toggle i.fa-sun {
  display: none;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.header.header-scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .header.header-scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
  .nav {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 24px;
    gap: 0;
    box-shadow: var(--shadow-lg);
  }
  .nav.nav-open {
    display: flex;
  }
  .nav a {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
  }
  .nav a:last-child {
    border-bottom: none;
  }
  .nav-toggle {
    display: flex;
  }
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 12px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--surface);
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
}

.btn-accent {
  background: var(--accent);
  color: #1E293B;
}

.btn-accent:hover {
  background: #D97706;
  color: white;
}

.btn-lg {
  padding: 18px 36px;
  font-size: 1.1rem;
}

/* ========== Hero ========== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 0 80px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background: var(--gradient-hero);
  opacity: 0.95;
  animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { opacity: 0.95; }
  50% { opacity: 0.98; }
}

[data-theme="dark"] .hero-gradient {
  opacity: 0.9;
}

/* Floating books */
.floating-books {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.floating-book {
  position: absolute;
  font-size: 2.5rem;
  color: var(--primary);
  opacity: 0.25;
  animation: float 6s ease-in-out infinite;
}

[data-theme="dark"] .floating-book {
  color: var(--secondary);
  opacity: 0.2;
}

.floating-book.book-1 { top: 15%; left: 10%; animation-delay: 0s; }
.floating-book.book-2 { top: 25%; right: 15%; animation-delay: 1.2s; font-size: 2rem; }
.floating-book.book-3 { bottom: 30%; left: 8%; animation-delay: 2.4s; font-size: 1.8rem; }
.floating-book.book-4 { bottom: 20%; right: 12%; animation-delay: 3.6s; }
.floating-book.book-5 { top: 50%; left: 5%; animation-delay: 4.8s; font-size: 2.2rem; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.15;
  margin-bottom: 16px;
  color: var(--text);
}

.hero-title .highlight {
  color: var(--primary);
  position: relative;
}

.hero-tagline {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 16px;
}

.hero-desc {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  max-width: 520px;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.hero-illustration {
  position: absolute;
  right: 5%;
  bottom: 10%;
  z-index: 1;
  opacity: 0.9;
}

.hero-illustration img {
  max-width: 320px;
  height: auto;
}

@media (max-width: 900px) {
  .hero-illustration {
    display: none;
  }
}

/* Hero animations */
.animate-fade-up {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeUp 0.8s ease forwards;
}

.animate-fade-up.delay-1 { animation-delay: 0.15s; }
.animate-fade-up.delay-2 { animation-delay: 0.3s; }
.animate-fade-up.delay-3 { animation-delay: 0.45s; }

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== Sections ========== */
.section {
  padding: 80px 0;
}

.section-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  text-align: center;
  margin-bottom: 16px;
  color: var(--text);
}

.section-title .highlight {
  color: var(--primary);
}

.section-desc {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 48px;
  font-size: 1.1rem;
  color: var(--text-muted);
}

/* Scroll reveal (initial state) */
.scroll-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ========== What is EPUB ========== */
.epub-section {
  background: var(--bg-soft);
}

.epub-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.epub-card {
  background: var(--surface);
  padding: 32px;
  border-radius: 20px;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.epub-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.epub-card-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.75rem;
}

.epub-card h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: var(--text);
}

.epub-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ========== Digital Bookshelf ========== */
.bookshelf-section {
  background: var(--bg);
}

.bookshelf {
  position: relative;
  background: linear-gradient(180deg, #92400E 0%, #B45309 15%, #D97706 100%);
  border-radius: 16px;
  padding: 24px 24px 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 2px 0 rgba(255,255,255,0.2);
}

[data-theme="dark"] .bookshelf {
  background: linear-gradient(180deg, #78350F 0%, #92400E 30%, #B45309 100%);
}

.shelf-bar {
  height: 12px;
  background: linear-gradient(180deg, #1C1917 0%, #44403C 50%, #1C1917 100%);
  border-radius: 4px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.shelf-bar-bottom {
  margin-top: 20px;
  margin-bottom: 0;
}

.book-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  align-items: stretch;
}

.book-card.scroll-reveal:nth-child(1) { transition-delay: 0.1s; }
.book-card.scroll-reveal:nth-child(2) { transition-delay: 0.2s; }
.book-card.scroll-reveal:nth-child(3) { transition-delay: 0.3s; }
.book-card.scroll-reveal:nth-child(4) { transition-delay: 0.4s; }

.book-card {
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-book);
  display: flex;
  flex-direction: column;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  cursor: pointer;
}

.book-card:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: 0 16px 40px rgba(79, 70, 229, 0.25);
}

.book-card-cover {
  aspect-ratio: 2/3;
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3rem;
  position: relative;
}

.epub-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent);
  color: #1E293B;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
}

.book-card-info {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.book-card-info h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text);
}

.book-card-info p {
  font-size: 0.9rem;
  color: var(--text-muted);
  flex: 1;
}

.book-icon {
  margin-top: 12px;
  color: var(--primary);
  font-size: 1rem;
}

/* ========== Resources ========== */
.resources-section {
  background: var(--bg-soft);
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.resource-card {
  background: var(--surface);
  padding: 32px;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s;
  display: block;
  color: var(--text);
}

.resource-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.resource-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--secondary), #16A34A);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.resource-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.resource-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ========== Developer Corner ========== */
.developer-section {
  background: var(--bg);
}

.developer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.developer-card {
  background: var(--surface);
  padding: 36px;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.developer-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.developer-card i {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 20px;
  display: block;
}

.developer-card h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: var(--text);
}

.developer-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ========== Community ========== */
.community-section {
  background: var(--gradient-hero);
  padding: 80px 0;
}

.community-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 48px;
  max-width: 900px;
  margin: 0 auto;
}

.community-content .section-title {
  text-align: left;
}

.community-content p {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 1.1rem;
}

.community-illustration img {
  max-width: 280px;
  height: auto;
}

@media (max-width: 768px) {
  .community-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .community-content .section-title {
    text-align: center;
  }
  .community-illustration {
    order: -1;
  }
}

/* ========== Newsletter ========== */
.newsletter-section {
  padding: 80px 0;
  background: var(--bg-soft);
}

.newsletter-box {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  background: var(--surface);
  padding: 48px;
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.newsletter-box .section-title {
  margin-bottom: 8px;
}

.newsletter-box p {
  color: var(--text-muted);
  margin-bottom: 28px;
}

.newsletter-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.newsletter-form input {
  flex: 1;
  min-width: 220px;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.newsletter-form input::placeholder {
  color: var(--text-muted);
}

.newsletter-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* ========== Footer ========== */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.footer-brand .logo {
  margin-bottom: 12px;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-brand .tagline {
  margin-top: 4px;
  font-style: italic;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: var(--text-muted);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--primary);
}

@media (max-width: 600px) {
  .footer-grid {
    flex-direction: column;
    text-align: center;
  }
}
