/*
 * Eralux Dynamic Catalog — catalog.css
 * Page-specific styles only — theme tokens come from
 * assets/css/design-system.css (mobile boundary: 900px — see --eralux-mobile-breakpoint).
 *
 * Scoping model
 * -------------
 * catalog.js relocates two subtrees to <body> at runtime:
 *   • .filters        (desktop sticky dock — catalog.js appendChild)
 *   • .compare-modal  (modal portal      — catalog.js appendChild)
 * Both therefore escape .eralux-catalog and must stay valid outside it.
 * That is why the token block and the reset target three roots rather
 * than nesting everything under .eralux-catalog.
 *
 * The reset uses :where() so it keeps zero specificity — identical
 * cascade behaviour to the old bare `*`, minus the site-wide leak.
 */

/* =====================================================
   TOKENS
   Aliased to assets/css/design-system.css so the module
   cannot drift from the global palette.
   Note: --muted and --muted-2 are currently identical to
   --ink. Kept as separate names to preserve intent.
===================================================== */
.eralux-catalog,
.filters,
.compare-modal {
  --ink: var(--ews-ink);
  --paper: var(--ews-paper);
  --grey: var(--ews-paper-2);
  --muted: var(--ink);
  --muted-2: var(--ink);
  --accent: var(--ews-accent);
  --accent-dark: var(--ews-accent-dark);
  --accent-hover: var(--ews-accent-light);
  --on-accent: var(--ews-contrast-ink);
  --line: rgba(var(--ews-ink-rgb), 0.12);
  /* softer than --ews-line (.18) by design */
  --line-light: rgba(var(--ews-paper-rgb), 0.22);
  --gut: var(--ews-gutter);
  --ph-gradient: var(--ews-placeholder-grad);
}

/* =====================================================
   RESET / BASE
===================================================== */
:where(.eralux-catalog, .filters, .compare-modal),
:where(.eralux-catalog, .filters, .compare-modal) * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:where(.eralux-catalog, .filters, .compare-modal) img,
:where(.eralux-catalog, .filters, .compare-modal) svg {
  display: block;
  max-width: 100%;
}

:where(.eralux-catalog, .filters, .compare-modal) :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Lenis smooth scroll — must stay unscoped, it targets <html>. */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

/* Page-level paint, keyed off the body class rather than bare `body`. */
body.eralux-catalog-page {
  background: var(--ews-paper);
  color: var(--ews-ink);
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Image placeholder shell */
.image-placeholder {
  position: absolute;
  inset: 0;
  height: 100%;
  background: var(--ph-gradient);
  overflow: hidden;
}

.image-placeholder img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =====================================================
   AVADA FULL-BLEED BREAKOUT
   !important is required here to beat theme column rules.
===================================================== */
.eralux-catalog {
  width: calc(100vw - var(--ews-scrollbar, 0px)) !important;
  max-width: none !important;
  margin-left: calc(50% - 50vw + var(--ews-scrollbar, 0px) / 2) !important;
  margin-right: calc(50% - 50vw + var(--ews-scrollbar, 0px) / 2) !important;
  overflow-x: hidden;
}

.eralux-catalog main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

body.eralux-catalog-page #main {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* =====================================================
   PAGE HEADING — image band, single word. Vertical padding
   comes from the shared --eralux-heading-padding-vertical.
===================================================== */
.eralux-catalog-heading {
  position: relative;
  overflow: hidden;
}

.eralux-catalog-heading-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.eralux-catalog-heading-media .image-placeholder {
  will-change: transform;
}

.eralux-catalog-heading-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(var(--ews-dark-rgb), 0.5) 0%,
    rgba(var(--ews-dark-rgb), 0.18) 36%,
    rgba(var(--ews-dark-rgb), 0.66) 100%
  );
}

