/* ==========================================================================
   MASOUN — Category page (product listing with filters)
   WP: woocommerce/archive-product.php
   ========================================================================== */

/* ---------------------------------------------------------------- Hero ---- */
.cat-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding-block: clamp(48px, 8vw, 104px) clamp(32px, 4vw, 48px);
  background: var(--c-onyx);
}
.cat-hero__media { position: absolute; inset: 0; z-index: -1; }
.cat-hero__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: .42;
  transform: scale(1.06);
  transition: opacity 1.2s var(--ease), transform 3s var(--ease-out);
}
.is-loaded .cat-hero__media img { transform: none; }
.cat-hero__media::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to top, var(--c-onyx) 4%, rgba(14, 12, 10, .55) 50%, rgba(14, 12, 10, .75)),
    linear-gradient(to left, rgba(14, 12, 10, .7), transparent 70%);
}
html[dir="ltr"] .cat-hero__media::after {
  background:
    linear-gradient(to top, var(--c-onyx) 4%, rgba(14, 12, 10, .55) 50%, rgba(14, 12, 10, .75)),
    linear-gradient(to right, rgba(14, 12, 10, .7), transparent 70%);
}
.cat-hero .breadcrumb { padding: 0 0 clamp(28px, 5vw, 56px); color: var(--c-text-mute); }
.cat-hero__title { font-size: clamp(46px, 8vw, 104px); line-height: 1.15; }
html[lang="en"] .cat-hero__title { line-height: 1; }
.cat-hero__desc { margin-top: 18px; }
.cat-hero__count { display: inline-block; margin-top: 18px; color: var(--c-sand); }

.cat-tabs {
  display: flex; gap: 8px;
  margin-top: clamp(32px, 5vw, 56px);
  overflow-x: auto;
  scrollbar-width: none;
  margin-inline: calc(var(--gutter) * -1);
  padding-inline: var(--gutter);
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tabs .chip { flex: none; gap: 8px; white-space: nowrap; }
.cat-tabs .chip small { font-family: var(--f-ui-la); font-size: 10.5px; opacity: .6; }
.cat-tabs .chip[aria-current="page"] { background: var(--c-ivory); border-color: var(--c-ivory); color: var(--c-onyx); }
.cat-tabs .chip.is-soon { opacity: .55; }

/* ------------------------------------------------------------- Toolbar ---- */
.cat-bar {
  position: sticky;
  top: calc(var(--header-h));
  z-index: 30;
  background: rgba(243, 236, 223, .94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-dark);
  transition: top .8s var(--ease-out);
}
@media (min-width: 1100px) { .cat-bar { top: calc(var(--header-h) + 46px); } }
body:has(.site-header.is-hidden) .cat-bar { top: 0; }
.cat-bar__inner { display: flex; align-items: center; gap: 10px; height: 60px; min-width: 0; }
@media (max-width: 599px) {
  .cat-bar__count { display: none; }
  .sort select { max-width: 132px; padding-inline: 12px 28px; text-overflow: ellipsis; }
  .sort::after { inset-inline-end: 12px; }
  .density button { width: 32px; }
}
.cat-bar__count { font-size: 13px; color: var(--c-text-mute); }
.cat-bar__spacer { flex: 1; }
.filter-btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 16px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  font-size: 13.5px;
}
.filter-btn b {
  display: none;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--c-onyx); color: var(--c-ivory);
  font-family: var(--f-ui-la); font-size: 10px; font-weight: 500; line-height: 18px; text-align: center;
}
.filter-btn b.has { display: inline-block; }
@media (min-width: 1000px) { .filter-btn { display: none; } }

.sort {
  position: relative;
  display: inline-flex; align-items: center;
}
.sort select {
  appearance: none; -webkit-appearance: none;
  height: 40px;
  padding-inline: 14px 34px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  background: transparent;
  font-size: 13.5px;
  color: var(--c-onyx);
  cursor: pointer;
}
.sort::after {
  content: "";
  position: absolute; inset-inline-end: 15px; top: 50%;
  width: 7px; height: 7px;
  border-right: 1px solid currentColor; border-bottom: 1px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.density { display: inline-flex; gap: 2px; }
.density button { width: 36px; height: 40px; display: grid; place-items: center; color: var(--c-text-mute); }
.density button[aria-pressed="true"] { color: var(--c-onyx); }
.density svg { width: 16px; height: 16px; fill: currentColor; }
@media (min-width: 1000px) { .density { display: none; } }

/* -------------------------------------------------------------- Layout ---- */
.cat-body { padding-block: clamp(28px, 4vw, 48px) clamp(80px, 10vw, 140px); }
.cat-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px; }
@media (min-width: 1000px) {
  .cat-layout { grid-template-columns: 260px minmax(0, 1fr); gap: clamp(40px, 4vw, 72px); align-items: start; }
}

