/*
 * STAREL — Product Discovery v1
 * Theme-owned archive/search placement for the approved staging host.
 * Filter Everything remains the filtering engine; loop-cards.css owns cards.
 */

body.starel-discovery-v1 {
  --starel-discovery-ink: #1c1c1c;
  --starel-discovery-black: #000000;
  --starel-discovery-white: #ffffff;
  --starel-discovery-divider: #dddddd;
  --starel-discovery-muted: #7a7a7a;
  --starel-discovery-light: #f4f4f4;
  --starel-discovery-accent: #c79868;

  font-family: "Classic Carrara", Arial, sans-serif;
}

body.starel-discovery-v1 button,
body.starel-discovery-v1 input,
body.starel-discovery-v1 select,
body.starel-discovery-v1 textarea {
  font-family: "Classic Carrara", Arial, sans-serif;
}

body.starel-discovery-v1.starel-filter-drawer-open {
  overflow: hidden;
}

.starel-discovery {
  width: 100%;
  color: var(--starel-discovery-ink);
  background: var(--starel-discovery-white);
  font-family: "Classic Carrara", Arial, sans-serif;
}

.starel-discovery__hero,
.starel-archive-boundary {
  width: 100%;
  max-width: none;
  padding-inline: 24px;
}

.starel-discovery__hero {
  padding-top: 48px;
  padding-bottom: 80px;
}

.starel-discovery__title {
  margin: 0;
  color: var(--starel-discovery-ink);
  font-family: "Tuscany", Georgia, serif;
  font-size: 44px !important;
  font-weight: 600;
  line-height: 1.2;
}

.starel-discovery__description {
  width: 50%;
  max-width: none;
  margin-top: 24px;
  color: var(--starel-discovery-ink);
  font-family: "Classic Carrara", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.starel-discovery__description > :first-child {
  margin-top: 0;
}

.starel-discovery__description > :last-child {
  margin-bottom: 0;
}

.starel-discovery__hero > .starel-category-subnav {
  margin-top: 28px;
}

.starel-archive-boundary {
  position: relative;
  padding-bottom: clamp(72px, 8vw, 128px);
}

.starel-discovery-v1 .starel-archive-toolbar {
  position: relative;
  z-index: 4;
  min-height: 62px;
  margin-bottom: 32px;
  padding: 12px 0;
  border: 0;
}

.starel-archive-filter-button {
  display: inline-flex;
  grid-area: filter;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 46px;
  height: 46px;
  padding: 13px 26px;
  border: 1px solid var(--starel-discovery-black);
  border-radius: 8px;
  color: var(--starel-discovery-white);
  background: var(--starel-discovery-black);
  font-family: "Classic Carrara", Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .2px;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  box-sizing: border-box;
}

.starel-discovery-v1 .starel-archive-sorting .woocommerce-ordering select.orderby {
  height: 46px !important;
  min-height: 46px !important;
  border: 1px solid var(--starel-discovery-muted) !important;
  border-radius: 8px;
  text-align: center;
  box-sizing: border-box;
}

.starel-discovery-v1 .starel-archive-sorting .woocommerce-ordering::before,
.starel-discovery-v1 .starel-archive-sorting .woocommerce-ordering::after {
  display: none;
}

.starel-discovery-v1 .starel-archive-sorting__visual {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--starel-discovery-muted);
  font-family: "Classic Carrara", Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .2px;
  line-height: 1;
  text-transform: uppercase;
  pointer-events: none;
}

.starel-discovery-v1 .starel-archive-sorting__chevron {
  width: 8px;
  height: 8px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.starel-discovery-v1 .starel-archive-sorting .woocommerce-ordering select.orderby {
  position: relative;
  z-index: 3;
}

.starel-archive-filter-button svg {
  width: 13px;
  height: 11px;
  fill: currentColor;
}

.starel-discovery-v1 .starel-archive-filter-button {
  border-color: var(--starel-discovery-black) !important;
  color: var(--starel-discovery-white) !important;
  background: var(--starel-discovery-black) !important;
}

.starel-archive-filter-button:hover,
.starel-archive-filter-button:focus-visible {
  color: var(--starel-discovery-white);
  background: #2b2b2b;
}

.starel-discovery-results {
  position: relative;
  width: 100%;
}

.starel-discovery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 48px 24px;
  width: 100%;
}

body.starel-archive-view-large .starel-discovery-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.starel-discovery-grid__item {
  min-width: 0;
  margin: 0;
}

