/**
 * HVE storefront extension styles.
 *
 * Sections retain the effective cascade order of the former inline
 * style blocks. Keep this file loaded after the base and route styles.
 */

/* ==========================================================================
   Mobile header checkout-link fix
   ========================================================================== */
#alert {
  pointer-events: none;
}

#alert > * {
  pointer-events: auto;
}

/* ==========================================================================
   Cart quantity-limit notice
   ========================================================================== */
#alert .hve-quantity-limit-alert {
  box-sizing: border-box;
  position: relative;
  width: min(420px, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  min-width: 0;
  padding-right: 3rem;
  overflow-wrap: anywhere;
  pointer-events: auto;
}

#alert .hve-quantity-limit-alert .btn-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  padding: 1.25rem 1rem;
}

/* ==========================================================================
   Equal-height product cards
   ========================================================================== */
/* List view reads more naturally as description, rating, then price. Keep
   this active at every width because the store remembers list view on mobile. */
main .row.product-list > .col.mb-3 > .product-thumb > .content > .description {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

main .row.product-list > .col.mb-3 > .product-thumb > .content > .description > .rating {
  order: 1;
  align-self: flex-start;
  max-width: 100%;
  padding-bottom: 4px;
  white-space: nowrap;
}

main .row.product-list > .col.mb-3 > .product-thumb > .content > .description > .price {
  order: 2;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Keep price and genuine review stars in one bottom metadata row. Because
   the price and rating share a grid row, unrated cards need no placeholder. */
main .row:not(.product-list) > .col.mb-3 > .product-thumb > .content > .description {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px;
  grid-template-rows: auto 1fr auto;
  column-gap: 8px;
  min-width: 0;
}

main .row:not(.product-list) > .col.mb-3 > .product-thumb > .content > .description > h4 {
  grid-column: 1 / -1;
  grid-row: 1;
  align-self: start;
}

main .row:not(.product-list) > .col.mb-3 > .product-thumb > .content > .description > p {
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: start;
  min-width: 0;
}

main .row:not(.product-list) > .col.mb-3 > .product-thumb > .content > .description > .price {
  grid-column: 1;
  grid-row: 3;
  align-self: end;
  min-width: 0;
  overflow-wrap: anywhere;
}

main .row:not(.product-list) > .col.mb-3 > .product-thumb > .content > .description > .rating {
  display: flex;
  grid-column: 2;
  grid-row: 3;
  align-self: start;
  justify-self: end;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  height: 20px;
  margin: 0;
  padding-bottom: 0;
  line-height: 20px;
  white-space: nowrap;
}

main .row:not(.product-list) > .col.mb-3 > .product-thumb > .content > .description > .rating .fa-stack {
  flex: 0 0 16px;
  width: 16px;
  height: 20px;
  line-height: 20px;
}

@media (min-width: 576px) {
  /* Bootstrap stretches each product column to the height of its flex row. */
  main .row:not(.product-list) > .col.mb-3 > .product-thumb {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-width: 0;
    margin-bottom: 0;
  }

  main .row:not(.product-list) > .col.mb-3 > .product-thumb > .content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
  }

  main .row:not(.product-list) > .col.mb-3 > .product-thumb > .content > .description {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* The form owns the action bar. Auto margin pins it to the shared bottom. */
  main .row:not(.product-list) > .col.mb-3 > .product-thumb > .content > form {
    flex: 0 0 auto;
    margin-top: auto;
  }
}

/* The shop can show three cards at only 576px. Compact just those stars so
   a five-star rating and a normal price still fit the shared row. */
@media (min-width: 576px) and (max-width: 767.98px) {
  main .row.row-cols-sm-3:not(.product-list) > .col.mb-3 > .product-thumb > .content > .description {
    grid-template-columns: minmax(0, 1fr) 62px;
    column-gap: 4px;
  }

  main .row.row-cols-sm-3:not(.product-list) > .col.mb-3 > .product-thumb > .content > .description > .rating .fa-stack {
    flex-basis: 12px;
    width: 12px;
  }

  main .row.row-cols-sm-3:not(.product-list) > .col.mb-3 > .product-thumb > .content > .description > .rating .fa-star {
    font-size: 12px;
  }
}

/* ==========================================================================
   Product-card and breadcrumb radius
   ========================================================================== */
main .product-thumb {
  border-radius: 4px;
  overflow: hidden;
}

main .breadcrumb {
  border-radius: 4px;
}

/* ==========================================================================
   Product-listing improvements
   ========================================================================== */
.hve-listing-view-controls {
  display: flex;
  justify-content: flex-end;
  padding-left: 0;
  margin-bottom: 1rem;
}
.hve-listing-view-controls .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hve-listing-compare-control #compare-total {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: .35rem;
}
.hve-listing-compare-control #compare-total > i {
  line-height: inherit;
}
@media (max-width: 991.98px) {
  /* Keep Sort/Show on their own row while Compare takes the remaining space. */
  #display-control::after {
    content: '';
    flex: 0 0 100%;
    height: 0;
    order: 1;
  }
  #display-control > .col-6 { order: 2; }
  .hve-listing-compare-control {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    padding-right: 8px;
  }
  .hve-listing-view-controls {
    flex: 0 0 auto;
    width: auto;
  }
}
@media (min-width: 992px) {
  .hve-listing-view-controls.col-lg-1 { justify-content: flex-start; }
}
.hve-list-description,
.hve-product-list-facts,
.hve-list-action-label { display: none; }

