/* === NAHIBU CATEGORY / ARCHIVE === */

/* ─── HERO ─── */
.nh-cat-hero {
  padding: var(--s-11) 0 var(--s-7);
  background: var(--nh-paper);
}
.nh-cat-hero-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-10);
  align-items: center;
  padding: var(--s-7) 0;
}
.nh-cat-hero-text {
  min-width: 0;
}

/* Eyebrow numéroté (01 / Science) — un seul visible via body class WP */
.nh-cat-eyebrow {
  display: none;
  font: 500 14px/1 var(--nh-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--nh-ink-3);
  margin-bottom: var(--s-4);
}
body.category-science      .nh-cat-eyebrow-science      { display: inline-block; color: var(--nh-science-ink); }
body.category-alimentation .nh-cat-eyebrow-alimentation { display: inline-block; color: var(--nh-alimentation-ink); }
body.category-recettes     .nh-cat-eyebrow-recettes     { display: inline-block; color: var(--nh-recettes-ink); }
body.category-life-style   .nh-cat-eyebrow-lifestyle    { display: inline-block; color: var(--nh-lifestyle-ink); }
body.category-sante        .nh-cat-eyebrow-sante        { display: inline-block; color: var(--nh-sante-ink); }
body.category-nahibu       .nh-cat-eyebrow-nahibu       { display: inline-block; color: var(--nh-nahibu-ink); }

/* Titre H1 (rempli par PHP filter, single H1 propre) */
.nh-cat-hero-title {
  font-family: var(--nh-serif);
  font-size: clamp(36px, 4.5vw, 56px);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.025em;
  margin: 0 0 var(--s-5);
  color: var(--nh-ink);
  text-wrap: balance;
}
.nh-cat-hero-title span { font-style: normal; }

/* Description (term-description WP) */
.nh-cat-hero-sub,
.nh-cat-hero-sub p {
  font: 400 18px/1.55 var(--nh-sans);
  color: var(--nh-ink-2);
  max-width: 620px;
  text-wrap: pretty;
  margin: 0;
}

/* Trait coloré sous l'intro */
.nh-cat-hero-rule {
  border: none;
  height: 3px;
  width: 80px;
  margin: var(--s-7) 0 0;
  background: var(--nh-cyan-700);
  border-radius: 3px;
}
body.category-science      .nh-cat-hero-rule { background: var(--nh-science); }
body.category-alimentation .nh-cat-hero-rule { background: var(--nh-alimentation); }
body.category-recettes     .nh-cat-hero-rule { background: var(--nh-recettes); }
body.category-life-style   .nh-cat-hero-rule { background: var(--nh-lifestyle); }
body.category-sante        .nh-cat-hero-rule { background: var(--nh-sante); }
body.category-nahibu       .nh-cat-hero-rule { background: var(--nh-nahibu); }

/* Glyph circulaire 120px — fond cat-soft + stroke cat-color */
.nh-cat-hero-glyph {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--nh-cyan-50);
  color: var(--nh-cyan-700);
  transition: transform var(--t-slow) var(--ease-spring);
}
.nh-cat-hero-glyph:hover { transform: scale(1.05) rotate(-4deg); }

/* SVG masqués par défaut, on n'affiche que celui qui matche la body class */
.nh-cat-hero-glyph svg {
  width: 56px;
  height: 56px;
  display: none;
}
/* Display SVG : matche soit body.category-X (page catégorie native)
   soit body[data-source-cat="X"] (page tag avec cat source trackée en JS). */
body.category-science            .nh-cat-hero-glyph .nh-glyph-science,
body[data-source-cat="science"]  .nh-cat-hero-glyph .nh-glyph-science      { display: block; }
body.category-alimentation            .nh-cat-hero-glyph .nh-glyph-alimentation,
body[data-source-cat="alimentation"]  .nh-cat-hero-glyph .nh-glyph-alimentation { display: block; }
body.category-recettes            .nh-cat-hero-glyph .nh-glyph-recettes,
body[data-source-cat="recettes"]  .nh-cat-hero-glyph .nh-glyph-recettes     { display: block; }
body.category-life-style          .nh-cat-hero-glyph .nh-glyph-lifestyle,
body[data-source-cat="life-style"] .nh-cat-hero-glyph .nh-glyph-lifestyle   { display: block; }
body.category-sante               .nh-cat-hero-glyph .nh-glyph-sante,
body[data-source-cat="sante"]     .nh-cat-hero-glyph .nh-glyph-sante        { display: block; }
body.category-nahibu              .nh-cat-hero-glyph .nh-glyph-nahibu,
body[data-source-cat="nahibu"]    .nh-cat-hero-glyph .nh-glyph-nahibu       { display: block; }

