/* ═════════════════════════════════════════════════════════════════
   Blog category archives — /category/*.

   Scoped via `.categories-preview` wrapper (see category_body() in
   _src/build.py). Loads only on slugs listed in PAGE_CSS_MAP, so
   nothing here leaks elsewhere.

   Design language MIRRORS public/css/pages/home.css 1:1 — same
   gradient, same eyebrow style, same CTA, same final-CTA editorial
   hierarchy. Tokens inherited from style.css :root.
   ═════════════════════════════════════════════════════════════════ */

/* Page-wide tonal wash — EXACT 10-stop gradient from home.css */
html,body{overflow-x:clip;max-width:100vw}
body:has(.categories-preview){
  background:linear-gradient(
    180deg,
    #fbf4f5   0%,
    #fdfaf8  10%,
    #fdf8f1  22%,
    #fbf9f4  36%,
    #faf5f3  52%,
    #fbf6f2  65%,
    #fbf7f2  78%,
    #faf8f3  88%,
    #fbf6ed  95%,
    #fbf4f5 100%
  );
}

.categories-preview{
  font-family:var(--sans);
  color:var(--ink);
  font-size:16px;line-height:1.65;
  max-width:1180px;
  margin:0 auto;
  padding:2rem 2rem 4rem;
  background:transparent;
}

/* ─── Eyebrow — EXACT match to homepage */
/* Category eyebrow — navy text + gold leading hairline to match the
   Terms-of-Service editorial theme used across the site. */
.categories-preview .bmb-eyebrow{
  font-family:var(--sans);font-size:.82rem;font-weight:700;
  letter-spacing:.22em;text-transform:uppercase;color:var(--navy);
  display:inline-flex;align-items:center;gap:14px;margin:0;
}
.categories-preview .bmb-eyebrow::before{
  content:"";width:36px;height:1px;background:var(--gold);
}

/* ─── Hero ─────────────────────────────────────────────────────── */
.categories-preview .bmb-categories-hero{
  text-align:center;
  padding:3.5rem 1rem 2.5rem;
  max-width:780px;
  margin:0 auto;
}
.categories-preview .bmb-categories-hero .bmb-eyebrow{
  justify-content:center;margin-bottom:1.4rem;
}
.categories-preview .bmb-categories-hero h1{
  font-family:var(--serif);
  font-weight:500;
  font-size:clamp(2.2rem, 5vw, 3.4rem);
  line-height:1.12;
  letter-spacing:-.015em;
  color:var(--ink);
  margin:0 0 1.4rem;
}
.categories-preview .bmb-categories-lead{
  font-family:var(--sans);
  font-size:1rem;
  line-height:1.7;
  color:var(--muted);
  margin:0 auto;
  max-width:62ch;
}

/* ─── Post grid — image-dominant editorial cards.
   Default is 3 columns so any count of cards (5, 7, 8+, including
   pregnancy-care with 7) wraps as rows of 3. Specific tiny counts
   get a forced narrower layout via :has() so they don't read as a
   half-empty row:
     - 3 cards → single row of 3 (matches default)
     - 4 cards → 2×2 grid (not 3+1 with an orphan)
   The :has() rules sit AFTER the default so they win on cascade. */
.categories-preview .bmb-post-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 360px));
  justify-content:center;
  gap:1.2rem;
  margin:0 auto;
  padding:0;
}
/* Exactly 4 cards — force a 2-column grid so they wrap as 2 × 2
   instead of 3+1 with an orphan in row 2. */
.categories-preview .bmb-post-grid:has(.bmb-post-card:nth-child(4):last-child){
  grid-template-columns:repeat(2, minmax(280px, 360px));
  max-width:760px;
}
/* Exactly 2 cards (Prenatal Massages, Postnatal Massage, Baby Massage)
   — force a centered 2-column grid so the cards sit visually centred
   instead of filling columns 1+2 of the default 3-up track and leaving
   an empty column on the right. */
.categories-preview .bmb-post-grid:has(.bmb-post-card:nth-child(2):last-child){
  grid-template-columns:repeat(2, minmax(280px, 360px));
  max-width:760px;
}
/* Exactly 1 card — single centered column. */
.categories-preview .bmb-post-grid:has(.bmb-post-card:first-child:last-child){
  grid-template-columns:minmax(280px, 360px);
  max-width:380px;
}

.categories-preview .bmb-post-card{
  position:relative;
  display:flex;
  flex-direction:column;
  background:var(--surface);
  border:none;
  border-radius:var(--r-lg);
  overflow:hidden;
  box-shadow:var(--shadow-sm);
  transition:transform .3s cubic-bezier(.2,.7,.3,1), box-shadow .3s ease;
  will-change:transform;
}
/* Override style.css's `.post-card > h3 {padding: 0 1.25rem}` etc. with
   the scoped padding for the new design. h3 / p / cta are direct
   children of <article> (flat DOM, see post_card() in build.py). */
.categories-preview .bmb-post-card > .bmb-post-card-date,
.categories-preview .bmb-post-card > h3,
.categories-preview .bmb-post-card > .bmb-post-card-excerpt{
  padding:0 1.4rem;margin:0;
}
.categories-preview .bmb-post-card > .bmb-post-card-date{padding-top:1.4rem}
.categories-preview .bmb-post-card > h3{padding-top:.6rem;padding-bottom:.6rem}
.categories-preview .bmb-post-card > .bmb-post-card-cta{
  margin:auto 0 0;padding:.5rem 1.4rem 1.5rem;
}
.categories-preview .bmb-post-card:hover{
  transform:translateY(-4px);
  box-shadow:0 10px 26px rgba(120,80,90,.10), 0 30px 60px rgba(120,80,90,.08);
}

