/* Mobile responsiveness patch for the static Khandelwal Gas site.
   The site is assembled from inline-styled React components, so these rules use
   scoped, mobile-only !important overrides to collapse desktop grids and tame
   the sticky header on narrow screens. */

@media (max-width: 760px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .kg-container,
  .kg-container--wide {
    padding-inline: var(--space-5) !important;
  }

  header .kg-container {
    max-width: 100% !important;
  }

  header .kg-container:first-child {
    gap: 10px !important;
  }

  header .kg-container:first-child > span {
    min-width: 0 !important;
    max-width: 58vw !important;
  }

  header .kg-container:first-child > a {
    padding-left: 0 !important;
  }

  header .kg-container--wide[style*="height: var(--header-h)"] {
    height: auto !important;
    min-height: var(--header-h) !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    padding-block: 8px !important;
    flex-wrap: wrap !important;
  }

  header .kg-container--wide[style*="height: var(--header-h)"] > a:first-child {
    margin-right: auto !important;
    min-width: 0 !important;
  }

  header img[alt*="Khandelwal Gas"] {
    height: 56px !important;
    max-width: min(190px, 45vw) !important;
    object-fit: contain !important;
  }

  header .kg-header-actions {
    gap: 8px !important;
    margin-left: auto !important;
  }

  header .kg-menu-toggle {
    display: inline-flex !important;
    padding: 0 !important;
    min-height: 42px !important;
    flex: none !important;
  }

  header nav#kg-primary-nav {
    order: 3 !important;
    display: none !important;
    width: 100% !important;
    flex: 0 0 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    overflow: visible !important;
    padding: 8px 0 4px !important;
  }

  header.kg-menu-open nav#kg-primary-nav {
    display: flex !important;
  }

  header nav#kg-primary-nav a {
    width: 100% !important;
    padding: 12px 14px !important;
    font-size: 14px !important;
    border: 1px solid var(--line-200) !important;
    background: var(--bg-surface) !important;
  }

  h1 {
    font-size: clamp(42px, 12vw, 50px) !important;
    line-height: 1.05 !important;
  }

  h2 {
    font-size: clamp(30px, 9vw, 42px) !important;
  }

  [style*="grid-template-columns: 1.05fr 0.95fr"],
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1.1fr"],
  [style*="grid-template-columns: 1.1fr 1fr"],
  [style*="grid-template-columns: 1.4fr 1fr"],
  [style*="grid-template-columns: 1.4fr 1fr 1.3fr"] {
    grid-template-columns: 1fr !important;
  }

  [style*="padding: var(--space-9) var(--space-5)"] {
    padding-block: var(--space-7) !important;
  }

  [style*="min-height: 420px"] {
    min-height: 300px !important;
  }

  [style*="height: 200px"] {
    height: 150px !important;
  }

  [style*="bottom: 26px"][style*="left: 26px"] {
    left: 16px !important;
    right: 16px !important;
    bottom: 16px !important;
    flex-direction: column !important;
  }

  [style*="display: flex"][style*="gap: var(--space-7)"][style*="margin-top: 40px"] {
    gap: var(--space-5) !important;
    flex-wrap: wrap !important;
  }

  [style*="background: var(--navy-700)"][style*="justify-content: space-between"] {
    align-items: flex-start !important;
    flex-direction: column !important;
  }

  form [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  [style*="display: flex"][style*="gap: 12px"] {
    flex-wrap: wrap !important;
  }

  iframe + div {
    max-width: calc(100% - 36px) !important;
  }
}

@media (max-width: 420px) {
  .kg-container,
  .kg-container--wide {
    padding-inline: 20px !important;
  }

  header .kg-container:first-child {
    font-size: 11px !important;
  }

  header .kg-container:first-child > span {
    max-width: 50vw !important;
  }

  header img[alt*="Khandelwal Gas"] {
    height: 54px !important;
    max-width: min(176px, 44vw) !important;
  }

  header .kg-header-actions {
    gap: 6px !important;
  }

  header .kg-menu-toggle {
    width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
  }

  h1 {
    font-size: 42px !important;
  }

  [style*="padding: var(--space-8)"] {
    padding: var(--space-6) !important;
  }
}
