/* 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;
  grid-template-columns: 1.5fr 1fr 1fr auto;
  gap: var(--saf-gap-3);
  align-items: end;
}

@media (max-width: 900px) {
  .saf-directory__filters-row {
    grid-template-columns: 1fr 1fr;
  }
  .saf-directory__filters-row > .saf-directory__submit {
    grid-column: 1 / -1;
  }
}

.saf-directory__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--saf-gap-5);
}

.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;
}

.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__visit:hover,
.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;
}

/* ------------------------------------------------------------------ *
 * 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;
}
