/* Responsive resilience layer.
 * Loaded last so these rules can normalize both current PHP components and
 * imported Webflow pages without disturbing their desktop presentation. */

html {
  scroll-padding-top: 77px;
}

:where(main, section, article, aside, header, footer, nav, div) {
  min-width: 0;
}

:where(pre, code, iframe, video, canvas, table) {
  max-width: 100%;
}

pre,
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.bttn,
.bttn-2,
.menu-button,
.w-slider-arrow-left,
.w-slider-arrow-right {
  min-height: 44px;
}

.bttn,
.bttn-2 {
  max-width: 100%;
  white-space: normal;
}

@media screen and (max-width: 991px) {
  html {
    scroll-padding-top: 65px;
  }

  html.has-open-menu,
  html.has-open-menu body {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .top-nav-menu {
    box-sizing: border-box;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    padding-top: calc(65px + var(--space-md) + env(safe-area-inset-top));
    padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .top-nav-brand {
    padding-left: max(var(--space-md), env(safe-area-inset-left));
  }

  .menu-button {
    padding-right: max(var(--space-md), env(safe-area-inset-right));
  }

  /* A fixed 600px hero can clip translated pages or large-text users. Keep
     the shared visual height when it fits, but let content make it taller. */
  body.interior-page :is(.hero-sub, .hero-full, .hero-small, .hero-gradient,
    .hero-2col, .hero--learntensorflowjs, .rn-hero, .expo-hero, .ignite-hero,
    .ios-hero, .case-study-hero, .podcast-hero) {
    height: auto !important;
    min-height: min(var(--interior-hero-height), 100svh) !important;
    max-height: none !important;
  }

  /* Standard content sections need less empty space once they stack. */
  .section,
  .alt-blocks,
  .lg-feature {
    padding-top: calc(var(--space-lg) + var(--space-md));
    padding-bottom: calc(var(--space-lg) + var(--space-md));
  }

  .section + .alt-blocks,
  .section + .lg-feature,
  .talks-grid-section + .lg-feature {
    padding-top: 0;
  }

  /* Imported pages contain a few authored embed widths. They may retain
     their aspect ratio, but never force the page wider than the viewport. */
  .imported-content [class*="html-embed"],
  .imported-content :is(.copy-contain--sm, .block__heading,
    .block__narrative--full, .block__heading--full, .block__centered,
    .decryptor-content) {
    width: 100%;
    max-width: 100%;
  }

  .imported-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media screen and (max-width: 767px) {
  body.interior-page {
    --interior-hero-height: 400px;
  }

  .footer-v2 {
    padding-top: var(--space-lg);
    padding-bottom: var(--space-lg);
  }

  .footer-v2 .footer-container:has(.site-footer__intro) {
    gap: var(--space-md);
  }

  .site-footer__intro {
    gap: var(--space-md);
    padding-bottom: var(--space-md);
  }

  .section,
  .alt-blocks,
  .lg-feature {
    padding-top: var(--space-lg);
    padding-bottom: var(--space-lg);
  }

  .hero-sub,
  body.interior-page :is(.hero-sub, .hero-small, .hero-gradient, .hero-2col,
    .hero--learntensorflowjs, .rn-hero, .expo-hero, .ignite-hero, .ios-hero,
    .case-study-hero, .podcast-hero) {
    padding-top: calc(65px + var(--space-lg)) !important;
    padding-bottom: var(--space-lg) !important;
  }

  .hero-sub .measure {
    margin-bottom: 0;
  }

  .hero-home__text,
  .hero-sub :is(.measure, .hero-sub__content),
  body.interior-page :is(.expo-hero-wrapper, .podcast-hero-wrapper,
    .ignite-hero-heading-container) {
    width: 100%;
  }

  .contact-aside {
    max-width: var(--reading-width);
    margin-right: auto;
    margin-left: auto;
  }

  .footer-v2 .footer-nav-col-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding-top: var(--space-xs);
    padding-bottom: var(--space-xs);
  }
}

@media screen and (max-width: 479px) {
  .hero-home .bttn,
  .hero-sub .bttn,
  .bottom-cta-content .bttn,
  .contact-form .bttn,
  .signup .bttn,
  .services-open-source .bttn {
    width: 100%;
  }

  .form__input,
  .imported-content :is(input, select, textarea) {
    font-size: 16px;
  }

  .contact-form {
    margin-top: calc(-1 * var(--space-md));
  }

  .site-footer__cta .bttn {
    width: 100%;
    white-space: normal;
  }

  .footer-v2 .footer-nav-wrapper {
    gap: var(--space-lg) var(--space-md);
  }
}

/* Short phone/tablet landscape viewports need a content-height hero instead
   of a forced viewport panel. This also avoids hiding calls to action behind
   mobile browser chrome. */
@media screen and (max-width: 991px) and (max-height: 600px) {
  .hero-home {
    min-height: auto;
    padding-top: calc(65px + var(--space-lg));
    padding-bottom: var(--space-lg);
  }

  body.interior-page :is(.hero-sub, .hero-full, .hero-small, .hero-gradient,
    .hero-2col, .hero--learntensorflowjs, .rn-hero, .expo-hero, .ignite-hero,
    .ios-hero, .case-study-hero, .podcast-hero) {
    min-height: min(var(--interior-hero-height), 100svh) !important;
  }
}
