/* Responsive finish layer v1 — compact actions, even footer controls, and safer small-screen rhythm.
   Kept isolated so responsive refinements remain simple to maintain or revert. */

:root {
  --responsive-gutter: 28px;
  --control-height: 44px;
}

/* Avoid min-content overflow in dense grids and embedded project layouts. */
.container,
.detail-grid,
.detail-copy,
.detail-media,
.project-actions,
.footer-grid,
.footer-links,
.publication-showcase,
.publication-list,
.contact-shell,
.contact-grid,
.recognition-shell,
.recognition-section,
.recognition-card-grid {
  min-width: 0;
}

img,
video {
  max-width: 100%;
}

/* Expansion controls should feel like deliberate buttons, not full-width bars. */
.project-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.project-more,
.project-details-button,
.coverage-more,
.recognition-viewmore {
  box-sizing: border-box;
  min-height: var(--control-height);
  max-width: 100%;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.project-more,
.project-details-button {
  flex: 0 1 auto;
  width: auto;
}

.project-more {
  justify-content: center;
  gap: 14px;
}

.project-more-main {
  min-width: 0;
  gap: 9px;
}

.project-more small {
  flex: 0 0 auto;
}

.project-details-button {
  justify-content: center;
  gap: 12px;
}

.coverage-more,
.recognition-viewmore {
  display: flex;
  width: fit-content;
  min-width: 0;
  margin-inline: auto;
  padding: 10px 16px;
}

.coverage-more { gap: 12px; }

/* Contact links become four real, equal-sized rows with intentional breathing room.
   Previously inline-flex + max-content let these collapse together in the footer. */
.site-footer .footer-connect {
  min-width: 0;
}

.site-footer .footer-connect .social-link {
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  width: min(100%, 236px) !important;
  max-width: 100%;
  min-width: 0 !important;
  min-height: 44px;
  margin: 0 0 9px !important;
  padding: 8px 11px !important;
  gap: 10px !important;
  border-radius: var(--neo-radius-sm, 10px);
  line-height: 1.2;
  white-space: nowrap;
}

.site-footer .footer-connect .social-link:last-of-type {
  margin-bottom: 0 !important;
}

.site-footer .footer-connect .social-link > span {
  flex: 0 0 22px;
  width: 22px;
  min-width: 22px;
  height: 22px;
}

.site-footer .footer-connect .social-link > b {
  flex: 0 0 auto;
  margin-left: auto;
}

/* Tablet: let heading copy breathe instead of squeezing title and summary together. */
@media (min-width: 761px) and (max-width: 960px) {
  .section-heading {
    align-items: flex-start;
    gap: 24px;
  }

  .section-heading h2 {
    font-size: clamp(42px, 5.8vw, 62px);
  }

  .section-heading .kicker {
    max-width: 340px;
  }

  .footer-grid {
    gap: 30px;
  }

  .detail-grid {
    gap: 36px;
  }
}

/* Mobile and narrow tablet: center compact controls and make touch layout predictable. */
@media (max-width: 760px) {
  /* At tablet/mobile widths, detail copy and media should share one full-width track.
     The older two-track detail rule had a 300px minimum that could squeeze video cards. */
  .detail-grid,
  .project-detail:not(.opensoccerbot-project):not(.reference-project) .detail-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
  }

  .project-detail:not(.opensoccerbot-project):not(.reference-project) .detail-copy,
  .project-detail:not(.opensoccerbot-project):not(.reference-project) .detail-media {
    width: 100%;
    max-width: none;
    min-width: 0;
    margin-inline: 0;
  }

  .project-actions {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
  }

  .project-more,
  .project-details-button {
    align-self: center;
    width: fit-content;
    min-width: 0;
    max-width: calc(100vw - 36px);
    min-height: 46px;
    padding: 10px 15px;
    flex: 0 1 auto;
    text-align: center;
  }

  .project-more {
    justify-content: center;
    gap: 11px;
  }

  .project-more small {
    padding-left: 9px;
  }

  .coverage-more,
  .recognition-viewmore {
    width: fit-content !important;
    min-width: 0 !important;
    max-width: calc(100% - 4px);
    min-height: 44px;
    margin: 18px auto 0;
    padding: 10px 15px;
    text-align: center;
  }

  .publication-list {
    max-height: min(360px, 48svh);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .publication-item {
    padding: 16px 17px;
  }

  .publication-item strong {
    font-size: 14px;
    overflow-wrap: anywhere;
  }

  .publication-feature {
    min-height: 0;
    padding: 25px;
    gap: 30px;
  }

  .pub-feature-top,
  .pub-feature-foot {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .publications-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  .publications-head h3 {
    font-size: clamp(24px, 6vw, 30px);
  }

  .footer-grid {
    gap: 31px;
  }

  .site-footer .footer-connect .social-link {
    width: min(100%, 236px) !important;
    min-height: 44px;
    margin-bottom: 9px !important;
  }

  .footer-bottom {
    column-gap: 12px;
    row-gap: 8px;
  }

  .contact-grid {
    gap: 12px;
  }

  .contact-card {
    min-width: 0;
  }

  .contact-card h2 {
    font-size: clamp(23px, 6vw, 27px);
    overflow-wrap: anywhere;
  }

  .contact-direct strong {
    overflow-wrap: anywhere;
  }

  .detail-hero-inner h1,
  .section-heading h2 {
    overflow-wrap: anywhere;
  }
}

/* Very narrow phones: preserve side margins and avoid forcing footer microtype off-screen. */
@media (max-width: 360px) {
  .project-more,
  .project-details-button,
  .coverage-more,
  .recognition-viewmore {
    font-size: 8px;
    letter-spacing: .09em;
    padding-inline: 12px;
  }

  .project-more-main { gap: 7px; }
  .project-more small { padding-left: 7px; font-size: 7px; }
  .site-footer .footer-connect .social-link { width: min(100%, 226px) !important; }
  .footer-bottom {
    flex-wrap: wrap !important;
    white-space: normal !important;
    font-size: 6px !important;
    letter-spacing: .045em !important;
    gap: 6px 9px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-more,
  .project-details-button,
  .coverage-more,
  .recognition-viewmore,
  .site-footer .footer-connect .social-link {
    transition: none !important;
  }
}