/* Filters: bottom sheet on mobile, sidebar on desktop */
.filters { display: flex; flex-direction: column; }
.filters__head, .filters__foot { display: none; }
.f-group { padding-block: 22px; border-bottom: 1px solid var(--line-dark); }
.f-group:first-child { padding-top: 0; }
.f-group__title {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 16px;
  font-family: var(--f-ui-la); font-size: 10.5px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--c-sand-dark);
}
html[lang="ar"] .f-group__title { font-family: var(--f-body); font-size: 13px; letter-spacing: 0; color: var(--c-onyx); font-weight: 400; }
.f-options { display: flex; flex-wrap: wrap; gap: 8px; }
.f-chip { gap: 8px; min-height: 40px; padding: 0 14px; font-size: 13.5px; }
.f-chip small { font-family: var(--f-ui-la); font-size: 10.5px; opacity: .55; }
.f-chip:disabled { opacity: .35; pointer-events: none; }
.theme-ivory .chip[aria-pressed="true"] { background: var(--c-onyx); border-color: var(--c-onyx); color: var(--c-ivory); }
.f-colors { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 14px; }
.f-color {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px;
  font-size: 13.5px;
  color: var(--c-text-soft);
  text-align: start;
}
.f-color__dot {
  position: relative; flex: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.f-color__dot::after {
  content: ""; position: absolute; inset: -5px;
  border-radius: 50%;
  border: 1px solid transparent;
  transition: border-color .4s var(--ease);
}
.f-color[aria-pressed="true"] { color: var(--c-onyx); }
.f-color[aria-pressed="true"] .f-color__dot::after { border-color: var(--c-onyx); }
.f-color small { font-family: var(--f-ui-la); font-size: 10.5px; opacity: .55; margin-inline-start: auto; }
.f-color:disabled { opacity: .35; pointer-events: none; }
.f-clear { margin-top: 22px; font-size: 13px; text-decoration: underline; text-underline-offset: 4px; color: var(--c-text-mute); align-self: flex-start; }

@media (min-width: 1000px) {
  .filters { position: sticky; top: calc(var(--header-h) + 46px + 84px); }
}

@media (max-width: 999px) {
  .filters {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 85;
    max-height: 86svh;
    background: var(--c-ivory);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -30px 60px -20px rgba(0, 0, 0, .5);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform .8s var(--ease-out), visibility 0s linear .8s;
  }
  .filters.is-open { transform: none; visibility: visible; transition: transform .8s var(--ease-out); }
  .filters__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px var(--gutter) 6px;
    border-bottom: 1px solid var(--line-dark);
  }
  .filters__head::before {
    content: ""; position: absolute; top: 8px; left: 50%;
    width: 38px; height: 4px; border-radius: 2px;
    background: var(--line-dark);
    transform: translateX(-50%);
  }
  .filters__head h2 { font-size: 22px; padding-top: 12px; }
  .filters__body { overflow-y: auto; padding: 22px var(--gutter) 8px; overscroll-behavior: contain; }
  .filters__body .f-clear { display: none; }
  .filters__foot {
    display: grid; grid-template-columns: auto 1fr; gap: 10px;
    padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line-dark);
  }
  .filters__foot .btn { min-height: 50px; }
}
.scrim {
  position: fixed; inset: 0; z-index: 84;
  background: rgba(8, 7, 6, .55);
  opacity: 0; visibility: hidden;
  transition: opacity .6s var(--ease), visibility 0s linear .6s;
}
.scrim.is-on { opacity: 1; visibility: visible; transition: opacity .6s var(--ease); }
@media (min-width: 1000px) { .scrim { display: none; } }

/* Active filter pills */
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.active-filters:empty { display: none; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 12px;
  border-radius: 999px;
  background: var(--c-ivory-2);
  font-size: 13px;
}
.pill .i { width: 12px; height: 12px; }
.pill--clear { background: none; text-decoration: underline; text-underline-offset: 4px; color: var(--c-text-mute); }

/* Grid */
.p-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 12px; }
.p-grid.is-single { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .p-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 44px 18px; } .p-grid.is-single { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .p-grid, .p-grid.is-single { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 56px 22px; } }
.p-grid .p-card__title { font-size: clamp(17px, 2vw, 21px); }
@media (max-width: 699px) {
  .p-grid:not(.is-single) .p-card__badge { top: 10px; inset-inline-start: 10px; font-size: 10px; padding: 2px 8px; }
  .p-grid:not(.is-single) .p-card__sub { font-size: 9px; letter-spacing: .18em; }
}
.p-grid.is-updating { opacity: 0; transform: translateY(8px); }
.p-grid { transition: opacity .35s var(--ease), transform .5s var(--ease-out); }

/* Empty / coming soon */
.empty {
  grid-column: 1 / -1;
  display: grid; justify-items: center; text-align: center; gap: 14px;
  padding: clamp(48px, 8vw, 96px) var(--gutter);
  border: 1px solid var(--line-dark);
}
.empty svg { width: 40px; height: 46px; stroke: var(--c-cognac); fill: none; stroke-width: 1.3; }
.empty h3 { font-size: clamp(26px, 3vw, 36px); }
.empty p { color: var(--c-text-soft); max-width: 44ch; }
.empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }

/* SEO / about the category */
.cat-about { border-top: 1px solid var(--line-dark); padding-top: clamp(40px, 6vw, 72px); margin-top: clamp(56px, 8vw, 96px); display: grid; gap: 24px; }
@media (min-width: 1000px) { .cat-about { grid-template-columns: 1fr 1.4fr; gap: 72px; } }
.cat-about h2 { font-size: clamp(26px, 3vw, 38px); }
.cat-about p { color: var(--c-text-soft); }
.cat-about p + p { margin-top: 14px; }