/* Couleur par cat : fond soft + stroke saturé (light mode) */
body.category-science            .nh-cat-hero-glyph,
body[data-source-cat="science"]  .nh-cat-hero-glyph { background: var(--nh-science-soft);      color: var(--nh-science); }
body.category-alimentation           .nh-cat-hero-glyph,
body[data-source-cat="alimentation"] .nh-cat-hero-glyph { background: var(--nh-alimentation-soft); color: var(--nh-alimentation); }
body.category-recettes           .nh-cat-hero-glyph,
body[data-source-cat="recettes"] .nh-cat-hero-glyph { background: var(--nh-recettes-soft);     color: var(--nh-recettes); }
body.category-life-style          .nh-cat-hero-glyph,
body[data-source-cat="life-style"] .nh-cat-hero-glyph { background: var(--nh-lifestyle-soft);    color: var(--nh-lifestyle); }
body.category-sante           .nh-cat-hero-glyph,
body[data-source-cat="sante"] .nh-cat-hero-glyph { background: var(--nh-sante-soft);        color: var(--nh-sante); }
body.category-nahibu           .nh-cat-hero-glyph,
body[data-source-cat="nahibu"] .nh-cat-hero-glyph { background: var(--nh-nahibu-soft);       color: var(--nh-nahibu); }

/* DARK MODE : fond très subtil blanc translucide, stroke garde la couleur cat (saturée) → contraste assuré */
[data-theme="dark"] .nh-cat-hero-glyph,
[data-theme="dark"] body.category-science      .nh-cat-hero-glyph,
[data-theme="dark"] body.category-alimentation .nh-cat-hero-glyph,
[data-theme="dark"] body.category-recettes     .nh-cat-hero-glyph,
[data-theme="dark"] body.category-life-style   .nh-cat-hero-glyph,
[data-theme="dark"] body.category-sante        .nh-cat-hero-glyph,
[data-theme="dark"] body.category-nahibu       .nh-cat-hero-glyph {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ─── MOTS-CLÉS (top 8 tags par cat, pills FILLED) ─── */
.nh-cat-keywords-section {
  background: var(--nh-paper);
  padding: 0 0 var(--s-7);
}
.nh-cat-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
  padding: var(--s-5) 0;
  border-top: 1px solid var(--nh-line);
}
.nh-cat-keywords-label {
  font: 500 12px/1 var(--nh-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--nh-ink-3);
  margin-right: var(--s-2);
}

/* Pill FILLED par défaut (cat-soft + cat-color visible tout le temps) */
.nh-keyword-pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  font: 500 13px/1 var(--nh-sans);
  letter-spacing: 0.005em;
  color: var(--nh-lifestyle-ink); /* WCAG AA fallback for "Tous les articles" or untyped cat */
  background: var(--nh-cyan-50);
  border-radius: var(--r-pill);
  text-decoration: none;
  transition: transform var(--t-fast) var(--ease-spring),
              filter var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out);
  white-space: nowrap;
}
.nh-keyword-pill:hover {
  transform: translateY(-1px);
  filter: brightness(0.96) saturate(1.1);
  box-shadow: 0 4px 12px -4px rgba(20, 34, 74, 0.14);
}

/* Couleur par catégorie : fond cat-soft + texte cat-color (toujours visible) */
body.category-science      .nh-keyword-pill { background: var(--nh-science-soft);      color: var(--nh-science-ink); }
body.category-alimentation .nh-keyword-pill { background: var(--nh-alimentation-soft); color: var(--nh-alimentation-ink); }
body.category-recettes     .nh-keyword-pill { background: var(--nh-recettes-soft);     color: var(--nh-recettes-ink); }
body.category-life-style   .nh-keyword-pill { background: var(--nh-lifestyle-soft);    color: var(--nh-lifestyle-ink); }
body.category-sante        .nh-keyword-pill { background: var(--nh-sante-soft);        color: var(--nh-sante-ink); }
body.category-nahibu       .nh-keyword-pill { background: var(--nh-nahibu-soft);       color: var(--nh-nahibu-ink); }

/* Dark mode : fond rgba blanc translucide, texte garde la couleur cat saturée */
[data-theme="dark"] .nh-keyword-pill {
  background: rgba(255, 255, 255, 0.08);
  color: var(--nh-cyan-500);
}
[data-theme="dark"] body.category-science      .nh-keyword-pill { color: var(--nh-science); }
[data-theme="dark"] body.category-alimentation .nh-keyword-pill { color: var(--nh-alimentation); }
[data-theme="dark"] body.category-recettes     .nh-keyword-pill { color: var(--nh-recettes); }
[data-theme="dark"] body.category-life-style   .nh-keyword-pill { color: var(--nh-cyan-500); }
[data-theme="dark"] body.category-sante        .nh-keyword-pill { color: var(--nh-sante); }
[data-theme="dark"] body.category-nahibu       .nh-keyword-pill { color: var(--nh-cyan-500); }
[data-theme="dark"] .nh-keyword-pill:hover {
  background: rgba(255, 255, 255, 0.14);
  filter: none;
}