.eralux-catalog-heading-inner {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eralux-catalog-heading-inner h1 {
  color: var(--ews-contrast-ink);
  /* Match the Contact Us heading rhythm (the module reset strips the
     browser's default h1 margins). */
  margin: clamp(28px, 4vw, 59px) 0;
}

/* =====================================================
   CATALOG SHELL
===================================================== */
.catalog {
  position: relative;
  background: var(--paper);
}

.catalog-wrap {
  padding: 0 var(--gut);
}

.catalog-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: clamp(32px, 4vw, 64px);
  padding: var(--ews-page-pad-top) 0 var(--ews-page-pad-bottom);
}

/* =====================================================
   CATEGORY TABS — quiet editorial row
===================================================== */
.category-tabs {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: start;
  column-gap: clamp(28px, 3vw, 46px);
  width: 100%;
  max-width: 100%;
  padding: clamp(24px, 3vh, 34px) 0 12px;
  border-bottom: 1px solid var(--line);
  overflow: visible;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.segment-tabs {
  display: flex;
  align-items: flex-start;
  align-content: flex-start;
  flex-wrap: wrap;
  column-gap: clamp(18px, 2.4vw, 38px);
  row-gap: 14px;
  min-width: 0;
}

.segments-toggle-mobile {
  display: none;
}

.tab-button {
  position: relative;
  border: 0;
  background: transparent;
  padding: 0 0 8px;
  color: var(--muted);
  white-space: nowrap;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.3s ease;
}

.tab-button:hover,
.tab-button[aria-selected="true"] {
  color: var(--ink);
}

.tab-button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

/* tab sub-filter dropdowns */
.tab-sub-wrap {
  display: inline-flex;
  align-items: flex-start;
  gap: 7px;
  max-width: 100%;
  white-space: nowrap;
}

/* Chevron, not a plus: the control opens a dropdown, it does not add
   anything. It takes the segment label's colour rather than the accent,
   and `align-self: stretch` gives it the label's line height to centre
   inside -- the wrap itself is top-aligned, so without it the 8px glyph
   would sit at the top of the text. */
.tab-plus {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  border: 0;
  background: transparent;
  padding: 0 0 8px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s ease;
}

.tab-plus > svg {
  width: 11px;
  height: 8px;
  transition: transform 0.25s ease;
}

/* Hovering either half lights up both, so the icon always reads as part
   of the label next to it. */
.tab-sub-wrap:hover .tab-button,
.tab-sub-wrap:hover .tab-plus,
.tab-sub-wrap:has(.tab-button[aria-selected="true"]) .tab-plus {
  color: var(--ink);
}

.tab-plus[aria-expanded="true"] > svg {
  transform: rotate(180deg);
}

/* Positioned inline by catalog.js (menu.style.top / .left). */
.tab-menu {
  position: fixed;
  z-index: 80;
  min-width: 190px;
  padding: 8px 0;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgba(var(--ews-ink-rgb), 0.14);
}

.tab-menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 11px 20px;
  color: var(--ink);
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease;
}

.tab-menu button:hover {
  background: var(--grey);
}

.tab-menu button.is-active {
  color: var(--accent-dark);
}

/* =====================================================
   COMPARE — toggle, tray, modal
===================================================== */
.name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
}

.product-title-block {
  min-width: 0;
  text-align: left;
}

.compare-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--ews-radius-pill);
  background: transparent;
  color: var(--accent-dark);
  text-transform: uppercase;
  cursor: pointer;
  transition:
    border-color 0.3s ease,
    background 0.3s ease,
    color 0.3s ease;
}

.compare-toggle:hover,
.compare-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.product-grid.is-list .name-row {
  justify-content: flex-start;
}

