.storefront .mobile-search-toggle { display: none; }

.storefront .mobile-search-dialog {
  inset: 12px 0 auto;
  width: min(480px, calc(100% - 24px));
  max-width: none;
  height: fit-content;
  max-height: calc(100dvh - 24px);
  margin: 0 auto;
  padding: 16px;
  border: 1px solid var(--shop-border);
  border-radius: 16px;
  background: var(--shop-surface);
  color: var(--shop-ink);
}

.storefront .mobile-search-dialog[open] { animation: cm-mobile-search-in 180ms ease-out both; }
.storefront .mobile-search-dialog .dialog-head { margin-bottom: 12px; }
.storefront .mobile-search-dialog .header-search { width: 100%; max-width: none; }
.storefront .mobile-search-dialog .header-search input { min-width: 0; font-size: 16px; }
.storefront .mobile-search-dialog .header-search button { flex: none; min-width: 44px; min-height: 44px; }

.storefront .mobile-menu-theme { margin-top: 14px; padding: 0 5px; }
.storefront .mobile-menu-theme .cm-theme-toggle:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
}

.storefront .mobile-menu-theme .cm-theme-toggle::after { content: attr(title); }

@keyframes cm-mobile-search-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 960px) {
  .storefront .topbar,
  .storefront .site-header .desktop-nav { display: none; }

  .storefront .site-header .header-main {
    width: calc(100% - 24px);
    min-height: 62px;
    flex-wrap: nowrap;
    gap: 8px;
    padding-block: 8px;
  }

  .storefront .site-header .brand {
    flex: 0 0 auto;
    width: clamp(91px, 27vw, 133px);
    min-width: 0;
  }

  .storefront .site-header .brand img { width: 100%; height: auto; }
  .storefront .site-header .header-main > .header-search,
  .storefront .site-header .header-actions > :is(.cm-theme-toggle, .account-link, .register-link) { display: none; }

  .storefront .site-header .header-actions {
    flex-wrap: nowrap;
    gap: clamp(2px, .72vw, 6px);
    margin-inline-start: auto;
  }

  .storefront .site-header .header-actions > :is(.mobile-search-toggle, .mobile-menu, .cart-link) {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: none;
    padding: 0;
    border-radius: 11px;
    color: var(--shop-ink);
  }

  .storefront .site-header .header-actions > :is(.mobile-search-toggle, .mobile-menu, .cart-link):hover { background: var(--shop-ice); }
  .storefront .site-header .header-actions > .cart-link { position: relative; }
  .storefront .site-header .header-actions > .cart-link > span { display: none; }
  .storefront .site-header .header-actions > .cart-link b {
    position: absolute;
    inset-block-start: 3px;
    inset-inline-end: 0;
    width: auto;
    min-width: 17px;
    height: 17px;
    padding-inline: 3px;
    border-radius: 10px;
    background: var(--shop-button);
    color: var(--shop-button-text);
    font-size: 9px;
  }

  .storefront .site-header .cm-lang-trigger {
    width: 47px;
    min-height: 44px;
    gap: 3px;
    padding-inline: 4px;
    font-size: 11px;
  }

  .storefront .site-header .header-actions .cm-lang-options {
    inset-inline-start: auto;
    inset-inline-end: 0;
  }
}

@media (max-width: 480px) {
  .cm-auth-header .cm-auth-header-actions { flex-wrap: nowrap; gap: 5px; }
  .cm-auth-header .cm-auth-header-actions .cm-lang-options { inset-inline-start: auto; inset-inline-end: 0; }
  .cm-auth-header .cm-auth-header-actions .cm-theme-toggle,
  .cm-auth-header .cm-auth-header-actions .cm-auth-return { width: 44px; height: 44px; }
  .cm-auth-header .cm-auth-header-actions .cm-auth-return { justify-content: center; }
  .cm-auth-header .cm-auth-header-actions .cm-auth-return span { display: none; }
}

@media (max-width: 440px) {
  .masthead { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .masthead .masthead-location { display: none; }
  .masthead > .cm-lang-dropdown { grid-column: auto; justify-self: end; }
  .masthead .cm-lang-options { inset-inline-end: 0; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .storefront .mobile-search-dialog[open] { animation: none; }
}
