/* Common layout safeguards for all six pages. */
main :where(section, article, div, figure, aside, form, nav, ol, ul) > *,
.shared-site-header *,
.shared-site-footer * {
  min-width: 0;
}

:where(h1, h2, h3, p, li, dd, figcaption, label, a) {
  overflow-wrap: anywhere;
}

main :where(img, video, iframe) { max-width: 100%; }
input, select, textarea { max-width: 100%; }
.shared-brand, .shared-menu-toggle { flex-shrink: 0; }
.shared-primary-nav a, .shared-footer-column a {
  display: flex;
  align-items: center;
  min-height: 44px;
}
.shared-primary-nav .shared-nav-cta { justify-content: center; gap: 4px; }
.shared-footer-bottom button, .shared-footer-bottom > a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.shared-footer-bottom > div { flex-wrap: wrap; }
.shared-dialog-close { width: 44px; height: 44px; }
.shared-legal-dialog {
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.shared-legal-dialog > div { padding-top: 65px; }

@media (max-width: 850px) {
  .shared-primary-nav {
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .shared-primary-nav a { display: flex; }
  .lab-index.lab-index-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-index.lab-index-four a { border-bottom: 1px solid #ffffff35; }
  .lab-index.lab-index-four a:nth-child(even) { border-right: 0; }
}

@media (max-width: 640px) {
  /* 16px controls avoid automatic input zoom on mobile Safari. */
  input:not([type="checkbox"]):not([type="radio"]), select, textarea,
  .contact-form-page input:not([type="checkbox"]):not([type="radio"]),
  .contact-form-page select, .contact-form-page textarea {
    font-size: 16px;
  }
  .button { min-height: 48px; white-space: normal; text-align: center; }
  .lab-hero-bottom p { flex: 1; }
  .lab-index.lab-index-four { grid-template-columns: minmax(0, 1fr); }
  .lab-hero h1 { font-size: clamp(2.2rem, 9vw, 3.5rem); }
  .technical-figure img { object-fit: contain; }
  .project-tabs { max-width: 100%; overscroll-behavior-x: contain; }
  .project-tab { flex-shrink: 0; }
  .shared-footer-top { gap: 28px; }
  .shared-footer-bottom > div { gap: 8px 20px; }
  .shared-legal-dialog h2 { font-size: clamp(1.65rem, 7vw, 2.25rem); }
}

@media (max-width: 380px) {
  .shared-nav-shell, .shared-section-shell { width: calc(100% - 30px); }
  .hero h1 { font-size: clamp(2.6rem, 13vw, 3.1rem); }
  .about-content, .pillar-copy, .pillar-compact > div, .project-panel { padding-inline: 20px; }
  .roadmap-stage { grid-template-columns: 45px minmax(0, 1fr); gap: 16px; }
  .about-section h2, .contact-section h2 { font-size: 2.1rem; }
}

@media (max-height: 500px) and (max-width: 950px) {
  .shared-site-header { padding-block: 8px; }
  .shared-brand, .shared-site-header.scrolled .shared-brand { height: 45px; }
  .shared-primary-nav { max-height: calc(100dvh - 90px); }
  .lab-hero { padding-top: 100px; }
  .lab-label { margin-top: 35px; }
}