.starel-discovery-grid__item .starel-loop-card__title-heading,
.starel-discovery-grid__item .starel-loop-card__title-heading a {
  color: var(--starel-discovery-ink);
  font-family: "Classic Carrara", Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .2px;
  line-height: 1.35;
  text-transform: uppercase;
}

.starel-discovery-grid__item .starel-loop-card__price,
.starel-discovery-grid__item .starel-loop-card__price * {
  font-family: "Classic Carrara", Arial, sans-serif;
}

.starel-discovery-grid__item .starel-loop-card__variation-count {
  color: var(--starel-discovery-muted);
  font-family: "Classic Carrara", Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
}

.starel-discovery-load-more {
  display: flex;
  justify-content: center;
  width: 100%;
  padding-top: 56px;
}

.starel-discovery-load-more__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 160px;
  padding: 14px 28px;
  border: 1px solid var(--starel-discovery-black);
  border-radius: 8px;
  color: var(--starel-discovery-white);
  background: var(--starel-discovery-black);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .2px;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
}

.starel-discovery-load-more__button:hover,
.starel-discovery-load-more__button:focus-visible {
  color: var(--starel-discovery-white);
  background: #2b2b2b;
}

.starel-discovery-load-more__button.is-loading {
  pointer-events: none;
  opacity: .75;
}

.starel-discovery-load-more__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: starel-discovery-spin .7s linear infinite;
}

.starel-discovery-load-more__button.is-loading .starel-discovery-load-more__spinner {
  display: block;
}

/* JavaScript upgrades the fallback link to production-style automatic loading. */
.starel-discovery-load-more.is-auto-mode {
  position: relative;
  min-height: 48px;
  padding-top: 24px;
}

.starel-discovery-load-more.is-auto-mode .starel-discovery-load-more__button {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.starel-discovery-load-more.is-auto-mode.is-loading::after {
  content: "";
  position: absolute;
  top: 24px;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  border: 2px solid rgba(28, 28, 28, .18);
  border-top-color: var(--starel-discovery-black);
  border-radius: 50%;
  animation: starel-discovery-spin .7s linear infinite;
}

@keyframes starel-discovery-spin {
  to { transform: rotate(360deg); }
}

.starel-discovery-filter-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10020;
  background: rgba(0, 0, 0, .66);
  opacity: 0;
  transition: opacity .22s ease;
}

.starel-discovery-filter-backdrop[hidden] {
  display: none;
}

.starel-discovery-filter-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10021;
  display: flex;
  flex-direction: column;
  width: min(585px, 100vw);
  height: 100dvh;
  color: var(--starel-discovery-ink);
  background: var(--starel-discovery-white);
  box-shadow: 20px 0 50px rgba(0, 0, 0, .12);
  transform: translateX(-102%);
  visibility: hidden;
  transition: transform .28s ease, visibility .28s ease;
  font-family: "Classic Carrara", Arial, sans-serif;
}

body.starel-filter-drawer-open .starel-discovery-filter-backdrop {
  opacity: 1;
}

body.starel-filter-drawer-open .starel-discovery-filter-drawer {
  transform: translateX(0);
  visibility: visible;
}

.starel-discovery-filter-drawer__header {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 114px;
  padding: 28px 56px 40px;
}

.starel-discovery-filter-drawer__header h2 {
  width: 100%;
  margin: 0;
  color: var(--starel-discovery-ink);
  font-family: "Tuscany", Georgia, serif;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
}

.starel-discovery-filter-drawer__header button {
  position: absolute;
  top: 23px;
  right: 12px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  color: var(--starel-discovery-black);
  background: transparent;
  cursor: pointer;
}

.starel-discovery-filter-drawer__header button span {
  position: absolute;
  top: 19px;
  left: 10px;
  width: 20px;
  height: 1px;
  background: currentColor;
}

.starel-discovery-filter-drawer__header button span:first-child {
  transform: rotate(45deg);
}

.starel-discovery-filter-drawer__header button span:last-child {
  transform: rotate(-45deg);
}

.starel-discovery-filter-drawer__header button:hover,
.starel-discovery-filter-drawer__header button:focus {
  color: var(--starel-discovery-black) !important;
  background: transparent !important;
  box-shadow: none !important;
}

.starel-discovery-filter-drawer__header button:focus-visible {
  outline: 1px solid var(--starel-discovery-muted);
  outline-offset: 2px;
}

.starel-discovery-filter-drawer__content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 32px 32px;
  overscroll-behavior: contain;
}

