/*
 * Financial Assistance & Care Funding, subpage 5 (Resource Directory, Local
 * Resources & Downloads): the directory and county cards, the downloadable
 * library and the sources table (templates/sections/funding-directory.php,
 * funding-local.php, funding-downloads.php and funding-sources.php). The
 * shared funding pieces are in funding.css.
 */

/* ---- Cards: the button sits at the foot, so a row's buttons line up ---- */
.sn-funding-resource,
.sn-funding-library__card {
  display: flex;
  flex-direction: column;
}

.sn-funding-resource > .sn-actions,
.sn-funding-library__card > .sn-actions {
  margin-block-start: auto;
  padding-block-start: 0.75rem;
}

/* A web address shown as text under its name (as on the mockup). */
.sn-funding-url {
  display: block;
  margin-block-start: 0.25rem;
  color: var(--sn-muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

/* Stand-alone links (a card's web address, "Find Services In My County"). */
.sn-funding-resource__url a,
.sn-funding-references__link a {
  display: inline-flex;
  align-items: center;
  min-block-size: 3rem;
  color: var(--sn-navy);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.sn-funding-resource__url {
  margin-block-end: 0;
}

/* ---- Greater Sacramento county blocks ---------------------------------- */
.sn-funding-local .sn-note {
  margin-block: 0;
}

.sn-funding-county__org a {
  color: var(--sn-navy);
  font-weight: 700;
}

/* ---- Downloadable library ---------------------------------------------- */
.sn-funding-library__label {
  margin-block-end: 0;
}

.sn-funding-library__label + .sn-list {
  margin-block: 0.25rem 0.75rem;
}

.sn-funding-library__index {
  margin-block-start: 1.5rem;
}

/* .sn-btn is a flex box, so the space before "(PDF)" collapses; restore it. */
.sn-funding-library__card .sn-btn .sn-doc__type {
  margin-inline-start: 0.35em;
}

/* ---- Sources & References table ---------------------------------------- */
/* Long names and web addresses wrap (site.css keeps cells on one line). */
.sn-funding-source-table td:not(:first-child),
.sn-funding-source-table th:not(:first-child) {
  white-space: normal;
}

.sn-funding-source-table tbody th {
  color: var(--sn-navy);
  font-weight: 700;
}

.sn-funding-source-table a {
  display: inline-flex;
  align-items: center;
  min-block-size: 3rem;
  color: var(--sn-navy);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sn-funding-references .sn-table-wrap + .sn-grid {
  margin-block-start: 2rem;
}

/* Phones: the table becomes stacked blocks (one row per block) so nothing
   scrolls sideways. The header row is visually hidden (still read by screen
   readers) and each cell shows its column name from data-label instead (the
   pattern in catalog.css). */
@media (max-width: 767.98px) {
  .sn-funding-source-table thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .sn-funding-source-table,
  .sn-funding-source-table tbody,
  .sn-funding-source-table tr,
  .sn-funding-source-table th,
  .sn-funding-source-table td {
    display: block;
    inline-size: 100%;
    box-sizing: border-box;
  }

  .sn-funding-source-table tr {
    padding-block: 0.75rem;
    padding-inline: 1rem;
    border-block-end: 1px solid var(--sn-gold-line);
    background: var(--sn-card);
  }

  .sn-funding-source-table tr:nth-child(even) {
    background: var(--sn-bg);
  }

  /* The parent theme stripes odd rows' cells; on phones the row is the card. */
  .sn-funding-source-table tbody > tr:nth-child(n) > th,
  .sn-funding-source-table tbody > tr:nth-child(n) > td {
    background: transparent;
  }

  .sn-funding-source-table th,
  .sn-funding-source-table td {
    padding-block: 0.15rem;
    padding-inline: 0;
    border: 0;
    background: transparent;
    white-space: normal;
  }

  .sn-funding-source-table td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--sn-navy);
    font-weight: 600;
  }
}
