/* Keep newly uploaded group photographs complete in the homepage tabs. */
.activity-photo.is-team-photo { background: var(--navy); }
.activity-photo.is-team-photo img { object-fit: contain; object-position: center; }

/* Phone layouts shared by the six Academy pages. Desktop styles stay intact. */
@media (max-width: 700px) {
  html { scroll-padding-top: 84px; }
  body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  .wrap { width: calc(100% - 36px); }
  main, main section, main article, main .wrap > *, footer .wrap > * { min-width: 0; }
  h1, h2, h3, .button, .text-link { overflow-wrap: break-word; }
  h2 { font-size: clamp(2.15rem, 8.5vw, 3rem); line-height: 1.04; }
  .eyebrow { font-size: .75rem; letter-spacing: .09em; margin-bottom: 15px; }
  .section, .philosophy-section, .staff-teaser, .social-wall, .join-section,
  .faq-section, .safeguarding-section, .staff-section, .staff-roster, .staff-training,
  .staff-cta, .teams-section, .team-directory, .athletes-ready, .teams-cta,
  .training-schedule, .friendlies-section { padding: 48px 0; }
  .section-top, .staff-section-heading, .teams-heading,
  .training-schedule-head, .friendlies-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; margin-bottom: 26px; }
  .section-top > p, .gallery-intro, .teams-heading > p,
  .staff-section-heading > p { max-width: none; font-size: 1rem; }
  .button { min-height: 48px; max-width: 100%; padding: 13px 20px; border-radius: 6px; }
  .text-link { font-size: .9375rem; line-height: 1.5; }

  /* A shorter header and a scrollable menu fit a phone in either orientation. */
  .topbar .wrap { min-height: 28px; justify-content: center; padding: 5px 0; text-align: center; font-size: .75rem; line-height: 1.3; letter-spacing: .025em; }
  .topbar .wrap > div { display: none; }
  .header-inner { min-height: 72px; gap: 14px; }
  .brand { min-width: 0; gap: 10px; }
  .brand img { width: 46px; height: 48px; }
  .brand strong { font-size: 1.25rem; }
  .brand small { display: none; }
  .menu-toggle { width: auto; min-width: 88px; min-height: 44px; padding: 0 11px; gap: 10px; border-radius: 6px; }
  .menu-toggle::after { content: "Menu"; font-size: .875rem; font-weight: 600; }
  .menu-toggle[aria-expanded="true"]::after { content: "Chiudi"; }
  .header nav { top: 100%; padding: 12px 18px 20px; max-height: calc(100vh - 84px); max-height: calc(100dvh - 84px); overflow-y: auto; overscroll-behavior: contain; }
  .header nav.open { gap: 2px; }
  .header nav > a { min-height: 48px; padding: 11px 14px; font-size: 1rem; border-radius: 5px; }
  .header nav > a:active { background: #173947; }

  /* The slider controls sit below the photograph, with no overlapping text. */
  .hero-track { align-items: stretch; }
  .hero-slide { min-width: 0; min-height: 460px; display: flex; align-items: center; }
  .hero-carousel .hero-content { min-height: 0; padding-top: 36px; padding-bottom: 36px; display: block; }
  .hero-copy { max-width: 100%; }
  .hero h1, .hero-carousel .hero-slide:not(.hero-slide-main) h1 { font-size: clamp(2.8rem, 10.5vw, 4.4rem); line-height: .98; max-width: 100%; }
  .hero .eyebrow { gap: 8px; font-size: .75rem; flex-wrap: wrap; }
  .hero .eyebrow > span { flex: 0 0 18px; }
  .hero-description { font-size: 1rem; line-height: 1.55; margin-top: 20px; max-width: 440px; }
  .hero-actions { margin-top: 24px; gap: 13px; flex-direction: column; align-items: flex-start; }
  .hero-actions .button { width: 100%; }
  .hero-actions .text-link { font-size: .9375rem; padding: 8px 0; }
  .hero-carousel .hero-photo-caption { display: none; }
  .hero-background { object-position: 60% center; }
  .hero-carousel .hero-shade { background: linear-gradient(90deg, #061b29e6, #061b29b3 60%, #061b2966), linear-gradient(0deg, #061b29b3, transparent 65%); }
  .hero-carousel-bar { position: relative; bottom: auto; background: var(--navy); }
  .hero-carousel-bar > .wrap { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px 0 6px; }
  .hero-carousel-bar > .wrap > span { grid-column: 1; grid-row: 1; align-self: center; padding: 0; text-align: left; font-size: .75rem; letter-spacing: .035em; line-height: 1.4; }
  .hero-controls { grid-column: 2; grid-row: 1; gap: 6px; padding: 0; justify-content: flex-end; align-self: center; }
  .hero-controls button { width: 44px; height: 44px; flex-shrink: 0; }
  .hero-controls #hero-play { min-width: 60px; padding: 0 10px; }
  .hero-controls span { min-width: 34px; font-size: .875rem; }
  .hero-dots { grid-column: 1 / -1; grid-row: 2; gap: 0; padding: 0; }
  .hero-dots button { width: 44px; height: 44px; border: 0; border-radius: 0; background: transparent; position: relative; }
  .hero-dots button::after { content: ""; position: absolute; width: 23px; height: 4px; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 3px; background: #617986; }
  .hero-dots button[aria-current="true"] { background: transparent; }
  .hero-dots button[aria-current="true"]::after { background: var(--lime); }

  .numbers-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 24px 0; gap: 18px; align-items: start; }
  .number { padding-left: 12px; gap: 8px; flex-direction: column; align-items: flex-start; min-width: 0; }
  .number:first-of-type { padding-left: 0; }
  .number > strong { font-size: 3rem; }
  .number > span { font-size: .875rem; line-height: 1.35; overflow-wrap: break-word; }
  .number:last-child { grid-column: 1 / -1; padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--line); flex-direction: row; align-items: center; gap: 16px; }
  .academy-grid, .staff-teaser-inner, .join-grid, .faq-grid, .safeguarding-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .academy-story h2, .philosophy-section h2, .staff-teaser h2,
  .social-wall-copy h2, .join-section h2, .faq-section h2,
  .safeguarding-grid h2 { font-size: clamp(2.15rem, 8.5vw, 3rem); line-height: 1.04; }
  .staff-training h2 { font-size: clamp(2.15rem, 8.5vw, 3rem); line-height: 1.04; }
  .story-images { padding-right: 0; padding-bottom: 28px; }
  .story-main-photo > img { height: auto; aspect-ratio: 4 / 3; }
  .story-main-photo figcaption { top: 14px; left: 14px; padding: 7px 10px; font-size: .75rem; }
  .story-photo-stamp { padding: 12px 14px; gap: 12px; border-width: 4px; }
  .story-photo-stamp img { width: 48px; }
  .story-photo-stamp span { font-size: 1.2rem; }
  .photo-year { left: 16px; bottom: 48px; }
  .photo-year strong { font-size: 3rem; }
  .academy-story .lead { font-size: 1.125rem; }
  .story-timeline { grid-template-columns: minmax(0, 1fr); margin-top: 32px; padding-top: 24px; gap: 24px; }
  .story-timeline h3 { margin-top: 8px; }
  .story-timeline p, .philosophy-grid p { font-size: 1rem; }
  .philosophy-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 24px; }
  .philosophy-grid h3 { margin: 8px 0 10px; font-size: 1.8rem; }
  .activity-tabs { max-width: 100%; scroll-snap-type: x proximity; }
  .activity-tabs button { min-height: 48px; padding: 13px 18px; scroll-snap-align: start; }
  .activity-panel { grid-template-columns: minmax(0, 1fr); padding: 20px; gap: 22px; }
  .activity-photo { min-height: 0; height: 220px; grid-row: 1; }
  .activity-photo.is-team-photo { background: var(--navy); }
  .activity-photo.is-team-photo img { object-fit: contain; object-position: center; }
  .activity-info { grid-row: 2; }
  .activity-info p, .training-strip p { font-size: 1rem; }
  .activity-info .text-link { white-space: normal; }
  .affiliation-strip { padding: 22px; gap: 18px; }
  .affiliation-badges > span { white-space: normal; font-size: .875rem; }
  .training-strip strong span { display: block; margin: 4px 0 0; }
  .home-staff-card { flex-basis: 78%; }
  .home-staff-card img { max-height: 420px; }
  .home-staff-card strong { font-size: 1.65rem; }
  .home-staff-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 15px; }
  .home-staff-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-staff-controls button { min-height: 48px; }
  .home-staff-play { width: 100%; }
  .gallery-grid, .family-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .gallery-feature { grid-row: auto; }
  .gallery-image, .gallery-feature .gallery-image { height: auto; aspect-ratio: 4 / 3; }
  .gallery-caption { gap: 8px; }
  .gallery-caption > a { white-space: normal; font-size: .875rem; padding: 6px 0; }
  .social-wall > .wrap { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .social-wall-grid { gap: 8px; grid-template-rows: 210px 160px 160px; }
  .journal-invite, .documents-help { padding: 22px; gap: 20px; }
  .journal-invite .button, .documents-help .button { width: 100%; }
  .project-poster { padding: 16px; }
  .project-poster img { max-width: 100%; }
  .project-copy, .family-card-body { padding: 24px; }
  .project-copy h3 { font-size: clamp(2rem, 8vw, 2.8rem); }
  .project-facts span, .family-tag { font-size: .875rem; }
  .family-card-body > p:not(.family-tag) { font-size: 1rem; }
  .join-grid > div > p:not(.eyebrow) { font-size: 1rem; margin: 22px 0; }
  .join-section .button { width: 100%; }
  .contact-details { padding-top: 0; }
  .email-link { font-size: 1rem; }
  .safeguarding-person { padding: 24px; }
  .safeguarding-person h3 { font-size: 3rem; }
  .safeguarding-person > span { font-size: .75rem; }
  .safeguarding-person .button { width: 100%; }
  .faqs summary { font-size: 1rem; padding: 18px 32px 18px 0; }
  .faqs details p { font-size: 1rem; }

  /* Staff and teams use the available width without giant empty panels. */
  .staff-intro, .journal-intro, .calendar-intro { padding: 34px 0; }
  .staff-intro .wrap, .teams-intro-grid, .documents-intro-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .staff-intro h1, .journal-intro h1, .calendar-intro h1,
  .teams-intro h1, .documents-intro h1 { font-size: clamp(2.65rem, 10.5vw, 4rem); line-height: 1.02; }
  .staff-intro .intro-copy > p, .teams-intro-copy > p,
  .documents-intro p:not(.eyebrow) { font-size: 1rem; }
  .staff-total { gap: 14px; margin-top: 18px; padding-top: 16px; }
  .staff-total > strong { font-size: 2.5rem; }
  .staff-total > span { font-size: .875rem; }
  .staff-section-heading h2, .teams-heading h2, .staff-roster h2,
  .staff-cta h2, .teams-cta h2, .athletes-ready h2 { font-size: clamp(2.1rem, 8.5vw, 2.9rem); line-height: 1.04; }
  .staff-slide { grid-template-columns: minmax(0, 1fr); min-width: 0; min-height: 0; }
  .staff-portrait img { height: auto; max-height: 440px; width: 100%; object-fit: contain; }
  .staff-profile, .staff-slide.no-portrait .staff-profile { padding: 24px; }
  .staff-profile h3, .staff-slide.no-portrait h3 { font-size: clamp(2.25rem, 9.5vw, 3.2rem); line-height: 1.05; }
  .staff-slide.no-portrait { min-height: 0; }
  .staff-role { max-width: 100%; font-size: .875rem; }
  .staff-profile blockquote, .staff-profile > .staff-motto { font-size: 1.2rem; padding-left: 16px; line-height: 1.5; }
  .staff-profile .staff-quote-label, .staff-post-date { font-size: .875rem; }
  .carousel-controls, .team-carousel-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .carousel-buttons, .team-carousel-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .carousel-buttons button, .carousel-play, .team-carousel-buttons button,
  .team-carousel-play { min-height: 48px; font-size: .875rem; padding: 10px 12px; }
  .carousel-play, .team-carousel-play { width: 100%; grid-row: 2; }
  .carousel-dots { grid-row: 3; min-width: 0; max-width: 100%; flex-wrap: nowrap; justify-content: flex-start; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; padding: 4px 0 8px; }
  .carousel-dots button { flex: 0 0 44px; width: 44px; height: 44px; font-size: .875rem; }
  .staff-count, .team-count { font-size: .875rem; overflow-wrap: break-word; }
  .staff-roster-list { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .staff-roster-list li { padding: 17px 18px; }
  .staff-roster-list strong { font-size: 1rem; }
  .teams-intro-grid { min-height: 0; padding-top: 38px; padding-bottom: 38px; }
  .teams-total { gap: 16px; margin-top: 18px; }
  .teams-total strong { font-size: 3.5rem; }
  .teams-total span { font-size: .875rem; }
  .team-slide { grid-template-columns: minmax(0, 1fr); min-width: 0; }
  .team-visual { min-height: 250px; }
  .team-visual.has-photo { min-height: 0; display: block; }
  .team-visual.has-photo img { position: static; height: auto; object-fit: contain; }
  .team-visual.has-photo .team-photo-shade { display: none; }
  .team-visual.has-photo .team-photo-caption { position: static; display: block; padding: 10px 14px; font-size: .75rem; }
  .team-placeholder { padding: 25px; }
  .team-placeholder img { width: 112px; height: 114px; margin-bottom: 18px; }
  .team-placeholder strong { font-size: 1.9rem; }
  .team-placeholder small { font-size: .875rem; letter-spacing: .04em; }
  .team-profile { padding: 24px; }
  .team-profile h3 { font-size: clamp(2.5rem, 10vw, 3.5rem); }
  .team-profile h4 { font-size: 1.8rem; }
  .team-badges span, .team-training span { font-size: .875rem; }
  .team-actions { gap: 14px; margin-top: 24px; }
  .team-actions .button { width: 100%; }
  .team-carousel-dots { grid-row: 3; flex-basis: auto; gap: 8px; }
  .team-carousel-dots button { width: 44px; height: 44px; font-size: .875rem; }
  .team-directory-card { padding: 20px; gap: 16px; }
  .team-directory-card small { font-size: .875rem; }
  .athletes-ready-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .athletes-ready-panel article { min-height: 120px; padding: 16px; }
  .athletes-ready-panel h3 { font-size: 1.4rem; }
  .athletes-ready-panel p { font-size: .875rem; }
  .staff-cta-inner .button, .teams-cta-inner .button { width: 100%; }

  .journal-intro-bottom { margin-top: 20px; flex-direction: column; align-items: flex-start; gap: 18px; }
  .journal-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .journal-card-body { padding: 22px; }
  .journal-meta { font-size: .875rem; letter-spacing: .015em; }
  .journal-card h2 { font-size: 2rem; }
  .journal-story { font-size: 1rem; }
  .journal-card { scroll-margin-top: 84px; }
  .journal-card-links a, .journal-photo .photo-open { font-size: .875rem; }
  .journal-card-links a { min-height: 44px; display: inline-flex; align-items: center; }
  .journal-end { flex-direction: column; align-items: flex-start; gap: 20px; }
  .journal-end .button { width: 100%; }
  .calendar-workspace { padding-top: 22px; padding-bottom: 44px; }
  .calendar-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .calendar-tabs button { min-width: 0; min-height: 80px; font-size: .875rem; padding: 12px 7px; text-align: center; line-height: 1.35; overflow-wrap: break-word; }
  .calendar-tabs button span { font-size: .875rem; }
  .next-fixture, .next-fixture.compact, .next-fixture.featured,
  .friendly-card { padding: 22px; border-radius: 6px; }
  .next-fixtures-grid { margin-top: 25px; }
  .fixture-venue, .fixture-note, .friendly-card > p { font-size: 1rem; }
  .compact .button, .featured > .button { width: 100%; }
  .fixture-row { grid-template-columns: minmax(0, 1fr); padding: 22px; gap: 14px; }
  .fixture-day { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 14px; }
  .calendar-full-heading { display: block; }
  .calendar-full-heading > span { display: block; margin-top: 10px; }
  .calendar-photo-lead > div { padding: 24px; }
  .training-schedule-head h2, .friendlies-heading h2 { font-size: clamp(2.15rem, 8.5vw, 3rem); }
  .training-schedule-grid article { padding: 22px; }
  .training-schedule-grid strong { font-size: 2.5rem; }
  .friendly-card-top { flex-direction: column; align-items: flex-start; gap: 8px; }
  .friendly-time { font-size: 2.8rem; }
  .documents-intro-grid { min-height: 0; padding-top: 36px; padding-bottom: 36px; }
  .documents-intro img { height: 200px; border-width: 4px; transform: none; border-radius: 6px; }
  .documents-workspace { padding-top: 36px; padding-bottom: 48px; }
  .document-category-heading { grid-template-columns: 32px minmax(0, 1fr); gap: 14px; }
  .document-category-heading h2 { font-size: 2rem; }
  .document-card { grid-template-columns: 42px minmax(0, 1fr); padding: 18px; gap: 14px; }
  .document-icon { width: 40px; }
  .document-card .button { width: 100%; }
  .document-card p { font-size: 1rem; }
  .documents-help h2 { font-size: 2.25rem; }

  footer { padding: 34px 0 calc(25px + env(safe-area-inset-bottom, 0px)); }
  .footer-top, .footer-bottom { flex-direction: column; align-items: flex-start; gap: 20px; }
  .footer-bottom { font-size: .875rem; }
  .footer-bottom > div { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
  .footer-bottom a { min-height: 44px; display: flex; align-items: center; overflow-wrap: anywhere; }
  .social-row { gap: 14px; }
  .social-row a { font-size: .9375rem; overflow-wrap: anywhere; }
  .photo-dialog { width: calc(100% - 24px); max-width: none; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); margin: auto; border-radius: 10px; }
  .dialog-close { position: relative; top: auto; right: auto; margin: 10px 10px 10px auto; min-height: 44px; }
  .dialog-image-wrap img { max-height: 60vh; max-height: 60dvh; }
  .dialog-details { padding: 20px; display: block; }
  .dialog-details h2 { font-size: 1.125rem; }
  .dialog-details a { display: inline-flex; align-items: center; min-height: 44px; }
  .dialog-controls { margin-top: 16px; }
  .dialog-controls button { flex: 1; min-height: 48px; }
  .academy-weekend-backdrop { padding: 12px; }
  .academy-weekend-backdrop .academy-weekend-popup { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); padding: 58px 22px 24px; border-radius: 10px; }
  .academy-weekend-backdrop .academy-weekend-popup h2 { font-size: clamp(2.5rem, 10vw, 3.5rem); line-height: 1.02; }
  .academy-weekend-backdrop .academy-weekend-close { width: 44px; height: 44px; top: 10px; right: 10px; }
  .academy-weekend-event-meta span, .academy-weekend-event p,
  .academy-weekend-event a, .academy-weekend-reminder small { font-size: .875rem; }
  .academy-weekend-reminder { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 380px) {
  .hero-carousel-bar > .wrap { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .hero-carousel-bar > .wrap > span { grid-column: 1; grid-row: 1; text-align: center; }
  .hero-controls { grid-column: 1; grid-row: 2; justify-content: center; }
  .hero-dots { grid-row: 3; }
}

@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  .header-inner { min-height: 60px; }
  .brand img { width: 40px; height: 42px; }
  .header nav { max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); }
  .hero-carousel .hero-content { min-height: 0; padding-top: 30px; padding-bottom: 130px; }
  .hero-carousel .hero-slide h1, .hero-carousel .hero-slide:not(.hero-slide-main) h1 { font-size: 3rem; }
  .hero-description { font-size: 1rem; }
}

@media (max-width: 700px) and (max-height: 500px) and (orientation: landscape) {
  .hero-carousel .hero-content { padding-bottom: 30px; }
}
