/* Responsive documentation layout. Loaded after the desktop stylesheet. */

html,
body {
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  min-width: 0;
}

img,
video,
svg,
canvas {
  max-width: 100%;
}

@media (max-width: 900px) {
  .docs-header {
    width: 100%;
  }

  .docs-header-inner {
    display: grid !important;
    width: 100%;
    max-width: none;
    height: auto !important;
    min-height: 0;
    grid-template-columns: 44px minmax(0, 1fr) !important;
    grid-template-areas:
      "menu brand"
      "search search" !important;
    align-items: center;
    gap: 10px 12px;
    padding: 10px 14px 12px;
  }

  .sidebar-toggle {
    grid-area: menu !important;
    display: grid !important;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    place-items: center;
    border: 1px solid #dfdfe8;
    border-radius: 12px;
    background: #fff;
    color: #4d4b57;
    font-size: 22px;
    line-height: 1;
  }

  .brand {
    grid-area: brand !important;
    display: flex;
    width: max-content;
    max-width: 100%;
    min-width: 0;
    align-items: center;
    justify-self: start !important;
    overflow: visible;
  }

  .brand-mark {
    flex: 0 0 34px;
  }

  .brand > span:last-child {
    min-width: 0;
  }

  .brand strong,
  .brand small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .search-wrap {
    position: relative !important;
    inset: auto !important;
    grid-area: search !important;
    width: 100%;
    min-width: 0;
  }

  .search-wrap > input {
    width: 100%;
    height: 44px;
    padding: 0 42px;
    font-size: 16px;
  }

  .search-icon {
    top: 10px;
  }

  .search-wrap kbd {
    display: none;
  }

  .search-results {
    top: calc(100% + 7px);
    max-height: min(420px, calc(100dvh - 140px));
  }

  .header-actions {
    display: none !important;
  }

  .docs-layout {
    display: block !important;
    width: 100%;
    max-width: none !important;
    min-width: 0;
    margin: 0;
    padding: 0 14px !important;
  }

  .docs-main,
  .article,
  .article-section,
  .docs-home-grid,
  .home-card,
  .mini-ui,
  .callout,
  .step {
    min-width: 0;
    max-width: 100%;
  }

  .docs-main {
    width: 100%;
    margin: 0;
    padding: 20px 0 60px !important;
    overflow: visible;
  }

  .article-toc {
    display: none !important;
  }

  .docs-sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    z-index: 80;
    width: min(340px, calc(100vw - 24px)) !important;
    max-width: 100%;
    height: 100dvh !important;
    padding: 18px 14px 28px !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: 1px solid #e5e3eb;
    background: #fff;
    box-shadow: 18px 0 48px rgba(27, 18, 55, .17);
    transform: translateX(-105%);
    transition: transform .2s ease;
  }

  .docs-sidebar.open {
    transform: translateX(0);
  }

  body:has(.docs-sidebar.open) {
    overflow: hidden;
  }

  .sidebar-top {
    margin-bottom: 14px;
  }

  .sidebar-top button {
    display: grid !important;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border-radius: 10px;
    background: #f5f3f9;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: block;
    border: 0;
    background: rgba(23, 25, 35, .38);
  }

  .breadcrumbs {
    display: flex;
    max-width: 100%;
    flex-wrap: nowrap;
    gap: 7px;
    margin-bottom: 16px;
    overflow-x: auto;
    color: #8b8993;
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
    scrollbar-width: none;
  }

  .breadcrumbs::-webkit-scrollbar {
    display: none;
  }

  .breadcrumbs span {
    flex: 0 0 auto;
  }

  .article-hero {
    position: relative;
    margin-bottom: 25px;
    padding: 24px 20px;
    overflow: hidden;
    border-radius: 18px;
  }

  .article-hero > * {
    position: relative;
    z-index: 1;
  }

  .article-hero::after {
    right: -68px;
    bottom: -82px;
    width: 148px;
    height: 148px;
  }

  .article h1 {
    max-width: none;
    margin-bottom: 11px;
    font-size: clamp(30px, 8.5vw, 38px);
    line-height: 1.08;
    letter-spacing: -.035em;
    overflow-wrap: break-word;
  }

  .article-lead {
    font-size: 16px;
    line-height: 1.5;
  }

  .article-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 12px;
    margin-top: 17px;
    line-height: 1.35;
  }

  .article-meta span:last-child {
    grid-column: 1 / -1;
  }

  .article-section {
    margin-bottom: 30px;
    scroll-margin-top: 132px;
  }

  .article h2 {
    margin-bottom: 13px;
    font-size: clamp(23px, 6.5vw, 28px);
    line-height: 1.2;
  }

  .article h3 {
    font-size: 18px;
    line-height: 1.3;
  }

  .article p,
  .article ul,
  .article ol {
    font-size: 15px;
    line-height: 1.62;
    overflow-wrap: break-word;
  }

  .article ul,
  .article ol {
    padding-left: 21px;
  }

  .docs-home-grid,
  .quick-links,
  .role-grid,
  .metric-mock,
  .kds-board {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .home-card {
    padding: 18px;
    overflow: hidden;
  }

  .home-card h3,
  .home-card p,
  .home-card small {
    overflow-wrap: break-word;
  }

  .step {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .step-index {
    width: 34px;
    height: 34px;
  }

  .callout {
    align-items: flex-start;
    gap: 11px;
    padding: 14px;
  }

  .callout > span {
    flex: 0 0 auto;
  }

  .feature-table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .feature-table th,
  .feature-table td {
    min-width: 150px;
  }

  .feature-table th:first-child,
  .feature-table td:first-child {
    min-width: 170px;
  }

  .mini-ui {
    overflow: hidden;
    border-radius: 14px;
  }

  .mini-ui-body {
    max-width: 100%;
    padding: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .status-flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .status-node:nth-child(3n)::after {
    display: none;
  }

  .stock-grid {
    min-width: 520px;
  }

  .phone-ui {
    width: min(250px, 100%);
  }

  .article-pagination {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-top: 38px;
  }

  .pagination-link {
    min-width: 0;
  }

  .pagination-link.next {
    text-align: left;
  }
}

@media (max-width: 430px) {
  .docs-header-inner {
    grid-template-columns: 42px minmax(0, 1fr) !important;
    gap: 9px 10px;
    padding: 9px 12px 11px;
  }

  .sidebar-toggle {
    width: 42px;
    height: 42px;
    min-width: 42px;
  }

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

  .brand strong {
    font-size: 16px;
  }

  .brand small {
    display: block;
    font-size: 10px;
  }

  .docs-layout {
    padding-inline: 12px !important;
  }

  .docs-main {
    padding-top: 18px !important;
  }

  .article-hero {
    padding: 21px 17px;
  }

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

  .article-meta span:last-child {
    grid-column: auto;
  }

  .article h1 {
    font-size: 30px;
  }

  .article h2 {
    font-size: 24px;
  }

  .home-card {
    padding: 16px;
  }

  .status-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-node:nth-child(3n)::after {
    display: block;
  }

  .status-node:nth-child(2n)::after {
    display: none;
  }
}

@media (max-width: 340px) {
  .brand small {
    display: none;
  }

  .docs-layout {
    padding-inline: 10px !important;
  }

  .article-hero {
    padding: 19px 15px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .sidebar-toggle,
  .sidebar-top button,
  .doc-group-title,
  .doc-link,
  .pagination-link,
  .button {
    min-height: 44px;
  }
}
