/**
 * PREMIUM UPGRADES — Breslev by Esther Ifrah
 * Scroll reveal, mobile polish, luxury micro-interactions
 * Claude Code EMUNAH-102 — 2026-03-18
 */

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */

/* Initial state — elements are hidden until revealed */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.12s; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.19s; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.26s; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.33s; }
.reveal-stagger.visible > *:nth-child(n+6) { transition-delay: 0.40s; }

.reveal-stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   BOOK CARDS — PREMIUM MOBILE POLISH
   ============================================ */

/* Ensure 2:3 book ratio on all screen sizes */
.book-cover-container {
  aspect-ratio: 2 / 3;
  height: auto;
}

/* Fix landscape images (likoutey-halakhot, etc.) — use cover mode with top alignment */
.book-cover-container img.book-cover,
.book-cover-container .book-cover {
  object-fit: cover;
  object-position: center top;
}

/* Smooth page load */
@keyframes pageReveal {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.grid-products {
  animation: pageReveal 0.5s ease-out both;
}

/* ============================================
   MOBILE SPECIFIC IMPROVEMENTS (≤768px)
   ============================================ */

@media (max-width: 768px) {

  /* Navbar — prevent cramping */
  .navbar__logo {
    font-size: 0.95rem !important;
    letter-spacing: 0.04em !important;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .navbar__logo .logo-sub {
    display: none; /* Hide "by Esther Ifrah" subtitle on very small screens */
  }

  /* Book grid — better mobile spacing */
  .grid-products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
    padding: 0 0.5rem;
  }

  /* Book cards — tighter but cleaner */
  .book-card {
    border-radius: 10px !important;
  }

  .book-info {
    padding: 0.85rem 0.75rem !important;
  }

  .book-title {
    font-size: 0.82rem !important;
    line-height: 1.3 !important;
    margin-bottom: 0.3rem !important;
    /* Limit to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .book-author {
    font-size: 0.68rem !important;
    margin-bottom: 0.4rem !important;
    letter-spacing: 0.05em !important;
  }

  .book-price {
    font-size: 1rem !important;
    display: block;
    margin-bottom: 0.6rem;
  }

  /* Add to cart button — readable on mobile */
  .btn-add-to-cart {
    padding: 0.55rem 0.4rem !important;
    font-size: 0.72rem !important;
    letter-spacing: 0.03em !important;
  }

  /* Hero section — better mobile padding */
  .hero-section {
    min-height: 80vh !important;
  }

  /* Section headers — center on mobile */
  .section-header {
    text-align: center;
  }

  /* Container — comfortable side padding */
  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Cours du jour audio player — full width */
  audio {
    width: 100% !important;
  }

  /* Cours cards — fix text overflow */
  .cours-card-title {
    font-size: 0.9rem;
    line-height: 1.4;
  }

}

/* ============================================
   SMALL PHONES (≤360px only — keep 2 cols down to 360px)
   ============================================ */

@media (max-width: 360px) {

  /* Single column only on very small (≤360px) screens */
  .grid-products {
    grid-template-columns: 1fr !important;
    max-width: 300px;
    margin: 0 auto;
  }

  .book-title {
    font-size: 0.95rem !important;
    -webkit-line-clamp: 3;
  }

  .book-info {
    padding: 1rem !important;
  }

  .btn-add-to-cart {
    font-size: 0.85rem !important;
    padding: 0.75rem !important;
  }

}

/* ============================================
   PREMIUM HOVER EFFECTS (desktop only)
   ============================================ */

@media (hover: hover) and (pointer: fine) {

  /* Section titles — gold underline reveal on hover */
  .section-title {
    position: relative;
    display: inline-block;
  }

  .section-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--gold, #D4AF37);
    transform: translateX(-50%);
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .section-title:hover::after {
    width: 60%;
  }

  /* Nav links — refined gold underline */
  .navbar__nav-link {
    position: relative;
  }

  .navbar__nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--gold, #D4AF37);
    transition: width 0.25s ease;
  }

  .navbar__nav-link:hover::after {
    width: 100%;
  }

}

/* ============================================
   CATALOGUE PAGE — FILTER BAR MOBILE
   ============================================ */

@media (max-width: 768px) {

  /* Scroll horizontally on mobile if many filters */
  .filter-bar, .collection-filters {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
    padding-bottom: 0.5rem;
    gap: 0.5rem !important;
  }

  .filter-bar::-webkit-scrollbar,
  .collection-filters::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    display: inline-block !important;
    flex-shrink: 0;
    padding: 0.45rem 0.9rem !important;
    font-size: 0.78rem !important;
  }

}

/* ============================================
   FOOTER MOBILE
   ============================================ */

@media (max-width: 768px) {

  .footer {
    padding: 2.5rem 0 1.5rem !important;
  }

  .footer__grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
    text-align: center;
  }

  .footer__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }

  .footer__bottom {
    font-size: 0.72rem;
    padding-top: 1rem;
  }

}

/* ============================================
   COURS PAGE — MOBILE POLISH
   ============================================ */

@media (max-width: 768px) {

  /* Audio cards stacked nicely */
  .audio-card {
    border-radius: 10px;
    margin-bottom: 0.75rem;
  }

  .audio-categories-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

}

/* ============================================
   CONTACT / FORM — MOBILE
   ============================================ */

@media (max-width: 768px) {
  /* Form fields full width */
  input, textarea, select {
    font-size: 16px !important; /* Prevent iOS zoom on focus */
  }
}
