/* Mobile layout corrections.
 *
 * Material for MkDocs already owns the page and drawer geometry. Keep fixes
 * local to content that can genuinely overflow instead of forcing every
 * container to 100vw and hiding the resulting overflow.
 */

@media screen and (max-width: 76.1875em) {
  .md-main__inner {
    min-width: 0;
  }

  .md-content {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding-inline: 0 !important;
  }

  .md-content__inner {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .md-sidebar--secondary {
    display: none;
  }
}

@media screen and (max-width: 768px) {
  .md-content__inner {
    margin-inline: 0;
    padding-inline: 0.75rem !important;
    padding-top: 0.75rem;
  }

  .md-typeset {
    font-size: 0.95rem;
    overflow-wrap: anywhere;
  }

  .md-typeset h1 {
    font-size: clamp(1.55rem, 7vw, 2rem);
    line-height: 1.3;
  }

  .md-typeset h2 {
    font-size: clamp(1.3rem, 6vw, 1.65rem);
    line-height: 1.35;
  }

  .md-typeset h3 {
    font-size: clamp(1.1rem, 5vw, 1.35rem);
  }

  .md-typeset img,
  .md-typeset video,
  .md-typeset iframe,
  .md-typeset embed,
  .md-typeset object {
    max-width: 100%;
    height: auto;
  }

  .md-typeset pre,
  .md-typeset .highlight,
  .md-typeset .md-typeset__scrollwrap,
  .md-typeset .md-typeset__table {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .md-typeset table:not([class]) {
    width: max-content;
    min-width: 100%;
  }

  .md-typeset .grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .md-typeset .grid.cards > ul,
  .md-typeset .grid.cards > ol {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero {
    padding: 2rem 0;
  }

  .hero__inner {
    max-width: 100%;
    padding-inline: 1rem;
  }

  .hero__cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .hero__cta .md-button {
    margin: 0;
  }

  .home-hero {
    box-sizing: border-box;
    max-width: 100%;
    padding: 1rem;
  }

  .home-hero .md-button {
    box-sizing: border-box;
    max-width: 100%;
    margin-block: 0.2rem;
    white-space: normal;
  }

  .mobile-cat-tabs {
    position: sticky;
    top: 2.4rem;
    z-index: 3;
    box-sizing: border-box;
    display: flex;
    width: calc(100% + 1.5rem);
    max-width: none;
    margin: -0.75rem -0.75rem 1rem;
    gap: 0.5rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 0.55rem 0.75rem;
    background: var(--md-default-bg-color);
    border-bottom: 1px solid var(--md-default-fg-color--lightest);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-cat-tab {
    flex: 0 0 auto;
  }

  .hub-v2,
  .hub-v2 * {
    min-width: 0;
  }

  .hub-v2 .hub-pop-tabs__labels {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .hub-v2 .hub-pop-tabs__label {
    flex: 0 0 auto;
    padding-inline: 0.9rem;
  }

  .hub-v2 .hub-pop-tabs__item,
  .hub-v2 .hub-fresh-item {
    align-items: flex-start;
  }

  .hub-v2 .hub-fresh-item {
    flex-direction: column;
    gap: 0.15rem;
  }

  .hub-v2 .hub-fresh-date {
    min-width: 0;
  }

  .md-typeset .tabbed-labels {
    display: flex;
    max-width: 100%;
    gap: 0.35rem;
    overflow-x: auto;
    padding: 0.35rem;
    background: var(--md-code-bg-color);
    border: 1px solid var(--md-default-fg-color--lightest);
    border-radius: 0.6rem;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .md-typeset .tabbed-labels > label {
    flex: 0 0 auto;
    padding: 0.45rem 0.75rem;
    border-radius: 0.4rem;
  }

  .md-footer__inner {
    padding-inline: 0.75rem;
  }
}

@media screen and (max-width: 480px) {
  .md-content__inner {
    padding-inline: 0.5rem !important;
  }

  .mobile-cat-tabs {
    width: calc(100% + 1rem);
    margin-inline: -0.5rem;
    padding-inline: 0.5rem;
  }

  .hero__cta {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .hero__cta .md-button,
  .home-hero .md-button {
    display: flex;
    width: 100%;
    justify-content: center;
  }
}
