/* v30: kaydırınca canlanan sayfa, paket yolu aracı, fiyat düşüş parlaması, ayraç, kitap sırtı iskeleti, kedi.
   Hareketlerin tümü prefers-reduced-motion: no-preference altında; destek yoksa sayfa olduğu gibi görünür. */

/* ---------- 1) Ana sayfa sahnesi: kaydırınca katmanlar farklı hızda kayar (JS --hs-p: -1..1) ---------- */
.hero-scene { --hs-p: 0; }
@media (prefers-reduced-motion: no-preference) {
  .hero-scene .hs-street, .hero-scene .hs-night { translate: 0 calc(var(--hs-p) * -7px); }                  /* uzak katman geride kalır */
  .hero-scene .hs-lamp, .hero-scene .hs-bell { translate: 0 calc(var(--hs-p) * 5px); }                      /* orta katman */
  .hero-scene .hs-cat, .hero-scene .hs-visitor, .hero-scene .hs-reader, .hero-scene .hs-courier,
  .hero-scene .hs-fbox, .hero-scene .hs-bird { translate: 0 calc(var(--hs-p) * 9px); }                      /* ön katman hızlı */
}

/* ---------- 2) Bölümler kaydırdıkça açılır, kartlar rafa dizilir (scroll-driven animations; yoksa görünür kalır) ---------- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .ss-selection, .sifir-band, .today-page, .weekly-shop, .wk-wanted, .ig-band, .vitrin-shop, .new-shop {
      animation: v82Reveal linear both; animation-timeline: view(); animation-range: entry 0% entry 45%;
    }
    main:has(.hero-scene) .card { animation: v82Pile linear both; animation-timeline: view(); animation-range: entry 5% entry 70%; }
    main:has(.hero-scene) .card:nth-child(4n+2) { animation-range: entry 12% entry 76%; }
    main:has(.hero-scene) .card:nth-child(4n+3) { animation-range: entry 19% entry 82%; }
    main:has(.hero-scene) .card:nth-child(4n) { animation-range: entry 26% entry 88%; }
  }
}
@keyframes v82Reveal { from { opacity: 0; translate: 0 34px; } to { opacity: 1; translate: 0 0; } }
@keyframes v82Pile { from { opacity: 0; translate: 0 26px; scale: .96; } to { opacity: 1; translate: 0 0; scale: 1; } }

/* ---------- 3) İlan kapağı: Ken Burns (çok yavaş yaklaşıp kayar; üzerine gelince durur) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .book-gallery .gallery-main img[data-gallery-main] { animation: v82KB 26s ease-in-out infinite alternate; }
  .book-gallery .gallery-main:hover img[data-gallery-main], .book-gallery .gallery-main:focus-visible img[data-gallery-main] { animation-play-state: paused; }
}
@keyframes v82KB { from { scale: 1; translate: 0 0; } to { scale: 1.035; translate: -.6% -.8%; } }

/* ---------- 4) Raftaki kitap sırtı: öne çıkar, kapağı belirir ---------- */
@media (prefers-reduced-motion: no-preference) {
  .spine:hover, .spine:focus-visible { translate: 0 -2px; scale: 1.08; z-index: 3; box-shadow: inset -2px 0 3px rgba(0, 0, 0, .28), 0 10px 18px -6px rgba(0, 0, 0, .55); }
}
.v82-peek { position: fixed; z-index: 1400; width: 138px; padding: 6px 6px 8px; border-radius: 4px; background: var(--paper, #fff); color: var(--ink, #2a1a10);
  box-shadow: 0 14px 28px -8px rgba(0, 0, 0, .5); border: 1px solid var(--line, #d8c8a8); pointer-events: none; opacity: 0; transform: translateY(8px) scale(.94); transition: opacity .16s ease, transform .16s ease; }
.v82-peek.on { opacity: 1; transform: none; }
.v82-peek img { display: block; width: 100%; height: 170px; object-fit: cover; border-radius: 2px; background: #e8dcc2; }
.v82-peek b { display: block; margin-top: 6px; font: 600 .78rem/1.2 var(--serif, serif); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.v82-peek span { display: block; margin-top: 2px; font-size: .74rem; color: var(--muted, #7a6a55); }

/* ---------- 5) Paket yolu: araç sipariş aşamasına kadar yol alır (aşama bilgisidir, anlık konum değil) ---------- */
.pkg-road::after { content: ""; position: absolute; top: -18px; left: calc((var(--pk-stage, 1) - .5) * 25%); width: 30px; height: 20px; margin-left: -15px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 22' fill='none' stroke='%23a8241a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3h18v13H2zM20 7h7l5 5v4H20z'/%3E%3Ccircle cx='9' cy='18' r='2.4' fill='%23fff'/%3E%3Ccircle cx='26' cy='18' r='2.4' fill='%23fff'/%3E%3C/svg%3E") center / contain no-repeat; }
.pkg-road.st1::after { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .pkg-road::after { animation: v82Van 1.9s cubic-bezier(.45, .05, .35, 1) .35s both, v82VanBob .4s ease-in-out .35s 5; }
}
@keyframes v82Van { from { left: 12.5%; } to { left: calc((var(--pk-stage, 1) - .5) * 25%); } }
@keyframes v82VanBob { 50% { translate: 0 -1.5px; } }

/* ---------- 6) Fiyat düşünce "↓" parlar ---------- */
.badge.sale::before { content: "↓"; display: inline-block; margin-right: 3px; font-weight: 800; }
@media (prefers-reduced-motion: no-preference) {
  .badge.sale::before { animation: v82Arrow 1.3s ease-out 1; }
  .sale-line .badge.sale { animation: v82Glow 1.8s ease-out 2; }
}
@keyframes v82Arrow { 0% { translate: 0 -7px; opacity: 0; text-shadow: none; } 40% { translate: 0 1px; opacity: 1; text-shadow: 0 0 10px #ffd27a, 0 0 18px #ff8a3d; } 100% { translate: 0 0; text-shadow: none; } }
@keyframes v82Glow { 0% { box-shadow: 0 0 0 0 rgba(255, 138, 61, .0); } 35% { box-shadow: 0 0 0 5px rgba(255, 138, 61, .35), 0 0 18px rgba(255, 190, 90, .65); } 100% { box-shadow: 0 0 0 0 rgba(255, 138, 61, 0); } }

/* ---------- 7) Favori: kalp yerine ayraç, üzerine gelince kıvrılır ---------- */
.v82-ayrac { display: inline-block; width: 12px; height: 17px; margin-right: 8px; vertical-align: -3px; background: currentColor; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%); transform-origin: 50% 0; }
.v82-fav[data-fav="rem"] .v82-ayrac { background: var(--accent-fill, #a8241a); }
@media (prefers-reduced-motion: no-preference) {
  .v82-fav:hover .v82-ayrac { animation: v82Curl .55s ease-out; }
  .v75-mark.drop button { animation: v82CardCurl .8s cubic-bezier(.3, 1.2, .5, 1); transform-origin: 50% 0; }
}
@keyframes v82Curl { 0% { transform: none; } 30% { transform: scaleY(.7) skewX(-10deg); } 65% { transform: scaleY(1.1) skewX(6deg); } 100% { transform: none; } }
@keyframes v82CardCurl { 0% { transform: scaleY(.12) translateY(-12px) rotate(-12deg); } 35% { transform: scaleY(.6) skewX(-9deg) rotate(6deg); } 65% { transform: scaleY(1.08) skewX(5deg) rotate(-4deg); } 100% { transform: none; } }

/* ---------- 8) Sayfa yüklenirken kitap sırtlarından iskelet ---------- */
.v82-loader { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1500; height: 74px; display: flex; align-items: flex-end; justify-content: center; gap: 4px; padding: 0 10px 8px;
  pointer-events: none; background: linear-gradient(transparent, rgba(42, 26, 16, .22)); opacity: 0; transition: opacity .2s ease; }
.v82-loader.on { opacity: 1; }
.v82-loader i { display: block; width: 14px; height: var(--h); border-radius: 2px 2px 0 0; background: var(--c); opacity: .85; transform-origin: 50% 100%; animation: v82Rise 1s ease-in-out infinite; animation-delay: var(--d); }
@keyframes v82Rise { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

/* ---------- 9) Boş sonuç: kedi aranan kitabın boşluğuna yürür ---------- */
.v82-shelfwrap { position: relative; width: min(420px, 90%); margin: 0 auto; }
.v82-shelfwrap .v75-shelf { width: 100%; }
.v82-cat { position: absolute; bottom: 10px; left: 0; width: 56px; height: 39px; pointer-events: none; }
.v82-qpaw { position: absolute; left: 47%; bottom: 10px; width: 8px; height: 22px; border-radius: 4px 4px 0 0; background: #d9822b; transform-origin: 50% 100%; opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .v82-cat { animation: v82CatWalk 12s ease-in-out infinite; }
  .v82-cat-bob { animation: v82CatBob .4s ease-in-out 8; transform-box: fill-box; transform-origin: 50% 100%; }
  .v82-cat-head { animation: v82CatLook 12s ease-in-out infinite; transform-box: fill-box; transform-origin: 70% 90%; }
  .v82-tail { animation: v82Tail 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 0 100%; }
  .v82-qpaw { animation: v82Paw 12s ease-in-out infinite; }
}
@media (prefers-reduced-motion: reduce) { .v82-cat { left: 38%; } }
@keyframes v82CatWalk { 0% { left: -4%; opacity: 0; } 4% { opacity: 1; } 28% { left: 37%; } 86% { left: 37%; opacity: 1; } 96% { left: 37%; opacity: 0; } 100% { left: -4%; opacity: 0; } }
@keyframes v82CatBob { 50% { translate: 0 -2px; } }
@keyframes v82CatLook { 0%, 28% { rotate: 0deg; } 36%, 52% { rotate: -14deg; } 60%, 74% { rotate: 6deg; } 84%, 100% { rotate: 0deg; } }
@keyframes v82Tail { 50% { rotate: 14deg; } }
@keyframes v82Paw { 0%, 54% { opacity: 0; transform: translateY(12px); } 60%, 70% { opacity: 1; transform: translateY(-6px) rotate(8deg); } 76%, 100% { opacity: 0; transform: translateY(12px); } }

/* ===== v31: nadir eser vitrini (2-3 kitap sırayla) + YENİ etiketi ===== */
.hs-vitrin[data-vn]:not([data-vi="0"]) { visibility: hidden; }
.hs-newtag { pointer-events: none; transform-box: fill-box; }
@media (prefers-reduced-motion: no-preference) {
  .hs-vitrin[data-vn] { animation-duration: 16s; animation-iteration-count: infinite; animation-timing-function: linear; animation-name: v82Vit2; }
  .hs-vitrin[data-vn="3"] { animation-duration: 24s; animation-name: v82Vit3; }
  .hs-newtag { animation: v82Tag 2.6s ease-in-out infinite; }
}
@keyframes v82Vit2 { 0% { opacity: 0; visibility: visible; } 3%, 47% { opacity: 1; visibility: visible; } 50%, 100% { opacity: 0; visibility: hidden; } }
@keyframes v82Vit3 { 0% { opacity: 0; visibility: visible; } 2%, 31% { opacity: 1; visibility: visible; } 33.4%, 100% { opacity: 0; visibility: hidden; } }
@keyframes v82Tag { 0%, 100% { translate: 0 0; } 50% { translate: 0 -2px; } }