/* ---------------- compare tray ---------------- */
.compare-tray {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  padding: 14px var(--gut);
  background: var(--ink);
  color: var(--paper);
  border-top: 1px solid var(--line-light);
  transform: translateY(110%);
  transition: transform 0.45s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.compare-tray.is-open {
  transform: none;
}

.tray-count {
  color: rgba(var(--ews-paper-rgb), 0.55);
  text-transform: uppercase;
  white-space: nowrap;
}

.compare-tray.pulse .tray-count {
  animation: trayPulse 0.5s ease;
}

@keyframes trayPulse {
  0%,
  100% {
    color: rgba(var(--ews-paper-rgb), 0.55);
  }

  50% {
    color: var(--accent);
  }
}

.tray-items {
  display: flex;
  flex-wrap: wrap;
  flex: 1;
  gap: 10px;
  min-width: 200px;
}

.tray-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 13px;
  border: 1px solid rgba(var(--ews-paper-rgb), 0.25);
  border-radius: var(--ews-radius-pill);
}

.tray-chip .chip-remove {
  color: rgba(var(--ews-paper-rgb), 0.55);
}

.tray-chip .chip-remove:hover {
  color: var(--paper);
}

.tray-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-tray {
  padding: 12px 22px;
  border-radius: var(--ews-radius);
  cursor: pointer;
  transition:
    background 0.3s ease,
    border-color 0.3s ease,
    opacity 0.3s ease;
}

.btn-tray-primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--on-accent);
}

.btn-tray-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-tray-primary[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-tray-ghost {
  background: transparent;
  border: 1px solid rgba(var(--ews-paper-rgb), 0.3);
  color: var(--paper);
}

.btn-tray-ghost:hover {
  border-color: rgba(var(--ews-paper-rgb), 0.6);
}

/* ---------------- compare modal ---------------- */
.compare-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  background: rgba(var(--ews-ink-rgb), 0.55);
  padding: 4vh var(--gut);
}

.compare-modal.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-panel {
  position: relative;
  width: 100%;
  max-width: 1240px;
  max-height: 90vh;
  padding: clamp(24px, 4vw, 52px);
  background: var(--paper);
  overflow: auto;
}

.compare-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: clamp(20px, 3vh, 32px);
}

.compare-close {
  border: 0;
  background: transparent;
  padding: 6px;
  color: var(--muted-2);
  cursor: pointer;
}

.compare-close:hover {
  color: var(--ink);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
}

.compare-table th,
.compare-table td {
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.compare-table thead th {
  border-top: 0;
  padding-top: 0;
}

.compare-table tbody th {
  color: var(--muted-2);
  text-transform: uppercase;
  white-space: nowrap;
}

/* =====================================================
   FILTERS
===================================================== */
.filters {
  position: relative;
}

.filters-inner,
.filters-inner * {
  min-width: 0;
  box-sizing: border-box;
}

.filters-inner form,
.filter-group,
.group-body,
.check-list {
  width: 100%;
  max-width: 100%;
}

.check span:not(.option-count) {
  overflow-wrap: anywhere;
}

/* Desktop: filters dock to the viewport and scroll independently.
   catalog.js moves .filters to <body> and feeds these custom props. */
/* Sidebar-mode filter panel. This is the pair of the (max-width: 1200px)
   collapse block below — the two must move together. It was left at 981px
   when the collapse moved to 1200px, so between those widths the panel
   collapsed to the top but kept height: calc(100vh - 48px), which is the
   empty band that appeared under the filter toggle. */
@media (min-width: 1201px) {
  .filters-placeholder {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .filters {
    align-self: start;
    position: relative;
    height: var(--edc-filter-height, calc(100vh - 48px));
    min-height: 0;
  }

  .filters.is-viewport-fixed {
    position: fixed;
    z-index: 55;
    top: var(--edc-filter-top, 24px);
    left: var(--edc-filter-left);
    width: var(--edc-filter-width);
  }

  .filters-inner {
    height: 100%;
    padding-right: 14px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--ews-ink-rgb), 0.28) transparent;
  }

  .filters-inner::-webkit-scrollbar {
    width: 6px;
  }

  .filters-inner::-webkit-scrollbar-track {
    background: transparent;
  }

  .filters-inner::-webkit-scrollbar-thumb {
    background: rgba(var(--ews-ink-rgb), 0.25);
    border-radius: var(--ews-radius-pill);
  }
}

.filters-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.clear-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--accent-dark);
  cursor: pointer;
}