/* Mobile : keywords scrollables si débordement */
@media (max-width: 560px) {
  .nh-cat-keywords {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: var(--s-4);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nh-cat-keywords::-webkit-scrollbar { display: none; }
  .nh-cat-keywords-label,
  .nh-keyword-pill { flex-shrink: 0; }
}

/* ─── ONGLETS DE TRI (Récents · Populaires · Audio) ─── */
.nh-cat-tabs {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 var(--s-7);
  padding: 0 0 var(--s-4);
  border-bottom: 1px solid var(--nh-line);
}
.nh-cat-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 var(--s-4);
  font: 500 14px/1 var(--nh-sans);
  letter-spacing: 0.005em;
  color: var(--nh-ink-2);
  background: transparent;
  border: 1px solid var(--nh-line);
  border-radius: var(--r-pill);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out);
  white-space: nowrap;
}
.nh-cat-tab-count {
  font: 500 12px/1 var(--nh-mono);
  color: var(--nh-ink-3);
  background: var(--nh-paper-2);
  padding: 4px 7px;
  border-radius: var(--r-pill);
  min-width: 22px;
  text-align: center;
}
.nh-cat-tab:hover {
  background: var(--nh-paper-2);
  color: var(--nh-ink);
  border-color: var(--nh-line-strong);
}
.nh-cat-tab.is-active {
  background: var(--nh-cyan-50);
  color: var(--nh-lifestyle-ink); /* WCAG AA: #076578 on #ecf8fc = 5.5:1 (was cyan-700 = 3.37:1) */
  border-color: transparent;
  font-weight: 600;
}
.nh-cat-tab.is-active .nh-cat-tab-count {
  background: rgba(255, 255, 255, 0.55);
  color: var(--nh-lifestyle-ink);
}
.nh-cat-tab.is-disabled {
  opacity: 0.42;
  pointer-events: none;
  cursor: not-allowed;
}

/* Couleur de l'actif par catégorie */
body.category-science      .nh-cat-tab.is-active { background: var(--nh-science-soft);      color: var(--nh-science-ink); }
body.category-alimentation .nh-cat-tab.is-active { background: var(--nh-alimentation-soft); color: var(--nh-alimentation-ink); }
body.category-recettes     .nh-cat-tab.is-active { background: var(--nh-recettes-soft);     color: var(--nh-recettes-ink); }
body.category-life-style   .nh-cat-tab.is-active { background: var(--nh-lifestyle-soft);    color: var(--nh-lifestyle-ink); }
body.category-sante        .nh-cat-tab.is-active { background: var(--nh-sante-soft);        color: var(--nh-sante-ink); }
body.category-nahibu       .nh-cat-tab.is-active { background: var(--nh-nahibu-soft);       color: var(--nh-nahibu-ink); }

body.category-science      .nh-cat-tab.is-active .nh-cat-tab-count { color: var(--nh-science-ink); }
body.category-alimentation .nh-cat-tab.is-active .nh-cat-tab-count { color: var(--nh-alimentation-ink); }
body.category-recettes     .nh-cat-tab.is-active .nh-cat-tab-count { color: var(--nh-recettes-ink); }
body.category-life-style   .nh-cat-tab.is-active .nh-cat-tab-count { color: var(--nh-lifestyle-ink); }
body.category-sante        .nh-cat-tab.is-active .nh-cat-tab-count { color: var(--nh-sante-ink); }
body.category-nahibu       .nh-cat-tab.is-active .nh-cat-tab-count { color: var(--nh-nahibu-ink); }

/* Dark mode */
[data-theme="dark"] .nh-cat-tab {
  border-color: rgba(255, 255, 255, 0.10);
  color: var(--nh-ink-2);
}
[data-theme="dark"] .nh-cat-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--nh-ink);
  border-color: rgba(255, 255, 255, 0.18);
}
[data-theme="dark"] .nh-cat-tab.is-active {
  background: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .nh-cat-tab-count {
  background: rgba(255, 255, 255, 0.06);
  color: var(--nh-ink-3);
}
[data-theme="dark"] .nh-cat-tab.is-active .nh-cat-tab-count {
  background: rgba(0, 0, 0, 0.30);
}

/* ─── TOPIC ROW ─── */
.nh-topic-row {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
  padding: var(--s-6) 0;
  border-top: 1px solid var(--nh-line);
}

/* ─── TOOLBAR ─── */
.nh-cat-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s-6);
  margin-top: var(--s-2);
}

