/* ════════════════════════════════════════════════════════════════════
   Ooki Music - shared mobile / tablet layer
   Phones 320-768px, tablets 769-1024px. Desktop (>1024px) is untouched:
   every rule below lives inside a max-width media query.
   ════════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  :where(img, video, canvas, iframe, embed, object) { max-width: 100%; }
  :where(img, video) { height: auto; }
  .env-table, .dl-table, .api-table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .deploy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deploy-card, .d-step, .d-step-text { min-width: 0; }
  .d-step-text, .step-code { overflow-wrap: anywhere; }
  pre { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* touch-friendly tap targets (touch devices only) */
@media (max-width: 1024px) and (pointer: coarse) {
  .btn, a.btn, button.btn, .btn-sm,
  .nav-hamburger, .theme-toggle, .nav-icon-btn, .menu-btn,
  select, textarea,
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]):not([type=file]) {
    min-height: 44px;
  }
  .btn, a.btn, button.btn { display: inline-flex; align-items: center; justify-content: center; }
  .nav-hamburger, .theme-toggle, .nav-icon-btn, .menu-btn { min-width: 44px; }
  .nav-link, .footer-links a { min-height: 40px; display: inline-flex; align-items: center; }
}

@media (max-width: 768px) {
  body { overflow-wrap: break-word; }
  h1, h2, h3, h4, p, li, td, th, a, code { overflow-wrap: break-word; }
  code, kbd, samp { word-break: break-word; }
  table { max-width: 100%; }

  /* nav bars that carry a hamburger: keep only logo + hamburger inline */
  .top-nav:has(.nav-hamburger) > div:not(:first-child),
  .guide-nav:has(.nav-hamburger) > div:not(:first-child),
  .lic-nav:has(.nav-hamburger) > div:not(:first-child) { display: none !important; }
  /* inline text links beside the logo live in the hamburger drawer on phones */
  .top-nav:has(.nav-hamburger) > div:first-child > a:not(:first-child) { display: none !important; }
  .top-nav, .guide-nav, .lic-nav { padding-left: 16px !important; padding-right: 16px !important; }

  /* horizontal tab strips scroll inside themselves instead of widening the page */
  .profile-tabs, .artist-tabs {
    overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .profile-tabs::-webkit-scrollbar, .artist-tabs::-webkit-scrollbar { display: none; }
  .ptab, .atab { flex: 0 0 auto; white-space: nowrap; padding-left: 16px; padding-right: 16px; }

  /* long link/button rows wrap rather than overflow */
  .footer-links, .dh-hero-chips, .search-mode-btns, .nav-cta-group { flex-wrap: wrap; }
  .footer-links { gap: 10px 18px; }

  /* multi-column content blocks stack */
  .two-col, .bio-grid, .features-grid, .deploy-grid, .ov-fans, .ov-radio { grid-template-columns: minmax(0, 1fr) !important; }
  .two-col > *, .bio-grid > *, .features-grid > *, .deploy-grid > *, .ov-fans > *, .ov-radio > * { min-width: 0; }
  .code-box, .code-block, .code-snippet { max-width: 100%; overflow-x: auto; }
  .search-demo { flex-wrap: wrap; }
  .search-mode-btns { max-width: 100%; }
  .ov-pcard { width: min(300px, 100%); }
  .ov-fans-art { padding: 16px; overflow: hidden; }
  .dh-topbar { padding-left: 14px; padding-right: 14px; gap: 8px; }
  .dh-topbar-actions { gap: 6px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
  .dh-topbar-actions .btn { padding-left: 10px; padding-right: 10px; }
  .dh-main, .dh-hero, .dh-section, .dh-hero-content { min-width: 0; max-width: 100%; }
  .dh-chip { white-space: normal; }

  /* card grids: one column on phones */
  .coverage-grid, .dh-card-grid, .file-grid, .payout-grid, .place-grid, .posts-grid, .realm-grid,
  .steps-grid, .values-grid, .vp-lore-grid, .ap-va-grid, .products-grid, .shows-grid, .sw-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .step-card, .sw-card, .coverage-card, .realm-card { min-width: 0; max-width: 100%; }
  .ov-steps li, .ov-steps li > div { min-width: 0; }
  .ov-steps li b, .ov-steps li span { overflow-wrap: anywhere; }
  .ov-wrap, .ov-wrap > * { min-width: 0; max-width: 100%; }
  .press-email { max-width: 100%; padding: 12px 18px; font-size: 14px; word-break: break-all; }
  .d-step, .d-step-text { min-width: 0; max-width: 100%; }
  .d-step-text, .step-code { overflow-wrap: anywhere; }
  .step-code { overflow-x: auto; max-width: 100%; }
  .api-endpoint-card { flex-wrap: wrap; min-width: 0; }
  .endpoint-desc, .endpoint-path { min-width: 0; overflow-wrap: anywhere; }
  .capsule-3d { max-width: 100%; }
  .cap-glow-ring { inset: -12px !important; }
  .qs-step, .how-step { min-width: 0; }
  .qs-step > div, .how-step > div, .how-step-body { min-width: 0; }
}

@media (max-width: 480px) {
  [style*="grid-template-columns:repeat(auto-fill,minmax"],
  [style*="grid-template-columns: repeat(auto-fill, minmax"],
  [style*="grid-template-columns:repeat(auto-fit,minmax"] { grid-template-columns: minmax(0, 1fr) !important; }
  .ov-btns .ov-btn { flex: 1 1 100%; justify-content: center; }
}