.clear-btn:hover {
  text-decoration: underline;
}

.filter-toggle-mobile {
  display: none;
}

.filter-search {
  position: relative;
  margin-bottom: 26px;
}

.filter-search input {
  width: 100%;
  padding: 13px 40px 13px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
}

.filter-search input::placeholder {
  color: var(--muted);
}

.filter-search input:focus {
  outline: none;
  border-bottom-color: var(--ink);
}

.filter-search svg {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted-2);
  pointer-events: none;
}

.filter-group {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 0 22px;
  margin: 0 0 22px;
}

/* The New Release flag: a filter with no values to choose between, so it
   sits on its own above the collapsible groups rather than inside one.
   It borrows .check for the row itself and only needs the separator and
   spacing that a .filter-group would otherwise have given it. Rendered by
   PHP only when a product actually qualifies today, so there is no
   empty-state to style. */
.filter-flags {
  border-bottom: 1px solid var(--line);
  padding: 0 0 22px;
  margin: 0 0 22px;
}

.filter-flags .check {
  align-items: center;
  color: var(--ink);
}

.filter-flags .check-label {
  font-weight: 500;
}

.filter-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 28px;
  border: 0;
  background: transparent;
  padding: 0;
  margin-bottom: 15px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

/* Group titles are paragraphs (the filter panel reads h4 title -> p group
   titles -> label options), so they take the paragraph size and weight.
   They are NOT uppercased: the labels are already written in title case
   in PHP, so rendering them as-is gives "Fixture Size" and leaves "CCT"
   alone -- and the French page keeps French capitalisation ("Taille du
   luminaire"), which a CSS transform would have broken.
   The catalog reset already strips p margins. */
.filter-legend > p {
  display: flex;
  align-items: center;
  min-height: 28px;
}

.filter-legend .chevron {
  display: block;
  flex: none;
  align-self: center;
  width: 15px;
  height: 15px;
  color: var(--ink);
  transition: transform 0.25s ease;
}

.filter-group.is-collapsed .filter-legend {
  margin-bottom: 0;
}

.filter-group.is-collapsed .chevron {
  transform: rotate(-90deg);
}

.filter-group.is-collapsed .group-body {
  display: none;
}

.check-list {
  display: grid;
  gap: 10px;
}

/* When a group's options are wrapped in sub-groups, the sub-group rows
   carry their own 12px bands. The 10px checkbox gap would land ON TOP of
   the hairline between two rows, making the space above a sub-group title
   wider than the space below it. */
.check-list:has(.filter-subgroup) {
  gap: 0;
}

/* Sub-group rows are bands between two hairlines, with the label centred
   in the band. The spacing lives on the toggle (12px above AND below the
   label) rather than on the container, which only had padding-top — that
   is what pulled every sub-group title up towards the line above it. */
.filter-subgroup {
  border-top: 1px solid var(--line);
  padding: 0 0 0 10px;
  margin: 0;
}

.filter-subgroup:first-child {
  border-top: 0;
}

.filter-subgroup-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 24px;
  border: 0;
  background: transparent;
  padding: 12px 0;
  color: var(--muted-2);
  text-align: left;
  cursor: pointer;
}

.filter-subgroup-toggle > p {
  display: flex;
  align-items: center;
  min-height: 24px;
}

.filter-subgroup-toggle .chevron {
  display: block;
  flex: none;
  align-self: center;
  width: 12px;
  height: 12px;
  color: var(--muted);
  transition: transform 0.25s ease;
}

/* The toggle already supplies the 12px under the label, so the open body
   only needs to close the band off at the bottom. */
.filter-subgroup-body {
  display: grid;
  gap: 10px;
  padding-bottom: 12px;
}

/* An OPEN group whose options all sit in sub-groups ends on a sub-group's
   own 12px. The group's bottom padding would double that gap and push the
   last sub-group title off-centre in its band. While the group is closed
   that padding is the only thing holding the legend off the hairline, so
   it has to stay. */
