@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Crimson+Pro:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Caveat:wght@400;500;600;700&family=Patrick+Hand&family=Bubblegum+Sans&family=Indie+Flower&family=Comic+Neue:wght@400;700&family=Quicksand:wght@400;500;600&family=Gaegu:wght@400;700&family=Gloria+Hallelujah&family=Schoolbell&family=Shadows+Into+Light&family=Architects+Daughter&family=Amatic+SC:wght@400;700&family=Bangers&family=Luckiest+Guy&family=Chewy&family=Permanent+Marker&display=swap');

:root {
  --cream: #fdf6e3;
  --warm-white: #fefaf4;
  --parchment: #f5ead6;
  --tan: #e8d5b7;
  --brown-light: #c4a882;
  --brown: #8b6f47;
  --brown-dark: #5a4530;
  --text: #3a2a1a;
  --text-soft: #7a6a5a;
  --accent: #e8734a;
  --accent-hover: #d4623b;
  --accent-soft: #f4a67a;
  --sage: #8faa7b;
  --sage-soft: #d4e4cc;
  --sky: #7ba4c4;
  --sky-soft: #d4e4f0;
  --rose: #c47b8a;
  --rose-soft: #f0d4da;
  --violet: #9b8abf;
  --violet-soft: #e0d6f0;
  --shadow: rgba(90, 69, 48, 0.08);
  --shadow-md: rgba(90, 69, 48, 0.12);
  --danger: #d94f4f;
  --success: #4f9a5f;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--warm-white);
  color: var(--text);
  font-family: 'Crimson Pro', Georgia, serif;
  line-height: 1.6;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.018'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ── Animations ───────────────────── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-8px); } }
.fade-up { animation: fadeUp 0.8s ease both; }
.fade-up-1 { animation-delay: 0.1s; }
.fade-up-2 { animation-delay: 0.25s; }
.fade-up-3 { animation-delay: 0.4s; }
.fade-up-4 { animation-delay: 0.55s; }

/* ── Nav ──────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(253, 246, 227, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(200, 180, 150, 0.2);
  padding: 0 clamp(20px, 5vw, 60px);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font-family: 'Fredoka', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--brown-dark);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(232, 115, 74, 0.25);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}
.nav-links a {
  font-family: 'Fredoka', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-soft);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--accent); }
.nav-links a.active { color: var(--accent); }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 101;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--brown-dark);
  border-radius: 2px;
  transition: all 0.25s;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ── Buttons ──────────────────────── */
.btn {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 50px;
}
.btn-primary {
  background: var(--accent);
  color: white;
  padding: 10px 24px;
  font-size: 14px;
  box-shadow: 0 2px 12px rgba(232, 115, 74, 0.25);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(232, 115, 74, 0.35);
}
.btn-ghost {
  background: transparent;
  color: var(--brown);
  padding: 10px 20px;
  font-size: 14px;
  border: 1.5px solid var(--tan);
}
.btn-ghost:hover {
  border-color: var(--accent-soft);
  color: var(--accent);
}
.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }

