/* Resource Center styles — layered on theme base. */

.saf-directory__filters {
  background: #fff;
  border: 1px solid var(--saf-border);
  border-radius: var(--saf-radius);
  padding: var(--saf-gap-4);
  margin-bottom: var(--saf-gap-6);
}

.saf-directory__filters-row {
  display: grid;
  /* P2+P3 (session 9): grew from 3 selects + search to 8 fields (search, category,
   * region, the 3 B-i(c) facets: service/fee/language, + P3's near-ZIP/radius)
   * once the facet bar was wired onto the live page -- auto-fill keeps each
   * field a sane min-width instead of the old fixed 4-column fr split squeezing
   * 8 fields into it. */
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--saf-gap-3);
  align-items: end;
}

.saf-directory__filters-row > .saf-directory__submit {
  grid-column: 1 / -1;
  justify-self: start;
}

@media (max-width: 600px) {
  .saf-directory__filters-row {
    grid-template-columns: 1fr;
  }
}

.saf-directory__grid {
  display: grid;
  /* P2 (session 9): matches the 3/2/1 breakpoint the prior JetEngine Listing
   * Grid (template 4244, columns/columns_tablet/columns_mobile) used on the
   * live /resources/ page, instead of an unconstrained minmax(280px,1fr)
   * auto-fill (which rendered 4-up at 1440 -- a visual-parity delta). */
  grid-template-columns: repeat(3, 1fr);
  gap: var(--saf-gap-5);
}

@media (max-width: 1024px) {
  .saf-directory__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .saf-directory__grid {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------ *
 * P2 (session 9): [saf_resource_directory] card style, matched to the
 * card look the JetEngine Listing Grid (template 4244) rendered on the
 * live /resources/ page before the swap -- white card, 14px radius,
 * soft drop shadow, 20px title / 14px muted excerpt / 13px brick-red
 * link (computed live via Playwright before the swap, session-9 P2).
 * The tag row + phone/email/web/address meta list are a documented
 * improvement over the prior JetEngine card (which showed neither).
 * ------------------------------------------------------------------ */

.saf-card--resource {
  display: block;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 16px 0 rgba(28, 23, 16, 0.06);
  padding: var(--saf-gap-5);
  transition: transform 0.25s, box-shadow 0.25s;
}

.saf-card--resource:hover,
.saf-card--resource:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px -16px rgba(28, 23, 16, 0.18);
}

.saf-card--resource .saf-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--saf-gap-3);
}

.saf-card--resource .saf-card__title {
  margin: 0 0 var(--saf-gap-3);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--saf-charcoal);
}

.saf-card--resource .saf-card__title a {
  color: inherit;
  text-decoration: none;
}

.saf-card--resource .saf-card__title a:hover,
.saf-card--resource .saf-card__title a:focus-visible {
  text-decoration: underline;
}

.saf-card--resource .saf-card__body {
  margin: 0;
  font-size: var(--saf-text-sm);
  color: #5a554e;
  line-height: 1.5;
}

.saf-card--resource .saf-card__meta {
  list-style: none;
  padding: 0;
  margin: var(--saf-gap-3) 0 0;
  display: grid;
  gap: 4px;
  font-size: var(--saf-text-sm);
}

.saf-card--resource .saf-card__meta a {
  color: var(--saf-brick-red);
  font-weight: 600;
  text-decoration: none;
}

.saf-card--resource .saf-card__meta a:hover,
.saf-card--resource .saf-card__meta a:focus-visible {
  text-decoration: underline;
}

.saf-card--resource .saf-card__cta {
  margin: var(--saf-gap-3) 0 0;
}

