/* ============================================================
   Mobile horizontal section scroll (site-wide)
   Card strips on phones; grids unchanged from 769px up.
   ============================================================ */

@media (max-width: 768px) {
  :root {
    --section-scroll-gap: 14px;
    --section-scroll-card-w: clamp(260px, 82vw, 320px);
    --section-scroll-panel-w: clamp(280px, 88vw, 340px);
  }

  /* Shared scroll row */
  .section-hscroll,
  .home-cat-grid,
  .home-utils-grid,
  .news-grid-2,
  .news-grid-3,
  .news-grid-4,
  .news-grid.news-grid-2,
  .news-grid.news-grid-3,
  .news-grid.news-grid-4,
  .author-news-grid,
  .team-grid,
  .weather-cities-grid,
  .weather-forecast-grid,
  .exchange-grid,
  .featured-layout-right {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    grid-template-columns: unset !important;
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
    gap: var(--section-scroll-gap);
    scrollbar-width: thin;
    scrollbar-color: rgba(193, 11, 27, 0.65) transparent;
    scroll-padding-inline: var(--gutter);
    width: calc(100% + 2 * var(--gutter));
    max-width: none;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    padding-block: 2px 10px;
  }

  .section-hscroll::-webkit-scrollbar,
  .home-cat-grid::-webkit-scrollbar,
  .news-grid-2::-webkit-scrollbar,
  .news-grid-3::-webkit-scrollbar,
  .news-grid-4::-webkit-scrollbar,
  .author-news-grid::-webkit-scrollbar {
    height: 6px;
  }

  .section-hscroll::-webkit-scrollbar-thumb,
  .home-cat-grid::-webkit-scrollbar-thumb,
  .news-grid-2::-webkit-scrollbar-thumb,
  .news-grid-3::-webkit-scrollbar-thumb,
  .news-grid-4::-webkit-scrollbar-thumb,
  .author-news-grid::-webkit-scrollbar-thumb {
    background: rgba(193, 11, 27, 0.55);
    border-radius: 999px;
  }

  /* Card / item widths */
  .section-hscroll > *,
  .home-cat-grid > *,
  .news-grid-2 > *,
  .news-grid-3 > *,
  .news-grid-4 > *,
  .author-news-grid > *,
  .team-grid > *,
  .weather-cities-grid > *,
  .weather-forecast-grid > *,
  .exchange-grid > *,
  .featured-layout-right > * {
    flex: 0 0 var(--section-scroll-card-w);
    width: var(--section-scroll-card-w);
    max-width: none;
    min-width: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .home-utils-grid > .home-utils-panel,
  .home-utils-grid > .widget {
    flex: 0 0 var(--section-scroll-panel-w);
    width: var(--section-scroll-panel-w);
    scroll-snap-align: start;
  }

  .home-cat-grid > .card,
  .author-news-grid > .card,
  .news-grid-2 > .card,
  .news-grid-3 > .card,
  .news-grid-4 > .card,
  .news-grid-3 > .news-card,
  .news-grid-4 > .news-card {
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    height: auto;
  }

  /* Vertical list modes stay vertical */
  .news-list-view,
  #newsList.news-list-view {
    display: flex !important;
    flex-direction: column !important;
    overflow-x: visible !important;
    scroll-snap-type: none !important;
    width: 100% !important;
    margin-inline: 0 !important;
    padding-inline: 0 !important;
  }

  .news-list-view > *,
  #newsList.news-list-view > * {
    flex: none !important;
    width: 100% !important;
    scroll-snap-align: unset !important;
  }

  /* Subnav / pills */
  .cat-subnav,
  .home-subcat-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    gap: 8px;
    padding-bottom: 6px;
    margin-bottom: 12px;
    scrollbar-width: none;
  }

  .cat-subnav::-webkit-scrollbar,
  .home-subcat-nav::-webkit-scrollbar {
    display: none;
  }

  .cat-subnav__link,
  .home-subcat-pill {
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  /* Sidebar trending → horizontal strip when sidebar stacks on top */
  .page-layout > .sidebar .widget-body--trending-scroll,
  .sidebar-widget .widget-body.sidebar-trending-scroll {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 12px;
    padding-block: 8px 10px;
    padding-inline: 12px;
    margin-inline: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .sidebar-trending-scroll .trending-card {
    flex: 0 0 clamp(152px, 44vw, 188px);
    width: clamp(152px, 44vw, 188px);
    scroll-snap-align: start;
    scroll-margin-inline: 4px;
    flex-direction: column;
    align-items: stretch;
    position: relative;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg-card);
    box-shadow: var(--shadow-xs);
    gap: 0;
  }

  .sidebar-trending-scroll .trending-card:last-child {
    border-bottom: 1px solid var(--border);
  }

  .sidebar-trending-scroll .trending-card:hover {
    background: var(--bg-card);
  }

  .sidebar-trending-scroll .trending-img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: var(--r-xs);
    margin-bottom: 6px;
  }

  .sidebar-trending-scroll .trending-title {
    font-size: 11.5px;
    line-height: 1.35;
    -webkit-line-clamp: 3;
  }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .section-hscroll,
  .home-cat-grid,
  .news-grid-2,
  .news-grid-3,
  .news-grid-4,
  .author-news-grid {
    scroll-behavior: auto;
  }
}