.starel-floating-filter--native {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 132px;
  padding: 14px 28px;
  border: 0;
  border-radius: 8px;
  color: var(--starel-discovery-white);
  background: var(--starel-discovery-black);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .2px;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  box-sizing: border-box;
  flex-direction: row !important;
}

.starel-floating-filter--native > span {
  order: 1;
}

.starel-floating-filter--native > .icon-filter {
  order: 2;
  flex: 0 0 auto;
}

.starel-floating-filter--native svg,
.starel-floating-filter--native svg path {
  fill: currentColor;
}

.starel-floating-actions {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 999;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .22s ease, visibility .22s ease;
}

body.starel-show-floating-filter .starel-floating-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.starel-floating-actions .starel-floating-filter,
body.starel-show-floating-filter .starel-floating-actions .starel-floating-filter {
  position: static !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  min-height: 46px;
  transform: none !important;
  opacity: 1;
  visibility: inherit;
  pointer-events: inherit;
}

.starel-floating-actions .starel-floating-filter--native,
.starel-floating-actions .starel-floating-filter--native:hover,
.starel-floating-actions .starel-floating-filter--native:focus,
.starel-floating-actions .starel-floating-filter--native:focus-visible,
.starel-floating-actions .starel-floating-filter--native:active {
  border: 0 !important;
  color: #ffffff !important;
  background: #000000 !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .16) !important;
  transform: none !important;
}

.starel-back-to-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 46px;
  padding: 14px 28px;
  border: 1px solid #cccccc !important;
  border-radius: 8px;
  color: var(--starel-discovery-ink) !important;
  background: var(--starel-discovery-white) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .16) !important;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .2px;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
  transition: background-color .3s, border-color .3s;
}

.starel-back-to-top:hover,
.starel-back-to-top:focus-visible,
.starel-back-to-top:active {
  border-color: #000000 !important;
  color: var(--starel-discovery-ink) !important;
  background: var(--starel-discovery-white) !important;
}

