/*
 * Catalog Page — page-level chrome only.
 *
 * Every content pattern on the catalog (hero lockup, listing cards,
 * filter pills, search pill, responsive grid) is a shared component
 * under styles/components/*.css, loaded via spark-all.css. This file
 * holds only catalog-page chrome that isn't shared:
 *
 *   • .catalog-shell            — the outer container max-width
 *   • .sparks-icon-btn          — the search-toggle icon button
 *   • .sparks-empty / -loading  — empty-state + loading placeholders
 *   • .site-footer*             — site-level footer (distinct from
 *                                 .spark-footer used on Sparks)
 *
 * The Editorial font pairing for .catalog-shell (EB Garamond display
 * + Source Serif 4 body + Source Sans 3 UI, instead of Editorial's
 * default Cormorant Garamond + EB Garamond) lives in
 * styles/themes/editorial.css scoped to .catalog-shell so the theme
 * owns the decision. See build/design/components.md §Catalog surfaces
 * for the Principle 7 carve-out rationale.
 */

.catalog-shell {
  /* Wider than --content-max-width (960px) because the catalog is a
     grid of listing cards, not a reading column. 1200px fits a 3-up
     row at each card's design width. */
  max-width: 1200px; /* lint-allow: raw-maxwidth — catalog grid shell, deliberately wider than --content-max-width */
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md) var(--space-xl);
  color: var(--text-primary);
  position: relative;
}

/* ═══════════════════════════════════════
   CATALOG SORT — segmented control between filter pills and search.
   Two-option toggle (Source date / Spark date). Right-aligned on
   desktop; wraps under the filter pills on mobile. The segmented
   buttons re-use the chip-token system (--chip-border, --accent-*)
   so they stay theme-aware across Nebula and Editorial.
   ═══════════════════════════════════════ */
.catalog-sort {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  font-family: var(--font-ui);
}
.catalog-sort-label {
  font-size: var(--font-size-caption);
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}
.catalog-sort-segmented {
  display: inline-flex;
  border: 1px solid var(--chip-border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: transparent;
}
.catalog-sort-btn {
  /* Match .filter-pill geometry minus the outer border (the segmented
     wrapper carries the border instead). 5/14 pairs with caption font
     for visual parity with the category pills above. */
  padding: 5px 14px; /* lint-allow: raw-spacing — segmented control geometry */
  border: 0;
  background: transparent;
  color: var(--chip-text);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-ui);
  line-height: 1.2;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  position: relative;
}
.catalog-sort-btn + .catalog-sort-btn {
  border-left: 1px solid var(--chip-border);
}
.catalog-sort-btn:hover {
  color: var(--chip-text-hover);
  background: rgba(var(--accent-primary-rgb), 0.04);
}
.catalog-sort-btn.active {
  background: rgba(var(--accent-primary-rgb), 0.12);
  color: var(--accent-primary);
}
.catalog-sort-btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  z-index: 1;
}

/* Mobile: keep right-aligned but allow vertical stacking if the row
   becomes too tight. The segmented control itself never wraps —
   .catalog-sort-segmented is inline-flex, so the two buttons stay
   side-by-side, only the label drops above on very narrow screens. */
@media (max-width: 600px) {
  .catalog-sort {
    justify-content: space-between;
    margin-top: calc(-1 * var(--space-xs));
  }
  .catalog-sort-btn {
    padding: 6px 14px; /* lint-allow: raw-spacing — mobile hit-target tuning, mirrors .filter-pill */
  }
}

/* ═══════════════════════════════════════
   SEARCH-TOGGLE ICON BUTTON
   Page-level chrome that opens/closes the .search-pill below the
   hero. Invisible hit-target extension via ::before so the tap area
   reaches --hit-target-min without growing the visual button.
   ═══════════════════════════════════════ */
.sparks-icon-btn {
  background: none;
  border: 1px solid var(--chip-border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--chip-text);
  transition: all var(--transition-base);
  flex-shrink: 0;
  position: relative;
}
.sparks-icon-btn::before {
  content: '';
  position: absolute;
  inset: -6px; /* lint-allow: raw-spacing — invisible hit-target extension to 44x44 */
}
.sparks-icon-btn:hover,
.sparks-icon-btn.active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(var(--accent-primary-rgb), 0.08);
}
.sparks-icon-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  pointer-events: none;
}

/* ═══════════════════════════════════════
   CATEGORY ICONS — inline-SVG sprite glyphs (one per category) rendered
   in 3 surfaces: card thumb fallback, card category label, filter pill.
   Sprite <symbol> defs live at the top of site/index.html; <use> pulls
   them by id. Sized at 1em so they scale with the surrounding font-size
   ladder (compact / regular / large) without bespoke rules per surface.
   Stroke color resolves via currentColor — i.e. whatever --cat-<slug>
   the parent context sets cascades into the SVG automatically.
   See features/category-icons/SPEC.md.
   ═══════════════════════════════════════ */
.sparks-cat-icon {
  /* core/reset.css sets `svg { display: block }` so SVGs don't get
     a baseline gap. Re-flow the category icon inline so it sits beside
     the label instead of stacking above it. */
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════
   EMPTY & LOADING STATES — rendered inside the catalog .card-grid
   when there are no results or while data is loading.
   ═══════════════════════════════════════ */
.sparks-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  color: var(--chip-text);
}
.sparks-empty-icon {
  font-size: 48px; /* lint-allow: raw-px — empty-state emoji glyph, not text content */
  margin-bottom: var(--space-md);
  opacity: 0.4;
}
.sparks-loading {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--chip-text);
}

/* ═══════════════════════════════════════
   SITE FOOTER — single minimal line: © YYYY SparkReads · Privacy · Terms.
   Distinct from .spark-footer (used inside Sparks). Centered on every
   breakpoint; routes through theme tokens for cross-theme rendering.
   ═══════════════════════════════════════ */
.site-footer {
  margin-top: var(--space-2xl);
  padding: var(--space-lg) var(--space-md);
  border-top: 1px solid rgba(var(--accent-primary-rgb), 0.15);
  text-align: center;
  font-family: var(--font-ui);
  font-size: var(--font-size-caption);
  color: var(--text-tertiary);
}

.site-footer-inner {
  max-width: 1200px; /* lint-allow: raw-maxwidth — matches catalog grid shell */
  margin: 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-xs);
  flex-wrap: wrap;
  justify-content: center;
}

.site-footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.site-footer-link:hover {
  color: var(--accent-primary);
}

.site-footer-sep {
  color: var(--text-tertiary);
  opacity: 0.5;
  user-select: none;
}

.site-footer-copyright {
  color: var(--text-tertiary);
}
