/* =========================================================
   KParts — Boutique + pages catégorie (refonte)
   Chargé uniquement sur la Boutique et les catégories produit.
   ========================================================= */

body.kjx-archive {
  --kjx-ink: #000;
  --kjx-text: #1a1a1a;
  --kjx-muted: #767676;
  --kjx-line: #e6e6e6;
  --kjx-tile: #f2f2f2;
  --kjx-hover: #f5f5f5;
  --kjx-focus: #046bd2;
  --kjx-font: 'Saira', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --kjx-header-offset: 0px; /* à augmenter si le header passe par-dessus le contenu */
  background: #fff !important;
}

/* ---- Neutralise les anciennes règles boutique/catégorie (fond bleuté, marges, flex…) ---- */
body.kjx-archive.kjx-archive.kjx-archive .site-content {
  background: #fff !important;
  margin-top: 0 !important;
}
body.kjx-archive.kjx-archive.kjx-archive .site-content > .ast-container {
  display: block !important;
  max-width: 1320px !important;
  margin: 0 auto !important;
  padding: 0 24px !important;
}

/* =========================================================
   Hero (bandeau image) — plus bas que l'ancien
   ========================================================= */
body.kjx-archive {
  --kjx-hero-h: 300px;     /* hauteur totale, header compris */
  --kjx-hero-pull: 0px;   /* remonte le hero sous le header transparent (hauteur du header) */
}

.kjx-main .woocommerce-notices-wrapper {
    margin-bottom: 0!important;
}

.kjx-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  left: 50%;
  margin-left: -50vw;
  margin-top: calc(-1 * var(--kjx-hero-pull));
  min-height: var(--kjx-hero-h);
  padding: calc(var(--kjx-hero-pull) + 60px) 16px 30px;
  background-color: #0b2233;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  isolation: isolate;
  box-sizing: border-box;
}
.kjx-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: -1;
}
.kjx-hero__inner { text-align: center; }
.kjx-hero__title {
  margin: 0;
  font-family: var(--kjx-font);
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #fff;
}
.kjx-hero__wave {
  position: absolute;
  left: 0;
  bottom: -1px;
  display: block;
  width: 100%;
  height: 40px;
  transform: scaleY(-1);
  fill: #fff;
  pointer-events: none;
}
@media (max-width: 921px) {
  body.kjx-archive { --kjx-hero-h: 220px; }
  .kjx-hero__wave { height: 26px; }
}

/* =========================================================
   Mise en page
   ========================================================= */
.kjx {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  column-gap: 40px;
  padding: calc(32px + var(--kjx-header-offset)) 0 96px;
  font-family: var(--kjx-font);
  color: var(--kjx-text);
}
.kjx *, .kjx *::before, .kjx *::after { box-sizing: border-box; }

.kjx a:focus-visible,
.kjx button:focus-visible,
.kjx select:focus-visible,
.kjx input:focus-visible {
  outline: 2px solid var(--kjx-focus);
  outline-offset: 2px;
}

/* =========================================================
   Sidebar catégories
   ========================================================= */
.kjx-side {
  border-right: 1px solid var(--kjx-line);
  padding-right: 20px;
  align-self: start;
  position: sticky;
  top: 120px;
}
.kjx-side__title {
  margin: 0 0 14px;
  padding-left: 14px;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--kjx-muted);
}
.kjx-side__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.kjx-side__list li { margin: 0 0 2px; }

.kjx .kjx-side__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 10px 12px 14px;
  border-left: 3px solid transparent;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.35;
  color: var(--kjx-text) !important;
  text-decoration: none !important;
  transition: background-color .15s ease;
}
.kjx .kjx-side__link .kjx-ico { flex: none; color: var(--kjx-muted); }
.kjx .kjx-side__link:hover { background: var(--kjx-hover); }
.kjx .kjx-side__link.is-active {
  background: var(--kjx-hover);
  border-left-color: var(--kjx-ink);
  font-weight: 500;
  color: var(--kjx-ink) !important;
}
.kjx .kjx-side__link.is-active .kjx-ico { color: var(--kjx-ink); }

/* =========================================================
   Colonne principale
   ========================================================= */
.kjx-main { min-width: 0; }