.filter-group:not(.is-collapsed):has(.filter-subgroup) {
  padding-bottom: 0;
}

.filter-subgroup.is-collapsed .filter-subgroup-toggle .chevron {
  transform: rotate(-90deg);
}

.filter-subgroup.is-collapsed .filter-subgroup-body {
  display: none;
}

.check {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 11px;
  color: var(--muted-2);
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--ink);
  cursor: pointer;
}

.check-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.check .option-count {
  min-width: 36px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

/* An option that matches nothing is removed, not dimmed: with the counts
   recalculated on every filter change this keeps the list to the choices
   that can actually narrow the results. */
.check.is-zero {
  display: none;
}

/* A group whose options have all gone to zero would otherwise sit there as
   a header that opens onto nothing. */
.filter-group.is-empty,
.filter-subgroup.is-empty {
  display: none;
}

/* =====================================================
   TOOLBAR
===================================================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  padding-bottom: 22px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 22px;
}

.sort {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-transform: uppercase;
}

.sort select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 11px 40px 11px 16px;
  border: 1px solid var(--ews-line-strong);
  border-radius: 3px;
  background-color: var(--ews-card, var(--paper));
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='m1 1 5 5 5-5' stroke='%230d0d0c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  color: var(--ink);
  text-transform: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.sort select:hover {
  border-color: var(--ink);
}

.sort select:focus {
  outline: none;
  border-color: var(--ews-accent);
}

/* -----------------------------------------------------
   Sort — enhanced listbox (catalog.js). The native select
   stays in the DOM as the source of truth but is hidden
   once the custom control is painted, because an open
   native option list cannot be styled.
----------------------------------------------------- */
.sort.is-enhanced > select {
  display: none;
}

.sort .sort-select {
  position: relative;
}

.sort .sort-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-width: 176px;
  padding: 11px 14px 11px 16px;
  border: 1px solid var(--ews-line-strong);
  border-radius: 3px;
  background: var(--ews-card, var(--paper));
  color: var(--ink);
  text-transform: none;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.sort .sort-trigger:hover {
  border-color: var(--ink);
}

.sort .sort-trigger[aria-expanded="true"] {
  border-color: var(--ews-accent);
}

.sort .sort-value {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sort .sort-trigger > svg {
  flex: 0 0 auto;
  width: 12px;
  height: 8px;
  transition: transform 0.15s ease;
}

.sort .sort-trigger[aria-expanded="true"] > svg {
  transform: rotate(180deg);
}

.sort .sort-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 100%;
  padding: 5px;
  border: 1px solid var(--ews-line-strong);
  border-radius: 3px;
  background: var(--ews-card, var(--paper));
  box-shadow: 0 14px 34px rgba(var(--ews-ink-rgb), 0.12);
}

.sort .sort-menu[hidden] {
  display: none;
}

.sort .sort-option {
  padding: 9px 12px;
  border-radius: 2px;
  color: var(--ink);
  text-transform: none;
  white-space: nowrap;
  cursor: pointer;
}

.sort .sort-option:hover,
.sort .sort-option:focus-visible {
  background: var(--grey);
  outline: none;
}

.sort .sort-option.is-selected {
  background: var(--grey);
  color: var(--accent-dark);
}

.view-toggle {
  display: flex;
  gap: 2px;
}

.view-toggle button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--ink);
  opacity: 0.35;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.view-toggle button:hover {
  opacity: 0.7;
}

.view-toggle button[aria-pressed="true"] {
  opacity: 1;
}

.view-toggle svg {
  width: 16px;
  height: 16px;
}

.applied-filters {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-bottom: 26px;
}

.applied-filters.has-chips {
  display: flex;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--ews-radius-pill);
  background: transparent;
  color: var(--ink);
}

/* The label is a flex item with its own line box, so the chip's
   align-items: center has a box to centre. */
.chip .chip-label,
.tray-chip .chip-label {
  display: block;
}

.chip .chip-remove,
.tray-chip .chip-remove {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
}

