/* Shared mobile refinements for every template page. */
@media (max-width: 780px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip !important;
  }

  .nav {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px 12px !important;
    width: 100% !important;
    min-height: 0 !important;
    padding: 9px 16px 0 !important;
    overflow: visible !important;
  }

  .nav .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .nav .brand img,
  .nav .brand-logo {
    width: min(142px, 42vw) !important;
    height: auto !important;
  }

  .nav .lang-dropdown {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .nav .lang-switcher {
    min-height: 34px;
    padding: 2px 4px 2px 10px;
    gap: 6px;
  }

  .nav .lang-switcher::after {
    width: 25px;
    height: 25px;
  }

  .nav .nav-cta {
    display: none !important;
  }

  .nav .nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    order: initial !important;
    position: static !important;
    inset: auto !important;
    display: flex !important;
    flex: none !important;
    width: calc(100% + 32px) !important;
    max-width: none !important;
    margin: 0 -16px !important;
    padding: 2px 16px 10px !important;
    gap: 20px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav .nav-links::-webkit-scrollbar {
    display: none;
  }

  .nav .nav-links a {
    flex: 0 0 auto;
    font-size: 13px !important;
    line-height: 28px;
    white-space: nowrap;
  }

  .lang-options {
    right: 0;
    min-width: 132px;
  }

  main,
  section,
  .hero,
  .hero-inner,
  .shell,
  .wrap,
  .article,
  .policy {
    min-width: 0;
    max-width: 100%;
  }

  .hero h1 {
    overflow-wrap: anywhere;
  }

  .hero-inner,
  .shell {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  .section,
  section {
    padding-left: 20px;
    padding-right: 20px;
  }

  .hero-grid,
  .showcase,
  .faq-layout,
  .dev-grid,
  .version-grid,
  .steps,
  .other-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .device-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .os-card,
  .feature,
  .step,
  .other,
  .dev-card,
  .version-card,
  .release-card {
    min-width: 0;
  }

  .actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
    width: 100%;
  }

  .actions .download-btn,
  .actions .qr-link,
  .actions .qr-link summary {
    width: 100%;
  }

  .platform-bar,
  .platforms,
  .faq-nav {
    max-width: calc(100vw - 28px) !important;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .platform-bar::-webkit-scrollbar,
  .platforms::-webkit-scrollbar,
  .faq-nav::-webkit-scrollbar {
    display: none;
  }

  .device img,
  .device-art img {
    max-width: none !important;
  }

  .news-card {
    min-width: 0;
  }

  .news-card > * {
    min-width: 0;
  }

  .news-card h3,
  .news-card p,
  .article,
  .article p,
  .policy-section,
  .history-note {
    overflow-wrap: anywhere;
  }

  .article img,
  .policy img,
  .article iframe,
  .policy iframe {
    max-width: 100%;
    height: auto;
  }

  .article table,
  .article pre,
  .policy table,
  .policy pre {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
  }

  .pagination {
    gap: 6px;
  }

  .pagination a,
  .pagination span {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
  }

  .foot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 28px 20px !important;
  }

  .foot-brand {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 380px) {
  .nav {
    padding-right: 14px !important;
    padding-left: 14px !important;
  }

  .nav .nav-links {
    width: calc(100% + 28px) !important;
    margin-right: -14px !important;
    margin-left: -14px !important;
    padding-right: 14px !important;
    padding-left: 14px !important;
    gap: 17px !important;
  }

  .hero h1 {
    font-size: 32px !important;
  }

  .hero-actions,
  .stats {
    flex-wrap: wrap;
  }

  .device-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .foot-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .foot-brand {
    grid-column: auto !important;
  }
}