.saf-card--resource .saf-card__cta a {
  color: var(--saf-brick-red);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.saf-card--resource .saf-card__cta a:hover,
.saf-card--resource .saf-card__cta a:focus-visible {
  text-decoration: underline;
}

/* P3 (session 9): ZIP-centroid "near me" search -- the per-card distance
 * pill + the "Clear ZIP search" link shown once a `near` filter is active. */
.saf-tag--distance {
  background: var(--saf-goldenrod);
  color: var(--saf-charcoal);
}

.saf-directory__clear-near {
  margin-left: var(--saf-gap-3);
  color: var(--saf-denim);
  font-size: var(--saf-text-sm);
  font-weight: 600;
  text-decoration: underline;
}

.saf-directory__pagination {
  margin-top: var(--saf-gap-6);
  display: flex;
  gap: var(--saf-gap-2);
  justify-content: center;
  flex-wrap: wrap;
}
.saf-directory__pagination .page-numbers {
  padding: 8px 14px;
  border-radius: var(--saf-radius);
  border: 1px solid var(--saf-border);
  color: inherit;
  text-decoration: none;
}
.saf-directory__pagination .page-numbers.current {
  background: var(--saf-brick-red);
  color: var(--saf-linen);
  border-color: var(--saf-brick-red);
}

/* ------------------------------------------------------------------ *
 * S-05: [saf_request_resource_form] form chrome + .saf-btn.
 *
 * The Tier-D hybrid front end does NOT enqueue the dormant `sober-af`
 * theme's components.css / design-extras.css, so the request form's
 * `.saf-form*` markup renders unstyled on both the request-a-resource
 * page AND the JTC `resource` single (where the form arrives via the
 * sidebar shortcode widget). These rules port the OLD components.css
 * form vocabulary + the vetted Tier-D `.saf-btn` (events.css) so the
 * form is brand-correct wherever resources.css loads. Tokens resolve
 * from tokens.css (enqueued globally by the child theme).
 * See memory: tier-d-old-theme-css-not-enqueued.
 * ------------------------------------------------------------------ */

.saf-form {
  display: grid;
  gap: var(--saf-gap-4);
}

.saf-form__field {
  display: grid;
  gap: var(--saf-gap-2);
}

.saf-form label {
  font-weight: 700;
  font-size: var(--saf-text-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.saf-form input[type="text"],
.saf-form input[type="email"],
.saf-form input[type="tel"],
.saf-form input[type="url"],
.saf-form input[type="number"],
.saf-form input[type="date"],
.saf-form input[type="time"],
.saf-form select,
.saf-form textarea {
  display: block;
  width: 100%;
  min-height: 44px; /* improvement over OLD: WCAG 2.5.5 touch target */
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--saf-border);
  border-radius: var(--saf-radius);
  background: #fff;
  font: inherit;
  font-size: 1rem; /* improvement over OLD: prevents iOS focus-zoom < 16px */
  color: inherit;
  transition:
    border-color var(--saf-transition),
    box-shadow var(--saf-transition);
}

.saf-form input:focus,
.saf-form select:focus,
.saf-form textarea:focus {
  outline: none;
  border-color: var(--saf-brick-red);
  box-shadow: 0 0 0 3px rgba(190, 39, 39, 0.15);
}

.saf-form textarea {
  min-height: 140px;
  resize: vertical;
}

/* Consent row: checkbox + label baseline-align without an inline style. */
.saf-form__field--checkbox label {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  text-transform: none;
  font-weight: 500;
  letter-spacing: 0;
  font-size: var(--saf-text-sm);
}

.saf-form__help {
  font-size: var(--saf-text-sm);
  color: var(--saf-fg-muted);
}

.saf-form__error {
  color: var(--saf-brick-red);
  font-size: var(--saf-text-sm);
  font-weight: 700;
}

.saf-form__notice {
  padding: var(--saf-gap-4);
  border-radius: var(--saf-radius);
  font-weight: 500;
}
.saf-form__notice--success {
  background: #e4f2ea;
  color: var(--saf-emerald);
  border-left: 4px solid var(--saf-emerald);
}
.saf-form__notice--error {
  background: #fbe6e6;
  color: var(--saf-brick-red);
  border-left: 4px solid var(--saf-brick-red);
}

/* Brand pill button for the request form submit -- vetted Tier-D port.
 * SCOPED to `.saf-form .saf-btn` ON PURPOSE: a bare `.saf-btn` here
 * leaks onto the GLOBAL JTC footer's "Say hi" newsletter <button>
 * (also class="saf-btn") on every page resources.css loads, changing
 * the footer height (min-height/padding the Elementor kit doesn't set)
 * -> page-height drift -> visual-diff size-mismatch. Per Rule 3 a
 * per-CPT stylesheet must never restyle global chrome. The submit is a
 * real <button> beaten by the kit `button` rule (0,1,1); `.saf-form
 * .saf-btn` (0,2,0) reclaims the pill for JUST the form, leaving the
 * footer/header buttons on their global styling. */
.saf-form .saf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--saf-gap-2);
  min-height: 44px; /* WCAG 2.5.5 touch target */
  padding: 0.75rem 1.5rem;
  background: var(--saf-brick-red);
  color: var(--saf-linen);
  font-family: var(--saf-font-sans);
  font-weight: 700;
  font-size: var(--saf-text-base);
  text-decoration: none;
  border: 2px solid var(--saf-brick-red);
  border-radius: var(--saf-radius-pill);
  cursor: pointer;
  transition:
    background var(--saf-transition),
    color var(--saf-transition),
    transform var(--saf-transition);
}

