/* Stage 32: phone navigation, search and touch-target hardening. */
@media (max-width: 700px) {
  .site-header,
  .nav-wrap,
  .brand,
  .main-nav,
  .search-box,
  .search-suggestions {
    min-width: 0;
  }

  .nav-wrap {
    position: relative;
  }

  .brand {
    max-width: calc(100% - 56px);
  }

  .brand > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .menu-toggle {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin-right: -6px;
    border-radius: 12px;
    touch-action: manipulation;
  }

  .menu-toggle:focus-visible,
  .main-nav a:focus-visible,
  .search-box button:focus-visible,
  .search-box input:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }

  .main-nav {
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    max-height: calc(100vh - 90px);
    max-height: calc(100dvh - 90px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
    border-radius: 16px;
  }

  .main-nav.open {
    display: grid;
    gap: 4px;
  }

  .main-nav a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 12px 14px;
  }

  .search-box {
    width: 100%;
  }

  .search-box input {
    width: 100%;
  }

  .search-box button {
    min-height: 46px;
    touch-action: manipulation;
  }

  .search-suggestions {
    max-height: min(46vh, 320px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .search-suggestions a {
    align-items: flex-start;
    gap: 10px;
    min-height: 48px;
    padding: 12px 14px;
    overflow-wrap: anywhere;
  }

  .search-suggestions a > span {
    flex: 0 0 auto;
    max-width: 38%;
    text-align: right;
    white-space: normal;
  }

  .hero-links a,
  .filter-chip,
  .related-tools a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  .footer-grid a,
  .footer-grid span,
  .footer-bottom {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 380px) {
  .brand {
    font-size: 20px;
    gap: 8px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .search-icon {
    padding: 0 5px;
    font-size: 22px;
  }

  .search-suggestions a {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .search-suggestions a > span {
    max-width: none;
    text-align: left;
  }
}
