/* =========================================================
   LINKS PAGE
========================================================= */

.external-links-section,
.external-links-section * {
  box-sizing: border-box;
}

.external-links-section {
  padding-top: clamp(56px, 7vw, 76px) !important;
  padding-bottom: clamp(64px, 8vw, 88px) !important;
  background: var(--background) !important;
}

/* Introduction */
.external-links-section > .et_pb_row:first-child {
  max-width: 780px;
  margin-bottom: 42px !important;
  padding: 0 !important;
}

.external-links-section > .et_pb_row:first-child .et_pb_text {
  margin: 0 !important;
  text-align: center;
}

.external-links-section > .et_pb_row:first-child h2 {
  margin: 0;
  padding: 0;
  color: var(--dark-text);
  font-size: clamp(30px, 3.5vw, 40px);
  line-height: 1.2;
}

.external-links-section > .et_pb_row:first-child h2::after {
  display: block;
  width: 48px;
  height: 4px;
  margin: 15px auto 17px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.external-links-section > .et_pb_row:first-child p {
  margin: 0;
  color: var(--slate);
  font-size: 16px;
  line-height: 1.75;
}

/* Card layout */
.external-links-grid.et_pb_row {
  display: block !important;
  width: 90%;
  max-width: 1120px;
  padding: 0 !important;
}

.external-links-grid > .et_pb_column {
  display: flex !important;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 24px;
}

/* Individual card */
.external-links-grid .external-link-card {
  display: flex !important;
  width: auto !important;
  max-width: calc((100% - 48px) / 3);
  min-width: 0;
  min-height: 410px;
  flex: 0 1 calc((100% - 48px) / 3);
  margin: 0 !important;
  padding: 18px 18px 22px !important;
  overflow: hidden;
  border: 1px solid var(--border) !important;
  border-top: 4px solid var(--primary) !important;
  border-radius: var(--radius) !important;
  background: var(--white) !important;
  box-shadow: 0 10px 30px rgba(23, 42, 42, 0.08);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.external-links-grid .external-link-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent) !important;
  box-shadow: 0 17px 38px rgba(23, 42, 42, 0.13);
}

/* Ensure the content fills the card */
.external-link-card .et_pb_blurb_content {
  display: flex;
  width: 100%;
  max-width: none !important;
  height: 100%;
  flex: 1;
  flex-direction: column;
  margin: 0 !important;
}

/* Logo area */
.external-link-card .et_pb_main_blurb_image {
  display: flex !important;
  width: 100%;
  height: 190px;
  align-items: center;
  justify-content: center;
  margin: 0 0 22px !important;
  padding: 24px;
  border-radius: 12px;
  background: var(--background);
}

.external-link-card .et_pb_image_wrap {
  display: flex !important;
  width: 100% !important;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.external-link-card .et_pb_main_blurb_image img {
  display: block;
  width: 100% !important;
  max-width: 210px;
  height: 100% !important;
  max-height: 142px;
  object-fit: contain;
  object-position: center;
}

/* Text content */
.external-link-card .et_pb_blurb_container {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.external-link-card .et_pb_module_header {
  margin: 0 0 9px !important;
  padding: 0 !important;
  color: var(--dark-text) !important;
  font-size: 23px;
  line-height: 1.25;
  text-align: center;
}

.external-link-card .et_pb_blurb_description {
  display: flex;
  flex: 1;
  color: var(--slate);
  font-size: 14px;
  line-height: 1.65;
  text-align: center;
}

.external-link-card .et_pb_blurb_description p {
  display: flex;
  width: 100%;
  flex: 1;
  flex-direction: column;
  margin: 0 !important;
  padding: 0 !important;
}

/* Remove line breaks added around the action row */
.external-link-card .et_pb_blurb_description p > br,
.external-link-card .external-link-action br {
  display: none;
}

/* Visit website action */
.external-link-card .external-link-action {
  display: inline-flex;
  width: auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  align-self: center;
  margin: auto auto 0;
  padding-top: 19px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

/* Hide the original text arrow */
.external-link-action span[aria-hidden="true"] {
  display: none !important;
}

/* Custom external-link SVG */
.external-link-action::after {
  display: block;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 1px solid rgba(10, 102, 93, 0.12);
  border-radius: 8px;
  background-color: var(--mint);
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%230a665d%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27M14 4h6v6%27/%3E%3Cpath d=%27M20 4l-9 9%27/%3E%3Cpath d=%27M18 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5%27/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 17px 17px;
  content: "";
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background-color 0.2s ease;
}

.external-link-card:hover .external-link-action::after {
  transform: translate(2px, -2px);
  border-color: rgba(10, 102, 93, 0.22);
  background-color: rgba(62, 193, 170, 0.22);
}

/* Tablet: two cards per row */
@media (max-width: 980px) {
  .external-links-grid > .et_pb_column {
    gap: 22px;
  }

  .external-links-grid .external-link-card {
    max-width: calc((100% - 22px) / 2);
    flex-basis: calc((100% - 22px) / 2);
  }
}

/* Mobile: one card per row */
@media (max-width: 767px) {
  .external-links-section {
    padding-top: 48px !important;
    padding-bottom: 58px !important;
  }

  .external-links-section > .et_pb_row:first-child {
    margin-bottom: 32px !important;
  }

  .external-links-section > .et_pb_row:first-child .et_pb_text {
    text-align: left;
  }

  .external-links-section > .et_pb_row:first-child h2::after {
    margin-right: 0;
    margin-left: 0;
  }

  .external-links-grid > .et_pb_column {
    gap: 18px;
  }

  .external-links-grid .external-link-card {
    width: 100% !important;
    max-width: 520px;
    min-height: 0;
    flex-basis: 100%;
  }

  .external-link-card .et_pb_main_blurb_image {
    height: 170px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .external-links-grid .external-link-card,
  .external-link-card .external-link-action::after {
    transition: none;
  }
}