.saf-form .saf-btn:hover,
.saf-form .saf-btn:focus-visible {
  background: var(--saf-burgundy);
  border-color: var(--saf-burgundy);
  color: var(--saf-linen);
  transform: translateY(-1px);
}

.saf-form .saf-btn--secondary {
  background: transparent;
  color: var(--saf-brick-red);
}

.saf-form .saf-btn--secondary:hover,
.saf-form .saf-btn--secondary:focus-visible {
  background: var(--saf-brick-red);
  color: var(--saf-linen);
}

/* ------------------------------------------------------------------ *
 * S-05b: [saf_resource_contact] -- the "How to reach them" panel.
 * Sits at the top of the resource single body (body_lead_shortcode).
 * Self-contained `.saf-resource-contact*` classes -- no `.saf-card` /
 * `.saf-btn` dependency, no global-chrome leak.
 * ------------------------------------------------------------------ */

.saf-resource-contact {
  background: #fff;
  border: 1px solid var(--saf-border);
  border-left: 4px solid var(--saf-brick-red);
  border-radius: var(--saf-radius);
  padding: var(--saf-gap-5);
  margin-bottom: var(--saf-gap-6);
}

.saf-resource-contact__title {
  margin: 0 0 var(--saf-gap-3);
  font-size: var(--saf-text-sm);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--saf-brick-red);
}

.saf-resource-contact__list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px var(--saf-gap-4);
  margin: 0;
}

.saf-resource-contact__list dt {
  font-weight: 700;
  font-size: var(--saf-text-sm);
  color: var(--saf-fg-muted);
}

.saf-resource-contact__list dd {
  margin: 0;
  font-size: var(--saf-text-base);
}

.saf-resource-contact__list dd a {
  color: var(--saf-brick-red);
  text-decoration: underline;
}

.saf-resource-contact__list dd a:hover,
.saf-resource-contact__list dd a:focus-visible {
  color: var(--saf-burgundy);
}

.saf-resource-contact__url a {
  overflow-wrap: anywhere;
}

/* The compound `.saf-resource-contact a.saf-resource-contact__visit` selector
 * (0,2,1) outranks the Elementor global kit link-color rule
 * (`.elementor-kit-NNNN a`, 0,1,1) — without it the kit's red link color wins
 * over `color: var(--saf-linen)`, rendering red text on the brick-red button
 * (invisible label + WCAG contrast fail). See memory elementor-kit-button-
 * specificity / elementor-kit-button-cascade-leak. */
.saf-resource-contact a.saf-resource-contact__visit {
  display: inline-flex;
  align-items: center;
  gap: var(--saf-gap-2);
  min-height: 44px; /* WCAG 2.5.5 touch target */
  margin-top: var(--saf-gap-4);
  padding: 0.6rem 1.4rem;
  background: var(--saf-brick-red);
  color: var(--saf-linen);
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--saf-radius-pill);
  transition:
    background var(--saf-transition),
    transform var(--saf-transition);
}

.saf-resource-contact a.saf-resource-contact__visit:hover,
.saf-resource-contact a.saf-resource-contact__visit:focus-visible {
  background: var(--saf-burgundy);
  color: var(--saf-linen);
  transform: translateY(-1px);
}