/* ── Section ──────────────────────── */
section {
  position: relative;
  z-index: 1;
  padding: clamp(40px, 6vw, 80px) clamp(20px, 5vw, 60px);
}
.section-inner { max-width: 1200px; margin: 0 auto; }
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(22px, 3.5vw, 32px);
  font-weight: 700;
  color: var(--brown-dark);
}
.section-link {
  font-family: 'Fredoka', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.section-link:hover { text-decoration: underline; }

/* ── Book Cards ───────────────────── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}
.book-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 16px var(--shadow);
  transition: all 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px var(--shadow-md);
}
.book-cover {
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.book-cover::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(transparent, rgba(0,0,0,0.04));
  pointer-events: none;
}
.book-cover .age-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: 'Fredoka', sans-serif;
  font-size: 10px;
  font-weight: 600;
  background: rgba(255,255,255,0.9);
  color: var(--brown);
  padding: 3px 8px;
  border-radius: 50px;
}
.book-card-body { padding: 16px 18px 18px; }
.book-card-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--brown-dark);
  margin-bottom: 4px;
  line-height: 1.3;
}
.book-card-author {
  font-family: 'Caveat', cursive;
  font-size: 15px;
  color: var(--accent);
  margin-bottom: 8px;
}
.book-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-soft);
  font-family: 'Fredoka', sans-serif;
}
.book-card-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}
.book-card-tags { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.mini-tag {
  font-family: 'Fredoka', sans-serif;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 50px;
  background: var(--parchment);
  color: var(--brown);
}

/* ── Featured Cards ───────────────── */
.featured-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.featured-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 24px var(--shadow-md);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}
.featured-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(90, 69, 48, 0.15); }
.featured-cover { aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; font-size: 72px; position: relative; }
.featured-badge {
  position: absolute;
  top: 14px; left: 14px;
  font-family: 'Fredoka', sans-serif;
  font-size: 11px; font-weight: 600;
  color: white;
  background: var(--accent);
  padding: 4px 12px;
  border-radius: 50px;
  box-shadow: 0 2px 8px rgba(232, 115, 74, 0.3);
}
.featured-body { padding: 24px; flex: 1; }
.featured-title { font-family: 'Fredoka', sans-serif; font-size: 22px; font-weight: 700; color: var(--brown-dark); margin-bottom: 6px; }
.featured-author { font-family: 'Caveat', cursive; font-size: 18px; color: var(--accent); margin-bottom: 10px; }
.featured-desc { font-size: 15px; color: var(--text-soft); font-weight: 300; line-height: 1.6; }

/* ── Categories ───────────────────── */
.categories { display: flex; gap: 8px; flex-wrap: wrap; }
.category-tag {
  font-family: 'Fredoka', sans-serif;
  font-size: 13px; font-weight: 500;
  padding: 8px 18px;
  border-radius: 50px;
  border: 1.5px solid var(--tan);
  background: white;
  color: var(--brown);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.category-tag:hover { border-color: var(--accent-soft); color: var(--accent); }
.category-tag.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ── Forms ────────────────────────── */
label.form-label {
  display: block;
  font-family: 'Fredoka', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--tan);
  border-radius: 10px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 16px;
  color: var(--text);
  background: white;
  transition: border-color 0.2s;
  outline: none;
}
.form-input:focus {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(232, 115, 74, 0.08);
}
.form-field { margin-bottom: 16px; }
.form-error {
  font-family: 'Fredoka', sans-serif;
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.alert {
  padding: 12px 18px;
  border-radius: 10px;
  font-family: 'Fredoka', sans-serif;
  font-size: 14px;
  margin-bottom: 20px;
}
.alert-error { background: #fce8e8; color: var(--danger); border: 1px solid #f0c4c4; }
.alert-success { background: #e8f8ec; color: var(--success); border: 1px solid #c4e8cc; }

/* ── Page container ───────────────── */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(20px, 5vw, 60px);
  position: relative;
  z-index: 1;
}

/* ── Footer ───────────────────────── */
footer {
  background: var(--brown-dark);
  color: rgba(255,255,255,0.6);
  padding: 40px clamp(20px, 5vw, 60px);
  position: relative;
  z-index: 1;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-logo {
  font-family: 'Fredoka', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
}
.footer-links { display: flex; gap: 24px; }
.footer-links a {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-family: 'Fredoka', sans-serif;
  font-size: 13px;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--accent-soft); }
.footer-note {
  width: 100%;
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  font-family: 'Fredoka', sans-serif;
}

/* ── Toast ────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--brown-dark);
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: 50px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
  z-index: 200;
  transition: transform 0.3s ease;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Responsive ───────────────────── */
@media (max-width: 900px) {
  .featured-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .featured-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
  .hamburger { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(253, 246, 227, 0.97);
    backdrop-filter: blur(16px);
    flex-direction: column;
    padding: 16px 24px 20px;
    gap: 4px;
    border-bottom: 1px solid rgba(200, 180, 150, 0.2);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 0; font-size: 16px; border-bottom: 1px solid rgba(200,180,150,.1); }
  .nav-links a:last-child { border-bottom: none; }
  .nav-links .btn { margin-top: 8px; text-align: center; justify-content: center; }
}