main #product-list.product-list > .col,
#product-category #product-list.product-list > .col {
  flex: 0 0 100% !important;
  width: 100% !important;
  max-width: 100% !important;
}

main #product-list.product-list > .col > .product-thumb {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  margin-bottom: 0;
  overflow: hidden;
  border-color: #d8e1e6;
  background: #fff;
  box-shadow: 0 4px 14px rgba(37, 55, 68, .06);
}

main #product-list.product-list .product-thumb > .image {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  margin: 0 !important;
  padding: 12px;
  border-bottom: 1px solid #e0e7eb;
  background: #f7fafb;
}
main #product-list.product-list .product-thumb > .image > a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
main #product-list.product-list .product-thumb > .image img {
  width: auto;
  max-width: 100%;
  max-height: 190px;
  object-fit: contain;
  border: 1px solid #dfe8ed;
  border-radius: 4px;
  background: #fff;
}

/* Flatten only the inert wrapper in list mode, keeping the original form
   and grid-mode DOM intact. Full-width specs sit above the purchase row. */
main #product-list.product-list .product-thumb > .content {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto 1fr auto auto;
  column-gap: 12px;
  align-content: stretch;
  min-width: 0;
  padding: 15px 14px;
  position: static !important;
  container: hve-list-content / inline-size;
}
main #product-list.product-list .product-thumb .description {
  display: contents !important;
}
main #product-list.product-list .product-thumb .description > h4 {
  grid-column: 1 / -1;
  grid-row: 1;
  order: 0;
  margin: 0 0 6px;
  font-size: 1.06rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
main #product-list.product-list .product-thumb .hve-grid-description {
  display: none !important;
}
main #product-list.product-list .product-thumb .hve-list-description {
  display: -webkit-box !important;
  grid-column: 1 / -1;
  grid-row: 2;
  order: 0;
  margin: 0 0 11px;
  overflow: hidden;
  color: #52616b;
  line-height: 1.45;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
main #product-list.product-list .hve-product-list-facts {
  display: grid;
  grid-column: 1 / -1;
  grid-row: 3;
  grid-template-columns: minmax(0, 1fr);
  align-self: start;
  order: 0;
  gap: 8px;
  min-width: 0;
  margin: 0 0 14px;
}
main #product-list.product-list .hve-product-list-fact {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #dfe8ed;
  border-radius: 4px;
  background: #f7fafb;
}
main #product-list.product-list .hve-product-list-fact > dt,
main #product-list.product-list .hve-product-list-fact > dd {
  min-width: 0;
  margin: 0;
  line-height: 1.4;
  text-align: left;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}
main #product-list.product-list .hve-product-list-fact > dt {
  color: #60727d;
  font-size: .72rem;
  font-weight: 700;
}
main #product-list.product-list .hve-product-list-fact > dt i {
  width: 13px;
  color: #1594be;
  text-align: center;
}
main #product-list.product-list .hve-product-list-fact > dd {
  max-width: 100%;
  color: #33434d;
  font-size: .82rem;
  /* Prose wraps at word boundaries. Long model codes scroll locally,
     instead of splitting the code or widening the card/page. */
  overflow-x: auto;
}
main #product-list.product-list .hve-product-list-fact > .hve-list-value--nowrap {
  white-space: nowrap;
}

