:root {
  --yellow: #F5A800;
  --navy:   #1B3A8C;
  --navy-d: #0F2660;
  --white:  #fff;
  --bg:     #F2F5FB;
  --muted:  #8391A8;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--navy); }

/* ── HERO FLIP BOOK ── */
.hero-book {
  position: absolute;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}
.flip-book {
  width: 72px;
  height: 96px;
  position: relative;
  perspective: 220px;
}
.fb-back {
  position: absolute;
  inset: 0;
  background: var(--navy);
  border-radius: 2px 5px 5px 2px;
  box-shadow: -3px 4px 10px rgba(0,0,0,.22);
}
.fb-spine {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 10px;
  background: var(--navy-d);
  border-radius: 2px 0 0 2px;
  z-index: 10;
}
.fb-accent {
  position: absolute;
  top: 10px; left: 14px;
  right: 6px; bottom: 10px;
  background: rgba(255,255,255,.55);
  border-radius: 2px;
}
.fb-page {
  position: absolute;
  top: 4px; bottom: 4px;
  left: 10px; right: 4px;
  border-radius: 0 5px 5px 0;
  transform-origin: left center;
  animation: fbFlip 2.8s ease-in-out infinite;
  box-shadow: 1px 0 4px rgba(0,0,0,.12);
}
.fb-page:nth-child(4) { background: #fff;    animation-delay: 0s;     z-index: 3; }
.fb-page:nth-child(5) { background: #f3f3ef; animation-delay: 0.55s;  z-index: 2; }
.fb-page:nth-child(6) { background: #e7e7e3; animation-delay: 1.1s;   z-index: 1; }

@keyframes fbFlip {
  0%   { transform: rotateY(0deg);    }
  38%  { transform: rotateY(-168deg); }
  62%  { transform: rotateY(-168deg); }
  100% { transform: rotateY(0deg);    }
}

/* ── HEADER ── */
.site-header {
  background: var(--navy);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(15,38,96,.35);
}
.logo      { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.logo-mark {
  width: 38px; height: 38px;
  background: var(--yellow);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.logo-mark svg { width: 22px; height: 22px; fill: var(--navy); }
.logo-text { font-size: 22px; font-weight: 900; letter-spacing: .4px; color: var(--yellow); line-height: 1; }
.logo-sub  { font-size: 10px; color: rgba(255,255,255,.4); letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px; }
.header-tag { color: rgba(255,255,255,.4); font-size: 12px; letter-spacing: .5px; }

/* ── HERO ── */
.hero {
  background: var(--yellow);
  padding: 44px 32px 40px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; right: -80px; top: -60px;
  width: 320px; height: 320px;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
}
.hero::after {
  content: '';
  position: absolute; right: 80px; bottom: -100px;
  width: 200px; height: 200px;
  background: rgba(27,58,140,.08);
  border-radius: 50%;
}
.hero-brand {
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 900;
  color: var(--navy);
  letter-spacing: -1px;
  line-height: 1;
  position: relative; z-index: 1;
}
.hero-brand em {
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--navy-d);
  opacity: .8;
}
.hero-tagline {
  margin-top: 10px;
  font-size: clamp(12px, 1.6vw, 17px);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--navy-d);
  opacity: .6;
  position: relative; z-index: 1;
}

/* ── FILTER BAR ── */
.filter-bar {
  background: var(--white);
  padding: 14px 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid rgba(27,58,140,.08);
  position: sticky;
  top: 64px;
  z-index: 90;
  box-shadow: 0 2px 8px rgba(27,58,140,.06);
}
.filter-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted);
  margin-right: 4px;
}
.pill {
  padding: 6px 16px;
  border-radius: 20px;
  border: 2px solid transparent;
  background: var(--bg);
  color: var(--navy);
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s, transform .15s;
  user-select: none;
}
.pill:hover  { border-color: var(--yellow); background: var(--yellow); color: var(--navy); }
.pill.active { background: var(--navy); color: var(--white); border-color: var(--navy); }
.pill:active { transform: scale(.96); }

/* ── FILTER SELECT (mobile) ── */
.filter-select {
  display: none;
  flex: 1;
  padding: 10px 40px 10px 16px;
  font-size: 14px; font-weight: 700;
  font-family: inherit;
  color: var(--navy);
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231B3A8C' stroke-width='2.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  border: 2px solid rgba(27,58,140,.18);
  border-radius: 24px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s;
}
.filter-select:focus {
  outline: none;
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(245,168,0,.2);
}

/* ── GRID ── */
.grid-wrap { padding: 32px 32px 56px; }
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 28px;
}

/* ── BOOK CARD ── */
.book {
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  animation: enterCard .55s cubic-bezier(.34, 1.2, .64, 1) backwards;
}
.cover {
  position: relative;
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: -5px 5px 0 rgba(0,0,0,.13);
  transition: transform .32s cubic-bezier(.34, 1.56, .64, 1), box-shadow .32s ease;
  background: var(--navy);
}
.cover img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform .32s cubic-bezier(.34, 1.56, .64, 1);
}
.cover-read {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(15,38,96,.88);
  color: var(--white);
  font-size: 11px; font-weight: 800;
  letter-spacing: 1px; text-transform: uppercase;
  text-align: center;
  padding: 11px 8px;
  transform: translateY(100%);
  transition: transform .25s cubic-bezier(.34, 1.2, .64, 1);
}
.book:hover .cover         { transform: translateX(5px) translateY(-4px) scale(1.04); box-shadow: -9px 11px 0 rgba(0,0,0,.17); }
.book:hover .cover-read    { transform: translateY(0); }
.book:hover .cover img     { transform: scale(1.04); }
.book-meta                 { padding: 11px 4px 0; }
.book-class-badge {
  font-size: 9px; font-weight: 800;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--yellow); background: var(--navy);
  display: inline-block;
  padding: 2px 8px; border-radius: 4px;
  margin-bottom: 6px;
}
.book-title { font-size: 13px; font-weight: 700; color: var(--navy); line-height: 1.35; }
.book-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 500; }

@keyframes enterCard {
  from { opacity: 0; transform: translateY(24px) scale(.94); }
  to   { opacity: 1; transform: none; }
}

/* ── EMPTY ── */
.empty { grid-column: 1 / -1; text-align: center; padding: 72px 20px; color: var(--muted); }
.empty p { font-size: 15px; font-weight: 600; }

/* ── FOOTER ── */
.site-footer {
  text-align: center;
  padding: 28px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid rgba(27,58,140,.07);
}
.site-footer strong { color: var(--navy); }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .hero-book { right: 20px; }
  .flip-book { width: 52px; height: 70px; }

  .site-header, .hero, .filter-bar, .grid-wrap { padding-left: 16px; padding-right: 16px; }
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px; }
  .filter-bar  { padding-top: 12px; padding-bottom: 12px; gap: 0; }
  .filter-label, .pill { display: none; }
  .filter-select { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .book, .cover, .pill, .fb-page { animation: none !important; transition: none !important; }
}