.kjx-crumbs__list {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  font-size: 12px;
  font-weight: 300;
  color: var(--kjx-muted);
}
.kjx-crumbs__list li { margin: 0; }
.kjx-crumbs__list li + li::before {
  content: '/';
  margin: 0 8px;
  color: #b5b5b5;
}
.kjx .kjx-crumbs__list a {
  color: var(--kjx-muted) !important;
  text-decoration: none;
}
.kjx .kjx-crumbs__list a:hover { color: var(--kjx-ink) !important; }

.kjx .kjx-title {
  margin: 0 0 28px;
  font-family: var(--kjx-font) !important;
  font-size: clamp(32px, 3.4vw, 48px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -.02em;
  color: var(--kjx-ink) !important;
  text-transform: none;
}

/* ---- Barre : onglets à gauche, recherche + tri à droite ---- */
.kjx-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.kjx-tabs {
  display: flex;
  gap: 28px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.kjx-tabs::-webkit-scrollbar { display: none; }
.kjx-tabs.is-empty { visibility: hidden; }

.kjx .kjx-tab {
  flex: none;
  position: relative;
  padding: 6px 0 10px;
  font-size: 14px;
  font-weight: 300;
  white-space: nowrap;
  color: var(--kjx-muted) !important;
  text-decoration: none !important;
}
.kjx .kjx-tab::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--kjx-ink);
  transform: scaleX(0);
  transition: transform .2s ease;
}
.kjx .kjx-tab:hover { color: var(--kjx-ink) !important; }
.kjx .kjx-tab.is-active {
  color: var(--kjx-ink) !important;
  font-weight: 500;
}
.kjx .kjx-tab.is-active::after { transform: scaleX(1); }

.kjx-tools {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding-bottom: 6px;
}
.kjx-tools__sep {
  width: 1px;
  height: 20px;
  background: var(--kjx-line);
}

.kjx-search,
.kjx-sort {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--kjx-ink);
  cursor: pointer;
}
.kjx .kjx-search input {
  width: 130px;
  height: 34px;
  margin: 0;
  padding: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-family: var(--kjx-font);
  font-size: 13px;
  font-weight: 300;
  color: var(--kjx-ink);
  transition: width .2s ease, border-color .2s ease;
}
.kjx .kjx-search input::placeholder { color: var(--kjx-muted); opacity: 1; }
.kjx .kjx-search input:focus,
.kjx .kjx-search input:not(:placeholder-shown) {
  width: 200px;
  border-bottom-color: var(--kjx-ink) !important;
  outline: none;
}

.kjx .kjx-sort select {
  appearance: none;
  -webkit-appearance: none;
  height: 34px;
  margin: 0;
  padding: 0 22px 0 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-family: var(--kjx-font);
  font-size: 13px;
  font-weight: 300;
  color: var(--kjx-muted);
  cursor: pointer;
}
.kjx.is-sorted .kjx-sort select { color: var(--kjx-ink); font-weight: 400; }
.kjx-sort .kjx-ico {
  position: absolute;
  right: 0;
  pointer-events: none;
}

.kjx-tools__apply {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--kjx-ink);
  background: var(--kjx-ink);
  color: #fff;
  font-size: 13px;
}

/* =========================================================
   Grille produits
   ========================================================= */
.kjx-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 36px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  transition: opacity .2s ease;
}
.kjx.is-loading .kjx-grid { opacity: .4; pointer-events: none; }

.kjx-card { margin: 0; min-width: 0; }

.kjx .kjx-card__link {
  display: block;
  color: var(--kjx-text) !important;
  text-decoration: none !important;
}

.kjx-card__media {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--kjx-tile);
}
.kjx .kjx-card__img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  padding: 0;
  object-fit: contain;
  mix-blend-mode: multiply; /* les photos sur fond blanc se fondent dans le gris */
  transition: transform .4s ease;
}
.kjx .kjx-card__link:hover .kjx-card__img { transform: scale(1.04); }

.kjx-card__cta {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: #fff;
  font-size: 12px;
  font-weight: 400;
  color: var(--kjx-ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .2s ease, transform .2s ease;
}
.kjx-card__link:hover .kjx-card__cta,
.kjx-card__link:focus-visible .kjx-card__cta {
  opacity: 1;
  transform: none;
}

.kjx-card__flag {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 4px 8px;
  background: #fff;
  font-size: 11px;
  color: var(--kjx-muted);
}
.kjx-card.is-out .kjx-card__img { opacity: .55; }

.kjx-card__name {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--kjx-ink);
}