main #product-list.product-list .product-thumb .description > .rating {
  grid-column: 1;
  grid-row: 4;
  order: 0;
  align-self: end;
  justify-self: start;
  max-width: 100%;
  margin: 0;
  padding: 0 0 4px;
  white-space: nowrap;
}
main #product-list.product-list .product-thumb .rating .fa-stack {
  width: 16px;
  height: 20px;
  line-height: 20px;
}
main #product-list.product-list .product-thumb .description > .price {
  grid-column: 1;
  grid-row: 5;
  order: 0;
  align-self: start;
  min-width: 0;
  margin: 0;
  font-size: 1rem;
  overflow-wrap: normal;
}
main #product-list.product-list .product-thumb .price-new,
main #product-list.product-list .product-thumb .price-old {
  display: inline-block;
  white-space: nowrap;
  max-width: 100%;
}
main #product-list.product-list .product-thumb > .content > form {
  grid-column: 2;
  grid-row: 4 / 6;
  align-self: center;
  min-width: 0;
  margin: 0;
}
main #product-list.product-list .product-thumb .button-group {
  position: static !important;
  inset: auto !important;
  display: flex;
  flex-direction: row;
  width: auto !important;
  border: 0;
  border-left: 0 !important;
  border-radius: 4px;
  overflow: hidden;
  background: transparent;
}
main #product-list.product-list .product-thumb .button-group > button {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: auto;
  min-width: 44px;
  min-height: 0;
  padding: .35rem 10px;
  border: 1px solid;
  border-color: #dddddd #dddddd #b3b3b3 #b7b7b7;
  color: #777;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
  background-color: #f8f9fa;
  background-image: linear-gradient(to bottom, #eeeeee, #dddddd);
  background-repeat: repeat-x;
  transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
  font-size: .8125rem;
  line-height: 1.8;
  text-transform: none;
}
main #product-list.product-list .product-thumb .button-group > button > i {
  line-height: inherit;
}
main #product-list.product-list .product-thumb .button-group > button + button {
  border-left: 0;
}
main #product-list.product-list .product-thumb .button-group > button:last-child {
  border-radius: 0 4px 4px 0;
}
main #product-list.product-list .product-thumb .button-group > button:first-child {
  border-radius: 4px 0 0 4px;
}
main #product-list.product-list .product-thumb .button-group > button:focus {
  color: #333;
  background-color: #e6e6e6;
  border-color: #adadad;
  background-position: 0;
}
main #product-list.product-list .product-thumb .button-group > button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid #159dcc !important;
  outline-offset: -3px;
}

/* Container widths account for both responsive breakpoints and sidebars. */
@container hve-list-content (min-width: 340px) {
  main #product-list.product-list .hve-product-list-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container hve-list-content (min-width: 560px) {
  main #product-list.product-list .hve-product-list-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 768px) {
  main #product-list.product-list .button-group > button:first-child .hve-list-action-label {
    display: inline;
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
  }
}
@container hve-list-content (min-width: 680px) {
  main #product-list.product-list .hve-list-action-label {
    display: inline;
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
  }
}
@media (min-width: 576px) {
  main #product-list.product-list > .col > .product-thumb {
    grid-template-columns: minmax(140px, 22%) minmax(0, 1fr);
  }
  main #product-list.product-list .product-thumb > .image {
    padding: 14px;
    border-right: 1px solid #e0e7eb;
    border-bottom: 0;
  }
  main #product-list.product-list .product-thumb > .image img { max-height: 180px; }
}
@media (min-width: 992px) {
  main #product-list.product-list > .col > .product-thumb {
    grid-template-columns: minmax(190px, 23%) minmax(0, 1fr);
  }
  main #product-list.product-list .product-thumb > .content { padding: 17px 19px 15px; }
}
@media (hover: hover) and (pointer: fine) {
  main #product-list.product-list .product-thumb .button-group > button:hover {
    color: #333;
    background-color: #e6e6e6;
    border-color: #adadad;
    background-position: 0;
  }
}
main #product-list.product-list .product-thumb .button-group > button:active {
  color: #000;
  background-color: #c6c7c8;
  border-color: #babbbc;
  background-position: 0;
}