.chip .chip-remove > svg,
.tray-chip .chip-remove > svg {
  display: block;
  width: 9px;
  height: 9px;
}

.chip .chip-remove:hover {
  color: var(--ink);
}

.chips-clear {
  border: 0;
  background: transparent;
  padding: 6px 4px;
  color: var(--accent-dark);
  cursor: pointer;
}

.chips-clear:hover {
  text-decoration: underline;
}

/* =====================================================
   PRODUCT GRID — image-led
===================================================== */
/* Column count is set by screen width, not by a minimum card width, so the
   grid lands on the counts the design asks for: 1 under 600px, 3 at
   1000px, 5 at 2000px. From 1000px up a column is added every 500px, which
   is the straight line through those two points and keeps going past
   2000px. The list view overrides this with its own single column and wins
   on specificity (.product-grid.is-list), so it is unaffected. */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 1.4vw, 22px);
  row-gap: clamp(30px, 4vh, 48px);
}

@media (max-width: 599px) {
  .product-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 1000px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1500px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 2000px) {
  .product-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 2500px) {
  .product-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.product-card {
  display: block;
}

.product-card[hidden] {
  display: none;
}

.product-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: transparent;
  overflow: hidden;
}

/* contain, not cover: a product photo is never cropped, and keeps its own
   aspect ratio inside the card's fixed media box. The mobile layout has
   always done this; the desktop grid now matches it. */
.product-media > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.product-media .image-placeholder {
  transition: transform 0.8s cubic-bezier(0.2, 0.6, 0.2, 1);
  will-change: transform;
}

.product-card:hover .product-media .image-placeholder {
  transform: scale(1.045);
}

.product-body {
  padding-top: 15px;
}

.product-family {
  margin-bottom: 7px;
  color: var(--muted);
  text-transform: uppercase;
}

.product-name {
  margin: 0;
  text-align: left;
}

.product-code {
  display: block;
  margin: 7px 0 0;
  color: var(--muted-2);
  text-transform: uppercase;
  text-align: left;
}

.no-results {
  display: none;
  padding: 52px 0 20px;
  color: var(--muted-2);
}

.no-results.is-visible {
  display: block;
}

/* ---------------- spec overlay on hover ---------------- */
.spec-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(18px, 2vw, 28px);
  background: rgba(var(--ews-ink-rgb), 0.88);
  color: var(--paper);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.spec-overlay .spec-title {
  margin-bottom: 6px;
  color: var(--accent);
  text-transform: uppercase;
}

.spec-overlay .spec-list {
  margin: 0;
}

.spec-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0;
  border-top: 1px solid rgba(var(--ews-paper-rgb), 0.16);
}

/* Both halves are <label>, so their type comes from the design system's
   label rule. Only the cursor is restated, so the rows do not override
   the surrounding card link. */
.spec-row .spec-key,
.spec-row .spec-value {
  cursor: inherit;
}

.spec-row .spec-key {
  color: rgba(var(--ews-paper-rgb), 0.5);
  text-transform: uppercase;
  white-space: nowrap;
}

.spec-row .spec-value {
  margin: 0;
  color: var(--paper);
  text-align: right;
}

@media (hover: hover) {
  .product-card:hover .spec-overlay {
    opacity: 1;
  }
}

.product-grid.is-list .spec-overlay {
  display: none;
}

/* ---------------- list view — editorial index rows ---------------- */
.product-grid.is-list {
  grid-template-columns: 1fr;
  gap: 0;
  row-gap: 0;
}

.product-grid.is-list .product-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) minmax(0, 54%);
  align-items: center;
  gap: clamp(20px, 3vw, 40px);
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.product-grid.is-list .product-card[hidden] {
  display: none;
}

.product-grid.is-list .product-card:first-child {
  border-top: 1px solid var(--line);
}

.product-grid.is-list .product-media {
  aspect-ratio: 4 / 3;
}

.product-grid.is-list .product-body {
  padding-top: 0;
}

