/* ==================================================================
   MooseFS — Blog tag-cloud styles (sectioned, collapsible, sticky band)
   Layered on top of blog-index.css.
   ================================================================== */

/* Section wrapper */
.mfs-tc {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 40px 0;
}


/* ==================================================================
   Collapsible tag cloud
   Default: collapsed. Shows a toggle header + an inline "Popular" row
   (1 line of top tags). Selected tags pin to the top whenever any are
   active. Click the header to expand into the full grouped grid.
   ================================================================== */

/* --- chip primitive (shared by collapsed + expanded views) --- */
.mfs-tc-v2 .mfs-tc-tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px;
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  color: var(--navy-800);
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; transition: all .12s ease;
  text-decoration: none; white-space: nowrap;
}
.mfs-tc-v2 .mfs-tc-tag:hover { border-color: var(--navy-400); }
.mfs-tc-v2 .mfs-tc-tag.is-on {
  background: var(--brand-burgundy);
  border-color: var(--brand-burgundy);
  color: #fff;
}
.mfs-tc-v2 .mfs-tc-tag-count {
  font-size: 11.5px; color: var(--fg-subtle); font-variant-numeric: tabular-nums;
}
.mfs-tc-v2 .mfs-tc-tag.is-on .mfs-tc-tag-count { color: rgba(255,255,255,.7); }

/* removable chip (the dynamic ones in the "Selected" row): same .is-on
   look but with a small × indicator on the right. */
.mfs-tc-v2 .mfs-tc-tag-removable {
  padding-right: 7px;
  font-family: inherit;
}
.mfs-tc-v2 .mfs-tc-tag-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px;
  font-size: 14px; line-height: 1;
  opacity: 0.75;
  margin-left: 2px;
}
.mfs-tc-v2 .mfs-tc-tag-removable:hover .mfs-tc-tag-x { opacity: 1; }

/* --- header (the clickable title + chevron) --- */
.mfs-tc-v2 .mfs-tc-toggle {
  display: flex; align-items: center; gap: 12px;
  background: none; border: 0; padding: 0;
  color: inherit; font: inherit;
  cursor: pointer; text-align: left;
  margin: 0;
}
.mfs-tc-v2 .mfs-tc-toggle h2 {
  margin: 0;
  font-family: var(--font-display); font-weight: 300;
  font-size: 26px; line-height: 1.1; color: var(--navy-900);
}
.mfs-tc-v2 .mfs-tc-toggle-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #fff; border: 1px solid var(--border);
  color: var(--navy-700);
  transition: transform .2s var(--ease-out), border-color .15s ease, color .15s ease;
}
.mfs-tc-v2 .mfs-tc-toggle:hover .mfs-tc-toggle-icon {
  border-color: var(--navy-400); color: var(--navy-900);
}
.mfs-tc-v2.is-expanded .mfs-tc-toggle-icon { transform: rotate(180deg); }

/* --- a row that pairs a label + tags + optional trailing action --- */
.mfs-tc-v2 .mfs-tc-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 24px;
  align-items: center;
  margin-top: 16px;
}
.mfs-tc-v2 .mfs-tc-row[hidden] { display: none; }
.mfs-tc-v2 .mfs-tc-row-label {
  font-family: var(--font-sans); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--fg-muted);
  align-self: center;
}
.mfs-tc-v2 .mfs-tc-row-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.mfs-tc-v2 .mfs-tc-row-tags--single-line {
  /* exactly one row of chips; the rest overflow off-screen */
  max-height: 28px; /* chip height */
  overflow: hidden;
}
.mfs-tc-v2 .mfs-tc-row-clear {
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  color: var(--brand-burgundy);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.mfs-tc-v2 .mfs-tc-row-clear:hover { text-decoration: underline; text-underline-offset: 3px; }
.mfs-tc-v2 .mfs-tc-row-clear[hidden] { display: none; }

/* --- full sectioned grid (expanded only) --- */
.mfs-tc-v2 .mfs-tc-sections {
  display: none;  /* hidden by default */
  gap: 14px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.mfs-tc-v2.is-expanded .mfs-tc-sections { display: grid; }
.mfs-tc-v2.is-expanded .mfs-tc-popular-row { display: none; }

.mfs-tc-v2 .mfs-tc-section {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 24px;
  align-items: start;
}
.mfs-tc-v2 .mfs-tc-section-label {
  font-family: var(--font-sans); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--fg-muted);
  padding-top: 7px;
}
.mfs-tc-v2 .mfs-tc-section-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
}

