/* ==========================================================================
   Bingo Daubers — Archive / listing template
   Loaded (after style.css + header.css + footer.css) on:
     /blog/, /category/*, /tag/*, /author/*, /search/
   Owns: views/archive.ejs (and the thin index.ejs / search.ejs wrappers).

   All accents route through --cat-accent. Flip that ONE line to re-theme
   the whole archive (e.g. to the violet used in the original mock).
   Tokens (--bd-*) come from header.css :root — never redefined here.
   ========================================================================== */

:root {
  --cat-accent:       var(--bd-pink);
  --cat-accent-hover: var(--bd-pink-hover);
  --cat-accent-soft:  var(--bd-pink-soft);
  --cat-thumb-bg:     #EEF0F4;
  --cat-row-hover:    #FAFBFC;
  --cat-chevron:      #C3C8D2;
}

/* --------------------------------------------------------------------------
   Page shell
   -------------------------------------------------------------------------- */
.cat-page {
  background: var(--bd-bg);
  padding: 28px 0 60px;
}
.cat-page *,
.cat-page *::before,
.cat-page *::after { box-sizing: border-box; }

.cat-page a:focus-visible,
.cat-page button:focus-visible,
.cat-page input:focus-visible,
.cat-page summary:focus-visible {
  outline: 2px solid var(--cat-accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   1. Hero — icon + H1 + description, promo card on the right
   -------------------------------------------------------------------------- */
.cat-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr);
  gap: 28px;
  align-items: center;
  margin-bottom: 28px;
}

.cat-hero-head {
  display: flex;
  align-items: center;
  gap: 16px;
}
.cat-hero-icon {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--cat-accent-soft);
  color: var(--cat-accent);
}
.cat-hero-icon svg { width: 26px; height: 26px; }

.cat-hero h1 {
  font-family: 'Poppins', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(1.875rem, 3.4vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--bd-ink);
  margin: 0;
}
.cat-hero-page {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--bd-muted);
  margin-top: 6px;
  font-family: 'Inter', system-ui, sans-serif;
}

.cat-hero-desc {
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--bd-body);
  max-width: 56ch;
  margin: 16px 0 0;
}

.cat-hero-links {
  margin: 14px 0 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--bd-muted);
}
.cat-hero-links a {
  color: var(--cat-accent);
  font-weight: 600;
  text-decoration: none;
}
.cat-hero-links a:hover { color: var(--cat-accent-hover); text-decoration: underline; }

/* --------------------------------------------------------------------------
   2. Promo card — real site search, no fake geolocation
   -------------------------------------------------------------------------- */
.cat-promo {
  position: relative;
  overflow: hidden;
  min-height: 178px;
  display: flex;
  align-items: center;
  padding: 26px 28px;
  border: 1px solid var(--cat-accent-soft);
  border-radius: var(--bd-radius);
  background:
    linear-gradient(120deg, var(--cat-accent-soft) 0%, #FFFFFF 78%);
  box-shadow: var(--bd-shadow);
}
.cat-promo-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 62%;
}
.cat-promo h2 {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--bd-ink);
  margin: 0 0 8px;
}
.cat-promo p {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--bd-body);
  margin: 0 0 16px;
}

.cat-promo-form {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bd-card);
  border: 1px solid var(--bd-line);
  border-radius: 999px;
  padding: 5px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
.cat-promo-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}
.cat-promo-field svg {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--cat-accent);
  pointer-events: none;
}
.cat-promo-field input {
  width: 100%;
  height: 44px;
  border: 0;
  background: transparent;
  padding: 0 12px 0 40px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--bd-ink);
  border-radius: 999px;
}
.cat-promo-field input::placeholder { color: var(--bd-muted); }
.cat-promo-field input:focus { outline: none; }
.cat-promo-form:focus-within {
  border-color: var(--cat-accent);
  box-shadow: 0 0 0 3px var(--cat-accent-soft);
}

.cat-promo-btn {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--cat-accent);
  color: #fff;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.cat-promo-btn:hover { background: var(--cat-accent-hover); }

