/**
 * @file
 * Our Resources section (dark band with 4 category cards).
 *
 * Interactive states on .sml-resources__card (Figma Cards / Homepage Cards):
 *   Static  — white background, drop shadow.
 *   Hover   — gray background, no shadow; linked title is purple + underlined
 *             while the body copy stays normal black with no underline.
 *   Focus   — 3 px solid black inset outline via :focus-within (keyboard).
 *   Clicked — 3 px solid black inset outline via :active.
 *
 * The title link stretches across the card BODY only (not the media). That
 * keeps Drupal contextual pencils on the image hoverable and clickable.
 */

.sml-resources .sml-section__title {
  margin-bottom: 3.5rem;
}

.sml-resources__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 303px), 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sml-resources__card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--sml-black);
  border: 0;
  border-radius: 10px;
  background: var(--sml-white);
  --sml-resources-gradient-color: var(--sml-orange);
  box-shadow: 0 4px 12.5px rgba(0, 0, 0, 0.25);
}

/* Hover: gray fill, no shadow. */
.sml-resources__card:hover {
  background: var(--sml-gray);
  box-shadow: none;
}

.sml-resources__card:hover .sml-resources__body {
  background: var(--sml-gray);
}

.sml-resources__link {
  text-decoration: none;
  color: inherit;
}

a.sml-resources__link {
  cursor: pointer;
}

/*
 * Stretch across the body only. Positioning against .sml-resources__body keeps
 * the hit area off the media so contextual pencils remain usable.
 */
a.sml-resources__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.sml-resources__card .contextual,
.sml-resources__card [data-contextual-id] {
  z-index: 10;
}

/* The card link is a wrapper, not a text link, so the global a:hover /
   a:focus color and underline must not reach the body copy. */
.sml-resources__link:hover,
.sml-resources__link:focus,
.sml-resources__link:focus-visible,
.sml-resources__link:active {
  text-decoration: none;
  color: inherit;
}

.sml-resources__card:hover .sml-resources__title a.sml-resources__link {
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--sml-purple);
}

/* Focus (keyboard) and clicked (:active): white + 3 px black inset outline. */
.sml-resources__card:focus-within,
.sml-resources__card:active {
  outline: 3px solid var(--sml-black);
  outline-offset: -3px;
  background: var(--sml-white);
  box-shadow: 0 4px 12.5px rgba(0, 0, 0, 0.25);
}

.sml-resources__card:focus-within .sml-resources__body,
.sml-resources__card:active .sml-resources__body {
  background: var(--sml-white);
}

/* Card outline is the focus ring; hide nested link outlines. */
.sml-resources__card a:focus,
.sml-resources__card a:focus-visible {
  outline: none;
}

.sml-resources__media {
  position: relative;
  z-index: 2;
  display: block;
  height: 175px;
  overflow: visible;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(135deg, var(--sml-gray-mid) 0%, var(--sml-near-black) 100%);
}

/* Clip the image only so contextual pencils/menus are not cut off. */
.sml-resources__media .field,
.sml-resources__media .field__item {
  overflow: hidden;
  border-radius: inherit;
  height: 100%;
}

.sml-resources__media .media {
  height: 100%;
}

.sml-resources__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sml-resources__card--vertical_alt .sml-resources__media {
  height: auto;
}

.sml-resources__card--vertical_alt .sml-resources__media img {
  height: auto;
  object-fit: initial;
}

.sml-resources__body {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 1rem;
  background: var(--sml-white);
  border-radius: 0 0 10px 10px;
}

.sml-resources__accent {
  width: 100%;
  height: 3px;
  flex: 0 0 3px;
  margin: 0;
  border: 0;
  background: linear-gradient(
    to right,
    var(--sml-resources-gradient-color) 48.2%,
    var(--sml-black) 100%
  );
}

.sml-resources__card--gradient-red {
  --sml-resources-gradient-color: #ef4727;
}

.sml-resources__card--gradient-yellow {
  --sml-resources-gradient-color: #fdd900;
}

.sml-resources__card--gradient-green {
  --sml-resources-gradient-color: #04a952;
}

.sml-resources__card--gradient-purple {
  --sml-resources-gradient-color: #6b52a2;
}

.sml-resources__title {
  margin: 0;
  font-family: var(--sml-font-code-pro-bold);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.167;
}

.sml-resources__text {
  font-family: var(--sml-font-jost);
  font-size: 1.125rem;
  line-height: 1.29;
}

.sml-resources__text > :first-child,
.sml-resources__text > :last-child {
  margin-block: 0;
}

.sml-card-element__title {
  margin-block-end: 1.5rem;
}

.sml-card-element__cta {
  margin-block-start: 1.5rem;
}

.sml-resources__grid--horizontal {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 518px), 1fr));
}

.sml-resources__card--horizontal {
  flex-direction: row;
  min-height: 205px;
}

.sml-resources__card--horizontal .sml-resources__media {
  width: 165px;
  height: auto;
  flex: 0 0 165px;
  border-radius: 10px 0 0 10px;
}

.sml-resources__card--horizontal .sml-resources__body {
  justify-content: center;
  border-radius: 0 10px 10px 0;
}

@media (max-width: 991px) {
  .sml-resources__grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 303px), 1fr));
  }
}

@media (max-width: 575px) {
  .sml-resources__grid {
    grid-template-columns: 1fr;
  }

  .sml-resources__card--horizontal {
    min-height: 0;
  }
}

@media (min-width: 1500px) {
  .sml-homepage .sml-resources__grid {
    grid-template-columns: repeat(4, 333px);
    justify-content: space-between;
    gap: 20px;
  }

  .sml-resources__card {
    min-height: 0;
  }

  .sml-resources__media {
    height: 175px;
  }
}