.starel-back-to-top svg {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  display: block;
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.starel-back-to-top__icon {
  position: relative;
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
}

.starel-back-to-top__glyph {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 12px;
  height: 10px;
  transform: translate(-50%, -50%);
  transition: height .3s ease;
}

.starel-back-to-top__stem {
  position: absolute;
  top: 2px;
  left: 6px;
  z-index: 1;
  display: block;
  width: 1px;
  height: calc(100% - 2px);
  border-radius: 999px;
  background: currentColor;
  transform: translateX(-0.5px);
}

@media (min-width: 768px) {
  .starel-back-to-top:hover .starel-back-to-top__glyph,
  .starel-back-to-top:focus-visible .starel-back-to-top__glyph {
    height: 12px;
  }
}

.starel-discovery .woocommerce-info,
.starel-discovery .woocommerce-no-products-found {
  margin: 0;
}

@media (max-width: 1024px) {
  .starel-discovery-grid,
  body.starel-archive-view-large .starel-discovery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .starel-discovery__hero,
  .starel-archive-boundary {
    padding-inline: 16px;
  }

  .starel-discovery__hero {
    padding-top: 36px;
    padding-bottom: 48px;
  }

  .starel-discovery__title {
    font-size: 44px !important;
  }

  .starel-discovery__description {
    width: 100%;
  }

  .starel-discovery-v1 .starel-archive-toolbar,
  .starel-discovery-v1 .starel-archive-toolbar.has-no-subnav {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    grid-template-areas:
      "filter sorting"
      "gridtoggle count" !important;
    column-gap: 8px !important;
    row-gap: 14px !important;
    margin-bottom: 24px;
    padding: 12px 0;
  }

  .starel-discovery-v1 .starel-archive-toolbar > .starel-archive-grid-toggle {
    display: block !important;
    grid-area: gridtoggle;
    justify-self: start;
  }

  .starel-discovery-v1 .starel-archive-toolbar > .starel-archive-count {
    grid-area: count;
    justify-self: end !important;
  }

  .starel-discovery-v1 .starel-archive-filter-button,
  .starel-discovery-v1 .starel-archive-sorting,
  .starel-discovery-v1 .starel-archive-sorting .woocommerce-ordering {
    width: 100% !important;
    max-width: none;
  }

  .starel-discovery-v1 .starel-archive-filter-button {
    height: 46px;
    min-height: 46px;
    padding: 12px 18px;
  }

  .starel-discovery-v1 .starel-archive-sorting .woocommerce-ordering {
    --sorting-x-padding: 18px;
  }

  .starel-discovery-v1 .starel-archive-sorting .woocommerce-ordering select.orderby {
    width: 100% !important;
    height: 46px !important;
    min-height: 46px !important;
  }

  .starel-discovery-v1 .starel-archive-grid-toggle-control .starel-toggle-ui {
    width: 30px !important;
    height: 18px !important;
  }

  .starel-discovery-v1 .starel-archive-grid-toggle-control .starel-toggle-ui::after {
    top: 1px !important;
    left: 1px !important;
    width: 14px !important;
    height: 14px !important;
  }

  .starel-discovery-v1 .starel-archive-grid-toggle-control__input:checked + .starel-toggle-ui::after {
    transform: translateX(12px) !important;
  }

  .starel-discovery-v1 .starel-archive-grid-toggle-control,
  .starel-discovery-v1 .starel-archive-grid-toggle-control__text,
  .starel-discovery-v1 .starel-result-count {
    font-size: 12px;
  }

  .starel-discovery-grid__item .starel-loop-card__variation-count {
    color: #737373 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
  }

  .starel-discovery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 36px 10px;
  }

  body.starel-archive-view-large .starel-discovery-grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 52px;
  }

  body.starel-discovery-v1 #search-results {
    display: block !important;
    margin-bottom: 0 !important;
  }

  .starel-discovery-grid__item .starel-loop-card__info {
    margin-top: 0 !important;
  }

  .starel-discovery-grid__item .starel-loop-card__title-heading,
  .starel-discovery-grid__item .starel-loop-card__title-heading a {
    font-size: 14px;
    line-height: 1.35;
  }

  .starel-discovery-grid__item .starel-loop-card__price .starel-loop-card-price,
  .starel-discovery-grid__item .starel-loop-card__price .starel-price-per-sqm,
  .starel-discovery-grid__item .starel-loop-card__price .starel-loop-card-price--slab .starel-loop-card-price__row {
    font-size: 12px;
  }

  .starel-discovery-grid__item .starel-loop-card__price .starel-loop-card-price,
  .starel-discovery-grid__item .starel-loop-card__price .starel-price-per-sqm,
  .starel-discovery-grid__item .starel-loop-card__price .starel-loop-card-price--slab .starel-loop-card-price__row {
    gap: 4px;
  }

  .starel-discovery-grid__item .starel-loop-card__media:has(.starel-loop-card__badge) .starel-loop-card__discount-badge {
    top: 50px !important;
  }

  body.starel-archive-view-large .starel-discovery-grid__item .starel-loop-card__title-heading,
  body.starel-archive-view-large .starel-discovery-grid__item .starel-loop-card__title-heading a {
    font-size: 14px;
  }

  body.starel-archive-view-large .starel-discovery-grid__item .starel-loop-card__price .starel-loop-card-price,
  body.starel-archive-view-large .starel-discovery-grid__item .starel-loop-card__price .starel-price-per-sqm,
  body.starel-archive-view-large .starel-discovery-grid__item .starel-loop-card__price .starel-loop-card-price--slab .starel-loop-card-price__row {
    font-size: 14px;
  }

  .starel-discovery-filter-drawer__header {
    min-height: 96px;
    padding: 22px 50px 30px;
  }

  .starel-discovery-filter-drawer__header button {
    top: 16px;
    right: 8px;
  }

  .starel-discovery-filter-drawer__content {
    padding: 6px 20px 24px;
  }

  .starel-floating-actions {
    bottom: 16px;
  }

  .starel-floating-actions .starel-floating-filter--native .icon-filter,
  .starel-back-to-top__label {
    display: none !important;
  }

  .starel-floating-actions .starel-floating-filter--native {
    width: auto !important;
    min-width: 0 !important;
  }

  .starel-back-to-top {
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    padding: 0 !important;
    gap: 0;
  }

  .starel-back-to-top__glyph {
    height: 10px;
    transition: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .starel-discovery-filter-drawer,
  .starel-discovery-filter-backdrop,
  .starel-discovery-load-more__spinner,
  .starel-floating-actions,
  .starel-back-to-top,
  .starel-back-to-top__glyph {
    transition: none;
    animation: none;
  }

  .starel-back-to-top__glyph,
  .starel-back-to-top:hover .starel-back-to-top__glyph,
  .starel-back-to-top:focus-visible .starel-back-to-top__glyph {
    height: 10px;
  }
}
