/* Compatibility fixes for the original themes. Keep each theme's layout,
   typography and palette; constrain content, not the document's overflow. */

/* Give wordmarks room to keep their proportions. The legacy headers use
   square image attributes and inline caps as low as 22px. */
html[data-classic-theme] {
  --classic-logo-height: 56px;
  --classic-logo-width: 200px;
}

html[data-classic-theme] :is(
  .header-logo #logo,
  .company-name-logo img,
  .header .store-name-section img,
  .ls-main-header img.image,
  .headerStoreInfo .logoStoreImg,
  .header-section-title > img.logo,
  .header-inner .logo img,
  .menu-mobile-logo img,
  #desktop-header > .container > a > #logo,
  .header-section #image0_507_1809
) {
  width: auto !important;
  height: var(--classic-logo-height) !important;
  max-width: min(var(--classic-logo-width), 100%) !important;
  max-height: var(--classic-logo-height) !important;
  min-width: 0;
  object-fit: contain;
  flex-shrink: 1;
}

html[data-classic-theme] :is(#desktop-header, #dkn-desktop-header) .header-logo {
  flex-shrink: 0;
}

html[data-classic-theme] .header-logo > a {
  min-width: 0;
  max-width: 100%;
}

html[data-classic-theme] .header-logo > a > :not(img) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1024px) {
  html[data-classic-theme] {
    --classic-logo-height: 48px;
    --classic-logo-width: min(160px, 40vw);
  }
}

category-cards,
.results-wrapper,
.advance-filter__cards-wrapper,
.productInfo,
.product-info {
  min-width: 0;
}

.dkn-product-card-name,
.dkn-product-name,
.productTitle,
.product-title {
  overflow-wrap: anywhere;
}

.dkn-product-card-price-label,
.dkn-product-card-pricing-label {
  flex-wrap: wrap;
}

/* Keep whole header labels and their arrows clear of the More control. */
.classic-menu {
  min-width: 0;
}
.classic-menu-list > [data-classic-menu-hidden],
.classic-menu .classic-menu-toggle[hidden] {
  display: none !important;
}
.classic-menu-list > :not(.classic-menu-toggle) {
  flex-shrink: 0;
}
.classic-menu[data-classic-menu-overflow="true"] .classic-menu-list {
  margin-inline: 0 !important;
}
.classic-menu .classic-menu-toggle {
  position: absolute !important;
  inset-inline-end: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0 !important;
  padding: 0 !important;
}
.classic-menu .classic-menu-toggle::before {
  display: none;
}
.classic-menu-toggle > button {
  width: 44px;
  min-height: 44px;
}

/* These legacy side masks extend a full viewport beyond Oxford's header. */
html[data-classic-theme="luxury"] .sub-header-2 > .container::before,
html[data-classic-theme="luxury"] .sub-header-2 > .container::after {
  display: none;
}

/* Bootstrap rows need room for their negative gutters inside the container. */
category-cards.row {
  width: auto;
}

html[data-classic-theme="amaze"] .row:has(> .d-flex > .search-result-text) {
  margin-inline: 0;
}

html[data-classic-theme="dawn"] .input-wrapper {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1024px) {
  .pdp-button-wrapper {
    max-width: 100%;
    box-sizing: border-box;
  }

  html[data-classic-theme="ursa"]
    .pdp-button-wrapper:not(.pdp-button-wrapper-fixed) {
    /* The legacy tablet rule forces 100vw inside a padded container. */
    width: calc(100% + 32px) !important;
    max-width: calc(100% + 32px) !important;
  }

  html[data-classic-theme="d2c"] .main-container,
  html[data-classic-theme="luxury"] .filters-layout-wrapper,
  html[data-classic-theme="enigma"] .filters-layout-wrapper {
    margin-inline: 0;
    width: 100%;
    max-width: 100%;
  }

  html[data-classic-theme="luxury"] category-cards.product-row {
    width: auto;
    max-width: 100%;
    margin-inline: 0;
  }

  .pdp-button-wrapper-fixed,
  .custom-mobile-sort-button {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  select,
  textarea {
    font-size: max(1em, 16px);
    max-width: 100%;
  }
}

@media (max-width: 1200px) {
  html[data-classic-theme="impulse"]
    #splide-similar-products
    .splide__arrow--next {
    /* Override the template's negative inline offsets at tablet widths. */
    right: 0 !important;
  }
  html[data-classic-theme="impulse"]
    #splide-similar-products
    .splide__arrow--prev {
    left: 0 !important;
  }
}

@media (pointer: coarse), (max-width: 767px) {
  add-to-bag-button button,
  add-to-bag-button-with-variants button,
  add-to-bag-button-with-external-quantity-input button,
  buy-now-button-load-point button,
  .custom-mobile-sort-button button {
    min-height: 44px;
  }
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--primary, currentColor);
  outline-offset: 3px;
}
