/*
 * MOTIONBUILD mobile optimization
 * Desktop layout remains unchanged. These rules only improve the public flow
 * on phone-sized screens. Athlete media ratio rules intentionally stay in
 * athlete-career.css and athlete-media.js.
 */

@media (max-width: 760px) {
  html {
    scroll-padding-top: 76px;
  }

  /* Keep the tablet edge on the same compact navigation as phones. */
  .header,
  .home .header {
    height: 70px;
    position: relative;
    background: #38352d;
  }

  .header-wrap {
    width: calc(100% - 40px);
  }

  .logo,
  .logo img {
    width: 112px;
  }

  .menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    padding: 11px;
  }

  .header nav {
    display: none;
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    z-index: 40;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px 20px 28px;
    background: #38352d;
  }

  .header nav.open {
    display: flex;
  }

  .header nav a {
    padding: 12px 0;
    font-size: 14px;
  }

  .header nav a:last-child {
    margin-top: 7px;
    padding: 12px;
    text-align: center;
  }

  .header nav a,
  .master-footer-grid a,
  .footer a {
    min-height: 44px;
  }

  .header nav a,
  .master-footer-grid .footer-nav a,
  .master-footer-grid .footer-contact a,
  .master-footer-grid .footer-platform-links a,
  .master-footer-grid .footer-meta a {
    display: flex;
    align-items: center;
  }

  .text-link,
  .ps17-text-link,
  .ap-text-link,
  .mb9-text-link,
  .home-coach__actions a,
  .home-thinking__archive-heading > a,
  .home-case-catalog__actions a,
  .home-coaching-loop__footer a,
  .athlete-pro-card__link,
  .coach-career-card a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-block: 8px;
  }

  .home .home-film-hero__stage,
  .home .home-film-hero__inner {
    min-height: max(680px, calc(100svh - 70px));
  }

  .home .home-film-hero__eyebrow {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, .2);
    color: #fff;
    background: rgba(25, 23, 20, .58);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
    backdrop-filter: blur(8px);
  }

  .home .film-play {
    min-width: 44px;
    min-height: 44px;
  }

  .home .home-mobile-actions {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .home {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
    scroll-padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  /* All items remain available; repeated sets become swipe rows on phones. */
  .home .home-thinking__cards,
  .home .home-goals__cards,
  .home .catalog-featured-grid--home,
  .home .home-case-folders,
  .home .home-coaching-loop__steps,
  .home .home-evidence-loop ol,
  .records-page .catalog-featured-grid {
    display: grid !important;
    grid-template-columns: none !important;
    grid-auto-flow: column;
    grid-auto-columns: calc(100% - 36px);
    gap: 14px !important;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 14px;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 0;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .home .home-thinking__cards::-webkit-scrollbar,
  .home .home-goals__cards::-webkit-scrollbar,
  .home .catalog-featured-grid--home::-webkit-scrollbar,
  .home .home-case-folders::-webkit-scrollbar,
  .home .home-coaching-loop__steps::-webkit-scrollbar,
  .home .home-evidence-loop ol::-webkit-scrollbar,
  .records-page .catalog-featured-grid::-webkit-scrollbar {
    display: none;
  }

  .home .home-thinking__cards > *,
  .home .home-goals__cards > *,
  .home .catalog-featured-grid--home > *,
  .home .home-case-folders > *,
  .home .home-coaching-loop__steps > *,
  .home .home-evidence-loop ol > *,
  .records-page .catalog-featured-grid > * {
    min-width: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .home .home-thinking-card,
  .home .home-goal-card,
  .home .catalog-featured-card,
  .home .home-case-folders > a,
  .home .home-coaching-loop__steps > li,
  .home .home-evidence-loop li {
    height: auto;
  }

  .home .home-goal-card,
  .home .home-coaching-loop__steps > li,
  .home .home-coaching-loop__steps > li:nth-child(n),
  .home .home-evidence-loop li,
  .home .home-evidence-loop li:nth-child(n) {
    border: 1px solid var(--home-line, #d4c8ba);
  }

  .home .home-evidence-loop li,
  .home .home-evidence-loop li:nth-child(n) {
    min-height: 170px;
    padding: 20px;
    border-color: rgba(255, 250, 244, .24);
  }

  .home .home-case-folders {
    border: 0;
  }

  .home .home-case-folders > a,
  .home .home-case-folders > a:first-child {
    min-height: 150px;
    border: 1px solid var(--home-line, #d4c8ba);
  }

  .records-page .record-filter-bar {
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .records-page .record-filter-bar button {
    flex: 0 0 auto;
    min-height: 44px;
    scroll-snap-align: start;
  }

  .records-page .record-result-count {
    flex: 0 0 auto;
    width: auto;
    margin: 0 4px;
    white-space: nowrap;
  }

  .coach-page .mb10-career__filters {
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .coach-page .mb10-career__filters button {
    min-height: 44px;
    scroll-snap-align: start;
  }

  .coach-page .athlete-history__filter-buttons button,
  .coach-page .athlete-media-tools__button,
  .coach-page .athlete-pro-card__link,
  .coach-page .athlete-evidence a {
    min-height: 44px;
  }

  .program-page .ce-page {
    min-width: 44px;
    min-height: 44px;
  }

  .program-page .pr-plan-document .pr-table-scroll,
  .program-page .pr-worksheet .pr-table-scroll,
  .program-page .sample-table-wrap {
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 520px) {
  .contact-page .inquiry-process {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
  }

  .contact-page .inquiry-process li:nth-child(2)::after {
    display: none;
  }
}

@media (max-width: 420px) {
  .master-footer-grid .footer-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .home .home-thinking__cards,
  .home .home-goals__cards,
  .home .catalog-featured-grid--home,
  .home .home-case-folders,
  .home .home-coaching-loop__steps,
  .home .home-evidence-loop ol,
  .records-page .catalog-featured-grid,
  .records-page .record-filter-bar {
    scroll-behavior: auto;
  }
}