/* ─── SEARCH ─── */
.nh-search-hero {
  padding: var(--s-11) 0 var(--s-7);
  text-align: center;
}
.nh-search-hero h1 { margin-bottom: var(--s-6); }

/* Cible le wp:search Gutenberg block (classes wp-block-search__*) */
.nh-search-form { max-width: 560px; margin: 0 auto; }
.nh-search-form .wp-block-search__inside-wrapper {
  display: flex;
  gap: var(--s-3);
  border: 0;
  padding: 0;
  background: transparent;
}
.nh-search-form .wp-block-search__input {
  flex: 1;
  height: 52px;
  padding: 0 var(--s-6);
  border: 1px solid var(--nh-line);
  border-radius: var(--r-pill);
  background: var(--nh-white);
  font: 400 16px/1 var(--nh-sans); /* ≥16px = anti-zoom iOS */
  color: var(--nh-ink);
  transition: border-color var(--t-fast) var(--ease-out);
  min-width: 0; /* évite l'overflow flex */
}
.nh-search-form .wp-block-search__input:focus {
  outline: none;
  border-color: var(--nh-cyan-600);
  box-shadow: 0 0 0 3px rgba(11, 174, 212, .15);
}
.nh-search-form .wp-block-search__input::placeholder { color: var(--nh-ink-4); }

.nh-search-form .wp-block-search__button {
  height: 52px;
  padding: 0 var(--s-6);
  border-radius: var(--r-pill);
  border: 0;
  background: var(--nh-cyan-600);
  color: #fff;
  font: 600 14px/1 var(--nh-sans);
  letter-spacing: .02em;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
  white-space: nowrap;
}
.nh-search-form .wp-block-search__button:hover {
  background: var(--nh-cyan-700);
  transform: translateY(-1px);
}
.nh-search-form .wp-block-search__button:focus-visible {
  outline: 2px solid var(--nh-cyan-700);
  outline-offset: 2px;
}

/* Hide visually the screen-reader label (déjà géré par .screen-reader-text WP) */
.nh-search-form .wp-block-search__label { /* no override needed */ }

/* ─── MOBILE (≤880px). Desktop unchanged. ─── */
@media (max-width: 880px) {
  /* Hero: 80/32 → 32/24 vertical */
  .nh-cat-hero { padding: var(--s-7) 0 var(--s-6); }
  .nh-cat-hero-inner {
    grid-template-columns: 1fr;
    gap: var(--s-5);
    padding: var(--s-5) 0;
  }
  .nh-cat-hero-glyph {
    width: 72px;
    height: 72px;
    order: -1; /* glyph en haut sur mobile */
    justify-self: start;
  }
  .nh-cat-hero-glyph svg { width: 36px; height: 36px; }
  .nh-cat-hero-rule { margin: var(--s-5) 0 0; }
  .nh-cat-eyebrow { font-size: 12px; margin-bottom: var(--s-3); }
  .nh-cat-hero-sub,
  .nh-cat-hero-sub p { font-size: 16px; line-height: 1.55; }

  .nh-cat-toolbar { flex-direction: column; align-items: flex-start; gap: var(--s-3); }
  .nh-cat-tabs { gap: 6px; margin-bottom: var(--s-6); padding-left: var(--s-5); padding-right: var(--s-5); }
  .nh-cat-tab { height: 36px; padding: 0 var(--s-3); font-size: 13px; }

  /* Search hero */
  .nh-search-hero { padding: var(--s-8) var(--s-5) var(--s-6); }
  .nh-search-form .wp-block-search__inside-wrapper { gap: var(--s-2); }
  .nh-search-form .wp-block-search__input { height: 48px; padding: 0 var(--s-5); font-size: 16px; }
  .nh-search-form .wp-block-search__button { height: 48px; padding: 0 var(--s-5); font-size: 13px; min-width: 88px; }
}

@media (max-width: 430px) {
  /* iPhone SE : stack input + bouton pour confort tactile */
  .nh-search-form .wp-block-search__inside-wrapper { flex-direction: column; }
  .nh-search-form .wp-block-search__button { width: 100%; }
}

@media (max-width: 560px) {
  .nh-cat-hero { padding: var(--s-6) 0 var(--s-5); }
  .nh-cat-hero-glyph { width: 64px; height: 64px; }
  .nh-cat-hero-glyph svg { width: 32px; height: 32px; }
}
