/* =========================================================
   Books & Cloud — Mobile-only extras
   v10 MFD: bottom nav bar, quick-add overlay, scroll-rail polish
   =========================================================
   Rendered only on phones (≤900px). Hidden on tablet/desktop.
   ========================================================= */

.bottom-nav,
.book-card .quick-add { display: none; } /* default OFF */

@media (max-width: 900px) {

  /* ---- Bottom nav bar — app-style primary jumps ---- */
  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 64px;
    background: var(--cream);
    border-top: 1px solid var(--hairline);
    z-index: 95; /* below cart drawer (200) + nav drawer (100) */
    align-items: stretch;
    justify-content: space-around;
    box-shadow: 0 -2px 18px rgba(28, 27, 24, 0.05);
    /* iOS safe-area handled by the @supports block in responsive.css */
  }
  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    color: var(--brown-2);
    text-decoration: none;
    font-family: var(--sans);
    font-size: 0.6rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px; /* enforces touch target */
    padding: 6px 4px 8px;
  }
  .bottom-nav a svg {
    width: 22px; height: 22px;
    stroke: currentColor; fill: none;
    stroke-width: 1.5;
  }
  .bottom-nav a:hover,
  .bottom-nav a:active,
  .bottom-nav a:focus-visible { color: var(--green); }
  .bottom-nav a.is-active { color: var(--green); position: relative; }
  .bottom-nav a.is-active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 30%; right: 30%;
    height: 2px;
    background: var(--gold);
  }
  .bottom-nav a.is-active svg { stroke: var(--green); }

  /* Hide bottom nav while a drawer is open (so users see the drawer fully) */
  body.nav-open .bottom-nav,
  body:has(.cart-drawer.open) .bottom-nav { display: none !important; }

  /* ---- Quick-add button on each book card ----
     Floats over the cover so users can add to cart from the grid
     without having to tap into a detail page. */
  .book-card { position: relative; }
  .book-card .quick-add {
    display: inline-flex !important;
    position: absolute;
    top: 8px; right: 8px;
    width: 38px; height: 38px;
    align-items: center; justify-content: center;
    background: rgba(245, 239, 225, 0.92);
    border: 1px solid var(--gold);
    color: var(--green);
    cursor: pointer;
    z-index: 2;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .book-card .quick-add svg { width: 18px; height: 18px; }
  .book-card .quick-add:active {
    transform: scale(0.92);
    background: var(--gold);
    color: var(--ink);
  }
  .book-card .quick-add.added {
    background: var(--green);
    border-color: var(--green);
    color: var(--gold-2);
  }
  /* RTL — mirror to left edge */
  html[dir="rtl"] .book-card .quick-add { right: auto; left: 8px; }

  /* ---- Hero artifact: pause autoplay during touch interactions ----
     (CSS only handles the look. The JS hook is in animations.js.) */
  .artifact-frame { touch-action: pan-y; }

  /* ---- Subtle entrance animation on scroll-snapped rail items ---- */
  @media (prefers-reduced-motion: no-preference) {
    .book-grid.book-rail .book-card {
      animation: bnc-rail-in 0.6s ease both;
    }
    @keyframes bnc-rail-in {
      from { opacity: 0; transform: translateY(12px); }
      to   { opacity: 1; transform: translateY(0); }
    }
  }
}
