/* ==========================================================================
   TOYO THEME - ADVANCED RESPONSIVE & MULTI-VIEWPORT STYLESHEET
   Supports: Large Desktop, Laptops, Tablets, Phablets, Mobile (iOS/Android)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. LARGE DESKTOPS & HIGH-RES MONITORS (>= 1440px)
   -------------------------------------------------------------------------- */
@media (min-width: 1440px) {
  :root {
    --container-padding: 40px;
  }

  .hero-banner-title {
    font-size: 4.4rem;
  }

  .hero-book-item {
    width: 220px;
  }

  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
  }

  .curated-collections-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
  }
}

/* --------------------------------------------------------------------------
   2. STANDARD LAPTOPS & DESKTOPS (1025px - 1439px)
   -------------------------------------------------------------------------- */
@media (min-width: 1025px) and (max-width: 1439px) {
  :root {
    --container-padding: 32px;
    --header-height: 92px;
  }

  .header-logo-img {
    height: 74px;
  }

  .hero-book-item {
    width: clamp(160px, 15vw, 195px);
  }

  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }

  .curated-collections-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

/* --------------------------------------------------------------------------
   3. MEDIUM SCREENS & TABLETS (769px - 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  :root {
    --container-padding: 24px;
    --header-height: 84px;
  }

  .header-logo-img {
    height: 64px;
  }

  .footer-logo-img {
    height: 76px;
  }

  .main-nav {
    gap: 18px;
  }

  .nav-link {
    font-size: 0.88rem;
  }

  .hero-banner-section {
    padding-top: 48px;
  }

  .hero-banner-books-row {
    padding: 0 16px;
    margin-top: 15px;
  }

  .hero-book-item {
    width: clamp(120px, 16vw, 165px);
  }

  .book-pos-1 {
    transform: translateX(-6%) translateY(-8px);
  }
  .book-pos-2 {
    transform: translateY(-26px);
  }
  .book-pos-3 {
    transform: translateY(0);
  }
  .book-pos-4 {
    transform: translateY(-26px);
  }
  .book-pos-5 {
    transform: translateX(6%) translateY(-8px);
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .curated-collections-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .testimonials-container {
    grid-template-columns: 1fr;
    gap: 28px;
    text-align: center;
  }

  .testimonials-side-tags {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  .testimonial-author-box {
    justify-content: center;
  }

  .testimonial-controls {
    justify-content: center;
  }

  .fp-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .footer-grid {
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 36px;
  }

  .blogs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .press-grid {
    gap: 24px;
    justify-content: center;
  }
}

/* --------------------------------------------------------------------------
   4. SMALL TABLETS & MOBILE DEVICES (<= 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --container-padding: 16px;
    --header-height: 68px;
  }

  body {
    /* Space for mobile sticky bottom navigation bar */
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  /* Header & Navigation */
  .header-logo-img {
    height: 52px;
  }

  .footer-logo-img {
    height: 68px;
  }

  .main-nav {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: inline-flex !important;
  }

  .header-actions {
    gap: 10px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  /* Top Announcement Bar */
  .announcement-bar {
    padding: 8px 0;
  }

  .announcement-inner {
    flex-direction: row;
    justify-content: space-between;
    gap: 8px;
  }

  .ticker-wrap {
    flex: 1;
    min-width: 0;
  }

  .currency-select,
  .lang-select {
    font-size: 0.75rem;
    padding: 2px 4px;
  }

  /* Hero Banner */
  .hero-banner-section {
    padding-top: 36px;
    padding-bottom: 20px;
  }

  .hero-banner-text-block {
    padding: 0 12px;
    margin-bottom: 16px;
  }

  .hero-banner-title {
    font-size: clamp(2.1rem, 7.5vw, 2.75rem);
    line-height: 1.14;
    margin-bottom: 14px;
  }

  .hero-banner-desc {
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
  }

  .hero-mascot-badge {
    border-radius: 16px;
    padding: 8px 12px;
    gap: 10px;
    margin-bottom: 16px;
    max-width: 100%;
  }

  .hero-mascot-avatar {
    width: 40px;
    height: 40px;
  }

  .hero-mascot-slogan {
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .hero-banner-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .hero-banner-btn,
  .hero-banner-btn-secondary {
    padding: 12px 24px;
    font-size: 0.8rem;
    width: 100%;
    max-width: 280px;
    justify-content: center;
    text-align: center;
  }

  /* Horizontal swipeable 5-book row on mobile */
  .hero-banner-books-row {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 20px 16px 16px 16px;
    gap: 16px;
    justify-content: flex-start;
    align-items: center;
    scrollbar-width: none;
    margin-top: 8px;
  }

  .hero-banner-books-row::-webkit-scrollbar {
    display: none;
  }

  .hero-book-item {
    width: 148px;
    flex-shrink: 0;
    scroll-snap-align: center;
    transform: none !important;
  }

  .hero-book-item:hover {
    transform: translateY(-8px) scale(1.03) !important;
  }

  /* Category Filter Navigation: Horizontal Swipeable Pills */
  .category-tabs-nav {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 6px 16px;
    margin: 0 -16px 28px -16px;
    gap: 8px;
  }

  .category-tabs-nav::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.84rem;
    padding: 8px 16px;
  }

  /* Product Cards Grid: 2 Columns */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .card-media {
    margin-bottom: 8px;
    padding: 8px;
  }

  .card-title {
    font-size: 0.96rem;
    line-height: 1.25;
  }

  .card-vendor {
    font-size: 0.72rem;
  }

  .card-price {
    font-size: 0.88rem;
    gap: 6px;
  }

  .card-badge {
    top: 8px;
    left: 8px;
    font-size: 0.65rem;
    padding: 3px 7px;
  }

  /* Ensure card action buttons are touch-accessible on mobile */
  .card-actions-hover {
    position: static;
    opacity: 1;
    transform: none;
    margin-top: 8px;
    display: flex;
    gap: 6px;
  }

  .btn-card-action {
    padding: 7px 4px;
    font-size: 0.74rem;
    border-radius: var(--radius-sm);
  }

  /* Curated Series */
  .curated-collections-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .collection-card {
    aspect-ratio: auto;
    min-height: 250px;
    padding: 20px 16px;
  }

  .collection-title {
    font-size: 1.25rem;
  }

  /* About Publisher Section */
  #about-section .grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }

  #about-section div[style*="padding: 40px"] {
    padding: 24px 20px !important;
  }

  .mascot-about-badge {
    flex-direction: column;
    text-align: center;
    padding: 18px 16px;
    gap: 12px;
  }

  /* Spotlight / Featured Book Section */
  .fp-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .fp-gallery {
    gap: 12px;
  }

  .fp-main-image {
    padding: 20px;
  }

  .fp-thumbnails {
    justify-content: center;
    gap: 8px;
  }

  .fp-thumb {
    width: 64px;
    height: 64px;
  }

  .fp-title {
    font-size: 2rem;
  }

  .fp-price-row {
    font-size: 1.35rem;
  }

  .fp-purchase-actions {
    gap: 10px;
  }

  /* Journal / Blogs */
  .blogs-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .blog-card-media {
    margin-bottom: 12px;
  }

  /* Press Mentions */
  .press-grid {
    gap: 20px;
    justify-content: center;
  }

  .press-item {
    font-size: 1.25rem;
  }

  /* Newsletter Box */
  .newsletter-section {
    padding: 45px 0;
  }

  .newsletter-form {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .newsletter-input {
    width: 100%;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    margin-bottom: 32px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .payment-badges {
    justify-content: center;
    flex-wrap: wrap;
  }

  /* Quick View Modal */
  .modal-backdrop {
    padding: 12px;
  }

  .quickview-modal {
    max-height: 88vh;
    border-radius: var(--radius-md);
  }

  .modal-content-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 16px;
  }

  .modal-gallery-main {
    padding: 16px;
    max-height: 260px;
  }

  .modal-close-btn {
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
  }

  /* Cart Drawer */
  .cart-drawer {
    max-width: 100%;
  }

  .drawer-header {
    padding: 18px 20px;
  }

  .cart-items-scroll {
    padding: 18px 16px;
  }

  .drawer-footer {
    padding: 18px 16px;
  }

  /* Predictive Search Overlay */
  .search-overlay {
    padding: 20px 16px;
  }

  .search-input-field {
    font-size: 1.35rem;
  }

  .search-results-area {
    margin-top: 24px;
  }

  /* Book Matcher Modal */
  .book-matcher-card {
    padding: 24px 18px;
    max-height: 88vh;
    overflow-y: auto;
  }

  .matcher-options {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .matcher-header {
    gap: 14px;
    padding-bottom: 14px;
    margin-bottom: 18px;
  }

  .matcher-avatar {
    width: 56px;
    height: 56px;
  }

  .matcher-header h3 {
    font-size: 1.05rem;
  }

  .matcher-footer {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }

  /* Floating Mascot Concierge Button */
  .mascot-concierge-btn {
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    right: 14px;
    z-index: 85;
  }

  .mascot-speech-bubble {
    display: none;
  }

  .mascot-avatar-wrap {
    width: 48px;
    height: 48px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18), 0 0 0 2.5px #f19c5b;
  }

  /* Scroll To Top Button */
  .scroll-top-btn {
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    left: 14px;
    width: 42px;
    height: 42px;
    z-index: 80;
  }

  /* Mobile Sticky Bottom Navigation Bar */
  .mobile-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(16, 16, 16, 0.08);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 75;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  }

  .sticky-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--color-base-heading);
    gap: 3px;
    flex: 1;
    height: 100%;
    text-decoration: none;
    position: relative;
    transition: color var(--transition-fast);
  }

  .sticky-bar-item:active,
  .sticky-bar-item.active {
    color: var(--color-secondary-heading);
  }

  .sticky-bar-item svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
  }

  .sticky-badge {
    position: absolute;
    top: 6px;
    right: 50%;
    transform: translateX(12px);
    background-color: var(--color-badge-default);
    color: #101010;
    font-size: 0.62rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
  }
}