/* --- page-level: hide the page hero, tighten top spacing --- */
.mfs-tc-v2-page .mfs-bi-pagehero { display: none; }
.mfs-tc-v2-page main { padding-top: 40px; }

/* --- spacing between toggle header and the sticky band --- */
.mfs-tc-v2 .mfs-tc-toggle { margin-bottom: 16px; }

/* --- sticky band: full-bleed wrapper that holds the active-filter rows.
       Position (fixed when stuck) is managed entirely by JS because the band
       lives inside a short <section> — CSS sticky would stop working as soon
       as that section scrolls off the viewport. --- */
.mfs-tc-v2 .mfs-tc-sticky-band {
  z-index: 4;
  background: var(--bg-subtle);
  transition: box-shadow .15s ease;
}
.mfs-tc-v2 .mfs-tc-sticky-band > .container {
  position: relative;
  padding-top: 0; padding-bottom: 0;
  transition: padding .18s var(--ease-out);
}

/* tighten inter-row spacing inside the band */
.mfs-tc-v2 .mfs-tc-sticky-band .mfs-tc-row { margin-top: 0; }
.mfs-tc-v2 .mfs-tc-sticky-band .mfs-tc-row + .mfs-tc-row { margin-top: 8px; }

/* stuck state — toggled by JS via getBoundingClientRect().top */
.mfs-tc-v2 .mfs-tc-sticky-band.is-stuck { box-shadow: var(--shadow-md); min-height: 52px; }
.mfs-tc-v2 .mfs-tc-sticky-band.is-stuck > .container {
  padding-top: 12px; padding-bottom: 12px;
}
.mfs-tc-v2 .mfs-tc-sticky-band .mfs-tc-row-label {
  transition: opacity .18s ease;
}
/* "Popular" label stays visible in both scroll states per design guidelines */
.mfs-tc-v2 .mfs-tc-sticky-band.is-stuck .mfs-tc-row {
  padding-right: 48px;  /* leave space for the floating chevron */
}

/* --- floating chevron — only visible when the band is stuck --- */
.mfs-tc-v2 .mfs-tc-floating-chevron {
  display: none;
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  align-items: center; justify-content: center;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--navy-700);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.mfs-tc-v2 .mfs-tc-floating-chevron:hover {
  border-color: var(--navy-400); color: var(--navy-900);
}
.mfs-tc-v2 .mfs-tc-floating-chevron > svg {
  transition: transform .2s var(--ease-out);
}
.mfs-tc-v2 .mfs-tc-sticky-band.is-stuck .mfs-tc-floating-chevron {
  display: inline-flex;
}
.mfs-tc-v2.is-expanded .mfs-tc-floating-chevron > svg {
  transform: rotate(180deg);
}


/* ==================================================================
   RESPONSIVE
   ================================================================== */
@media (max-width: 960px) {
  .mfs-tc { padding: 28px 0; }

  /* stack section label above its row; tighten collapsible rows */
  .mfs-tc-v2 .mfs-tc-section { grid-template-columns: 1fr; gap: 8px; }
  .mfs-tc-v2 .mfs-tc-section-label { padding-top: 0; }
  .mfs-tc-v2 .mfs-tc-row { grid-template-columns: 80px 1fr; gap: 12px; }
  .mfs-tc-v2 .mfs-tc-row-clear { grid-column: 2; justify-self: start; }

  /* Sticky band top is now dynamic via --filterbar-height CSS variable (set by JS).
     Floating chevron is disabled at <=600px (handled below). */
}

@media (max-width: 600px) {
  .mfs-tc { padding: 22px 0; }

  /* On mobile the JS skips fixing the band (accordion handles filtering instead). */
  .mfs-tc-v2 .mfs-tc-sticky-band { box-shadow: none !important; }
  .mfs-tc-v2 .mfs-tc-sticky-band > .container { padding-top: 0; padding-bottom: 0; }
  .mfs-tc-v2 .mfs-tc-floating-chevron { display: none !important; }
  .mfs-tc-v2 .mfs-tc-sticky-band .mfs-tc-row-label { opacity: 1 !important; }
  .mfs-tc-v2 .mfs-tc-sticky-band .mfs-tc-row { padding-right: 0 !important; }
}
