/*
  HZ connection — Responsive QA patch v3.0
  Loaded after the shared and page-specific stylesheets on all 13 public pages.
  Scope: mobile/tablet layout, navigation, overflow, touch targets and readable card sizing.
*/

/* Global safety: prevent accidental viewport overflow from decorative artwork and long content. */
html {
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}
@supports not (overflow: clip) {
  body { overflow-x: hidden; }
}
main, section, article, aside, .container, .container-fluid, .container-xl,
[class*="col-"], .row, .card, .modal-content {
  min-width: 0;
}
img, video, canvas, iframe, svg {
  max-width: 100%;
}
p, li, small, label, a, button, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: anywhere;
}
input, select, textarea, button {
  max-width: 100%;
}
main section[id], main [id] {
  scroll-margin-top: 88px;
}
:focus-visible {
  outline: 3px solid rgba(36, 184, 153, .72);
  outline-offset: 3px;
}

/* Header and drawer are intentionally independent of individual page layouts. */
.site-header {
  width: 100%;
  max-width: 100%;
  left: 0;
  right: 0;
  transition: transform .24s ease, background .3s ease, box-shadow .3s ease, top .3s ease;
}
.site-header.is-scrolled {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1100 !important;
  width: 100% !important;
  background: rgba(5, 22, 34, .97) !important;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
}
.mobile-nav,
.mobile-nav-backdrop {
  box-sizing: border-box;
}
.mobile-nav {
  background: linear-gradient(155deg, #061a28 0%, #082a38 100%) !important;
  color: #edf8f5 !important;
  opacity: 1 !important;
  isolation: isolate;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.mobile-nav-backdrop {
  background: rgba(1, 10, 18, .78) !important;
  pointer-events: none;
}
.mobile-nav-backdrop.is-open {
  pointer-events: auto;
}
.mobile-nav-language {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex: 0 0 auto;
  margin-top: auto;
  padding: 18px 0 13px;
  border-top: 1px solid rgba(255,255,255,.11);
}
.mobile-nav-language > span {
  width: 1px;
  height: 15px;
  background: rgba(255,255,255,.22);
}
.mobile-nav-language-btn {
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: #b8ccce;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}
.mobile-nav-language-btn.is-active {
  color: #73e4c5;
  border-color: rgba(115,228,197,.5);
  background: rgba(115,228,197,.09);
}
.mobile-nav-bottom {
  flex: 0 0 auto;
  margin-top: 0 !important;
}
body.menu-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

/* Tablet and phone layout. */
@media (max-width: 991.98px) {
  .site-header.is-hidden {
    transform: translate3d(0, -110%, 0) !important;
    pointer-events: none !important;
  }
  .site-header.is-scrolled .nav-shell {
    height: 70px !important;
    min-height: 70px;
  }
  .nav-shell {
    min-width: 0;
    height: 72px;
    min-height: 72px;
    gap: 9px;
  }
  .brand {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 43%;
    gap: 8px;
  }
  .brand-mark {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
  }
  .brand-wordmark {
    min-width: 0;
    max-width: 100%;
  }
  .brand-wordmark strong {
    font-size: 12px;
    line-height: 1.3;
    letter-spacing: 0;
    white-space: nowrap;
    overflow-wrap: normal;
  }
  .desktop-nav,
  .nav-login,
  .btn-register {
    display: none !important;
  }
  .nav-actions {
    flex: 0 0 auto;
    min-width: 0;
    margin-left: auto;
    gap: 7px;
  }
  .language-switch {
    flex: 0 0 auto;
    gap: 4px;
    padding: 4px 6px;
  }
  .language-btn {
    padding: 4px 5px;
    font-size: 10px;
    white-space: nowrap;
  }
  .mobile-menu-toggle {
    display: flex !important;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    align-items: center;
    justify-content: center;
  }
  .mobile-nav {
    display: flex !important;
    position: fixed !important;
    z-index: 1202 !important;
    inset: 0 0 0 auto !important;
    width: min(88vw, 390px) !important;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    padding: max(24px, env(safe-area-inset-top)) 23px max(22px, env(safe-area-inset-bottom)) !important;
    border-left: 1px solid rgba(115,228,197,.15);
    box-shadow: -25px 0 65px rgba(0,0,0,.38);
    transform: translate3d(105%,0,0) !important;
    visibility: hidden;
    pointer-events: none;
    transition: transform .32s cubic-bezier(.2,.7,.2,1), visibility .32s;
  }
  .mobile-nav.is-open {
    transform: translate3d(0,0,0) !important;
    visibility: visible;
    pointer-events: auto;
  }
  .mobile-nav-backdrop {
    display: block !important;
    position: fixed !important;
    z-index: 1201 !important;
    inset: 0 !important;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .28s ease, visibility .28s ease;
  }
  .mobile-nav-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .mobile-nav-top {
    flex: 0 0 auto;
    padding-bottom: 18px;
    margin-bottom: 8px;
  }
  .mobile-nav-label {
    font-size: 10px;
    line-height: 1.5;
  }
  .mobile-nav > a {
    display: block;
    flex: 0 0 auto;
    min-height: 46px;
    padding: 12px 2px;
    border-bottom: 1px solid rgba(255,255,255,.09);
    color: #eef8f5 !important;
    font-size: 15px;
    line-height: 1.45;
    font-weight: 650;
    text-decoration: none;
  }
  .mobile-nav > a:active,
  .mobile-nav > a:hover {
    color: #75e4c5 !important;
  }
  .mobile-nav-language {
    margin-top: 22px;
  }
  .container-xl {
    width: 100%;
    max-width: 100%;
  }
  .row > * {
    min-width: 0;
  }
  .hero-section,
  .about-hero,
  .directory-hero,
  .catalog-hero,
  .expo-hero,
  .ed-hero,
  .newsroom-hero,
  .research-hero,
  .video-hero,
  .contact-page-hero,
  .pd-hero {
    max-width: 100%;
  }
  .hero-copy h1,
  .about-hero-copy h1,
  .dir-hero-copy h1,
  .catalog-hero-copy h1,
  .expo-hero-copy h1,
  .ed-hero-copy h1,
  .newsroom-hero-copy h1,
  .research-hero h1,
  .video-hero h1,
  .contact-hero-copy h1,
  .pd-hero h1 {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .section-heading-row,
  .news-section-heading,
  .research-section-heading,
  .video-section-heading,
  .expo-directory-heading {
    min-width: 0;
  }
  .directory-layout,
  .catalog-layout,
  .expo-layout,
  .newsroom-layout,
  .research-library-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    min-width: 0;
  }
  .directory-main,
  .catalog-results,
  .expo-results,
  .news-results-area,
  .research-results {
    min-width: 0;
    width: 100%;
  }
  .directory-filters,
  .catalog-filter-panel,
  .expo-filter-panel,
  .news-filter-panel,
  .research-filter-panel {
    max-width: 100%;
  }
  .pd-jumpbar,
  .ed-section-nav,
  .ed-section-nav-inner,
  .expo-section-nav,
  .nd-toc-card {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .pd-jumpbar::-webkit-scrollbar,
  .ed-section-nav::-webkit-scrollbar,
  .ed-section-nav-inner::-webkit-scrollbar,
  .expo-section-nav::-webkit-scrollbar,
  .nd-toc-card::-webkit-scrollbar {
    display: none;
  }
}

/* Phone-specific refinements. */
@media (max-width: 767.98px) {
  .container-xl,
  .container {
    padding-left: 18px;
    padding-right: 18px;
  }
  .site-header .container-xl {
    padding-left: 15px;
    padding-right: 15px;
  }
  .section-space {
    padding-top: 64px;
    padding-bottom: 58px;
  }
  .section-heading-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 26px;
  }
  .section-heading h2,
  .section-heading-centered h2 {
    font-size: clamp(26px, 7.4vw, 34px);
    line-height: 1.28;
  }
  .section-heading p,
  .section-heading-centered p {
    font-size: 13px;
    line-height: 1.8;
  }
  .hero-copy h1 {
    font-size: clamp(35px, 9.2vw, 48px);
    line-height: 1.13;
    letter-spacing: -.035em;
  }
  .hero-description {
    font-size: 14px;
    line-height: 1.8;
  }
  .hero-actions {
    gap: 10px;
  }
  .hero-actions .btn {
    min-height: 48px;
    font-size: 13px;
  }
  .hero-bottom-row {
    align-items: flex-start;
  }
  .hero-stat {
    min-width: 0;
  }
  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-rows: minmax(188px, auto) !important;
    align-items: stretch;
    gap: 12px !important;
  }
  .category-card {
    min-width: 0;
    min-height: 188px !important;
    height: 100%;
    border-radius: 14px;
  }
  .category-card.category-large {
    grid-column: 1 / -1 !important;
    min-height: 220px !important;
  }
  .category-content {
    left: 15px;
    right: 14px;
    bottom: 15px;
  }
  .category-content h3 {
    font-size: clamp(13px, 3.8vw, 16px) !important;
    line-height: 1.35;
    margin: 6px 0 8px;
  }
  .category-link {
    font-size: 10px !important;
    line-height: 1.4;
  }
  .category-number {
    font-size: 10px;
  }
  .news-layout,
  .news-feature-layout,
  .newsroom-layout,
  .research-featured-card,
  .video-feature-card {
    min-width: 0;
  }
  .news-feature-image {
    max-width: 100%;
  }
  .news-list {
    min-width: 0;
  }
  .newsletter-panel,
  .news-newsletter-panel,
  .research-newsletter-inner,
  .nd-newsletter-inner {
    min-width: 0;
  }
  .company-card,
  .product-card,
  .event-card,
  .news-article-card,
  .research-card,
  .video-card,
  .contact-route-card,
  .cp-coop-card,
  .cp-process-card {
    min-width: 0;
    max-width: 100%;
  }
  .company-card p,
  .product-body p,
  .event-body p,
  .news-article-card p,
  .research-card p,
  .video-card p {
    overflow-wrap: anywhere;
  }
  .contact-form input,
  .contact-form select,
  .contact-form textarea,
  .cp-contact-form input,
  .cp-contact-form select,
  .cp-contact-form textarea,
  .ed-form-shell input,
  .ed-form-shell select,
  .ed-form-shell textarea,
  .video-submit-card input,
  .video-submit-card select,
  .video-submit-card textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    font-size: 16px;
  }
  .contact-form button,
  .cp-contact-form button,
  .ed-form-shell button,
  .video-submit-card button,
  .newsletter-form button,
  .news-newsletter-form button,
  .research-newsletter-form button {
    min-height: 46px;
  }
  .footer-main {
    min-width: 0;
  }
  .footer-bottom {
    gap: 12px;
  }
  .footer-legal {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .modal-card,
  .member-modal-card {
    width: min(100% - 20px, 560px);
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }
}

/* Small phones: favour readable single-column content and reliable touch targets. */
@media (max-width: 575.98px) {
  .nav-shell {
    height: 68px;
    min-height: 68px;
    gap: 7px;
  }
  .site-header.is-scrolled .nav-shell {
    height: 68px !important;
    min-height: 68px;
  }
  .brand {
    max-width: 39%;
    gap: 7px;
  }
  .brand-mark {
    flex-basis: 33px;
    width: 33px;
    height: 33px;
  }
  .brand-wordmark strong {
    font-size: 11px;
  }
  .nav-actions {
    gap: 5px;
  }
  .language-switch {
    gap: 2px;
    padding: 3px 4px;
  }
  .language-btn {
    padding: 4px 4px;
    font-size: 9px;
  }
  .mobile-menu-toggle {
    flex-basis: 42px;
    width: 42px;
    min-width: 42px;
    height: 42px;
  }
  .mobile-nav {
    width: min(90vw, 370px) !important;
    padding-left: 21px !important;
    padding-right: 21px !important;
  }
  .mobile-nav > a {
    min-height: 44px;
    font-size: 15px;
  }
  .mobile-nav-language-btn {
    min-height: 40px;
    font-size: 12px;
  }
  .directory-results-grid,
  .catalog-results,
  .expo-card-grid,
  .news-results-grid,
  .research-card-grid,
  .video-card-grid,
  .cp-products-grid,
  .cp-related-grid,
  .ed-related-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .directory-results-grid.is-list .directory-card,
  .catalog-results.is-list .catalog-card,
  .expo-card-grid.is-list .expo-card,
  .news-results-grid.list-view .news-article-card,
  .research-card-grid.is-list .research-card,
  .video-card-grid.is-list .video-card {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .directory-results-grid.is-list .directory-card img,
  .catalog-results.is-list .catalog-card img,
  .expo-card-grid.is-list .expo-card img,
  .news-results-grid.list-view .news-card-image,
  .research-card-grid.is-list .research-card-image,
  .video-card-grid.is-list .video-card-media {
    width: 100%;
    height: 175px;
    min-height: 175px;
    object-fit: cover;
  }
  .news-highlight-grid,
  .news-feature-side,
  .about-gallery-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .cp-cap-grid,
  .cp-updates-grid,
  .cp-document-grid,
  .pd-app-grid,
  .pd-docs-grid,
  .ed-topics-grid,
  .ed-benefits-grid,
  .research-theme-grid,
  .video-theme-grid,
  .video-pillar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cp-credentials-layout,
  .cp-contact-panel,
  .cp-location-card,
  .pd-inquiry-card,
  .pd-split-section,
  .expo-calendar-layout,
  .research-method-layout,
  .video-submission-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .cp-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .cp-field-full {
    grid-column: auto;
  }
  .ed-related-card {
    grid-template-columns: 112px minmax(0, 1fr);
  }
  .news-highlight-card {
    grid-template-columns: 104px minmax(0, 1fr);
  }
  .news-highlight-card img {
    min-width: 0;
    max-width: 100%;
  }
  .footer-main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 25px 16px;
  }
  .footer-brand-col,
  .footer-contact-col {
    grid-column: 1 / -1;
  }
  .footer-contact-col {
    min-width: 0;
  }
  .footer-contact-col a,
  .footer-brand-col p {
    overflow-wrap: anywhere;
  }
  .section-heading h2 {
    font-size: clamp(25px, 7.2vw, 31px);
  }
}

/* Narrow devices and very small viewport widths. */
@media (max-width: 380px) {
  .container-xl,
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }
  .site-header .container-xl {
    padding-left: 12px;
    padding-right: 12px;
  }
  .brand {
    max-width: 36%;
  }
  .brand-mark {
    flex-basis: 30px;
    width: 30px;
    height: 30px;
  }
  .brand-wordmark strong {
    font-size: 10px;
  }
  .language-btn {
    font-size: 8px;
    padding-left: 3px;
    padding-right: 3px;
  }
  .mobile-menu-toggle {
    flex-basis: 40px;
    width: 40px;
    min-width: 40px;
    height: 40px;
  }
  .category-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-auto-rows: auto !important;
    gap: 11px !important;
  }
  .category-card,
  .category-card.category-large {
    grid-column: 1 / -1 !important;
    min-height: 205px !important;
  }
  .category-content h3 {
    font-size: 15px !important;
  }
  .cp-cap-grid,
  .cp-updates-grid,
  .cp-document-grid,
  .pd-app-grid,
  .pd-docs-grid,
  .ed-topics-grid,
  .ed-benefits-grid,
  .research-theme-grid,
  .video-theme-grid,
  .video-pillar-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .ed-related-card,
  .news-highlight-card {
    grid-template-columns: minmax(0, 1fr);
  }
  .ed-related-img,
  .news-highlight-card img {
    height: 165px;
    min-height: 165px;
  }
}

/* Honour user motion preferences and avoid hover-only affordances on touch screens. */
@media (hover: none) {
  .company-card:hover,
  .category-card:hover img,
  .cp-coop-card:hover,
  .contact-route-card:hover,
  .research-card:hover,
  .video-card:hover {
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  .site-header,
  .mobile-nav,
  .mobile-nav-backdrop {
    transition-duration: .01ms !important;
  }
}