/* ------------------------------------------------------------------ *
 * S-05b: [saf_resource_related] -- same-category resource cards.
 * Full-width section appended after the body (after_section_shortcode).
 * ------------------------------------------------------------------ */

.saf-resource-related {
  max-width: 1100px;
  margin: 0 auto;
}

.saf-resource-related__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--saf-gap-3);
  margin-bottom: var(--saf-gap-5);
}

.saf-resource-related__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--saf-fg);
}

.saf-resource-related__all {
  font-weight: 700;
  font-size: var(--saf-text-sm);
  color: var(--saf-brick-red);
  text-decoration: none;
}

.saf-resource-related__all:hover,
.saf-resource-related__all:focus-visible {
  text-decoration: underline;
}

.saf-resource-related__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  /* auto-fit (not auto-fill) so 1-2 same-category siblings never leave
   * an empty trailing track; cap card width so a thin strip does not
   * balloon. */
  grid-template-columns: repeat(auto-fit, minmax(260px, 348px));
  justify-content: center;
  gap: var(--saf-gap-5);
}

.saf-resource-related__card {
  display: flex;
}

.saf-resource-related__card-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: var(--saf-gap-4);
  background: #fff;
  border: 1px solid var(--saf-border);
  border-radius: var(--saf-radius);
  text-decoration: none;
  color: inherit;
  transition:
    border-color var(--saf-transition),
    box-shadow var(--saf-transition),
    transform var(--saf-transition);
}

.saf-resource-related__card-link:hover,
.saf-resource-related__card-link:focus-visible {
  border-color: var(--saf-brick-red);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.saf-resource-related__card-cat {
  font-size: var(--saf-text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--saf-brick-red);
}

.saf-resource-related__card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--saf-fg);
}

.saf-resource-related__card-excerpt {
  font-size: var(--saf-text-sm);
  color: var(--saf-fg-muted);
  line-height: 1.5;
  /* Clamp to a fixed 3 lines so every card is the SAME height regardless of
   * excerpt length. This makes the grid rows uniform (equal-height cards, a
   * visual-parity win) AND makes the section's total height deterministic: the
   * related block is a random 3-of-N same-category pick (orderby=rand), so a
   * variable excerpt height would otherwise make the whole page taller/shorter
   * between captures and trip the visual-diff page-height (size) gate. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* 3 lines * 1.5 line-height at --saf-text-sm — reserve the space even when the
   * excerpt is short so short-excerpt cards match tall ones exactly. */
  min-height: calc(1.5em * 3);
}

/* ------------------------------------------------------------------ *
 * S-11: [saf_resource_category_chips] -- decorative chip row in the
 * /resources/ landing hero. Self-scoped under `.saf-rsrc-chips` (NOT
 * the generic `.saf-chip`) so the chips cannot leak into other
 * surfaces. Renders the `resource_category` taxonomy terms so the row
 * stays in sync when an admin adds/removes a category.
 * ------------------------------------------------------------------ */

.saf-rsrc-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.saf-rsrc-chips__item {
  display: inline-flex;
}

.saf-rsrc-chips__chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: rgba(28, 23, 16, 0.06);
  color: var(--saf-charcoal, #1c1710);
  border-radius: var(--saf-radius-pill, 9999px);
  font-family: var(--saf-font-sans, "Helvetica Neue", sans-serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

/* Resource single: contact/description (left) + request-form (right) render as a
   legacy Elementor Section (id 1a58dae) whose two columns stretch to equal height,
   leaving a ~500px blank void below the shorter left column on desktop/tablet.
   Legacy Sections expose no native "don't stretch columns" control, so un-stretch
   the section's flex container here (Rule-5 CSS fallback). Mobile stacks (single
   column) so scope to >=768px. Coupling: 1a58dae is the JTC single-resource
   section id (post 4245); re-derive if that template is rebuilt. session 15. */
@media (min-width: 768px) {
  body.single-resource .elementor-element-1a58dae > .elementor-container {
    align-items: flex-start;
  }
}
