/*
 * Author: Andrey Morozov
 * Confidential. Responsive and reduced-motion behavior for the IAM docs
 * portal. It collapses secondary navigation while preserving content order,
 * readable touch targets and the desktop information architecture.
 */

@media (max-width: 1180px) {
  :root { --sidebar-width: 236px; --toc-width: 180px; }
  .site-header { grid-template-columns: var(--sidebar-width) minmax(260px, 400px) 1fr; padding: 0 20px; }
  .header-links { gap: 18px; }
  .content-frame { gap: 34px; padding-inline: 32px; }
  .product-role { display: none; }
  .product-index-row { grid-template-columns: 1fr 16px; }
}

@media (max-width: 980px) {
  .site-header { grid-template-columns: auto minmax(240px, 1fr) auto; gap: 24px; }
  .header-links > a:not(.group-link), .header-links .language-switcher { display: none; }
  .content-frame { grid-template-columns: minmax(0, 860px); }
  .toc { display: none; }
  .capability-summary ul { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --header-height: 64px; }

  .site-header { grid-template-columns: 1fr auto; gap: 12px; padding: 0 18px; }
  .brand { font-size: 17px; }
  .brand-mark { width: 24px; }
  .search-trigger, .header-links { display: none; }
  .mobile-actions { display: flex; gap: 8px; }
  .mobile-actions .language-switcher { align-self: center; }
  .mobile-actions button { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--iam-stroke-strong); border-radius: var(--radius-sm); background: rgba(255,255,255,.02); color: var(--iam-ink); }
  .mobile-actions svg { width: 20px; }

  .docs-shell { display: block; }
  .sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: 90;
    width: min(320px, 88vw);
    height: auto;
    padding: 24px 22px 48px;
    background: #080e1d;
    box-shadow: 24px 0 60px rgba(0, 0, 0, .48);
    transform: translateX(-105%);
    transition: transform var(--transition);
  }

  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open::before { position: fixed; inset: var(--header-height) 0 0; z-index: 80; background: rgba(2, 5, 13, .7); content: ""; }

  .content-frame { display: block; padding: 34px 20px 56px; }
  .breadcrumbs { margin-bottom: 20px; }
  .home-hero { padding-bottom: 28px; }
  .home-hero h1, .article-header h1, .product-header h1 { font-size: clamp(38px, 12vw, 52px); line-height: 1.05; }
  .hero-lead, .article-header > p, .product-header > div > p { font-size: 19px; }
  .home-hero > p:not(.hero-lead) { font-size: 15px; }
  .hero-actions { display: block; }
  .hero-actions .button { width: 100%; min-height: 50px; }
  .hero-actions .button.secondary { margin-top: 10px; border: 0; background: transparent; }

  .ecosystem-map { margin-top: 10px; }
  .map-row { display: block; min-height: 0; margin: 24px 0; padding-left: 26px; border-left: 1px solid var(--iam-stroke-bright); }
  .map-label { display: block; margin-bottom: 10px; color: var(--iam-blue-hi); font-size: 12px; }
  .map-products { display: grid; justify-content: start; gap: 9px; }
  .map-products::before, .map-products::after { display: none; }
  .map-products a { min-height: 32px; font-size: 13px; }
  .core-rail, .mind-rail { justify-content: flex-start; min-height: 48px; margin: 14px 0; padding: 0 16px; }
  .mind-rail small { display: none; }

  .product-columns { display: block; }
  .product-index-row { min-height: 58px; }
  .product-name { font-size: 14px; }
  .integration-contract pre { padding-right: 18px; white-space: normal; }
  .integration-contract button { display: none; }

  .product-header { display: block; }
  .product-actions { justify-content: flex-start; max-width: none; margin-top: 20px; }
  .text-link { width: auto; text-align: left; }
  .product-screenshot { margin-top: 4px; }
  .product-screenshot img { aspect-ratio: 4 / 3; }
  .capability-summary { padding: 17px; }
  .prose { font-size: 15px; }
  .prose h2 { margin-top: 38px; font-size: 25px; }
  .prose table { display: block; overflow-x: auto; }
  .verified-links dl div { grid-template-columns: 90px 1fr; }
  .page-neighbors { grid-template-columns: 1fr; }

  .site-footer { display: block; margin: 0 20px; padding: 32px 0; }
  .site-footer nav { margin-top: 20px; }
  .site-footer .copyright { margin-top: 22px; }

  .search-dialog { padding-top: 10px; }
  .search-panel { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .search-results { max-height: calc(100vh - 160px); }
}

@media (max-width: 410px) {
  .brand-name { font-size: 16px; }
  .mobile-actions button { width: 38px; height: 38px; }
  .content-frame { padding-inline: 18px; }
  .home-hero h1, .article-header h1, .product-header h1 { font-size: 40px; }
  .product-actions .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