/* --------------------------------------------------------------------------
   5. EXTRA SMALL MOBILE DEVICES (<= 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  :root {
    --container-padding: 12px;
  }

  .hero-banner-title {
    font-size: 2.15rem;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .card-media {
    padding: 6px;
    border-radius: 4px;
  }

  .card-title {
    font-size: 0.92rem;
  }

  .card-price {
    font-size: 0.84rem;
  }

  .btn-card-action {
    font-size: 0.7rem;
    padding: 6px 2px;
  }

  .btn-card-action svg {
    display: none;
  }

  .testimonial-quote {
    font-size: 1.25rem;
  }

  .side-badge {
    font-size: 1.15rem;
    padding: 8px 14px;
  }

  .fp-main-image {
    padding: 14px;
  }

  .quickview-modal {
    margin: 6px;
  }

  .modal-content-grid {
    padding: 16px 12px;
  }
}

/* --------------------------------------------------------------------------
   6. MOBILE NAVIGATION DRAWER
   -------------------------------------------------------------------------- */
.mobile-menu-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 85vw;
  max-width: 320px;
  height: 100%;
  background: #ffffff;
  z-index: 110;
  box-shadow: 10px 0 40px rgba(0, 0, 0, 0.18);
  transform: translateX(-100%);
  transition: transform var(--transition-smooth);
  display: flex;
  flex-direction: column;
}

.mobile-menu-drawer.active {
  transform: translateX(0);
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border-light);
}

.mobile-drawer-links {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
}

.mobile-nav-item {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--color-base-heading);
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border-ultra-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color var(--transition-fast);
}

.mobile-nav-item:active {
  color: var(--color-secondary-heading);
}

.mobile-drawer-footer {
  padding: 18px 20px;
  border-top: 1px solid var(--color-border-light);
  background: var(--color-bg-paper);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