.kjx-card__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  
  font-size: 13px;
  font-weight: 300;
  color: var(--kjx-text);
}
/* Prix promo d'abord, ancien prix barré ensuite (comme la maquette) */
.kjx .kjx-card__price ins { order: 1; text-decoration: none; background: none; }
.kjx .kjx-card__price del { order: 2; color: var(--kjx-muted); opacity: 1; font-size: 12px; }
.kjx .kjx-card__price .screen-reader-text { order: 3; }
/* l'ancien CSS colore et grossit tous les prix en bleu : on revient à la maquette */
body.kjx-archive .kjx .kjx-card__price .woocommerce-Price-amount,
body.kjx-archive .kjx .kjx-card__price bdi {
  color: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
}
body.kjx-archive .kjx .kjx-card__price del .woocommerce-Price-amount,
body.kjx-archive .kjx .kjx-card__price del bdi { color: var(--kjx-muted) !important; }

/* ---- Aucun résultat ---- */
.kjx-empty {
  grid-column: 1 / -1;
  padding: 64px 0;
  text-align: center;
  font-size: 15px;
  font-weight: 300;
}
.kjx-empty p { margin: 0 0 12px; }
.kjx .kjx-empty__link {
  color: var(--kjx-ink) !important;
  text-decoration: underline !important;
  text-underline-offset: 3px;
}

/* =========================================================
   Compteur + pagination
   ========================================================= */
.kjx-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--kjx-line);
}
.kjx-footer:empty { display: none; }

.kjx-count {
  margin: 0;
  font-size: 12px;
  font-weight: 300;
  color: var(--kjx-muted);
}

.kjx-pager {
  display: flex;
  align-items: center;
  gap: 4px;
}
.kjx .kjx-pager a,
.kjx-pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 6px;
  font-size: 13px;
  font-weight: 300;
  color: var(--kjx-text) !important;
  text-decoration: none !important;
}
.kjx .kjx-pager a:hover { background: var(--kjx-hover); }
.kjx-pager .is-active {
  background: var(--kjx-ink);
  color: #fff !important;
  font-weight: 500;
}
.kjx-pager .is-disabled { color: #c4c4c4 !important; }
.kjx-pager__step span,
.kjx-pager__step { font-size: 18px !important; }

/* ---- Description SEO de la catégorie ---- */
.kjx-desc {
  max-width: 72ch;
  margin-top: 64px;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.7;
  color: var(--kjx-muted);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1200px) {
  .kjx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .kjx-toolbar { flex-direction: column; align-items: stretch; gap: 14px; }
  .kjx-tabs.is-empty { display: none; }
  .kjx-tools { justify-content: space-between; border-bottom: 1px solid var(--kjx-line); padding-bottom: 0; }
  .kjx-search { flex: 1; }
  .kjx .kjx-search input,
  .kjx .kjx-search input:focus,
  .kjx .kjx-search input:not(:placeholder-shown) { width: 100%; border-bottom-color: transparent !important; }
}

@media (max-width: 921px) {
  body.kjx-archive.kjx-archive.kjx-archive .site-content > .ast-container { padding: 0 16px !important; }

  .kjx {
    grid-template-columns: minmax(0, 1fr);
    padding-top: calc(20px + var(--kjx-header-offset));
  }

  /* La sidebar devient une rangée de catégories défilante */
  .kjx-side {
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--kjx-line);
    padding: 0 0 12px;
    margin: 0 -16px 20px;
  }
  .kjx-side__title { display: none; }
  .kjx-side__list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 16px;
    scrollbar-width: none;
  }
  .kjx-side__list::-webkit-scrollbar { display: none; }
  .kjx-side__list li { flex: none; margin: 0; }
  .kjx .kjx-side__link {
    padding: 9px 14px;
    border: 1px solid var(--kjx-line);
    border-left-width: 1px;
    font-size: 13px;
    white-space: nowrap;
  }
  .kjx .kjx-side__link .kjx-ico { display: none; }
  .kjx .kjx-side__link.is-active {
    background: var(--kjx-ink);
    border-color: var(--kjx-ink);
    color: #fff !important;
  }

  .kjx .kjx-title { margin-bottom: 18px; }
  .kjx-card__cta { display: none; }
}

@media (max-width: 600px) {
  .kjx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 12px; }
  .kjx-card__name { font-size: 13px; }
  .kjx-footer { flex-direction: column-reverse; }
  .kjx-tabs { gap: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .kjx *, .kjx *::before, .kjx *::after { transition: none !important; }
}
