/* Keep fixes local to the affected component or page. After copy changes, run
   tests/site-wrap-audit.cjs --dense across all languages and widths. */
/* Short sample descriptions need balanced lines; long articles retain pretty wrapping. */
.sample-page .sample-card-copy > p:not(.sample-reference),
.sample-page .sample-note,
.sample-page .sample-visit > p {
  text-wrap: balance !important;
}

.event-page .event-gallery > p,
.event-page .event-meeting > p {
  max-inline-size: 72ch;
}

/* Keep catalogue scans complete without a wide empty frame on tablets. */
.service-process-media:has(> img[src*="assets/catalog/"]) {
  width: 100%;
  max-inline-size: 25rem;
  justify-self: center;
}

.sample-page .sample-card h2 {
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  overflow-wrap: normal;
}

@media (max-width: 430px) {
  .sample-page .sample-intro h1 {
    font-size: clamp(1.6rem, 7.5vw, 1.9rem);
    line-height: 1.2;
    overflow-wrap: normal;
  }
}

@media (max-width: 360px) {
  main .product-faq-heading h2 {
    font-size: 1.375rem;
  }
}

/* Product detail templates: prose and labels need different line treatment. */
.product-detail-page main :is(p, li, figcaption),
.product-catalogue-page main :is(p, li, figcaption),
.event-page main :is(p, li, figcaption),
.contact-oem-page main :is(p, li, figcaption),
.buying-flow-page main :is(p, li, figcaption) {
  text-wrap: pretty !important;
}

.product-detail-page main :is(h1, h2, h3, summary, .contact-pill, .product-related-card span, .panel-link),
.product-catalogue-page main :is(h1, h2, h3, summary, .contact-pill, .catalogue-entry),
.event-page main :is(h1, h2, h3, summary, .contact-pill),
.contact-oem-page main :is(h1, h2, h3, summary, .contact-pill),
.buying-flow-page main :is(h1, h2, h3, summary, .contact-pill) {
  text-wrap: balance !important;
}

.buyer-search-card :is(h3, p) {
  text-wrap: balance !important;
}

/* Reusable editorial components on the remaining pages. */
:is(.inner-hero, .section-heading, .growth-heading, .growth-card,
    .buyer-search-heading, .product-photo-heading, .product-photo-copy,
    .product-faq-heading, .signal-copy, .service-process-copy,
    .news-card-copy, .brand-heading, .brand-card-copy,
    .catalogue-page-copy, .parts-page-card, .page-intro-copy,
    .home-sourcing-copy, .home-evidence-copy, .home-sourcing-range,
    .home-oem-copy, .home-own-brands, .home-process-grid,
    .home-final, .home-journey) :is(h1, h2, h3),
:is(.inner-hero, .signal-actions, .page-intro-actions, .brand-certificate-grid,
    .brand-card-copy, .product-photo-copy) :is(.contact-pill, .panel-link),
.catalogue-entry,
.home-sourcing-range {
  text-wrap: balance !important;
}

:is(.inner-hero, .section-heading, .growth-heading, .growth-card,
    .buyer-search-heading, .product-photo-heading, .product-photo-copy,
    .product-faq-heading, .signal-copy, .service-process-copy,
    .news-card-copy, .brand-heading, .brand-card-copy,
    .catalogue-page-copy, .parts-page-card, .page-intro-copy,
    .home-sourcing-copy, .home-evidence-copy, .home-sourcing-range,
    .home-oem-copy, .home-own-brands, .home-process-grid,
    .home-final, .home-journey, .product-faq-list, .brand-records,
    .brand-portfolio, .event-meeting, .guide-enquiry-list) p,
.growth-intro,
.inner-hero-intro,
.event-intro,
.event-discussion,
.event-archive-note,
.form-note,
.form-privacy-note,
.home-factory-identity,
.home-sourcing-helper,
.catalogue-section-intro,
.catalogue-search-help,
.catalogue-results-status,
.location-note,
.news-cover figcaption,
.event-photo figcaption,
.home-evidence-card figcaption,
.service-process-media figcaption,
.brand-photo-pair figcaption,
.home-export-facts li,
.export-market-list li,
.service-process-list li {
  text-wrap: pretty !important;
}

.product-faq-list summary,
.product-photo-more summary,
.inquiry-order-details summary,
.purchasing-summary summary {
  text-wrap: balance !important;
}

/* Narrow cards, links and disclosure subtitles. */
.product-oem-note li,
.service-process-list li,
.home-sourcing-range p,
.product-source-link,
.breadcrumbs li,
.brand-records summary,
.brand-portfolio summary,
.purchasing-terms-link,
.home-detail-links a,
.panel-link,
.home-sourcing-range h2,
.inquiry-order-details summary > span {
  text-wrap: balance !important;
}

/* These compact text blocks improve with even lines at narrow widths. */
.product-detail-description,
.guide-enquiry-list li,
.news-cover figcaption,
.service-process-media figcaption,
.home-export-facts li,
.event-photo figcaption,
.home-sourcing-copy > p:not(.eyebrow),
.home-own-brands > p,
.home-evidence-copy > p:not(.eyebrow),
.location-note,
.catalogue-results-status,
.form-note,
.inner-hero-intro {
  text-wrap: balance !important;
}

.export-market-list {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)) !important;
}

/* Short order-step descriptions need even lines in the intermediate two-column layout. */
.home-process-grid p {
  text-wrap: balance !important;
}

.site-footer .footer-brand-copy p {
  text-wrap: balance;
}

@media (max-width: 600px) {
  .quote-entry-options .contact-pill {
    flex-basis: 100%;
  }
}

@media (min-width: 431px) and (max-width: 520px) {
  .product-catalogue-page .catalogue-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 430px) {
  .service-process-list li {
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.75rem;
  }
  .service-process-list li > span {
    width: 2rem;
    height: 2rem;
  }

  .home-sourcing-range {
    grid-template-columns: 4.5rem minmax(0, 1fr);
  }
  .home-sourcing-range h2 {
    font-size: 1rem;
  }
  .fair-banner {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.55rem;
  }
  .fair-banner :is(.fair-banner-copy, .fair-banner-booth, .fair-banner-cta) {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }
}

@media (max-width: 360px) {
  .export-markets .growth-heading h2,
  .product-photo-heading h2,
  .product-faq-heading h2 {
    font-size: 1.5rem;
  }
  html[lang="ru"] .event-page .event-copy h1 {
    font-size: 1.55rem;
  }
  .product-catalogue-page .page-intro-copy h1 {
    font-size: 1.55rem;
  }
}

@media (max-width: 370px) {
  main .inner-hero.ru-wholesale-hero h1,
  main .inner-hero.ru-kids-hero h1 {
    font-size: 1.35rem;
  }
  .inner-hero:is(.ru-wholesale-hero, .ru-kids-hero) {
    padding-inline: 1rem;
  }
}

@media (min-width: 901px) and (max-width: 1100px) {
  html[lang="ru"] .page-intro-actions .contact-pill {
    font-size: 0.875rem;
  }
}
