/* Foxtrot Mike — Product archive / category (mockup 03). */

/* ========== Archive / category (mockup 03) ========== */
.fm-archive {
  padding: 1.5rem 0 4rem;
}

.fm-breadcrumb {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--fm-muted);
  margin-bottom: 0.65rem;
}

.fm-breadcrumb a {
  color: var(--fm-muted);
}

.fm-breadcrumb a:hover {
  color: var(--fm-accent);
}

.fm-breadcrumb__sep {
  opacity: 0.5;
}

.fm-breadcrumb__current {
  color: var(--fm-text);
}

.fm-archive__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1.25rem;
  margin-bottom: 1.15rem;
}

.fm-archive__heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.7rem;
  min-width: 0;
}

.fm-archive__title {
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  color: #fff;
  line-height: 1.15;
}

.fm-archive__count {
  margin: 0;
  color: var(--fm-muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.fm-archive__toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.fm-filters-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  height: 2.55rem;
  padding: 0 0.95rem;
  border: 1px solid var(--fm-border);
  border-radius: 8px;
  background: var(--fm-surface);
  color: var(--fm-text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.fm-filters-toggle:hover,
.fm-filters-toggle[aria-expanded="true"] {
  border-color: var(--fm-accent);
  color: var(--fm-accent);
}

.fm-ordering select,
.woocommerce-ordering select {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  height: 2.55rem;
  min-width: 10.5rem;
  padding: 0 2.25rem 0 0.95rem;
  border: 1px solid var(--fm-border);
  border-radius: 8px;
  background-color: var(--fm-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23a0a0a0' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1.5 1.5L6 6l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 10px;
  color: var(--fm-text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  color-scheme: dark;
  cursor: pointer;
}

.fm-ordering select:hover,
.woocommerce-ordering select:hover {
  border-color: var(--fm-accent);
}

.fm-ordering select:focus,
.woocommerce-ordering select:focus {
  outline: 2px solid var(--fm-accent);
  outline-offset: 1px;
  border-color: var(--fm-accent);
}

.fm-ordering select option,
.woocommerce-ordering select option {
  background: var(--fm-surface);
  color: var(--fm-text);
}

.fm-archive__layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

/* Archive product grid = 3 columns */
.fm-archive .products,
.fm-archive ul.products,
.fm-is-archive ul.products {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.fm-archive ul.products::before,
.fm-archive ul.products::after,
.fm-is-archive ul.products::before,
.fm-is-archive ul.products::after {
  display: none !important;
  content: none !important;
}

.fm-archive ul.products li.product,
.fm-is-archive ul.products li.product {
  width: 100% !important;
  margin: 0 !important;
  float: none !important;
  clear: none !important;
}

.fm-pagination {
  margin-top: 2rem;
}

.fm-pagination .woocommerce-pagination ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
  justify-content: center;
}

.fm-pagination .woocommerce-pagination a,
.fm-pagination .woocommerce-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 0.75rem;
  border: 1px solid var(--fm-border);
  border-radius: 6px;
  color: var(--fm-text);
  background: var(--fm-surface);
}

.fm-pagination .woocommerce-pagination .current {
  background: var(--fm-accent);
  border-color: var(--fm-accent);
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Page wrapper override on archives — full width via fm-archive */
.fm-is-archive .fm-page {
  width: 100%;
  margin: 0;
  max-width: none;
}

@media (max-width: 1000px) {
  .fm-archive__layout {
    grid-template-columns: 1fr;
  }

  .fm-filters-toggle {
    display: inline-flex;
  }

  .fm-archive .products,
  .fm-is-archive ul.products {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .fm-archive__toolbar {
    position: sticky;
    top: var(--fm-chrome-h);
    z-index: 40;
    margin-inline: -0.15rem;
    padding: 0.55rem 0.15rem;
    background: var(--fm-bg);
  }

  /* 1.13.05: minmax(0) so a long pagination row can't widen the page past the screen. */
  .fm-archive__layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .fm-filters-toggle {
    display: inline-flex;
  }

  .fm-archive .products,
  .fm-is-archive ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .fm-archive .fm-card__body,
  .fm-is-archive .fm-card__body {
    padding: 0.75rem;
  }

  .fm-archive .fm-card__title,
  .fm-is-archive .fm-card__title {
    font-size: 0.875rem;
  }

  /* 1.13.05: no margin here; the price row owns the spacing. A margin inside the fixed-height
     row squeezed the price to a 4px sliver on phones. */
  .fm-archive .fm-card__price,
  .fm-is-archive .fm-card__price {
    font-size: 1rem;
  }

  /* 1.13.51: smaller was-price on phones so "$1,049.00 $879.20" fits a 2-up card (sale configs on /black-friday/). */
  .fm-archive .fm-card__price del,
  .fm-is-archive .fm-card__price del {
    font-size: 0.75rem;
    margin-right: 0.25rem;
  }

  .fm-archive .fm-card .button,
  .fm-archive .fm-card .fm-btn,
  .fm-is-archive .fm-card .button,
  .fm-is-archive .fm-card .fm-btn {
    min-height: 44px;
    padding: 0.5rem 0.5rem !important;
    font-size: 0.875rem !important;
  }

  .fm-archive .fm-card:hover,
  .fm-is-archive .fm-card:hover {
    transform: none;
  }
  .fm-archive__top {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* /featured/ and /builders/: no filter sidebar, so 4-up on wide screens. */
@media (min-width: 1001px) {
  .fm-archive--collection ul.products {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---------------------------------------------------------------------------
   Filters (multi-select rework). Desktop: sticky sidebar, applies instantly.
   ≤1000px: full-height sheet, sticky header and footer, scroll area between.
   Red only marks a checked box.
   --------------------------------------------------------------------------- */
.fm-filters-toggle:hover,
.fm-filters-toggle[aria-expanded="true"] {
  border-color: var(--fm-text);
  color: var(--fm-text);
}

.fm-filters-toggle__n {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.5rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--fm-text);
  color: var(--fm-bg);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fm-filters-toggle__n[hidden] {
  display: none;
}

.fm-filters {
  position: sticky;
  top: var(--fm-chrome-h);
}

.fm-filters__drawer-head,
.fm-filters-backdrop {
  display: none;
}

.fm-filters__group {
  min-width: 0;
  margin: 0 0 1rem;
  padding: 0 0 1rem;
  border: 0;
  border-bottom: 1px solid var(--fm-border);
}

.fm-filters__group--stock {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.fm-filters__heading {
  margin: 0 0 0.5rem;
  padding: 0;
  color: var(--fm-text);
  font-size: 0.875rem;
  font-weight: 600;
}

.fm-filters__list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fm-filters__option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2rem;
  color: var(--fm-text);
  font-size: 0.875rem;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
}

.fm-filters__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.fm-filters__box {
  flex: 0 0 1rem;
  display: grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border: 1px solid #4a4a4a;
  border-radius: 4px;
  background: var(--fm-bg);
}

.fm-filters__option:hover .fm-filters__box {
  border-color: var(--fm-text);
}

.fm-filters__input:checked + .fm-filters__box {
  border-color: var(--fm-accent);
  background: var(--fm-accent);
}

.fm-filters__input:checked + .fm-filters__box::after {
  content: "";
  width: 0.28rem;
  height: 0.5rem;
  margin-top: -0.12rem;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}

.fm-filters__input:focus-visible + .fm-filters__box {
  outline: 2px solid var(--fm-text);
  outline-offset: 2px;
}

.fm-filters__label {
  min-width: 0;
}

.fm-filters__count {
  margin-left: auto;
  color: var(--fm-muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.fm-filters__option.is-disabled {
  color: var(--fm-muted);
  cursor: default;
  opacity: 0.5;
}

.fm-filters__option.is-disabled:hover .fm-filters__box {
  border-color: #4a4a4a;
}

.fm-filters__extra {
  display: none;
}

.fm-filters__group.is-open .fm-filters__extra {
  display: block;
}

.fm-filters__more {
  min-height: 2rem;
  margin-top: 0.25rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fm-text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.fm-filters__price {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.fm-filters__price input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 2.75rem;
  padding: 0 0.75rem;
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-radius-sm);
  background: var(--fm-surface);
  color: var(--fm-text);
  font: inherit;
  font-size: 1rem;
  color-scheme: dark;
}

.fm-filters__price input:focus {
  outline: 2px solid var(--fm-text);
  outline-offset: 1px;
}

.fm-filters__price-sep {
  color: var(--fm-muted);
}

/* Footer: Clear all + Show N results. Desktop with JS: hidden (filters apply instantly).
   Without JS it stays as the submit row. */
.fm-filters__dock {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.fm-filters.is-enhanced .fm-filters__dock {
  display: none;
}

.fm-filters__clear-all {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--fm-text);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.fm-filters__clear-all[hidden] {
  display: none;
}

.fm-filters__show.fm-btn {
  flex: 1 1 auto;
  box-sizing: border-box;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid var(--fm-text);
  background: var(--fm-text);
  color: var(--fm-bg);
}

.fm-filters__show.fm-btn:hover {
  border-color: #e6e6e6;
  background: #e6e6e6;
  color: var(--fm-bg);
}

/* Active filter chips above the grid. */
.fm-filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.fm-filter-chips[hidden] {
  display: none;
}

.fm-filter-chips__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--fm-border);
  border-radius: 999px;
  background: var(--fm-surface);
  color: var(--fm-text);
  font-size: 0.875rem;
  font-weight: 600;
}

.fm-filter-chips__chip:hover {
  border-color: var(--fm-text);
}

.fm-filter-chips__x {
  flex: none;
  display: block;
}

.fm-filter-chips__clear {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  color: var(--fm-text);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Light loading state while the next results load. */
.fm-archive__grid-wrap {
  transition: opacity 0.15s ease;
}

.fm-archive__grid-wrap.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

html.fm-scroll-locked,
html.fm-scroll-locked body {
  overflow: hidden;
}

html.fm-scroll-locked body {
  position: fixed;
  right: 0;
  left: 0;
  width: 100%;
}

@media (max-width: 1000px) {
  .fm-filters {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    height: 100dvh;
    margin: 0;
    padding: 0;
    background: var(--fm-bg);
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }

  body.fm-filters-open .fm-filters {
    transform: none;
    visibility: visible;
    pointer-events: auto;
    transition: transform 0.2s ease;
  }

  .fm-filters__drawer-head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--fm-border);
  }

  .fm-filters__drawer-title {
    margin: 0;
    color: var(--fm-text);
    font-size: 1.125rem;
    font-weight: 700;
  }

  .fm-filters__close {
    flex: 0 0 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0;
    padding: 0;
    border: 1px solid var(--fm-border);
    border-radius: 999px;
    background: transparent;
    color: var(--fm-text);
    font-size: 0;
    line-height: 0;
    cursor: pointer;
  }

  .fm-filters__close:focus-visible {
    outline: 2px solid var(--fm-text);
    outline-offset: 2px;
  }

  .fm-filters__close-icon {
    display: block;
    flex: none;
    width: 14px;
    height: 14px;
  }

  .fm-filters__form {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  /* Only this scrolls; the footer sits below it, so nothing hides behind the footer. */
  .fm-filters__scroll {
    flex: 1 1 auto;
    min-height: 0;
    padding: 1rem 1rem 1.5rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .fm-filters__option {
    min-height: 2.75rem;
  }

  .fm-filters__more {
    min-height: 2.75rem;
  }

  .fm-filters__group {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
  }

  .fm-filters__group--stock {
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .fm-filters__dock,
  .fm-filters.is-enhanced .fm-filters__dock {
    flex: none;
    display: flex;
    margin: 0;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--fm-border);
    background: var(--fm-bg);
  }

  .fm-filters-backdrop {
    position: fixed;
    inset: 0;
    z-index: 350;
    background: rgba(0, 0, 0, 0.62);
  }

  body.fm-filters-open .fm-filters-backdrop {
    display: block;
  }
}

/* SHOP-09: the count stays on one line next to Filters/sort when filters are on; the sort
   select gives up width instead of pushing past the gutter. */
.fm-archive__count {
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .fm-archive__toolbar .woocommerce-ordering,
  .fm-archive__toolbar .fm-ordering {
    flex: 1 1 auto;
    min-width: 0;
  }

  .fm-archive__toolbar .woocommerce-ordering select,
  .fm-archive__toolbar .fm-ordering select {
    width: 100%;
    min-width: 0;
  }
}

/* 1.12.91: Parts groups on Parts and each group page. Current group in the accent. */
.fm-subcats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
}

.fm-subcats__chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-radius-sm);
  background: var(--fm-surface);
  color: var(--fm-text);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.fm-subcats__chip:hover {
  border-color: var(--fm-text);
  color: var(--fm-text);
}

.fm-subcats__chip[aria-current="page"] {
  border-color: var(--fm-accent);
  box-shadow: inset 0 0 0 1px var(--fm-accent);
  color: #fff;
}

.fm-subcats__chip:focus-visible {
  outline: 2px solid var(--fm-text);
  outline-offset: 2px;
}

/* 1.12.93: count for the active filters. A group with 0 is dimmed but stays a link. */
.fm-subcats__count {
  margin-left: 0.25rem;
  color: var(--fm-muted);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.fm-subcats__chip.is-empty {
  background: var(--fm-surface);
  color: var(--fm-muted);
  font-weight: 400;
}

.fm-subcats__chip.is-empty:hover {
  border-color: var(--fm-muted);
  color: var(--fm-text);
}

/* Phones: one row that scrolls sideways, edge to edge. 1.12.93: 24px inline padding and
   scroll padding, so the first and current chips never sit flush and the next one peeks in. */
@media (max-width: 767px) {
  .fm-subcats {
    flex-wrap: nowrap;
    margin: 0 -1.5rem 1rem;
    padding: 0 0 0.25rem;
    padding-inline: 24px;
    scroll-padding-inline: 24px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .fm-subcats::-webkit-scrollbar {
    display: none;
  }

  .fm-subcats__chip {
    flex: none;
    min-height: 2.75rem;
  }
}

/* 1.12.93 (PARTS-01): archive empty state. One line, then Clear {filter} (red) and All {page} (n). */
.fm-archive .fm-archive-empty__title {
  margin: 0 0 1rem;
}

.fm-archive .fm-archive-empty__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
}

@media (max-width: 639px) {
  .fm-archive .fm-archive-empty__actions {
    flex-direction: column;
  }

  .fm-archive .fm-archive-empty__actions .fm-btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
}

/* 1.13.51: /black-friday/ filters run in the browser (assets/js/bf-filters.js). A filtered-out
   card is [hidden]; the card's own display rule must not bring it back. Chips are buttons here. */
.fm-bf-page ul.products > li[hidden],
.fm-bf-page .fm-archive-empty[hidden] {
  display: none !important;
}

.fm-bf-page button.fm-filter-chips__chip,
.fm-bf-page button.fm-filter-chips__clear {
  font-family: inherit;
  line-height: inherit;
  cursor: pointer;
}

.fm-bf-page button.fm-filter-chips__clear {
  padding: 0 0.25rem;
  border: 0;
  background: none;
}

/* 1.13.51: /black-friday/ card title: listing name, then one labeled line per option
   ("Length: 12.5\"", "Stock: SGA"), never cut off. The name no longer reserves two lines, so the
   options sit right under it. The options block takes the card's spare height, so the price and
   button sit at the bottom and line up across a row. */
.fm-bf-page .fm-card__title {
  height: auto;
  min-height: 0;
}

.fm-bf-page .fm-card__title a {
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.fm-bf-page .fm-card__opts {
  flex: 1 0 auto;
  margin: 0.15rem 0 0.35rem;
  font-size: 0.8125rem;
  line-height: 1.4;
}

.fm-bf-page .fm-card__opt {
  display: block;
}

.fm-bf-page .fm-card__opt dt,
.fm-bf-page .fm-card__opt dd {
  display: inline;
  margin: 0;
}

.fm-bf-page .fm-card__opt dt {
  color: var(--fm-muted);
  font-weight: 500;
}

.fm-bf-page .fm-card__opt dd {
  color: var(--fm-text);
  font-weight: 500;
}

.fm-bf-page .fm-card__opt--plain dd {
  color: var(--fm-muted);
}

@media (max-width: 720px) {
  .fm-bf-page .fm-card__opts {
    font-size: 0.75rem;
  }
}

/* 1.13.51: phones, sale cards in shop grids. "$1,649.00 $1,239.20" is ~147px and a 2-up card has
   124–139px, so the price was clipped. The was-price gets its own small line and the sale price
   shares the second line with the FFL pill: same two lines the row already reserves. */
@media (max-width: 639px) {
  .fm-archive .fm-card__price-row:has(del),
  .fm-is-archive .fm-card__price-row:has(del) {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    align-content: flex-start;
    column-gap: 0.4rem;
    row-gap: 0.2rem;
  }

  .fm-archive .fm-card__price-row:has(del) .fm-card__price,
  .fm-is-archive .fm-card__price-row:has(del) .fm-card__price {
    display: contents;
  }

  .fm-archive .fm-card__price-row:has(del) .fm-card__price del,
  .fm-is-archive .fm-card__price-row:has(del) .fm-card__price del {
    flex: 0 0 100%;
    margin: 0;
    line-height: 1.1rem;
  }

  .fm-archive .fm-card__price-row:has(del) .fm-card__price ins,
  .fm-is-archive .fm-card__price-row:has(del) .fm-card__price ins {
    line-height: 1.3rem;
  }
}