.cat-promo-art {
  position: absolute;
  right: -12px;
  bottom: 0;
  width: 250px;
  max-width: 40%;
  pointer-events: none;
  z-index: 0;
}
.cat-promo-art img {
  width: 100%;
  height: auto;
  display: block;
  mix-blend-mode: multiply;
}

/* --------------------------------------------------------------------------
   3. Filter pills + result count
   -------------------------------------------------------------------------- */
.cat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.cat-filters {
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
}
.cat-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--bd-line);
  border-radius: 999px;
  background: var(--bd-card);
  color: var(--bd-ink);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.cat-pill svg { width: 16px; height: 16px; color: var(--bd-muted); flex: 0 0 auto; }
.cat-pill:hover { border-color: var(--cat-accent); color: var(--cat-accent); }
.cat-pill:hover svg { color: var(--cat-accent); }
.cat-pill.is-active {
  background: var(--cat-accent);
  border-color: var(--cat-accent);
  color: #fff;
  font-weight: 600;
}
.cat-pill.is-active svg { color: #fff; }

.cat-count {
  flex: 0 0 auto;
  margin: 0;
  font-size: 0.875rem;
  color: var(--bd-muted);
  white-space: nowrap;
}

/* Pillar cross-link */
.cat-pillar-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--bd-line);
  border-left: 3px solid var(--cat-accent);
  border-radius: var(--bd-radius-sm);
  background: var(--bd-card);
  font-size: 0.9375rem;
  color: var(--bd-body);
}
.cat-pillar-note svg { width: 18px; height: 18px; color: var(--cat-accent); flex: 0 0 auto; }
.cat-pillar-note a { color: var(--cat-accent); font-weight: 600; }
.cat-pillar-note a:hover { color: var(--cat-accent-hover); text-decoration: underline; }

/* --------------------------------------------------------------------------
   4. Two-column body
   -------------------------------------------------------------------------- */
.cat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
}
.cat-main { min-width: 0; }

/* --------------------------------------------------------------------------
   5. Article rows
   -------------------------------------------------------------------------- */
.cat-list {
  background: var(--bd-card);
  border: 1px solid var(--bd-line);
  border-radius: var(--bd-radius);
  box-shadow: var(--bd-shadow);
  overflow: hidden;
}

.cat-row {
  position: relative;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 26px;
  gap: 22px;
  align-items: center;
  padding: 18px 20px;
  transition: background-color 0.15s ease;
}
.cat-row + .cat-row { border-top: 1px solid var(--bd-line); }
.cat-row:hover { background: var(--cat-row-hover); }

.cat-row-media {
  width: 180px;
  aspect-ratio: 9 / 8;
  border-radius: 12px;
  overflow: hidden;
  background: var(--cat-thumb-bg);
  display: grid;
  place-items: center;
  color: #A9B0BD;
}
.cat-row-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cat-row-media svg { width: 34px; height: 34px; }

.cat-row-body { min-width: 0; }

