.ncf-archive {
  --ncf-gold: #c99b43;
  --ncf-gold-light: #f4ead8;
  --ncf-green: #1f302b;
  --ncf-muted: #666b68;
  --ncf-line: rgba(31, 48, 43, .16);
  width: calc(100% - (2 * var(--nahavaran-page-gutter)));
  max-width: none;
  margin-inline: auto;
  padding: 0 0 72px;
  box-sizing: border-box;
  direction: rtl;
  background: #fff;
  color: var(--ncf-green);
}

body.tax-product_cat .shop-page-title.category-page-title {
  display: none;
}

body.tax-product_cat #main {
  padding-top: 0;
}

.ncf-archive .woocommerce-breadcrumb {
  margin: 0 0 20px;
  padding-top: 14px;
  color: #858a87;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.7;
  text-align: right;
}

.ncf-archive .woocommerce-breadcrumb a { color: #8d928f; font-weight: 400; }

.ncf-archive .woocommerce-breadcrumb .ncf-breadcrumb-title {
  display: inline;
  margin: 0;
  padding: 0;
  color: #26352e;
  font: inherit;
  font-weight: 600;
  letter-spacing: inherit;
}

.ncf-layout {
  display: grid;
  grid-template-columns: 234px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  direction: rtl;
}

.ncf-products-column,
.ncf-sidebar { min-width: 0; direction: rtl; }

.ncf-sidebar {
  position: sticky;
  top: 120px;
  z-index: 20;
  align-self: start;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.ncf-sidebar__heading { display: none; }
.ncf-drawer-close,
.ncf-mobile-sort-button,
.ncf-mobile-filter-button,
.ncf-drawer-backdrop,
.ncf-sorts__sheet-heading { display: none; }
:is(body.tax-product_cat, body.nahavaran-product-search) .ncf-mobile-filter-button svg,
:is(body.tax-product_cat, body.nahavaran-product-search) .ncf-mobile-filter-label-mobile { display: none; }

.ncf-filter { position: relative; border: 0; border-bottom: 1px solid var(--ncf-line); }

.ncf-filter__toggle {
  width: 100%;
  min-height: 74px;
  margin: 0;
  padding: 0 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ncf-green);
  box-shadow: none;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.5;
  text-align: right;
  transition: color 200ms ease;
}

.ncf-filter__toggle:hover,
.ncf-filter__toggle:focus-visible { color: #36574d; background: transparent; box-shadow: none; }

.ncf-filter__arrow {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border: solid currentColor;
  border-width: 0 0 1.4px 1.4px;
  transform: rotate(-45deg);
  transition: transform 200ms ease;
}

.ncf-filter__toggle[aria-expanded="true"] .ncf-filter__arrow { transform: rotate(135deg); }

.ncf-filter__popup {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  inset-inline: 0;
  width: 100%;
  max-height: 330px;
  overflow: auto;
  padding: 6px 16px;
  box-sizing: border-box;
  background: #f5f5f4;
  border: 1px solid rgba(31, 48, 43, .06);
  border-radius: 5px;
  box-shadow: 0 14px 34px rgba(31, 48, 43, .12);
  transform-origin: top center;
  animation: ncf-popup-in 200ms ease both;
}

.ncf-filter__popup[hidden] { display: none; }

@keyframes ncf-popup-in {
  from { opacity: 0; transform: translateY(-7px); }
  to { opacity: 1; transform: translateY(0); }
}

.ncf-check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  min-height: 44px;
  margin: 0;
  color: #343e3a;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.5;
  cursor: pointer;
}

.ncf-check > span { order: 1; }

.ncf-check + .ncf-check { border-top: 1px solid rgba(31, 48, 43, .08); }

.ncf-check input[type="checkbox"] {
  position: relative;
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin: 0;
  appearance: none;
  border: 1px solid rgba(31, 48, 43, .65);
  border-radius: 3px;
  background: #fff;
  box-shadow: none;
  cursor: pointer;
  order: 2;
}

.ncf-check input[type="checkbox"]:checked { border-color: var(--ncf-green); background: var(--ncf-green); }
.ncf-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 6px;
  width: 6px;
  height: 9px;
  border: solid #fff;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
}
.ncf-check input[type="checkbox"]:focus-visible { outline: 2px solid rgba(201, 155, 67, .45); outline-offset: 2px; }

.ncf-price { padding: 12px 2px 8px; }
.ncf-price__inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ncf-price__inputs label {
  display: grid;
  gap: 6px;
  margin: 0;
  color: var(--ncf-muted);
  font-size: 11px;
  font-weight: 300;
}

