/* Kartu buku (x-book-card) di beranda, Etalase, dan "Buku lainnya": gaya toko buku digital mode terang —
   panggung sampul abu muda (kategori + label), buku 3D dari CSS, lalu judul, penulis, harga, dan ketersediaan.
   Tanpa gambar/library tambahan; gerak hanya saat disorot (mati untuk prefers-reduced-motion). */
.book-tile { display: flex; min-width: 0; flex-direction: column; }

.book-tile-stage { position: relative; isolation: isolate; display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 5; padding: 3.25rem .9rem 3.4rem; overflow: hidden; background: #f6f6f6; color: inherit; }
.book-tile-stage:focus-visible { outline: 3px solid var(--fm-primary-600, #22396f); outline-offset: 2px; }
.book-tile-top { position: absolute; z-index: 3; top: .65rem; right: .9rem; left: .9rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: .6rem; }
.book-tile-category { overflow: hidden; color: #404040; font-size: .69rem; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.book-tile-badge { display: inline-flex; align-items: center; gap: .25rem; padding: .08rem .45rem; border-radius: 4px; background: #fde047; color: #000; font-size: .62rem; font-weight: 700; line-height: 1.5; text-transform: uppercase; white-space: nowrap; }
.book-tile-badge i { font-size: .55rem; }

/* Buku 3D (kertas A5 148x210): muka depan, tebal halaman di sisi kanan, sampul belakang. Tegak menghadap depan;
   saat disorot (atau .is-3d-active di layar sentuh) menoleh ke kiri sehingga tebal halamannya terlihat. */
.book-3d { --book-depth: 18px; position: relative; width: min(68%, 148px); aspect-ratio: 148 / 210; perspective: 900px; }
.book-3d.is-paperback { --book-depth: 10px; }
.book-3d-body { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateY(0deg); transition: transform .55s cubic-bezier(.2, .75, .25, 1); }
.book-3d-front, .book-3d-back { position: absolute; inset: 0; border-radius: 1px 4px 4px 1px; }
.book-3d-front { overflow: hidden; background: #e5e5e5; box-shadow: 10px 22px 26px -14px rgba(0, 0, 0, .32); transform: translateZ(calc(var(--book-depth) / 2)); }
.book-3d-front img { display: block; width: 100%; height: 100%; object-fit: cover; }
.book-3d-spine { position: absolute; inset: 0 auto 0 5px; width: 16px; border-left: 2px solid rgba(0, 0, 0, .08); background: linear-gradient(90deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0)); pointer-events: none; }
.book-3d-back { background: #2b2b2b; box-shadow: -8px 18px 30px -12px rgba(0, 0, 0, .35); transform: translateZ(calc(var(--book-depth) / -2)); }
.book-3d-pages { position: absolute; top: 3px; right: 0; bottom: 3px; width: var(--book-depth); transform-origin: right center; transform: translateZ(calc(var(--book-depth) / -2)) rotateY(90deg);
    background: linear-gradient(90deg, rgba(0, 0, 0, .12), transparent 18%, transparent 82%, rgba(0, 0, 0, .1)), repeating-linear-gradient(0deg, #fff 0 1px, #ebe6da 1px 2px); }
.book-3d.is-paperback .book-3d-pages { top: 1px; bottom: 1px; }
.book-3d.is-paperback .book-3d-front, .book-3d.is-paperback .book-3d-back { border-radius: 1px 2px 2px 1px; }
.book-tile:hover .book-3d-body, .book-tile-stage:focus-visible .book-3d-body, .book-3d.is-3d-active .book-3d-body { transform: rotateY(-34deg) scale(1.04); }

/* Foto/render buku (aset katalog bawaan & gaya "Mockup 3D siap pakai"): tampil apa adanya, latar fotonya
   dibaurkan ke panggung (multiply) dan tepinya dipudarkan. Aset katalog diperbesar ke area bukunya. */
.book-render { position: relative; display: block; width: 100%; height: 100%; min-height: 0; align-self: stretch; }
.book-render img { display: block; width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; transition: transform .3s ease;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent), linear-gradient(transparent, #000 9%, #000 91%, transparent); -webkit-mask-composite: source-in;
    mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent), linear-gradient(transparent, #000 9%, #000 91%, transparent); mask-composite: intersect; }
.book-render.is-catalog-art img { object-fit: cover; }
.book-tile:hover .book-render img, .book-tile-stage:focus-visible .book-render img { transform: scale(1.08); }

.book-tile-body { display: flex; flex-direction: column; gap: .45rem; padding-top: .75rem; }
.book-tile-title { display: -webkit-box; min-height: 2.5em; margin: 0; overflow: hidden; color: #171717; font-size: .95rem; font-weight: 600; line-height: 1.25; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.book-tile-title a { color: inherit; }
.book-tile-title a:hover { color: var(--fm-primary-700, #22396f); }
.book-tile-author { display: flex; min-width: 0; align-items: center; gap: .5rem; margin: 0; color: #525252; font-size: .84rem; }
.book-tile-avatar { display: grid; flex: 0 0 22px; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: #fcf1d0; color: #22396f; font-size: .66rem; font-weight: 700; }
.book-tile-author-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-tile-price { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.book-tile-price > span { display: flex; min-width: 0; flex-wrap: wrap; align-items: baseline; gap: 0 .35rem; }
.book-tile-price strong { color: #171717; font-size: .95rem; }
.book-tile-price del { color: #a3a3a3; font-size: .72rem; }
.book-tile-price small { color: #b42318; font-size: .68rem; font-weight: 700; }
.book-tile-order { display: inline-flex; flex: 0 0 auto; align-items: center; gap: .3rem; padding: .32rem .55rem; border-radius: 8px; background: #22396f; color: #fff; font-size: .72rem; font-weight: 600; }
.book-tile-order:hover { background: #010736; color: #fff; }
.book-tile-order span { display: none; }
.book-tile-availability { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; margin: 0; color: #404040; font-size: .78rem; }
.book-tile-availability span { display: inline-flex; align-items: center; gap: .25rem; color: #171717; font-weight: 600; }
.book-tile-availability i { color: #a57422; }

@media (min-width: 576px) {
    .book-tile-order span { display: inline; }
}

/* Smartphone tanpa hover: buku yang berada dekat pusat layar melakukan satu gerakan
   "peek" lalu diam sedikit miring. Desktop tetap memakai hover yang sudah ada. */
@keyframes book-mobile-peek {
    0% { transform: rotateY(0deg) scale(1); }
    40% { transform: rotateY(-37deg) scale(1.045); }
    62% { transform: rotateY(-19deg) scale(1.02); }
    78% { transform: rotateY(-25deg) scale(1.03); }
    100% { transform: rotateY(-21deg) scale(1.025); }
}
@media (max-width: 767.98px) and (hover: none), (max-width: 767.98px) and (pointer: coarse) {
    .book-3d.is-mobile-preview .book-3d-body {
        transform: rotateY(-21deg) scale(1.025);
        animation: book-mobile-peek .88s cubic-bezier(.2, .78, .24, 1) both;
    }
    .book-3d.is-mobile-preview .book-3d-front { box-shadow: 14px 23px 29px -13px rgba(0, 0, 0, .38); }
}

@media (prefers-reduced-motion: reduce) {
    .book-3d-body, .book-render img { transition: none; }
    .book-tile:hover .book-3d-body, .book-tile-stage:focus-visible .book-3d-body, .book-3d.is-3d-active .book-3d-body { transform: rotateY(-20deg); }
    .book-3d.is-mobile-preview .book-3d-body { animation: none; transform: none; }
    .book-tile:hover .book-render img, .book-tile-stage:focus-visible .book-render img { transform: none; }
}