/* inline spec panel — list view only */
.spec-inline {
  display: none;
}

.product-grid.is-list .spec-inline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px clamp(18px, 2.4vw, 34px);
  padding-left: clamp(20px, 3vw, 40px);
  border-left: 1px solid var(--line);
}

.spec-inline dt {
  margin-bottom: 5px;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.spec-inline dd {
  margin: 0;
  color: var(--muted-2);
}

/* =====================================================
   RESPONSIVE
===================================================== */
@media (max-width: 1100px) {
  .product-grid.is-list .product-card {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .product-grid.is-list .spec-inline {
    display: none;
  }
}

/* The filter column collapses to the top at 1200px, not 980px. Holding
   the 280px sidebar down to 980px left the grid about 580px wide, and a
   three-column row inside that put the compare button on top of the
   product name. Above this width the sidebar and the cards both have
   room. Kept in step with the resize handler in catalog.js. */
@media (max-width: 1200px) {
  .catalog-shell {
    display: block;
    padding-top: 0;
  }

  .filters {
    border-bottom: 1px solid var(--line);
    margin-bottom: 28px;
  }

  .filters-inner {
    display: none;
    padding-bottom: 26px;
  }

  .filters.is-open .filters-inner {
    display: block;
  }

  .filters-head {
    display: none;
  }

  .filter-toggle-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 22px 0;
    text-transform: uppercase;
    cursor: pointer;
  }
}

@media (max-width: 900px) {
  body.eralux-catalog-page {
    max-width: 100%;
    overflow-x: hidden;
  }

  body.eralux-catalog-filter-open {
    overflow: hidden;
  }

  .eralux-catalog {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  /* ---- tabs ---- */
  .segments-toggle-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 58px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    padding: 16px 0;
    text-transform: uppercase;
    cursor: pointer;
  }

  .category-tabs {
    display: none;
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 18px 0 16px;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  .category-tabs.is-open {
    display: grid;
  }

  .category-tabs > * {
    flex: 0 1 auto;
    max-width: 100%;
  }

  .segment-tabs {
    gap: 14px 22px;
  }

  .tab-button {
    padding-bottom: 8px;
  }

  .tab-sub-wrap {
    gap: 4px;
    max-width: 100%;
  }

  .tab-plus {
    min-width: 28px;
    min-height: 32px;
    padding: 0 0 8px;
  }

  /* !important beats the inline left/top written by catalog.js */
  .tab-menu {
    left: 12px !important;
    right: 12px !important;
    width: auto;
    max-height: 55vh;
    overflow-y: auto;
  }

  /* ---- filters ---- */
  .catalog-shell {
    padding-bottom: 72px;
  }

  .filters {
    margin: 0 0 20px;
    border-bottom: 1px solid var(--line);
  }

  .filter-toggle-mobile {
    min-height: 54px;
    padding: 16px 0;
  }

  .filters.is-open {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    flex-direction: column;
    margin: 0;
    border: 0;
    background: var(--paper);
    padding: 0 var(--gut);
  }

  .filters.is-open .filter-toggle-mobile {
    flex: 0 0 auto;
    border-bottom: 1px solid var(--line);
    padding-top: max(16px, env(safe-area-inset-top));
  }

  .filter-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .filter-back,
  .filter-label-open {
    display: none;
  }

  .filters.is-open .filter-back,
  .filters.is-open .filter-label-open {
    display: inline;
  }

  .filters.is-open .filter-label-closed,
  .filters.is-open .filter-toggle-symbol {
    display: none;
  }

  .filters.is-open .filters-inner {
    display: block;
    flex: 1;
    min-height: 0;
    padding: 22px 2px calc(32px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .filter-search {
    position: sticky;
    top: -22px;
    z-index: 2;
    margin: 0 0 24px;
    padding: 14px 0 8px;
    background: var(--paper);
  }

  .filter-view-products {
    position: sticky;
    bottom: 0;
    z-index: 4;
    display: block;
    width: 100%;
    min-height: var(--ews-control-height);
    margin: 24px 0 0;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: var(--ews-contrast-ink);
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 -12px 24px var(--paper);
  }

  .filter-group,
  .filter-flags {
    padding-bottom: 18px;
    margin-bottom: 18px;
  }

  .filter-legend {
    min-height: 38px;
    margin-bottom: 12px;
  }

  .check {
    min-height: 32px;
  }

  .check input {
    width: 19px;
    height: 19px;
  }

  /* ---- toolbar ---- */
  .toolbar {
    display: block;
    padding: 0 0 18px;
  }

  .toolbar-right {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .sort {
    min-width: 0;
    gap: 6px;
  }

  .sort select {
    max-width: 172px;
    padding: 9px 32px 9px 12px;
    background-position: right 10px center;
  }

  .sort .sort-trigger {
    min-width: 0;
    max-width: 172px;
    gap: 10px;
    padding: 9px 11px 9px 12px;
  }

  .sort .sort-menu {
    min-width: 190px;
  }

  .view-toggle button {
    width: 40px;
    height: 38px;
  }

  .applied-filters {
    flex-wrap: nowrap;
    gap: 7px;
    padding-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .chip {
    flex: 0 0 auto;
    padding: 7px 11px;
  }

  /* ---- product grid ---- */
  .product-grid {
    row-gap: 34px;
  }

  .product-media {
    aspect-ratio: 4 / 3;
  }

  .spec-overlay {
    display: none;
  }

  .product-body {
    padding-top: 12px;
  }

  .name-row {
    align-items: flex-start;
    gap: 10px;
  }

  .product-name {
    overflow-wrap: anywhere;
  }

  .product-code {
    margin-top: 6px;
  }

  .compare-toggle {
    padding: 7px 10px;
  }

  .product-grid.is-list .product-card {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 14px;
    padding: 16px 0;
  }

  .product-grid.is-list .product-media {
    aspect-ratio: 1 / 1;
  }

  .product-grid.is-list .name-row {
    display: block;
  }

  .product-grid.is-list .compare-toggle {
    margin-top: 10px;
  }

  /* ---- compare tray + modal ---- */
  .compare-tray {
    gap: 10px;
    padding: 12px var(--gut) calc(12px + env(safe-area-inset-bottom));
  }

  .tray-count {
    width: 100%;
  }

  .tray-items {
    display: none;
  }

  .tray-actions {
    width: 100%;
    gap: 8px;
  }

  .btn-tray {
    flex: 1;
    padding: 11px 12px;
  }

  .compare-modal {
    padding: max(28px, calc(env(safe-area-inset-top) + 16px)) 0
      max(28px, calc(env(safe-area-inset-bottom) + 16px));
  }

  .compare-modal.is-open {
    align-items: stretch;
  }

  .compare-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: none;
    padding: 0 var(--gut);
    border-radius: 0;
    overflow: hidden;
  }

  .compare-head {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    align-items: center;
    margin: 0;
    padding: 14px 0 16px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
  }

  .compare-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--ink);
  }

  .compare-scroll {
    flex: 1;
    min-height: 0;
    max-height: none;
    padding: 32px 0 38px;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .compare-table {
    min-width: 600px;
  }

  .compare-table thead th {
    padding-top: 8px;
    padding-bottom: 24px;
  }
}

@media (min-width: 901px) {
  .filter-view-products {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  :where(.eralux-catalog, .filters, .compare-modal),
  :where(.eralux-catalog, .filters, .compare-modal) *,
  :where(.eralux-catalog, .filters, .compare-modal) *::before,
  :where(.eralux-catalog, .filters, .compare-modal) *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* =====================================================
   Layout fixes (merged from catalog-layout-fix.css)
   Avada spacing overrides for the catalog page only.
===================================================== */
body.eralux-catalog-page #main,
body.eralux-catalog-page #main > .fusion-row,
body.eralux-catalog-page #content,
body.eralux-catalog-page .post-content {
  margin-top: 0 !important;
  padding-top: 0 !important;
}
