@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #0f172a;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e6e9f0;
  --accent: #4338ca;
  --accent-hover: #362da3;
  --accent-soft: #eef0ff;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 28px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */

.site-header {
  background: var(--ink);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
}

/* Hero */

.hero {
  background:
    radial-gradient(80% 140% at 15% 0%, rgba(99, 102, 241, 0.35), transparent 60%),
    radial-gradient(60% 120% at 90% 10%, rgba(168, 85, 247, 0.28), transparent 60%),
    var(--ink);
  color: #fff;
  padding: 64px 0 88px;
  text-align: center;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.35);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.85rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  max-width: 720px;
  margin-inline: auto;
}

.hero p {
  color: #cbd5e1;
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 32px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 36px;
}

.hero-stat {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 14px 22px;
  min-width: 140px;
}

.hero-stat strong {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
}

.hero-stat span {
  display: block;
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 2px;
}

/* Content */

main.container {
  padding-top: 0;
  padding-bottom: 72px;
}

.toolbar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  margin-top: -48px;
  margin-bottom: 40px;
  position: relative;
  z-index: 2;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.search-form {
  flex: 1 1 260px;
  display: flex;
  position: relative;
}

.search-form::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  background: var(--text-muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 21l-4.35-4.35m1.85-5.15a7 7 0 11-14 0 7 7 0 0114 0z' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 21l-4.35-4.35m1.85-5.15a7 7 0 11-14 0 7 7 0 0114 0z' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 13px 16px 13px 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--text);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-chip {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.category-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.category-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.section-heading h2 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}

.section-heading span {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.ebook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 24px;
}

.ebook-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.ebook-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
  border-color: #d6d9f5;
}

.cover-link {
  display: block;
  aspect-ratio: 3 / 4;
  background: var(--bg);
  position: relative;
}

.cover-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0) 55%, rgba(15, 23, 42, 0.55) 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 14px;
}

.ebook-card:hover .cover-overlay {
  opacity: 1;
}

.cover-overlay span {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 6px 14px;
  border-radius: 999px;
  backdrop-filter: blur(2px);
}

.ebook-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.ebook-category {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 700;
}

.ebook-title {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.ebook-author {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.ebook-description {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  flex: 1;
}

.download-btn {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 11px 16px;
  border-radius: 9px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.download-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 64px 0;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.footer-inner strong {
  color: var(--ink);
}

@media (max-width: 600px) {
  .hero {
    padding: 48px 0 72px;
  }

  .toolbar-card {
    margin-top: -36px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b0e17;
    --surface: #131826;
    --ink: #f8fafc;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #232b3d;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: rgba(129, 140, 248, 0.16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.55);
  }

  .site-header,
  .hero {
    background: #060810;
  }

  .download-btn {
    color: #0b0e17;
  }
}
