/* ==========================================
   DOWNLIN - RESPONSIVE MEDIA QUERIES
   Adapts layout smoothly from Desktop to Tablet & Mobile
   ========================================== */

/* Tablet Breakpoint (< 1024px) */
@media (max-width: 1024px) {
  .popular-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }

  .item-card-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .detail-content-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .megamenu {
    width: 480px;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile Breakpoint (< 768px) */
@media (max-width: 768px) {
  :root {
    --header-height: 58px;
  }

  .pagination {
    gap: unset;
  }
 .horizontal-scroll-container::before,
    .horizontal-scroll-container::after {
        width: 25px;
    }

    .popular-grid,
    .categories-browse-grid {
        padding-left: 1rem;
        padding-right: 1rem;
        gap: 1rem;
    }

    .popular-column,
    .categories-browse-grid .category-browse-card {
        flex-basis: 280px;
        min-width: 280px;
    }

  .ad-slot-top iframe,
    .ad-slot-bottom iframe{
      transform: scale(0.4265);
    }

    .ad-slot iframe {
      transform: scale(0.4265);
    }

  .header-search {
    display: flex;
    flex: 1;
    max-width: 220px;
    margin: 0 0.5rem;
  }

  .header-search input {
    height: 34px;
    font-size: 0.8rem;
    padding: 0 1.25rem 0 2rem;
  }

  .search-icon-inside {
    left: 0.6rem;
    width: 14px;
    height: 14px;
  }

  .search-shortcut-badge {
    display: none;
  }

  .nav-menu {
    display: none;
  }

  .mobile-controls {
    display: flex;
  }

  .home-hero-section {
    padding: 3rem 1rem 2.5rem;
  }

  .home-brand-title {
    font-size: 2.75rem;
  }

  .home-tagline {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }

  .home-search-input {
    height: 46px;
    font-size: 0.925rem;
    padding-left: 2.75rem;
  }

  .home-search-icon {
    left: 0.9rem;
  }

  .home-search-shortcut {
    display: none;
  }

  .popular-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .item-card-grid {
    grid-template-columns: 1fr;
  }

  .item-list-row {
    padding: 0.85rem;
    gap: 0.85rem;
  }

  .item-thumb-list {
    width: 64px;
    height: 88px;
    min-width: 64px;
    font-size: 1.4rem;
  }

  .item-detail-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.5rem 0;
  }

  .item-hero-thumb {
    width: 100px;
    height: 100px;
    min-width: 100px;
    font-size: 2.5rem;
  }

  .item-hero-title {
    font-size: 1.75rem;
  }

  .download-table-wrap {
    overflow-x: auto;
  }

  .download-table th, .download-table td {
    padding: 0.65rem 0.75rem;
    white-space: nowrap;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

/* Small Mobile Breakpoint (< 480px) */
@media (max-width: 480px) {
  .logo span {
    display: none; /* Hide brand text on tiny screens so header search fits comfortably */
  }

  .header-search {
    max-width: 170px;
  }

  .home-brand-title {
    font-size: 2.25rem;
  }

  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .controls-left, .controls-right {
    width: 100%;
    justify-content: space-between;
  }

  .select-control {
    flex: 1;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }
}
