/* EMPRENDE v4.9 — mobile second-screen final balance.
   Approved imagery/content preserved. Goals:
   - section heading + cards 1–4 fit as one second-screen composition
   - cards 1–4 equal height
   - titles max 2 lines
   - only a light title/media separation
   - descriptions readable, CTA unchanged
   - cards 5–8 untouched
*/
@media (max-width: 760px) {
  /* Compact only the section heading enough to keep it inside screen 2. */
  .reference-primary .paths {
    padding-top: 9px !important;
  }
  .reference-primary .section-heading {
    margin: 0 2px 8px !important;
    gap: 3px !important;
  }
  .reference-primary .section-heading h2 {
    margin: 0 !important;
    line-height: 1.06 !important;
  }
  .reference-primary .section-heading p {
    margin: 3px 0 0 !important;
    line-height: 1.28 !important;
  }

  /* Crucial fix: no 300px floor. Let the viewport determine the two-row height. */
  .reference-primary .path-grid > .path-card:nth-child(-n+4) {
    height: clamp(258px, calc((100svh - 176px) / 2), 306px) !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  /* Two-line title zone, but without the large empty band from v4.8. */
  .reference-primary .path-grid > .path-card:nth-child(-n+4) > .path-title {
    min-height: 42px !important;
    height: 42px !important;
    flex: 0 0 42px !important;
    padding: 6px 7px 4px !important;
    margin: 0 0 2px !important;
    gap: 5px !important;
    align-items: flex-start !important;
  }
  .reference-primary .path-grid > .path-card:nth-child(-n+4) > .path-title strong {
    font-size: 10.6px !important;
    line-height: 1.12 !important;
    letter-spacing: -.14px !important;
    padding-top: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    max-height: 2.24em !important;
  }

  .reference-primary .path-grid > .path-card:nth-child(-n+4) > .featured-media {
    flex: 0 0 auto !important;
    width: 100% !important;
    aspect-ratio: 4 / 3 !important;
    margin: 0 !important;
  }

  .reference-primary .path-grid > .path-card:nth-child(-n+4) > .featured-bottom {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: 7px 8px 8px !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .reference-primary .path-grid > .path-card:nth-child(-n+4) .featured-bottom p {
    min-height: 0 !important;
    margin: 0 0 8px !important;
    font-size: 10.7px !important;
    line-height: 1.25 !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 4 !important;
    overflow: hidden !important;
  }
  .reference-primary .path-grid > .path-card:nth-child(-n+4) .featured-cta {
    margin-top: auto !important;
    min-height: 32px !important;
    padding: 6px 11px !important;
    font-size: 9.6px !important;
    line-height: 1.05 !important;
  }
}

@media (max-width: 390px) {
  .reference-primary .path-grid > .path-card:nth-child(-n+4) {
    height: clamp(250px, calc((100svh - 170px) / 2), 296px) !important;
  }
  .reference-primary .path-grid > .path-card:nth-child(-n+4) > .path-title {
    min-height: 40px !important;
    height: 40px !important;
    flex-basis: 40px !important;
  }
  .reference-primary .path-grid > .path-card:nth-child(-n+4) > .path-title strong {
    font-size: 10.3px !important;
  }
  .reference-primary .path-grid > .path-card:nth-child(-n+4) .featured-bottom p {
    font-size: 10.4px !important;
  }
}

@media (max-width: 340px) {
  .reference-primary .path-grid > .path-card:nth-child(-n+4) {
    height: clamp(244px, calc((100svh - 164px) / 2), 286px) !important;
  }
  .reference-primary .path-grid > .path-card:nth-child(-n+4) > .path-title strong {
    font-size: 9.8px !important;
  }
  .reference-primary .path-grid > .path-card:nth-child(-n+4) .featured-bottom p {
    font-size: 9.9px !important;
  }
}