/* Optional earlier flat treatment: neutral colours from the grid buttons.
   Keep list geometry, rounded corners and keyboard focus indication. */
html[data-hve-list-button-style="flat"] main #product-list.product-list .product-thumb .button-group > button {
  color: #888;
  background-color: #eee;
  background-image: none;
  text-shadow: none;
  border-color: #ddd;
}
html[data-hve-list-button-style="flat"] main #product-list.product-list .product-thumb .button-group > button:focus {
  color: #444;
  background-color: #ddd;
  border-color: #adadad;
}
/* The left edge is shared with the preceding button. Paint that same 1px
   seam in the active border colour too, without adding width or a gap. */
html[data-hve-list-button-style="flat"] main #product-list.product-list .product-thumb .button-group > button + button:focus,
html[data-hve-list-button-style="flat"] main #product-list.product-list .product-thumb .button-group > button + button:active {
  position: relative;
  z-index: 1;
  box-shadow: -1px 0 0 #adadad;
}
@media (hover: hover) and (pointer: fine) {
  html[data-hve-list-button-style="flat"] main #product-list.product-list .product-thumb .button-group > button:hover {
    color: #444;
    background-color: #ddd;
    border-color: #adadad;
  }
  html[data-hve-list-button-style="flat"] main #product-list.product-list .product-thumb .button-group > button + button:hover {
    position: relative;
    z-index: 1;
    box-shadow: -1px 0 0 #adadad;
  }
}
html[data-hve-list-button-style="flat"] main #product-list.product-list .product-thumb .button-group > button:active {
  color: #333;
  background-color: #ccc;
  border-color: #adadad;
}

/* Gradient buttons retain their stronger shared separators. Flat buttons
   use their natural border colour for each interaction state. */
html:not([data-hve-list-button-style="flat"]) main #product-list.product-list .product-thumb .button-group > button:not(:last-child) {
  border-right-color: #adadad;
}

/* ==========================================================================
   Responsive header overflow
   ========================================================================== */
#header-cart {
  min-width: 0;
}

#header-cart > .dropdown.d-grid {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

#header-cart .hve-header-cart-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#header-cart .hve-header-cart-button > .hve-header-cart-icon,
#header-cart .hve-header-cart-button::after {
  flex: 0 0 auto;
}

#header-cart .hve-header-cart-text {
  display: block;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#menu #category.hve-category-toggle {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

#menu #category.hve-category-toggle:focus:not(:focus-visible) {
  outline: 0;
}

#menu #category.hve-category-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Every tier below XL uses the native Bootstrap collapse presentation. */
@media (max-width: 1199.98px) {
  #menu .navbar-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    width: 100%;
  }

  #menu .navbar-nav .dropdown-menu {
    position: static;
    margin-left: 0 !important;
    padding-bottom: 10px;
    background-color: rgba(0, 0, 0, 0.1);
  }

  #menu .navbar-nav .dropdown:hover > .dropdown-menu:not(.show) {
    display: none !important;
  }

  #menu .navbar-nav .dropdown-menu.show {
    display: block !important;
  }

  #menu .dropdown-inner,
  #menu .dropdown-inner > ul {
    display: block;
  }

  #menu .dropdown-inner a {
    width: 100%;
    color: #fff;
  }

  #menu .dropdown-menu a:hover {
    background: rgba(0, 0, 0, 0.1);
  }

  #menu .see-all {
    margin-top: 0;
    border: none;
    border-radius: 0;
    color: #fff;
  }
}

/* Keep each desktop label and the complete navigation on one line. */
@media (min-width: 1200px) {
  #menu > .navbar-collapse {
    min-width: 0;
  }

  #menu .navbar-nav {
    flex-wrap: nowrap;
  }

  #menu .navbar-nav > .nav-item {
    flex: 0 0 auto;
  }

  #menu .navbar-nav > li > a {
    white-space: nowrap;
  }
}

/* XL has a 1140px container, so reclaim a little horizontal room there. */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  #menu.navbar {
    padding-right: 0.5rem;
    padding-left: 0.5rem;
  }

  #menu .navbar-nav > li > a {
    padding-right: 10px;
    padding-left: 10px;
    font-size: 11.5px;
  }
}
