/* ==========================================================================
   LF CONTENT BOXES GRID
   Equal-size cards, 2x2 or 3x3, auto-condensing.

   How the sizing works
   --------------------
   - .lf-cb__grid is a CSS grid with N equal columns (minmax(0,1fr)), so
     every card is exactly the same width.
   - grid-auto-rows: 1fr makes every row the same height as the tallest row,
     and align-items: stretch makes each card fill its cell. Result: every
     card is the same width AND height no matter what's inside it.
   - .lf-cb is a container-query container. The @container rules below drop
     3 -> 2 -> 1 columns based on the width the MODULE is given, so it still
     behaves if you drop it in a half-width HubSpot column. The @media rules
     are a fallback for browsers without container-query support.

   Tweak the breakpoints in the CONDENSE section at the bottom.
   ========================================================================== */

.lf-cb {
  /* Brand tokens */
  --lf-blue: #236092;
  --lf-dark-azure: #152f45;
  --lf-yellow: #f9db6c;

  /* Defaults; the module.html wrapper overrides these inline from the Style tab */
  --lf-cb-cols: 3;
  --lf-cb-gap: 24px;
  --lf-cb-icon: 50px;
  --lf-cb-card-bg: #ffffff;
  --lf-cb-heading: var(--lf-blue);
  --lf-cb-text: #000000;

  /* Card look (matches existing dew Content Boxes on the site) */
  --lf-cb-radius: 14px;
  --lf-cb-pad: 40px;
  --lf-cb-shadow: 0 10px 25px 0 rgba(0, 0, 0, 0.2);
  --lf-cb-shadow-hover: 0 16px 34px rgba(21, 47, 69, 0.18);

  container-type: inline-size;
  container-name: lf-cb;

  width: 100%;
  font-family: "Lato", Arial, Helvetica, sans-serif;
}

.lf-cb,
.lf-cb *,
.lf-cb *::before,
.lf-cb *::after {
  box-sizing: border-box;
}


/* --------------------------------------------------------------------------
   Grid
   -------------------------------------------------------------------------- */

.lf-cb__grid {
  display: grid;
  grid-template-columns: repeat(var(--lf-cb-cols), minmax(0, 1fr));
  grid-auto-rows: 1fr;          /* every row = tallest row  */
  align-items: stretch;         /* every card fills its row */
  gap: var(--lf-cb-gap);
  width: 100%;
  margin: 0;
  padding: 0;
}


/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */

.lf-cb__card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;

  padding: var(--lf-cb-pad);

  background: var(--lf-cb-card-bg);
  border-radius: var(--lf-cb-radius);
  box-shadow: var(--lf-cb-shadow);

  color: var(--lf-cb-text);
  text-decoration: none;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.lf-cb--no-shadow .lf-cb__card {
  box-shadow: none;
  border: 1px solid #dfe6eb;
}

/* Only clickable cards get the hover lift */
a.lf-cb__card:hover,
a.lf-cb__card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--lf-cb-shadow-hover);
  outline: none;
}

a.lf-cb__card:focus-visible {
  outline: 2px solid var(--lf-yellow);
  outline-offset: 2px;
}


/* Alignment */
.lf-cb--align-center .lf-cb__card {
  align-items: center;
  text-align: center;
}

.lf-cb--align-left .lf-cb__card {
  align-items: flex-start;
  text-align: left;
}


/* Icon */
.lf-cb__icon {
  flex: 0 0 auto;
  width: var(--lf-cb-icon);
  height: var(--lf-cb-icon);
  margin: 0 0 20px;
}

.lf-cb__icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}


/* Heading */
.lf-cb h4.lf-cb__heading {
  margin: 0 0 10px;
  color: var(--lf-cb-heading);
  font-family: "Lato", Arial, Helvetica, sans-serif;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.25;
}


/* Body */
.lf-cb__body {
  flex: 1 1 auto;
  width: 100%;
  color: var(--lf-cb-text);
  font-size: 18px;
  line-height: 1.4;
}

.lf-cb__body p {
  margin: 0 0 10px;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.lf-cb__body p:last-child {
  margin-bottom: 0;
}

.lf-cb__body ul,
.lf-cb__body ol {
  margin: 0 0 10px;
  padding-left: 1.2em;
  text-align: left;
}

.lf-cb__body a {
  color: var(--lf-blue);
  text-decoration: underline;
}


/* ==========================================================================
   CONDENSE
   3 cols -> 2 cols -> 1 col as the module gets narrower.
   Container queries key off the module's own width, so this works inside
   half-width HubSpot columns too. Media queries are the fallback.
   ========================================================================== */

/* --- Container queries (modern browsers) --- */

@container lf-cb (max-width: 900px) {
  .lf-cb--cols-3 .lf-cb__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container lf-cb (max-width: 560px) {
  .lf-cb--cols-3 .lf-cb__grid,
  .lf-cb--cols-2 .lf-cb__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .lf-cb__card {
    --lf-cb-pad: 28px;
  }
}


/* --- Media query fallback (browsers without @container) --- */

@supports not (container-type: inline-size) {

  @media (max-width: 1000px) {
    .lf-cb--cols-3 .lf-cb__grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  @media (max-width: 640px) {
    .lf-cb--cols-3 .lf-cb__grid,
    .lf-cb--cols-2 .lf-cb__grid {
      grid-template-columns: minmax(0, 1fr);
    }

    .lf-cb__card {
      --lf-cb-pad: 28px;
    }
  }

}


/* Mobile type tweaks (screen-based, regardless of container) */

@media (max-width: 520px) {
  .lf-cb h4.lf-cb__heading {
    font-size: 18px;
  }

  .lf-cb__body {
    font-size: 16px;
  }
}


/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .lf-cb__card {
    transition: none;
  }
}
