/*! eLEND Mortgage Calculators: calculators index page
 *
 * Loads only on the pages listed in the elc_index_pages filter
 * (default: /direct/resources/calculators/). Restyles the theme's
 * text-columns block there as cards, and puts the mascot beside the
 * section headline. Theme markup and block content stay untouched.
 */

.elc-index .wp-block-pulp-text-columns {
  --elc-navy: #002253;
  --elc-blue: #006FFA;
  background-color: #F4F7FB !important; /* beats the theme's .bg-white */
}

/* ---------- Headline with mascot on the left ---------- */

.elc-index .wp-block-pulp-text-columns .container .title-area {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 32px;
  max-width: 960px;
  margin: 0 auto 48px;
  text-align: left;
}

.elc-index .wp-block-pulp-text-columns .container .title-area::before {
  content: "";
  grid-row: 1 / span 2;
  width: clamp(120px, 11vw, 156px);
  aspect-ratio: 320 / 321;
  background: url("../img/elend-calc-mascot.webp") center / contain no-repeat;
  filter: drop-shadow(0 12px 20px rgb(0 34 83 / 0.18));
}

.elc-index .wp-block-pulp-text-columns .container .title-area h3 {
  align-self: end;
  max-width: none;
  margin: 0 0 12px;
}

.elc-index .wp-block-pulp-text-columns .container .title-area p {
  align-self: start;
  width: auto;
  margin: 0;
}

@media (max-width: 700px) {
  .elc-index .wp-block-pulp-text-columns .container .title-area {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    row-gap: 14px;
    text-align: center;
  }
  .elc-index .wp-block-pulp-text-columns .container .title-area::before {
    grid-row: auto;
    width: 108px;
  }
  .elc-index .wp-block-pulp-text-columns .container .title-area h3 { margin: 0; }
}

/* ---------- Calculator cards ---------- */

.elc-index .wp-block-pulp-text-columns .container .layout {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.elc-index .wp-block-pulp-text-columns .container .layout .text-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 32px 24px 28px;
  text-align: center;
  background: #fff;
  border: 1px solid rgb(0 34 83 / 0.10) !important;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgb(0 34 83 / 0.04), 0 6px 18px rgb(0 34 83 / 0.06);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.elc-index .wp-block-pulp-text-columns .container .layout .text-column:hover {
  border-color: rgb(0 111 250 / 0.35) !important;
  box-shadow: 0 2px 4px rgb(0 34 83 / 0.06), 0 14px 32px rgb(0 34 83 / 0.12);
  transform: translateY(-3px);
}

.elc-index .wp-block-pulp-text-columns .container .layout .text-column:has(a:focus-visible) {
  outline: 2px solid var(--elc-blue);
  outline-offset: 3px;
}

.elc-index .wp-block-pulp-text-columns .container .layout .text-column h3 {
  margin: 0 0 14px;
  color: var(--elc-navy);
}

.elc-index .wp-block-pulp-text-columns .container .layout .text-column p {
  width: 100%;
  margin: 0 0 24px;
  font-size: 1rem;
}

/* The theme pins the link to the bottom with absolute positioning.
 * Put it back in flow at the bottom of the card, then stretch its hit
 * area over the whole card so the card is one click target. */
.elc-index .wp-block-pulp-text-columns .container .layout .text-column a {
  position: static;
  margin: auto 0 0;
}

.elc-index .wp-block-pulp-text-columns .container .layout .text-column a::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.elc-index .wp-block-pulp-text-columns .container .layout .text-column a:focus-visible {
  outline: none;
}

@media (max-width: 1200px) {
  .elc-index .wp-block-pulp-text-columns .container .layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .elc-index .wp-block-pulp-text-columns .container .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .elc-index .wp-block-pulp-text-columns .container .layout .text-column {
    padding: 24px 20px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .elc-index .wp-block-pulp-text-columns .container .layout .text-column { transition: none; }
  .elc-index .wp-block-pulp-text-columns .container .layout .text-column:hover { transform: none; }
}
