/* Siga em Frente 1.0.43 — Portrait tablet only.
 * Keeps the approved desktop layout and phone swipe interaction.
 * Match the JS tablet portrait query in assets/js/front-page.js.
 */
@media (orientation: portrait) and (min-width: 641px) and (max-width: 1100px) {
  #para-quem .container,
  #trilhas .container,
  #trilhas-tabs,
  #para-quem-cards-container {
    min-width: 0;
    max-width: 100%;
  }

  /* List view is the tablet-safe counterpart of the already-approved phone list. */
  #para-quem .layout-toggle-wrapper { justify-content: center; margin-bottom: 28px; }
  #para-quem-layout-toggle .layout-btn.hide-on-mobile { display: none !important; }
  #para-quem-layout-toggle .layout-btn.hide-on-desktop { display: inline-flex !important; }
  #para-quem-cards-container[data-layout="list"] {
    display: grid;
    width: 100%;
    max-width: 720px;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    margin: 0 auto;
  }
  #para-quem-cards-container[data-layout="list"] > .card-dark {
    min-width: 0;
    width: 100%;
    height: auto;
    position: relative;
    transform: none;
    opacity: 1;
    padding: 30px 32px;
  }
  #para-quem .stack-nav-wrapper { display: none !important; }

  /* Prevent multi-row tab navigation and the misaligned animated indicator. */
  #trilhas-tabs .animated-tabs-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    max-width: 100%;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  #trilhas-tabs .animated-tabs-nav::-webkit-scrollbar { display: none; }
  #trilhas-tabs .animated-tabs-nav button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  #trilhas-tabs .animated-tabs-nav::after { display: none; }
  #trilhas-tabs .animated-tabs-indicator { pointer-events: none; }

  /* Preserve the original animated tab carousel, now correctly constrained to
     the tablet's available width.  Each slide is its own responsive column. */
  #trilhas-tabs .animated-tabs-content {
    display: flex;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0;
    padding: 26px 0;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  #trilhas-tabs .animated-tabs-content::-webkit-scrollbar { display: none; }
  #trilhas-tabs .animated-tabs-content-panel {
    display: grid;
    position: static;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    flex: 0 0 100%;
    padding: 0 26px;
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    scroll-snap-align: start;
    align-content: start;
  }
  #trilhas-tabs .animated-tabs-content-panel.active {
    animation: tabContentFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
  }
  #trilhas-tabs .tab-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 330px;
    aspect-ratio: 16 / 9;
    margin: 0;
    object-fit: cover;
  }
  #trilhas-tabs .tab-text { min-width: 0; overflow-wrap: anywhere; }
  #trilhas-tabs .tabs-scroll-hint { display: flex; }

}

/* Keep the phone carousel aligned, including smaller 600px portrait tablets. */
@media (max-width: 640px) {
  #trilhas-tabs,
  #trilhas-tabs .animated-tabs-content,
  #trilhas-tabs .animated-tabs-content-panel { min-width: 0; }
  #trilhas-tabs .animated-tabs-content-panel {
    width: 100%;
    box-sizing: border-box;
    flex: 0 0 100%;
    grid-template-columns: minmax(0, 1fr);
  }
  #trilhas-tabs .tab-image { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  #trilhas-tabs .animated-tabs-indicator,
  #trilhas-tabs .animated-tabs-content-panel.active {
    animation: none;
    transition-duration: 0.01ms;
  }
  #trilhas-tabs .animated-tabs-content { scroll-behavior: auto; }
}
