/* Stable compact mobile header: controls never overlap the centered logo. */
@media (max-width: 767px) {
  header > .max-w-7xl > .relative.flex.items-center.justify-between {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(94px, 34vw) minmax(0, 1fr) !important;
    align-items: center !important;
    column-gap: 4px !important;
    min-width: 0 !important;
  }

  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:first-child {
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    min-width: 0 !important;
    gap: 4px !important;
    z-index: 3 !important;
  }

  /* Swap only the visual positions. The buttons and their actions stay unchanged. */
  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:first-child button[aria-label="Search"] {
    order: 1 !important;
  }

  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:first-child button[aria-label="Menu"] {
    order: 2 !important;
  }

  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:nth-child(2) {
    position: static !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: center !important;
    transform: none !important;
    min-width: 0 !important;
    width: 100% !important;
    z-index: 2 !important;
  }

  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:nth-child(2) a,
  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:nth-child(2) img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 44px !important;
    object-fit: contain !important;
  }

  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:nth-child(3) {
    grid-column: 3 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    min-width: 0 !important;
    gap: 3px !important;
    z-index: 3 !important;
  }

  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:nth-child(3) button,
  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:nth-child(3) select {
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }

  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:nth-child(3) button[aria-label="Language"] {
    gap: 1px !important;
    padding: 2px !important;
    font-size: 11px !important;
  }

  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:nth-child(3) button[aria-label="Language"] svg {
    width: 17px !important;
    height: 17px !important;
  }

  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:nth-child(3) button[aria-label="Currency"] {
    padding: 3px 4px !important;
    font-size: 10px !important;
  }

  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:first-child button {
    padding: 2px !important;
  }

  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:first-child button[aria-label="Menu"] svg {
    width: 22px !important;
    height: 22px !important;
  }

  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:first-child button[aria-label="Search"] svg {
    width: 20px !important;
    height: 20px !important;
  }
}

@media (max-width: 360px) {
  header > .max-w-7xl > .relative.flex.items-center.justify-between {
    grid-template-columns: minmax(0, 1fr) minmax(82px, 29vw) minmax(0, 1fr) !important;
  }

  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:nth-child(3) button[aria-label="Language"] span,
  header > .max-w-7xl > .relative.flex.items-center.justify-between > div:nth-child(3) button[aria-label="Currency"] span {
    display: none !important;
  }
}

@media (min-width: 361px) and (max-width: 767px) and (orientation: landscape) {
  header > .max-w-7xl > .relative.flex.items-center.justify-between {
    grid-template-columns: minmax(0, 1fr) minmax(110px, 26vw) minmax(0, 1fr) !important;
  }
}
