/* ========================================================
   e-Perpus Digital — Modern Sky Theme (v2)
   ======================================================== */

html { scroll-behavior: smooth; }
body { font-feature-settings: "cv11", "ss01"; }

/* ---------- Book card modern (glass + hover choreography) ---------- */
.book-card {
  position: relative;
  transition: transform .4s cubic-bezier(.2,.7,.2,1), box-shadow .4s ease;
  will-change: transform;
}
.book-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 30px 60px -20px rgba(14, 165, 233, 0.25),
              0 10px 25px -5px rgba(14, 165, 233, 0.1);
}
.book-cover-wrap {
  perspective: 1200px;
  overflow: hidden;
  position: relative;
}
.book-cover-wrap::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.55) 100%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.book-card:hover .book-cover-wrap::after { opacity: 1; }
.book-cover {
  transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
.book-card:hover .book-cover { transform: scale(1.08); }

/* ---------- Rank number (Netflix-style) — see enhanced version below ---------- */

/* ---------- Blob background ---------- */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  pointer-events: none;
}

/* ---------- Skeleton loading ---------- */
.skeleton {
  background: linear-gradient(110deg, rgba(14,165,233,.05) 8%, rgba(14,165,233,.14) 18%, rgba(14,165,233,.05) 33%);
  background-size: 1000px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: .75rem;
}
.dark .skeleton {
  background: linear-gradient(110deg, rgba(255,255,255,.05) 8%, rgba(255,255,255,.12) 18%, rgba(255,255,255,.05) 33%);
  background-size: 1000px 100%;
}
@keyframes shimmer { 0%{background-position:-1000px 0} 100%{background-position:1000px 0} }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(14, 165, 233, .35); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(14, 165, 233, .65); }

