/* ==========================================================================
   Services Grid & Hover Inversion
   ========================================================================== */

/* Main Grid Container (3 Columns on Desktop) */
.fe-services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 30px 15px;
  box-sizing: border-box;
  font-family: inherit;
}

/* Base Card Styles */
.fe-service-card {
  position: relative;
  min-height: 260px;
  box-sizing: border-box;
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ==========================================================================
   BLOCK 1: Featured Image Card + Offset Red Accent
   ========================================================================== */
.fe-service-card--featured {
  position: relative;
  display: flex;
  align-items: flex-start;
}

/* The Red Background Offset Box */
.fe-service-card__red-bg {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 85%;
  height: 80%;
  background-color: #c02b2b; /* Red Accent */
  z-index: 1;
  transition:
    transform 0.35s ease,
    background-color 0.35s ease;
}

/* The Image Frame */
.fe-service-card__img-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.fe-service-card__img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

/* Hover Effect for Block 1 (Red box shifts outwards & Image zooms) */
.fe-service-card--featured:hover .fe-service-card__red-bg {
  /* transform: translate(6px, 6px); */
  background-color: #a01f1f;
}

.fe-service-card__link:hover {
  transform: translateX(20px);
}

/* ==========================================================================
   BLOCKS 2+: Standard Text Cards (Hover Inversion)
   ========================================================================== */
.fe-service-card--text {
  position: relative; /* required as the stretched-link overlay anchors to this */
  background-color: #ffffff;
  padding: 32px 28px;
  text-decoration: none !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  border: 1px solid #f1f5f9;
}

.fe-service-card__body {
  position: relative;
  z-index: 2; /* keeps body content above the stretched-link overlay's stacking context */
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Default State Colors */
.fe-service-card__title {
  font-size: 17px;
  font-weight: 600;
  color: #000;
  text-transform: uppercase;
  line-height: 1.35;
  margin: 0 0 16px 0;
  letter-spacing: 0.3px;
  transition: color 0.35s ease;
}

.fe-service-card__desc {
  font-size: 14px;
  color: #000;
  line-height: 1.6;
  margin: 0 0 24px 0;
  transition: color 0.35s ease;
}

/* WYSIWYG output wraps text in <p> tags with default browser margins.
   Normalize spacing so the card rhythm doesn't shift depending on
   how many paragraphs an editor adds. */
.fe-service-card__desc p {
  margin: 0 0 1em 0;
}

.fe-service-card__desc p:last-child {
  margin-bottom: 0;
}

/* Real links an editor adds inside the WYSIWYG description.
   These need their own stacking context + higher z-index so they
   stay clickable above the card's stretched-link overlay. */
.fe-service-card__desc a {
  position: relative;
  z-index: 3;
  color: inherit;
  text-decoration: underline;
}

.fe-service-card__link {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #c02b2b; /* Red Text for Link */
  margin-top: auto;
  text-decoration: none;
  transition:
    color 0.35s ease,
    transform 0.35s ease;
}

.fe-service-card__link svg {
  transition: transform 0.35s ease;
}

/* Stretched-link overlay: makes the entire card clickable via the
   card's primary link, WITHOUT wrapping the whole card in an <a>.
   This avoids invalid nested anchors when the WYSIWYG description
   contains its own links. */
.fe-service-card__stretched-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* --- HOVER STATE: CARD BECOMES RED, TEXT BECOMES WHITE --- */
.fe-service-card--text:hover {
  background-color: #c02b2b; /* Card becomes Red */
  border-color: #c02b2b;
  box-shadow: 0 12px 30px rgba(192, 43, 43, 0.25);
}

.fe-service-card--text:hover .fe-service-card__title,
.fe-service-card--text:hover .fe-service-card__desc,
.fe-service-card--text:hover .fe-service-card__link {
  color: #ffffff !important; /* All text turns white */
}

.fe-service-card--text:hover .fe-service-card__link svg {
  transform: translateX(5px); /* Arrow nudges right */
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* Tablet (2 Columns) */
@media (max-width: 992px) {
  .fe-services-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

/* Mobile (1 Column) */
@media (max-width: 600px) {
  .fe-services-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 15px;
  }

  .fe-service-card--featured {
    min-height: 220px;
    margin-bottom: 10px;
  }

  .fe-service-card--text {
    padding: 24px 20px;
    min-height: auto;
  }
}