.categories-preview .bmb-post-card-img{
  display:block;
  position:relative;
  aspect-ratio:3/2;
  overflow:hidden;
  background:linear-gradient(135deg, var(--brand-50), var(--brand-100));
}
.categories-preview .bmb-post-card-img img{
  width:100%;height:100%;object-fit:cover;display:block;
  transition:transform .55s cubic-bezier(.2,.7,.3,1);
}
.categories-preview .bmb-post-card:hover .bmb-post-card-img img{
  transform:scale(1.05);
}
.categories-preview .bmb-post-card-img--empty{position:relative}
.categories-preview .bmb-post-card-img--empty::after{
  content:"BMB";
  position:absolute;inset:0;
  display:flex;align-items:center;justify-content:center;
  font-family:var(--serif);font-size:2.4rem;font-weight:500;
  color:var(--brand-200);letter-spacing:.02em;
}

.categories-preview .bmb-post-card-body{
  padding:1.4rem 1.4rem 1.6rem;
  display:flex;flex-direction:column;gap:.6rem;
  flex:1;
}
.categories-preview .bmb-post-card-date{
  font-family:var(--sans);font-size:.74rem;font-weight:600;
  letter-spacing:.12em;text-transform:uppercase;color:var(--muted);
  margin:0;
}
.categories-preview .bmb-post-card h3{
  font-family:var(--serif);
  font-weight:500;
  font-size:1.35rem;
  line-height:1.25;
  letter-spacing:-.005em;
  margin:0;
  color:var(--ink);
}
.categories-preview .bmb-post-card h3 a{
  color:inherit;text-decoration:none;
}
.categories-preview .bmb-post-card h3 a:hover{color:var(--brand-dk)}
.categories-preview .bmb-post-card-excerpt{
  font-family:var(--sans);
  font-size:.92rem;
  line-height:1.6;
  color:var(--ink-2);
  margin:0;
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.categories-preview .bmb-post-card-cta{
  display:inline-flex;align-items:center;gap:.35rem;
  margin:auto 0 0;padding:.5rem 0 0;
  background:none;border:none;
  font-family:var(--sans);font-size:.88rem;font-weight:500;
  color:var(--brand-dk);text-decoration:none;letter-spacing:.005em;
  align-self:flex-start;
}
.categories-preview .bmb-post-card-cta span{
  display:inline-block;transition:transform .25s ease;
}
.categories-preview .bmb-post-card:hover .bmb-post-card-cta span{
  transform:translateX(4px);
}

/* ─── Final CTA — homepage's flipped editorial hierarchy ──────── */
.categories-preview .bmb-categories-final-cta{
  text-align:center;
  padding:4.5rem 1rem 3rem;
  max-width:640px;
  margin:3rem auto 0;
}
.categories-preview .bmb-categories-final-cta .bmb-eyebrow{
  justify-content:center;
  margin-bottom:1.25rem;
  font-size:clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight:700;
  letter-spacing:.22em;
  gap:0;
  color:var(--navy);
}
/* Hide the leading mini-rule on big section-head eyebrows so the text
   centres properly — matches homepage's home.css treatment. */
.categories-preview .bmb-categories-final-cta .bmb-eyebrow::before{
  display:none;
}
.categories-preview .bmb-categories-final-cta h2{
  font-family:var(--sans);
  font-size:clamp(1rem, 1.3vw, 1.22rem);
  font-weight:400;
  color:var(--muted);
  line-height:1.5;
  margin:0 0 1rem;
  letter-spacing:0;
}
.categories-preview .bmb-categories-final-cta p{
  font-family:var(--sans);font-size:1rem;line-height:1.7;color:var(--muted);
  margin:0 auto 1.8rem;max-width:52ch;
}
.categories-preview .bmb-categories-ctas{
  display:flex;gap:.7rem;justify-content:center;flex-wrap:wrap;
}

/* ─── CTAs — EXACT homepage style ─────────────────────────────── */
.categories-preview .bmb-cta{
  display:inline-flex;align-items:center;gap:.5rem;
  font-family: var(--sans);
  font-size:1.05rem;font-weight:500;
  letter-spacing:.005em;padding:.7rem 1.5rem;border-radius:999px;
  text-decoration:none;
  transition:transform .15s ease, box-shadow .15s ease, background .15s, color .15s, border-color .15s;
  white-space:nowrap;
}
.categories-preview .bmb-cta--primary{
  background:var(--brand);color:#fff;box-shadow:var(--shadow-sm);
}
.categories-preview .bmb-cta--primary:hover{
  background:var(--brand-dk);transform:translateY(-1px);box-shadow:var(--shadow);
}
.categories-preview .bmb-cta--ghost{
  background:transparent;color:var(--ink);border:1px solid var(--line-rose);
}
.categories-preview .bmb-cta--ghost:hover{
  border-color:var(--brand);color:var(--brand-dk);
}

/* ── Mobile ───────────────────────────────────────────────────── */
@media (max-width:720px){
  .categories-preview{padding:1.4rem 1rem 3rem}
  .categories-preview .bmb-categories-hero{padding:2.4rem .5rem 1.8rem}
  .categories-preview .bmb-post-grid{grid-template-columns:1fr;gap:1.2rem}
  .categories-preview .bmb-categories-final-cta{padding:3rem .5rem 2rem}
}