/* ---------- Prose ---------- */
.prose-book {
  line-height: 1.85;
  font-size: 1.05rem;
  color: inherit;
}
.prose-book p { margin: 1em 0; }
.prose-book h1, .prose-book h2, .prose-book h3 { font-family: 'Space Grotesk', sans-serif; margin-top: 1.5em; margin-bottom: .5em; font-weight: 700; letter-spacing: -0.02em; }
.prose-book h1 { font-size: 1.75rem; }
.prose-book h2 { font-size: 1.4rem; }
.prose-book h3 { font-size: 1.15rem; }
.prose-book img { max-width: 100%; border-radius: .75rem; margin: 1em 0; }
.prose-book blockquote { border-left: 4px solid #0ea5e9; padding-left: 1em; margin: 1em 0; font-style: italic; opacity: .85; }
.prose-book a { color: #0284c7; text-decoration: underline; }
.dark .prose-book a { color: #38bdf8; }
.prose-book ul, .prose-book ol { padding-left: 1.5em; margin: 1em 0; }
.prose-book li { margin: .35em 0; }
@media (max-width: 640px) {
  .prose-book { font-size: 1rem; line-height: 1.75; }
  .prose-book h1 { font-size: 1.5rem; }
  .prose-book h2 { font-size: 1.25rem; }
}

/* ---------- Pill button ---------- */
.btn-pill {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .65rem 1.25rem; border-radius: 999px;
  font-weight: 600; font-size: .9rem;
  transition: transform .2s, box-shadow .2s, background-color .2s, color .2s;
}
.btn-pill:hover { transform: translateY(-1px); }
.btn-pill:active { transform: translateY(0); }

::selection { background: #0ea5e9; color: #fff; }

/* ---------- Slider ---------- */
.slider-track { scroll-snap-type: x mandatory; scrollbar-width: none; }
.slider-track::-webkit-scrollbar { display: none; }
.slider-track > * { scroll-snap-align: start; }

/* ---------- Fade-up (see enhanced pop-in below) ---------- */
[data-reveal] { opacity: 0; }
[data-reveal].fade-up { opacity: 1; }

/* ---------- PDF viewer & prose responsive ---------- */
iframe[data-testid="pdf-viewer"] { height: 80vh; min-height: 500px; }
@media (max-width: 640px) {
  iframe[data-testid="pdf-viewer"] { height: 70vh; min-height: 380px; }
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Focus ring ---------- */
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Gradient text (see enhanced version below with sheen animation) ---------- */

/* ---------- Category chip colors (biru dominan + 3 aksen hangat) ---------- */
.cat-chip {
  border-radius: 999px; padding: .35rem .85rem;
  font-size: .7rem; font-weight: 600; letter-spacing: .02em;
  display: inline-flex; align-items: center; gap: .25rem;
  transition: transform .25s ease, box-shadow .25s ease, filter .25s ease;
}
.cat-chip:hover { transform: translateY(-1px) scale(1.04); filter: brightness(1.08); box-shadow: 0 6px 14px -4px rgba(14,165,233,.35); }
.cat-0 { background: linear-gradient(135deg,#0ea5e9,#38bdf8); color:#fff; }
.cat-1 { background: linear-gradient(135deg,#f59e0b,#fbbf24); color:#fff; }         /* amber accent */
.cat-2 { background: linear-gradient(135deg,#0284c7,#0ea5e9); color:#fff; }
.cat-3 { background: linear-gradient(135deg,#10b981,#34d399); color:#fff; }         /* emerald accent */
.cat-4 { background: linear-gradient(135deg,#0891b2,#06b6d4); color:#fff; }
.cat-5 { background: linear-gradient(135deg,#f43f5e,#fb7185); color:#fff; }         /* rose accent */
.cat-6 { background: linear-gradient(135deg,#075985,#0369a1); color:#fff; }
.cat-7 { background: linear-gradient(135deg,#2563eb,#60a5fa); color:#fff; }

/* ---------- Book LIST item (koleksi bawah) ---------- */
.book-list-item {
  display: flex; gap: 1rem;
  padding: 1rem;
  border-radius: 1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s ease, border-color .35s ease;
}
.book-list-item::before {
  content:''; position:absolute; inset:0;
  background: radial-gradient(circle at var(--mx,50%) var(--my,0%), rgba(14,165,233,.10), transparent 60%);
  opacity:0; transition: opacity .4s ease;
  pointer-events:none;
}
.book-list-item:hover::before { opacity:1; }
.dark .book-list-item { background: #1e293b; border-color: rgba(255,255,255,.06); }
.book-list-item:hover {
  transform: translateY(-3px);
  border-color: #38bdf8;
  box-shadow: 0 18px 40px -14px rgba(14,165,233,.4);
}
.book-list-cover {
  width: 96px; height: 128px;
  border-radius: .75rem;
  overflow: hidden;
  flex-shrink: 0;
  background: #f1f5f9;
  box-shadow: 0 10px 24px -10px rgba(14,165,233,.5);
  position: relative;
}
.book-list-cover::after {
  content:''; position:absolute; inset:0;
  background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.35) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform .8s ease;
}
.book-list-item:hover .book-list-cover::after { transform: translateX(100%); }
.dark .book-list-cover { background: #0f172a; }
.book-list-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.book-list-item:hover .book-list-cover img { transform: scale(1.1) rotate(-1deg); }
@media (min-width: 640px) {
  .book-list-cover { width: 112px; height: 148px; }
}

/* ---------- Ping / Pop animations ---------- */
@keyframes pop-in {
  0%   { opacity:0; transform: translateY(14px) scale(.96); }
  60%  { opacity:1; transform: translateY(-2px) scale(1.02); }
  100% { opacity:1; transform: none; }
}
.fade-up { animation: pop-in .6s cubic-bezier(.2,.7,.2,1) both; }

@keyframes sheen {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.text-gradient {
  background: linear-gradient(90deg,#0ea5e9,#38bdf8,#f59e0b,#38bdf8,#0ea5e9);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: sheen 6s linear infinite;
}

/* ---------- Rank number recolor with amber highlight ---------- */
.rank-num {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 8rem;
  line-height: 0.85;
  letter-spacing: -0.05em;
  -webkit-text-stroke: 2px #0ea5e9;
  color: transparent;
  text-shadow: 0 0 40px rgba(14, 165, 233, 0.3);
  transition: transform .3s ease, -webkit-text-stroke-color .3s ease;
}
.dark .rank-num { -webkit-text-stroke: 2px #38bdf8; }
.book-card:hover .rank-num,
a:hover > .rank-num { -webkit-text-stroke-color: #f59e0b; transform: scale(1.05); }

/* ---------- Sparkle indicator ---------- */
.sparkle {
  position: relative; display:inline-block;
}
.sparkle::after {
  content:'✦'; position:absolute; top:-6px; right:-10px;
  color:#f59e0b; font-size:.65rem;
  animation: twinkle 1.8s ease-in-out infinite;
}
@keyframes twinkle {
  0%,100% { opacity:.35; transform: scale(.8) rotate(0deg); }
  50%     { opacity:1; transform: scale(1.2) rotate(20deg); }
}

/* ---------- Nav category link animated underline ---------- */
.nav-cat-link { position: relative; padding-bottom: 2px; }
.nav-cat-link::after {
  content:''; position:absolute; left:0; bottom:-4px;
  width:100%; height:2px;
  background: linear-gradient(90deg, #0ea5e9, #f59e0b);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.nav-cat-link:hover::after { transform: scaleX(1); }

/* ---------- Marquee bar ---------- */
.marquee-bar { position: relative; }
.marquee-bar::before,
.marquee-bar::after {
  content:''; position:absolute; top:0; bottom:0; width:60px; z-index:2;
  pointer-events:none;
}
.marquee-bar::before { left:0; background: linear-gradient(90deg, rgba(14,165,233,.9), transparent); }
.marquee-bar::after  { right:0; background: linear-gradient(-90deg, rgba(245,158,11,.9), transparent); }

/* ---------- Search input glow on focus ---------- */
input:focus, textarea:focus {
  animation: none;
}
input[name="q"] {
  transition: box-shadow .3s ease, background .3s ease;
}
input[name="q"]:focus {
  box-shadow: 0 0 0 4px rgba(14,165,233,.15), 0 8px 20px -8px rgba(14,165,233,.35);
}

/* ---------- Favorite button pop animation ---------- */
[data-fav-btn] i { transition: transform .3s cubic-bezier(.2,.7,.2,1), color .3s ease; }
[data-fav-btn]:hover i { transform: scale(1.25); color:#f43f5e; }
[data-fav-btn].is-fav i { color:#f43f5e; }
[data-fav-btn].is-fav i::before { content:"\f004"; font-family:"Font Awesome 6 Free"; font-weight:900; }
@keyframes heartbeat {
  0%,100% { transform: scale(1); }
  25%     { transform: scale(1.35); }
  50%     { transform: scale(.9); }
  75%     { transform: scale(1.15); }
}
[data-fav-btn].is-fav i { animation: heartbeat .55s ease; }

/* ---------- Bento hero card ---------- */
.bento-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  transition: transform .4s ease, box-shadow .4s ease;
}
.bento-card:hover { transform: translateY(-4px); }

/* ---------- Marquee ---------- */
.animate-marquee { animation: marquee 30s linear infinite; }
@keyframes marquee { 0%{transform:translateX(0)} 100%{transform:translateX(-50%)} }

/* ---------- Animated blob ---------- */
.animate-blob { animation: blob 14s ease-in-out infinite; }
@keyframes blob {
  0%,100% { transform:translate(0,0) scale(1); }
  33%     { transform:translate(30px,-40px) scale(1.1); }
  66%     { transform:translate(-20px,30px) scale(.95); }
}

/* ---------- Animate float ---------- */
.animate-floaty { animation: floaty 6s ease-in-out infinite; }
@keyframes floaty { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
