/*
 * AFA Telecom original-design responsive integrity patch, v1.1.
 * Does not change colours, images, animation, nav structure, or border radii.
 * Loaded after original page styles to stop editorial headings and grid children
 * from drawing over adjacent content.
 */
:where(
  .container, .numbered-layout, .numbered-layout > *,
  .about-layout, .about-layout > *, .about-layout .section-content,
  .story-heading-row, .story-heading-row > *, .story-intro,
  .md-layout, .md-layout > *, .md-content, .md-figure,
  .reach-layout, .reach-layout > *, .reach-text, .reach-map,
  .testimonial-layout, .testimonial-layout > *, .testimonials-window,
  .testimonial-track, .testimonial-card,
  .achievements-layout, .achievements-layout > *, .achievements-scroller,
  .hero-wrap, .hero-wrap > *, .hero-stage, .hero-carousel, .hero-slide,
  .category-layout, .category-layout > *, .domains-layout, .domains-layout > *,
  .lifecycle-layout, .lifecycle-layout > *,
  .fin-report-grid, .fin-report-grid > *, .fin-report,
  .fin-report-actions, .fin-report-actions > *,
  .ct-hero-grid, .ct-hero-grid > *, .ct-offices-grid,
  .ct-offices-grid > *, .ct-office, .ct-office-details,
  .ab-overview-grid, .ab-overview-grid > *, .ab-prose,
  .ab-process-grid, .ab-process-grid > *,
  .ab-masthead-inner, .ab-team-card,
  .policy-reading-grid, .policy-reading-grid > *, .policy-content,
  .master-mega-grid, .master-mega-grid > *, .master-mega-col,
  .master-footer-inner, .master-footer-inner > *
) { min-width: 0; }

:where(
  .about-layout h2, .about-layout p,
  .number-title h2, .story-intro h2, .story-intro p,
  .md-content h2, .md-content p,
  .reach-text h2, .reach-text p,
  .ab-prose, .ab-prose h2, .ab-prose p,
  .fin-report h3, .fin-report p,
  .ct-office h3, .ct-office p, .ct-office a,
  .policy-content, .policy-content h2, .policy-content p,
  .testimonial-card p, .hero-title-content,
  .master-mega-link, .master-footer-col a
) {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}

/* Screenshot 1: the large 01 serif heading must remain inside its grid area. */
.about-section .section-content h2,
.about-layout .section-content h2 {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  font-size: clamp(30px, 3.1vw, 56px);
  line-height: 1.08;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.about-layout .section-content,
.about-layout .about-copy,
.about-layout .about-media {
  min-width: 0;
  max-width: 100%;
}

/* Screenshot 2: give the 08 heading enough room without covering its card. */
.testimonial-layout {
  grid-template-columns: minmax(0, 300px) 25px minmax(0, 1fr) 25px;
}
.testimonial-layout > .number-title,
.testimonial-layout > .number-title h2 {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.testimonial-layout > .number-title h2 {
  min-width: 0;
  font-size: clamp(18px, 1.3vw, 22px);
  line-height: 1.18;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.testimonial-layout .testimonials-window,
.testimonial-layout .testimonial-track,
.testimonial-layout .testimonial-card {
  min-width: 0;
  max-width: 100%;
}
.testimonial-layout .testimonial-card p { overflow-wrap: anywhere; }

/* Other side-by-side text and media areas. No content clipping. */
.story-heading-row :where(h1,h2,h3),
.md-layout :where(h1,h2,h3),
.reach-layout :where(h1,h2,h3),
.ab-overview-grid :where(h1,h2,h3),
.ab-process-grid :where(h1,h2,h3),
.fin-hero-inner :where(h1,h2,h3),
.ct-hero-grid :where(h1,h2,h3),
.policy-reading-grid :where(h1,h2,h3) {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.hero-carousel,.achievements-scroller,.testimonial-track {
  min-width: 0;
  max-width: 100%;
}

/* A heading and two carousel arrows should fit at all tablet widths. */
@media (max-width: 1120px) {
  .testimonial-layout {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    gap: 12px;
    align-items: center;
  }
  .testimonial-layout > .number-title {
    grid-column: 1 / -1;
    grid-row: 1;
    align-self: start;
  }
  .testimonial-layout > .number-title h2 {
    font-size: clamp(23px, 3vw, 35px);
    overflow-wrap: anywhere;
  }
  .testimonial-layout > .testimonial-nav:first-of-type {
    grid-column: 1;
    grid-row: 2;
  }
  .testimonial-layout > .testimonials-window {
    grid-column: 2;
    grid-row: 2;
  }
  .testimonial-layout > .testimonial-nav:last-of-type {
    grid-column: 3;
    grid-row: 2;
  }
}

/* At tablet widths, stacked text and image avoids impossible 3-column ratios. */
@media (max-width: 960px) {
  .numbered-layout.about-layout {
    display: grid;
    grid-template-columns: 64px minmax(0,1fr);
    column-gap: 14px;
    row-gap: 24px;
  }
  .about-layout > .section-number { grid-column: 1; grid-row: 1; }
  .about-layout > .section-content {
    grid-column: 2;
    grid-row: 1;
  }
  .about-layout > .about-media {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    max-width: 100%;
  }
  .about-section .section-content h2,
  .about-layout .section-content h2 {
    font-size: clamp(30px, 5.4vw, 48px);
  }
  .md-layout,
  .reach-layout {
    grid-template-columns: minmax(0,1fr);
  }
  /* Keep the story section's intentional row/column placements intact. */
  .story-heading-row {
    grid-template-columns: minmax(0, 40%) 55px minmax(0, 1fr);
  }
  .md-layout > .md-rule { display: none; }
  .md-layout > .md-figure, .md-layout > .md-content {
    max-width: 100%;
    min-width: 0;
  }
}

@media (max-width: 620px) {
  .story-heading-row { grid-template-columns: 50px minmax(0,1fr); }
  .numbered-layout.about-layout { grid-template-columns: 48px minmax(0,1fr); gap: 12px; }
  .about-section .section-content h2,
  .about-layout .section-content h2 {
    font-size: clamp(27px, 7vw, 39px);
    line-height: 1.1;
  }
  .testimonial-layout { grid-template-columns: 25px minmax(0,1fr) 25px; gap: 8px; }
  .testimonial-layout > .number-title { gap: 12px; }
  .testimonial-layout > .number-title h2 {
    font-size: clamp(21px, 5.2vw, 29px);
    line-height: 1.15;
  }
  .testimonial-layout .testimonial-track { grid-auto-columns: 100%; }
  .testimonial-layout .testimonial-card { box-sizing: border-box; }
  .fin-report-actions {
    flex-wrap: wrap;
    gap: 10px;
  }
  .fin-report-actions > * {
    max-width: 100%;
    min-width: 0;
  }
  .master-footer-inner > * { min-width: 0; overflow-wrap: anywhere; }
}