.ncf-price__inputs input {
  width: 100%;
  height: 42px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid rgba(31, 48, 43, .18);
  border-radius: 5px;
  background: #fff;
  color: var(--ncf-green);
  box-shadow: none;
  font-size: 12px;
  font-weight: 300;
  text-align: center;
  direction: rtl;
}

.ncf-price__inputs input:focus {
  border-color: var(--ncf-gold);
  box-shadow: 0 0 0 2px rgba(201, 155, 67, .12);
  outline: 0;
}

.ncf-price__inputs input[aria-invalid="true"] {
  border-color: #b64a3b;
}

.ncf-price__error {
  margin: 8px 0 0;
  color: #9f3f32;
  font-size: 11px;
  font-weight: 300;
  line-height: 1.7;
}

.ncf-price__error[hidden] { display: none; }

.ncf-toolbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  direction: ltr;
  border-bottom: 1px solid var(--ncf-line);
}

.ncf-result-count {
  direction: rtl;
  flex: 0 0 auto;
  color: var(--ncf-green);
  font-size: 13px;
  font-weight: 300;
  line-height: 1.5;
  white-space: nowrap;
}

.ncf-result-count strong { font-weight: 400; }

.ncf-sorts {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0 30px;
  direction: rtl;
}

.ncf-sorts button {
  position: relative;
  min-height: 36px;
  margin: 0;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ncf-muted);
  box-shadow: none;
  font-size: 13px;
  font-weight: 300;
  line-height: 1.5;
  white-space: nowrap;
}

.ncf-sorts button:hover,
.ncf-sorts button:focus-visible { color: var(--ncf-green); background: transparent; box-shadow: none; }
.ncf-sorts button.is-active { color: var(--ncf-green); background: transparent; font-weight: 500; }
.ncf-sorts button.is-active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -10px;
  width: 100%;
  height: 1px;
  background: var(--ncf-gold);
}

.ncf-active-filters { display: flex; flex-wrap: wrap; gap: 8px; min-height: 0; margin: 14px 0 0; }
.ncf-active-filters:empty { display: none; margin: 0; }

.ncf-chip,
.ncf-clear-all {
  min-height: 31px;
  margin: 0;
  padding: 4px 11px;
  border: 1px solid rgba(31, 48, 43, .10);
  border-radius: 999px;
  background: #f5f7f4;
  color: #46534e;
  box-shadow: none;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}

