/* Sober AF -- Sponsors: saf_sponsor single-template chrome (S-06).
 *
 * The Tier-D hybrid front end does NOT enqueue the dormant `sober-af`
 * theme's components.css, so the `.saf-sponsor-*` markup emitted by
 * sober-af-sponsors/includes/class-saf-sponsors-single.php renders
 * unstyled unless this plugin ships the CSS. Enqueued on
 * is_singular('saf_sponsor'). Tokens resolve from tokens.css (enqueued
 * globally by the child theme). See memory: tier-d-old-theme-css-not-enqueued.
 *
 * No bare `.saf-btn` here ON PURPOSE -- the outbound CTA uses the
 * self-named `.saf-sponsor-visit` class so it can never leak onto the
 * global JTC footer "Say hi" <button> (which is also class="saf-btn").
 * See memory: per-cpt-css-saf-btn-footer-leak.
 */

/* ------------------------------------------------------------------ *
 * GAP 1 -- [saf_sponsor_logo]: the logo box leading the body-left
 * column. Featured image is letterboxed (object-fit:contain) inside a
 * square card; the monogram fallback fills the same box.
 * ------------------------------------------------------------------ */

.saf-sponsor-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 240px;
  aspect-ratio: 1 / 1;
  margin-bottom: var(--saf-gap-4);
  padding: var(--saf-gap-4);
  /* Linen tint (not bare white) so the box reads as a deliberate logo
   * tile rather than an unstyled void when the monogram fallback shows. */
  background: var(--saf-linen);
  border: 1px solid var(--saf-border);
  border-radius: 12px;
  overflow: hidden;
}

.saf-sponsor-logo__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.saf-sponsor-logo__monogram {
  font-family: var(--saf-font-sans);
  font-size: 6rem;
  font-weight: 700;
  line-height: 1;
  /* Brand brick rather than OLD's near-invisible grey-on-grey -- the
   * monogram reads as a deliberate logo placeholder. Decorative
   * (aria-hidden), so it carries no contrast requirement. */
  color: var(--saf-brick-red);
}

/* ------------------------------------------------------------------ *
 * GAP 2 -- [saf_sponsor_visit]: the outbound website CTA in the
 * sidebar. Ghost button (charcoal outline, fills on hover) ported from
 * the OLD theme's `.saf-btn--ghost`.
 * ------------------------------------------------------------------ */

.saf-sponsor-visit {
  display: inline-flex;
  align-items: center;
  gap: var(--saf-gap-2);
  min-height: 44px; /* improvement over OLD: WCAG 2.5.5 touch target */
  margin-top: var(--saf-gap-2);
  padding: 0.6rem 1.4rem;
  background: transparent;
  color: var(--saf-charcoal);
  font-family: var(--saf-font-sans);
  font-weight: 700;
  font-size: var(--saf-text-base);
  text-decoration: none;
  border: 2px solid var(--saf-charcoal);
  border-radius: var(--saf-radius-pill);
  transition:
    background var(--saf-transition),
    color var(--saf-transition),
    transform var(--saf-transition);
}

.saf-sponsor-visit:hover,
.saf-sponsor-visit:focus-visible {
  background: var(--saf-charcoal);
  color: var(--saf-linen);
  transform: translateY(-1px);
}

/* ------------------------------------------------------------------ *
 * /sponsors/ directory page (S-13) -- hide empty tier sections.
 *
 * The seed renders all 5 tier sections (Platinum / Gold / Silver /
 * Bronze / Community) regardless of whether any sponsor currently lives
 * in that tier. That choice keeps the section structure stable for the
 * count-shortcode + admin readability ("which tiers are empty?"). On
 * the PUBLIC page we hide tier sections whose listing grid is empty so
 * visitors do not see "0 partners / No partners in this tier yet."
 *
 * Uses :has() (Chrome 105+, Safari 15.4+, Firefox 121+ -- ~95% global
 * coverage). Older browsers see the existing "0 partners" honest text.
 * ------------------------------------------------------------------ */

section[id^="tier-"]:has(.jet-listing-not-found),
.elementor-section[id^="tier-"]:has(.jet-listing-not-found) {
  display: none !important;
}
