/**
 * TeamBonding - Mobile Program Detail Refresh (pilot)
 * --------------------------------------------------
 * Applies only to <main class="tb-program-mobile-redesign"> and mobile
 * screens. The class is added only to The Great Watermelon Race in the
 * accompanying single-programs-the-great-watermelon-race.php file.
 *
 * No existing theme CSS is edited or replaced.
 */
@media (max-width: 767.98px) {
  .tb-program-mobile-redesign {
    --tb-pmr-gutter: 15px;
    --tb-pmr-ink: #142d5c;
    --tb-pmr-muted: #62708a;
    --tb-pmr-border: #e3e8ef;
  }

  /* 1. Keep breadcrumbs compact and left aligned. Make the original action
        buttons a separately ordered flex item, without altering their HTML. */
  .tb-program-mobile-redesign .hero.hero--style-2 {
    padding-top: 0 !important;
    padding-bottom: 22px !important;
  }

  .tb-program-mobile-redesign .hero .hero__wrapper {
    display: flex;
    flex-direction: column;
  }

  .tb-program-mobile-redesign .hero .breadcrumb__wrapper {
    display: contents !important;
  }

  .tb-program-mobile-redesign .hero .breadcrumb__wrapper > [aria-label="breadcrumb"] {
    order: 0;
    width: 100%;
    min-width: 0;
    padding: 10px 0 9px;
    text-align: left;
  }

  .tb-program-mobile-redesign .hero .breadcrumb {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start !important;
    align-items: baseline;
    gap: 2px 0;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
    text-align: left;
  }

  .tb-program-mobile-redesign .hero .breadcrumb .breadcrumb-item {
    font-size: inherit !important;
    line-height: inherit !important;
    padding: 0 !important;
    margin: 0 !important;
    font-weight: 400 !important;
    text-decoration: none !important;
    white-space: normal;
  }

  .tb-program-mobile-redesign .hero .breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    float: none;
    padding: 0 5px !important;
    font-size: 10px;
  }

  .tb-program-mobile-redesign .hero .breadcrumb .breadcrumb-item a {
    color: var(--tb-pmr-ink);
    text-decoration: none !important;
  }

  .tb-program-mobile-redesign .hero .breadcrumb .breadcrumb-item.active {
    color: #3d4960;
  }

  /* 2. Bring gallery to the top of the hero. The left content column and
        right gallery column are still in their original PHP locations. */
  .tb-program-mobile-redesign .hero .hero__wrapper > .row.gx-0.gy-5 {
    order: 1;
    display: flex;
    flex-direction: column;
    --bs-gutter-y: 0;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .tb-program-mobile-redesign .hero .hero__wrapper > .row.gx-0.gy-5 > .col-lg-5 {
    order: -1;
    position: relative;
    width: 100%;
    max-width: 100%;
    padding: 0 !important;
    margin: 0 !important;
  }

  .tb-program-mobile-redesign .hero .hero__wrapper > .row.gx-0.gy-5 > .col-lg-7 {
    order: 1;
    width: 100%;
    max-width: 100%;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Full-bleed gallery between the breadcrumb and the text. */
  .tb-program-mobile-redesign .hero .video-slider {
    width: calc(100% + (2 * var(--tb-pmr-gutter)));
    margin-left: calc(-1 * var(--tb-pmr-gutter));
    margin-right: calc(-1 * var(--tb-pmr-gutter));
    border: 0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
    overflow: hidden;
  }

  .tb-program-mobile-redesign .hero .video-slider .slick-list,
  .tb-program-mobile-redesign .hero .video-slider .slick-slide,
  .tb-program-mobile-redesign .hero .video-slider__item {
    border-radius: 0 !important;
  }

  .tb-program-mobile-redesign .hero .video-slider__item {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 260px;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden;
    background: #e8eef0;
  }

  .tb-program-mobile-redesign .hero .video-slider__item > img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center;
  }

  /* Keep only the large-image rotation: hide thumbnail strip. */
  .tb-program-mobile-redesign .hero .video-slider__nav {
    display: none !important;
  }

  /* Reposition the existing prev/next buttons over the photograph.
     Their original click handlers remain unchanged. */
  .tb-program-mobile-redesign .hero .col-lg-5 > .slider-nav {
    position: absolute !important;
    z-index: 5;
    top: 50%;
    left: calc(-1 * var(--tb-pmr-gutter));
    width: calc(100% + (2 * var(--tb-pmr-gutter)));
    transform: translateY(-50%);
    display: flex !important;
    justify-content: space-between !important;
    align-items: center;
    padding: 0 12px !important;
    margin: 0 !important;
    gap: 0 !important;
    pointer-events: none;
  }

  .tb-program-mobile-redesign .hero .col-lg-5 > .slider-nav .slider-nav__btn {
    position: relative;
    display: flex !important;
    justify-content: center;
    align-items: center;
    flex: 0 0 38px;
    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #1e3762 !important;
    background: #ffffff !important;
    border: 0 !important;
    border-radius: 50% !important;
    box-shadow: 0 1px 5px rgb(0 0 0 / 14%);
    pointer-events: auto;
    cursor: pointer;
  }

  .tb-program-mobile-redesign .hero .col-lg-5 > .slider-nav .slider-nav__btn svg {
    display: block;
    width: 17px;
    height: 17px;
  }

  .tb-program-mobile-redesign .hero .tb-gallery-count {
    position: absolute;
    z-index: 5;
    bottom: 11px;
    right: calc(-1 * var(--tb-pmr-gutter) + 11px);
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    color: #ffffff;
    background: var(--primary);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
  }

  /* 3. Compact title + intro. JavaScript adds the clamp class only when the
        copy actually exceeds three rendered lines. */
  .tb-program-mobile-redesign .hero .hero__content {
    padding: 15px 0 0 !important;
    margin: 0 !important;
  }

  .tb-program-mobile-redesign .hero .hero__title {
    margin: 0 0 8px !important;
    padding: 0 !important;
    font-size: clamp(22px, 5.8vw, 26px) !important;
    font-weight: 750 !important;
    line-height: 1.16 !important;
    letter-spacing: -0.025em;
  }

  .tb-program-mobile-redesign .hero .hero__desc {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.45 !important;
  }

  .tb-program-mobile-redesign .hero .hero__desc.tb-intro--clamped {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
  }

  .tb-program-mobile-redesign .hero .tb-intro-toggle:not([hidden]) {
    display: inline-flex !important;
    align-items: center;
    border: 0;
    background: transparent;
    padding: 4px 0;
    margin: 6px 0 0;
    color: #E03317;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    cursor: pointer;
  }

  .tb-program-mobile-redesign .hero .tb-intro-toggle:focus-visible {
    outline: 2px solid #124aa8;
    outline-offset: 3px;
  }

  /* 4. Quote call-to-action: keep existing link/popup. */
  .tb-program-mobile-redesign .hero .tb-mobile-quote {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin: 13px 0 16px;
  }

  .tb-program-mobile-redesign .hero .tb-mobile-quote > .theme__btn {
    display: flex !important;
    justify-content: center;
    align-items: center;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 46px;
    padding: 11px 15px !important;
    margin: 0 !important;
    border-radius: 999px !important;
    font-size: 15px !important;
    line-height: 1.25 !important;
    text-align: center;
  }

  .tb-program-mobile-redesign .hero .tb-mobile-quote-note {
    display: block;
    margin-top: 6px;
    color: var(--tb-pmr-muted);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.25;
    text-align: center;
  }

  /* 5. Available / Team Size / Time / Outcomes in a 2x2 CSS grid.
        display:contents is used solely to flatten the nested Team/Time
        column; no ACF logic or data fields are changed. */
  .tb-program-mobile-redesign .hero .col-lg-7 > .row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px 13px;
    width: 100%;
    margin: 0 !important;
    padding: 13px 12px 14px;
    border: 1px solid var(--tb-pmr-border);
    border-radius: 12px;
    background: #fff;
  }

  .tb-program-mobile-redesign .hero .col-lg-7 > .row > .col-lg-3,
  .tb-program-mobile-redesign .hero .col-lg-7 > .row > .col-lg-4 {
    width: auto !important;
    max-width: none !important;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    flex: none !important;
  }

  .tb-program-mobile-redesign .hero .col-lg-7 > .row > .col-lg-4:nth-child(2) {
    display: contents !important;
  }

  .tb-program-mobile-redesign .hero .col-lg-7 > .row .hero__info-item {
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
  }

  .tb-program-mobile-redesign .hero .hero__info-title {
    margin: 0 0 6px !important;
    padding: 0 !important;
    font-size: 11px !important;
    font-weight: 750 !important;
    line-height: 1.2 !important;
    letter-spacing: 0.01em;
  }

  .tb-program-mobile-redesign .hero .hero__info-list {
    display: flex;
    flex-direction: column;
    gap: 5px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .tb-program-mobile-redesign .hero .hero__info-list li,
  .tb-program-mobile-redesign .hero .hero__info-list li span,
  .tb-program-mobile-redesign .hero .hero__info-list li a {
    min-width: 0;
    font-size: 12px !important;
    font-weight: 500;
    line-height: 1.35 !important;
    overflow-wrap: break-word;
  }

  .tb-program-mobile-redesign .hero .hero__info-list li {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 !important;
    padding: 0 !important;
  }

  .tb-program-mobile-redesign .hero .hero__info-list li > div.d-flex,
  .tb-program-mobile-redesign .hero .hero__info-list li > a.d-flex {
    display: flex;
    align-items: center;
    gap: 7px;
  }

  .tb-program-mobile-redesign .hero .hero__info-list li > img,
  .tb-program-mobile-redesign .hero .hero__info-list li > div.d-flex > img,
  .tb-program-mobile-redesign .hero .hero__info-list li > a.d-flex > img {
    flex: 0 0 28px;
    width: 28px !important;
    height: 28px !important;
    object-fit: contain;
  }

  .tb-program-mobile-redesign .hero .hero__info-list .check-icon {
    flex: 0 0 21px !important;
    width: 21px !important;
    height: 21px !important;
    min-width: 21px !important;
    border-radius: 5px !important;
  }

  .tb-program-mobile-redesign .hero .hero__info-list .check-icon img {
    width: 13px !important;
    height: 13px !important;
  }

  /* 6. Move original Share / Download / Favorite after the program details.
        Do not restyle the controls or change popup behavior. */
  .tb-program-mobile-redesign .hero .breadcrumb__wrapper > .action__btns {
    order: 2;
    display: flex !important;
    justify-content: center !important;
    align-items: center;
    align-self: stretch;
    width: 100%;
    margin: 18px 0 80px !important;
    padding: 14px 0 0 !important;
    border-top: 1px solid var(--tb-pmr-border);
  }
  .tb-program-mobile-redesign .hero .breadcrumb__wrapper > .action__btns .bread-modals {
	  left: -110px;
  }
}

/* The new markup is inert on desktop. Desktop uses the existing styles. */
.tb-program-mobile-redesign .tb-mobile-quote { display: contents; }
.tb-program-mobile-redesign .tb-intro-toggle[hidden] { display: none !important; }
.tb-program-mobile-redesign .tb-gallery-count { display: none; }
.tb-program-mobile-redesign .tb-mobile-quote-note { display: none; }

/* Restore the mobile-only elements inside the media query, after defaults. */
@media (max-width: 767.98px) {
  .tb-program-mobile-redesign .hero .tb-gallery-count { display: inline-flex; }
  .tb-program-mobile-redesign .hero .tb-mobile-quote-note { display: block; }
}