.ncf-clear-all { border-color: transparent; background: #fbf7ef; color: #8d6929; }
.ncf-chip:hover,
.ncf-clear-all:hover { border-color: rgba(201, 155, 67, .35); background: var(--ncf-gold-light); box-shadow: none; }

.ncf-status { min-height: 24px; margin: 7px 0 4px; color: var(--ncf-muted); font-size: 12px; line-height: 1.6; }
.ncf-status:empty { min-height: 14px; margin-top: 0; }
.ncf-products-shell { min-height: 380px; transition: opacity 150ms ease; }
.ncf-archive.is-loading .ncf-products-shell { opacity: .55; }

.ncf-archive .ncf-products-column .products.row {
  width: auto;
  max-width: none;
  margin: 0 -13px;
  direction: rtl;
  align-items: flex-start;
}

.ncf-products-column .products > .product {
  flex: 0 0 25%;
  width: 25%;
  max-width: 25%;
  margin: 0 0 42px;
  padding: 0 13px;
  box-sizing: border-box;
}

.ncf-products-column .product .col-inner,
.ncf-products-column .product-small.box { width: 100%; background: #fff; border: 0; box-shadow: none; }

.ncf-products-column .box-image,
.ncf-products-column .box-image > div:first-child,
.ncf-products-column .box-image > div:first-child > a {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 0;
  border-radius: 0;
}

.ncf-products-column .quick-view { display: none !important; }

.ncf-products-column .box-image img,
.ncf-products-column .box-image .woocommerce-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 0;
  border-radius: 0;
}

.ncf-products-column .box-text { padding-top: 13px; text-align: center; }
.ncf-products-column .title-wrapper { margin: 0; text-align: center; }
:is(body.tax-product_cat, body.nahavaran-product-search) .ncf-products-column .ncf-product-model { margin: 5px 0 0; color: #6f7471; font-size: 13px; font-weight: 400; line-height: 1.55; text-align: center; }
:is(body.tax-product_cat, body.nahavaran-product-search) .ncf-products-column .ncf-product-model bdi { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ncf-products-column .price-wrapper { margin-top: 6px; text-align: center; }
.ncf-products-column .category { display: none; }

.ncf-empty { display: grid; min-height: 280px; place-items: center; color: var(--ncf-muted); font-size: 15px; }
.ncf-empty[hidden] { display: none; }

.ncf-load-more {
  display: block;
  width: 230px;
  min-width: 0;
  min-height: 55px;
  margin: 8px auto 0;
  padding: 8px 20px;
  border: 1px solid var(--ncf-gold);
  border-radius: 999px;
  background: #fff;
  color: var(--ncf-green);
  box-shadow: none;
  font-size: 15px;
  font-weight: 500;
  transition: color 180ms ease, background-color 180ms ease;
}

.ncf-load-more:hover,
.ncf-load-more:focus-visible { color: var(--ncf-green); background: #fbf6eb; box-shadow: none; }
.ncf-load-more[hidden] { display: none; }
.ncf-product-hover { display: none; }
.ncf-product-hover-host {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.ncf-product-hover-host > :not(.ncf-product-hover) { display: none !important; }
.ncf-drawer-backdrop { border: 0; }

@media (hover: hover) and (pointer: fine) {
  .ncf-products-column .box-image img { transition: transform 300ms ease, filter 300ms ease; }
  .ncf-product-hover-host { display: block !important; opacity: 1 !important; transform: none !important; pointer-events: none !important; background: transparent !important; }
  .ncf-product-hover {
    position: absolute;
    z-index: 8;
    inset-inline: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 34px 14px 14px;
    color: #fff;
    background: linear-gradient(to top, rgba(15, 35, 29, .88), rgba(15, 35, 29, 0));
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 300ms ease, opacity 300ms ease;
  }
  .ncf-product-hover span { display: flex; align-items: center; gap: 7px; font-size: 12px; line-height: 1.5; }
  .ncf-product-hover svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; }
  .ncf-products-column .product:hover .box-image img { transform: scale(1.035); filter: brightness(.76); }
  .ncf-products-column .product:hover .ncf-product-hover { transform: translateY(0); opacity: 1; }
}

@media (min-width: 1024px) {
  body.tax-product_cat .ncf-archive .ncf-products-column .products.row { align-items: stretch; }
  body.tax-product_cat .ncf-products-column .products > .product { display: flex; margin-bottom: 26px; }
  body.tax-product_cat .ncf-products-column .product > .col-inner { display: flex; }
  body.tax-product_cat .ncf-products-column .product-small.box { display: flex; flex: 1; flex-direction: column; }
  body.tax-product_cat .ncf-products-column .box-image { flex: 0 0 auto; }
}

@media (max-width: 1400px) {
  .ncf-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 36px; }
  .ncf-sorts { gap: 0 21px; }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .ncf-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 30px; }
  .ncf-products-column .products > .product { flex-basis: 33.3333%; width: 33.3333%; max-width: 33.3333%; }
  .ncf-sorts { gap: 0 15px; }
  .ncf-sorts button { font-size: 14px; }
}

@media (max-width: 1023px) {
  .ncf-archive { padding: 16px 0 56px; }
  .ncf-archive .woocommerce-breadcrumb { margin-bottom: 18px; }
  .ncf-layout { display: block; }
  .ncf-mobile-filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: 0;
    padding: 8px 18px;
    border: 1px solid var(--ncf-gold);
    border-radius: 8px;
    background: #fff;
    color: var(--ncf-green);
    box-shadow: none;
    font-size: 15px;
  }
  .ncf-sidebar {
    position: fixed;
    z-index: 100002;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(90vw, 380px);
    padding: 22px 22px 32px;
    overflow: auto;
    box-sizing: border-box;
    background: #fff;
    transform: translateX(105%);
    visibility: hidden;
    transition: transform 150ms ease, visibility 0s linear 150ms;
  }
  .ncf-archive.is-drawer-open .ncf-sidebar { transform: translateX(0); visibility: visible; transition-delay: 0s; }
  .ncf-sidebar__heading { display: flex; min-height: 48px; align-items: center; justify-content: flex-end; margin-bottom: 8px; }
  .ncf-sidebar__heading strong { display: none; }
  .ncf-drawer-close {
    display: inline-grid;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ncf-green);
    box-shadow: none;
    font-size: 28px;
  }
  .ncf-drawer-backdrop {
    position: fixed;
    z-index: 100001;
    inset: 0;
    display: block;
    margin: 0;
    padding: 0;
    background: rgba(18, 29, 25, .32);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 150ms ease, visibility 0s linear 150ms;
  }
  .ncf-archive.is-drawer-open .ncf-drawer-backdrop { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
  .ncf-filter__popup { position: relative; top: auto; margin-bottom: 12px; box-shadow: none; }
  .ncf-filter__toggle { min-height: 68px; font-size: 15px; }
  .ncf-toolbar { min-height: 56px; align-items: center; flex-wrap: wrap; gap: 10px 18px; padding-bottom: 10px; }
  .ncf-sorts { order: 3; flex: 1 0 100%; flex-wrap: nowrap; gap: 0 24px; overflow-x: auto; padding-bottom: 5px; }
  .ncf-sorts button { flex: 0 0 auto; font-size: 12px; }
  .ncf-sorts button.is-active::after { bottom: -10px; }
  .ncf-products-column .products > .product { flex-basis: 50%; width: 50%; max-width: 50%; }
}

@media (max-width: 767px) {
  .ncf-archive { padding: 14px 0 48px; }
  .ncf-archive .woocommerce-breadcrumb { margin-bottom: 16px; font-size: 12px; }
  .ncf-result-count { font-size: 12px; }
  .ncf-toolbar { min-height: 54px; }
  .ncf-active-filters { margin-top: 10px; }
  .ncf-archive .ncf-products-column .products.row { margin-inline: -7px; }
  .ncf-products-column .products > .product { margin-bottom: 32px; padding-inline: 7px; }
  .ncf-products-column .box-text { padding-top: 12px; }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-products-column .ncf-product-model { display: block; margin-top: 4px; font-size: 11px; line-height: 1.45; color: #6f7471; font-weight: 400; text-align: center; }
  .ncf-load-more { width: 220px; min-height: 53px; }

  /* Match the compact mobile catalog spacing while retaining the search title. */
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-archive { padding-top: 4px; }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-archive .woocommerce-breadcrumb { padding-top: 8px; }

  /* The card outline extends 8px beyond each card, so leave equal visible gaps. */
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-archive .ncf-products-column .products.row { margin-inline: -12px; }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-products-column .products > .product {
    margin-bottom: 24px;
    padding-inline: 12px;
  }

  /* Shared mobile toolbar; desktop controls remain intact. */
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-toolbar {
    min-height: 52px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 8px;
    padding-bottom: 8px;
    direction: rtl;
  }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-mobile-sort-button,
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-mobile-filter-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 34px;
    margin: 0;
    padding: 5px 11px;
    color: var(--ncf-green);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    box-shadow: none;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
  }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-mobile-sort-button svg,
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-mobile-filter-button svg { display: block; width: 17px; height: 17px; flex: none; }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-mobile-filter-label-mobile { display: inline; }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-mobile-filter-label-tablet { display: none; }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-result-count { margin-right: auto; }
  :is(body.tax-product_cat, body.nahavaran-product-search).ncf-mobile-sheet-open { overflow: hidden; }

  /* Basic bottom sheets; their detailed appearance can be refined separately. */
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-sidebar,
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-sorts {
    position: fixed;
    z-index: 100002;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(80dvh, 680px);
    box-sizing: border-box;
    padding: 16px 20px calc(24px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    color: var(--ncf-green);
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 30px rgba(18, 29, 25, .13);
    transform: translateY(105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 150ms ease, visibility 0s linear 150ms;
  }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-sorts {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    direction: rtl;
  }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-archive.is-drawer-open .ncf-sidebar,
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-archive.is-sort-open .ncf-sorts {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-archive.is-sort-open .ncf-drawer-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-sidebar__heading,
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-sorts__sheet-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    margin-bottom: 8px;
  }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-sidebar__heading strong { display: block; }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-sorts__sheet-heading .ncf-sort-close {
    flex: 0 0 auto;
    width: 40px;
    min-height: 40px;
    padding: 0;
    color: var(--ncf-green);
    background: transparent;
    border: 0;
    box-shadow: none;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
  }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-sorts button[data-ncf-sort] {
    flex: none;
    width: 100%;
    min-height: 46px;
    padding: 9px 2px;
    text-align: right;
  }
  :is(body.tax-product_cat, body.nahavaran-product-search) .ncf-sorts button.is-active::after { bottom: 0; }
}

@media (max-width: 420px) {
  .ncf-sidebar { width: min(92vw, 360px); padding-inline: 18px; }
  .ncf-sorts { gap: 0 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .ncf-archive *,
  .ncf-archive *::before,
  .ncf-archive *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
