@media (max-width: 1200px) {
  .docs-shell {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 40px;
    width: min(100% - 48px, 1120px);
  }

  .page-toc {
    display: none;
  }

  .page-home .docs-shell {
    width: min(100% - 48px, 1120px);
  }

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

  .entity-grid {
    grid-template-columns: 1fr;
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .event-timeline {
    grid-template-columns: 1fr;
  }

  .event-timeline li:not(:last-child)::after {
    top: auto;
    left: 50%;
    bottom: calc(var(--space-sm) * -0.9);
    width: 0;
    height: calc(var(--space-sm) * 0.8);
    border-top: 0;
    border-left: 1px solid var(--color-gold);
  }

  .hero-section {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    padding-block: 64px;
  }

  .hero-visual {
    min-height: 420px;
  }
}

@media (max-width: 900px) {
  .site-header__inner {
    width: min(100% - 40px, 100%);
    gap: var(--space-sm);
  }

  .site-nav {
    display: none;
  }

  .search-trigger {
    margin-left: auto;
  }

  .header-search {
    margin-left: auto;
  }

  .menu-toggle {
    display: grid;
  }

  .docs-shell {
    display: block;
    width: min(100% - 40px, var(--max-width-content));
    padding-top: var(--space-xl);
  }

  .docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: var(--z-index-sidebar);
    width: min(86vw, var(--sidebar-width));
    height: 100vh;
    max-height: none;
    padding: var(--space-md);
    background: var(--color-background);
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform var(--transition-base);
  }

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

  .docs-nav {
    margin-top: var(--space-xl);
    background: var(--color-surface);
  }

  .site-footer {
    width: min(100% - 40px, var(--max-width-content));
  }
}

@media (max-width: 640px) {
  .page-home .docs-shell {
    width: min(100% - 40px, var(--max-width-content));
  }

  .site-header__inner {
    min-height: 3.75rem;
    width: min(100% - 24px, 100%);
    gap: 0.5rem;
  }

  .site-logo {
    gap: 0;
    height: 2.75rem;
  }

  .site-logo img {
    width: 7.5rem;
    height: 2.35rem;
  }

  .site-logo span {
    display: none;
  }

  .search-trigger {
    min-width: 2.75rem;
    padding-inline: 0.75rem;
  }

  .search-trigger kbd {
    display: none;
  }

  .header-search {
    width: min(9rem, calc(100vw - 13rem));
  }

  .header-search kbd {
    display: none;
  }

  .search-trigger svg {
    width: 1.2rem;
    height: 1.2rem;
  }

  .doc-section {
    grid-template-columns: 1fr;
  }

  .docs-content,
  .docs-article,
  .doc-header,
  .doc-section,
  .doc-section > div,
  .callout,
  .checklist-section,
  .endpoint-summary,
  .page-pagination {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .doc-intro,
  .doc-section p,
  .callout p,
  .endpoint-summary dd {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .field-list div {
    grid-template-columns: 1fr;
  }

  .endpoint-summary div {
    grid-template-columns: 1fr;
  }

  .flow-diagram,
  .flow-diagram--long {
    grid-template-columns: 1fr;
  }

  .flow-diagram li:not(:last-child)::after {
    top: auto;
    right: auto;
    bottom: calc(var(--space-sm) * -0.95);
    content: "↓";
  }

  .tab-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .code-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .copy-button {
    width: 100%;
  }

  .search-trigger span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .search-modal {
    padding: var(--space-md);
  }

  .search-modal__panel {
    max-height: calc(100vh - (var(--space-md) * 2));
    overflow: auto;
  }

  .hero-section {
    gap: var(--space-xl);
    padding-block: var(--space-xl);
    max-width: 100%;
  }

  .hero-section h1 {
    max-width: 100%;
    font-size: clamp(2.15rem, 9.2vw, 2.75rem);
    line-height: 1;
    letter-spacing: -0.04em;
  }

  .hero-section__content {
    max-width: 100%;
  }

  .hero-section__description {
    max-width: 21rem;
    font-size: var(--font-size-md);
    overflow-wrap: anywhere;
  }

  .hero-actions,
  .hero-visual,
  .api-flow-panel {
    max-width: 100%;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions .button,
  .api-flow-panel {
    max-width: 21rem;
  }

  .hero-actions,
  .final-callout {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .flow-steps {
    display: grid;
  }

  .flow-steps li {
    justify-content: space-between;
  }

  .hero-visual {
    min-height: 0;
    justify-content: flex-start;
  }

  .api-flow-panel {
    width: 100%;
  }

  .page-pagination {
    grid-template-columns: 1fr;
  }

  .page-pagination__item:last-child {
    justify-content: flex-start;
    text-align: left;
  }
}