.cat-kicker {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  margin: 0 0 9px;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--k-fg, var(--cat-accent));
  background: var(--k-bg, var(--cat-accent-soft));
}
/* Site-wide category colours (same values as home.css .kicker.is-*) */
.k-stores { --k-fg: #16A34A; --k-bg: #E7F6EC; }
.k-buying { --k-fg: #7C3AED; --k-bg: #F1EAFE; }
.k-tips   { --k-fg: #EA580C; --k-bg: #FDECE3; }
.k-safety { --k-fg: #DC2626; --k-bg: #FCE9E9; }
.k-diy    { --k-fg: #2563EB; --k-bg: #E6EEFD; }
.k-basics { --k-fg: #0891B2; --k-bg: #E2F4F8; }

.cat-row-title {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.34;
  letter-spacing: -0.01em;
  color: var(--bd-ink);
  margin: 0 0 8px;
}
.cat-row-title a {
  color: inherit;
  text-decoration: none;
}
/* Whole row is clickable, but the title stays the single real link. */
.cat-row-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.cat-row:hover .cat-row-title a { color: var(--cat-accent); }

.cat-row-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--bd-muted);
  margin: 0 0 12px;
}

.cat-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--bd-muted);
}
.cat-row-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cat-row-meta svg { width: 15px; height: 15px; flex: 0 0 auto; }

.cat-row-chevron {
  display: grid;
  place-items: center;
  color: var(--cat-chevron);
  transition: color 0.15s ease, transform 0.15s ease;
}
.cat-row-chevron svg { width: 20px; height: 20px; }
.cat-row:hover .cat-row-chevron {
  color: var(--cat-accent);
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   6. Empty state
   -------------------------------------------------------------------------- */
.cat-empty {
  background: var(--bd-card);
  border: 1px solid var(--bd-line);
  border-radius: var(--bd-radius);
  box-shadow: var(--bd-shadow);
  padding: 44px 28px;
  text-align: center;
}
.cat-empty-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cat-accent-soft);
  color: var(--cat-accent);
}
.cat-empty-icon svg { width: 28px; height: 28px; }
.cat-empty h2 {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--bd-ink);
  margin: 0 0 8px;
}
.cat-empty p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--bd-body);
  margin: 0 auto 20px;
  max-width: 48ch;
}
.cat-empty .cat-promo-form { max-width: 460px; margin: 0 auto 20px; }
.cat-empty-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* --------------------------------------------------------------------------
   7. Long-form archive intro (SEO prose, below the list)
   -------------------------------------------------------------------------- */
.cat-about {
  margin-top: 24px;
  padding: 24px 26px;
  background: var(--bd-card);
  border: 1px solid var(--bd-line);
  border-radius: var(--bd-radius);
  box-shadow: var(--bd-shadow);
}
.cat-about h2 {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--bd-ink);
  margin: 0 0 10px;
}
.cat-about p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--bd-body);
  margin: 0 0 12px;
}
.cat-about p:last-child { margin-bottom: 0; }
.cat-about a { color: var(--cat-accent); font-weight: 500; }
.cat-about a:hover { color: var(--cat-accent-hover); text-decoration: underline; }

/* Pagination partial keeps its own styling — just give it room. */
.cat-main .navigation.pagination { margin-top: 24px; }

/* --------------------------------------------------------------------------
   8. Sidebar
   -------------------------------------------------------------------------- */
.cat-rail {
  display: grid;
  gap: 20px;
  align-content: start;
  position: sticky;
  top: calc(var(--bd-header-h) + 16px);
}
/* category.js adds this when the rail is taller than the viewport. */
.cat-rail.is-unstuck { position: static; }

.cat-card {
  background: var(--bd-card);
  border: 1px solid var(--bd-line);
  border-radius: var(--bd-radius);
  box-shadow: var(--bd-shadow);
  padding: 20px;
}
.cat-card h2 {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--bd-ink);
  margin: 0 0 12px;
}

/* Popular topics */
.cat-topics { list-style: none; margin: 0; padding: 0; }
.cat-topics li + li { border-top: 1px solid var(--bd-line); }
.cat-topics a {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 4px;
  text-decoration: none;
  border-radius: var(--bd-radius-xs);
}
.cat-topic-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--k-fg, var(--cat-accent));
  background: var(--k-bg, var(--cat-accent-soft));
}
.cat-topic-icon svg { width: 18px; height: 18px; }
.cat-topic-name {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--bd-ink);
}
.cat-topics a:hover .cat-topic-name { color: var(--cat-accent); }
.cat-topic-count {
  display: block;
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--bd-muted);
}

/* Subscribe */
.cat-sub {
  text-align: center;
  border-color: var(--cat-accent-soft);
  background: linear-gradient(180deg, var(--cat-accent-soft) 0%, #FFFFFF 100%);
  padding: 24px 20px;
}
.cat-sub-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cat-accent);
  color: #fff;
}
.cat-sub-icon svg { width: 22px; height: 22px; }
.cat-sub h2 { margin-bottom: 8px; }
.cat-sub p {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--bd-body);
  margin: 0 0 16px;
}
.cat-sub-form { display: grid; gap: 10px; }
.cat-sub-form label { display: block; text-align: left; }
.cat-sub-form input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--bd-line);
  border-radius: var(--bd-radius-sm);
  background: #fff;
  font-family: inherit;
  font-size: 1rem;
  color: var(--bd-ink);
}
.cat-sub-form input:focus-visible {
  outline: 2px solid var(--cat-accent);
  outline-offset: 1px;
}
.cat-sub-btn {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: var(--bd-radius-sm);
  background: var(--cat-accent);
  color: #fff;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.cat-sub-btn:hover { background: var(--cat-accent-hover); }
.cat-sub-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 12px 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--bd-muted);
}
.cat-sub-hint svg { width: 13px; height: 13px; flex: 0 0 auto; }

/* Latest / trending list */
.cat-mini { list-style: none; margin: 0; padding: 0; }
.cat-mini li + li { border-top: 1px solid var(--bd-line); }
.cat-mini a {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 4px;
  text-decoration: none;
  border-radius: var(--bd-radius-xs);
}
.cat-mini img {
  width: 64px;
  height: 48px;
  border-radius: var(--bd-radius-xs);
  object-fit: cover;
  background: var(--cat-thumb-bg);
}
.cat-mini-thumb {
  width: 64px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: var(--bd-radius-xs);
  background: var(--cat-thumb-bg);
  color: #A9B0BD;
}
.cat-mini-thumb svg { width: 20px; height: 20px; }
.cat-mini-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--bd-ink);
}
.cat-mini a:hover .cat-mini-title { color: var(--cat-accent); }
.cat-mini-date {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--bd-muted);
}

/* Follow us */
.cat-follow p {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--bd-body);
  margin: 0 0 14px;
}
.cat-social { display: flex; gap: 10px; }
.cat-social a {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1877F2;
  color: #fff;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.cat-social a:hover { color: #fff; filter: brightness(1.08); transform: translateY(-2px); }
.cat-social svg { width: 21px; height: 21px; }

/* --------------------------------------------------------------------------
   9. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .cat-layout { grid-template-columns: minmax(0, 1fr); }
  .cat-rail {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .cat-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    align-items: start;
  }
  .cat-hero-desc { max-width: none; }
  .cat-promo-inner { max-width: 66%; }
  .cat-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .cat-count { text-align: left; }
  /* Pills become a single scrollable track instead of wrapping tall. */
  .cat-filter-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .cat-filters.has-overflow-end::after,
  .cat-filters.has-overflow-start::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 4px;
    width: 32px;
    pointer-events: none;
  }
  .cat-filters.has-overflow-end::after {
    right: 0;
    background: linear-gradient(90deg, rgba(247, 248, 250, 0) 0%, var(--bd-bg) 90%);
  }
  .cat-filters.has-overflow-start::before {
    left: 0;
    background: linear-gradient(270deg, rgba(247, 248, 250, 0) 0%, var(--bd-bg) 90%);
  }
}

@media (max-width: 760px) {
  .cat-promo-art { display: none; }
  .cat-promo-inner { max-width: 100%; }
}

@media (max-width: 700px) {
  .cat-rail { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .cat-page { padding: 20px 0 44px; }
  .cat-hero-icon { width: 48px; height: 48px; border-radius: 12px; }
  .cat-hero-icon svg { width: 22px; height: 22px; }
  .cat-hero-desc { font-size: 1rem; }
  .cat-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 18px 16px;
  }
  .cat-row-media {
    width: 100%;
    aspect-ratio: 16 / 9;
  }
  .cat-row-chevron { display: none; }
  .cat-list { border-radius: var(--bd-radius-sm); }
  .cat-about { padding: 20px 18px; }
}

@media (max-width: 480px) {
  .cat-promo { padding: 20px 18px; }
  .cat-promo-form {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    border-radius: var(--bd-radius-sm);
    padding: 8px;
  }
  .cat-promo-field input {
    border-radius: var(--bd-radius-xs);
    background: var(--bd-bg);
  }
  .cat-promo-btn { width: 100%; border-radius: var(--bd-radius-xs); }
}

/* --------------------------------------------------------------------------
   10. Motion preferences
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .cat-page *,
  .cat-page *::before,
  .cat-page *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .cat-row:hover .cat-row-chevron { transform: none; }
  .cat-social a:hover { transform: none; }
}
