/* ============================================================
   RAG IMPLEMENTATION CHALLENGES - module.css
   Fonts, spacing and breakpoints follow the Applied AI Solutions
   module (aas-*). --ric-accent / --ric-bg are injected from HubL.

   Each card spans 2 grid rows and uses subgrid, so the top part
   and the "Our Approach" box line up across every card in a row.
   Browsers without subgrid fall back to a flex column with the box
   pushed to the bottom.

   Cards per row (editor choice):
     3: 3 -> 2 (<=1024) -> 1 (<=640)
     4: 4 -> 2 (<=1024) -> 1 (<=640)
     5: 5 -> 3 (<=1180) -> 2 (<=1024) -> 1 (<=640)
   ============================================================ */

.ric-section {
  --ric-accent: #2F6BFF;
  --ric-bg: #FFFFFF;
  padding: clamp(48px, 7vw, 96px) 40px;
  background: var(--ric-bg);
  -webkit-font-smoothing: antialiased;
}

.ric-container {
  max-width: 1180px;
  margin: 0 auto;
}

/* -- Header -------------------------------------------------- */
.ric-label {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ric-accent);
}

/* Title (left) | description (right, bottom-aligned as in the design) */
.ric-head-row {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px clamp(32px, 4vw, 64px);
  align-items: start; /* description starts level with the title (as Applied AI Solutions) */
}

.ric-title {
  margin: 0;
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: 800;
  letter-spacing: -.028em;
  line-height: 1.06;
  color: #0B1020;
  text-wrap: balance;
}

.ric-desc {
  margin: 0;
  font-size: 16px;
  line-height: 1.75;
  color: #5A6472;
  text-wrap: pretty;
  padding-top: 6px;
}

@media (max-width: 1024px) {
  .ric-desc {
    padding-top: 0;
  }

  .ric-head {
    text-align: center;
  }

  .ric-head-row {
    grid-template-columns: 1fr;
  }

  .ric-label,
  .ric-title,
  .ric-desc {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  .ric-title,
  .ric-desc {
    max-width: 550px;
    text-wrap: wrap;
  }

  .ric-title {
    max-width: 600px;
  }
}

/* -- Rows + grid --------------------------------------------- */
/* Each row is its own grid with its own cards-per-row */
.ric-rows {
  margin-top: clamp(28px, 3.5vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ric-grid {
  --ric-cols: 3;
  display: grid;
  grid-template-columns: repeat(var(--ric-cols), minmax(0, 1fr));
  gap: 20px;
}

.ric-grid--2 { --ric-cols: 2; }
.ric-grid--3 { --ric-cols: 3; }
.ric-grid--4 { --ric-cols: 4; }
.ric-grid--5 { --ric-cols: 5; gap: 16px; }

/* -- Card ---------------------------------------------------- */
.ric-card {
  --ric-pad-x: 32px;
  position: relative;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #E4E9F4;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 30, 80, .04),
              0 14px 30px -24px rgba(16, 30, 80, .22);
  transition: box-shadow .35s ease, border-color .35s ease;
}

@supports (grid-template-rows: subgrid) {
  .ric-card {
    display: grid;
    grid-row: span 2;
    grid-template-rows: subgrid;
    row-gap: 0;
  }
}

/* Top border draws left -> right on hover */
.ric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--ric-accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .5s cubic-bezier(.22, .61, .36, 1);
}

.ric-card:hover::before,
.ric-card:focus-within::before {
  transform: scaleX(1);
}

.ric-card:hover {
  border-color: #D3DDF3;
  box-shadow: 0 1px 2px rgba(16, 30, 80, .04),
              0 22px 40px -26px rgba(16, 30, 80, .32);
}

.ric-card-main {
  padding: 30px var(--ric-pad-x) 22px;
}

/* -- Icon ---------------------------------------------------- */
.ric-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #EEF3FF;
  color: var(--ric-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .35s ease, color .35s ease, box-shadow .35s ease,
              transform .45s cubic-bezier(.2, .8, .2, 1);
}

.ric-icon i {
  font-size: 26px;
  line-height: 1;
  color: inherit;
  transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}

.ric-card:hover .ric-icon,
.ric-card:focus-within .ric-icon {
  background: var(--ric-accent);
  color: #fff;
  transform: translateY(-3px) rotate(-6deg);
  box-shadow: 0 12px 24px -10px rgba(47, 107, 255, .55);
}

.ric-card:hover .ric-icon i,
.ric-card:focus-within .ric-icon i {
  transform: scale(1.1) rotate(6deg);
}

/* -- Card text ----------------------------------------------- */
.ric-card-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.015em;
  line-height: 1.3;
  color: #0F1A2E;
  text-wrap: balance;
}

.ric-icon + .ric-card-title {
  margin-top: 22px;
}

.ric-card-desc {
  margin: 12px 0 0;
  font-size: 16px;
  line-height: 1.75;
  color: #5A6472;
  text-wrap: pretty;
}

/* -- Our Approach box ---------------------------------------- */
.ric-approach {
  margin: auto 18px 18px;
  padding: 18px 20px;
  border: 1px solid #E3EBFB;
  border-radius: 14px;
  background: #F5F8FF;
}

@supports (grid-template-rows: subgrid) {
  .ric-approach {
    margin-top: 0;
  }
}

.ric-approach-spacer {
  min-height: 0;
}

.ric-approach-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ric-approach-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ric-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ric-approach-icon i {
  font-size: 10px;
  line-height: 1;
}

.ric-approach-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ric-accent);
}

.ric-approach-text {
  margin: 10px 0 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  color: #0F1A2E;
  text-wrap: pretty;
}

/* -- Denser cards for 4 and 5 per row ------------------------ */
.ric-grid--4 .ric-card,
.ric-grid--5 .ric-card {
  --ric-pad-x: 24px;
}

.ric-grid--4 .ric-card-main,
.ric-grid--5 .ric-card-main {
  padding-top: 26px;
}

.ric-grid--4 .ric-card-title,
.ric-grid--5 .ric-card-title {
  font-size: 18px;
}

.ric-grid--4 .ric-card-desc,
.ric-grid--5 .ric-card-desc {
  font-size: 15px;
  line-height: 1.7;
}

.ric-grid--4 .ric-approach,
.ric-grid--5 .ric-approach {
  margin-left: 14px;
  margin-right: 14px;
  margin-bottom: 14px;
  padding: 16px;
}

.ric-grid--5 .ric-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.ric-grid--5 .ric-icon i {
  font-size: 22px;
}

.ric-grid--5 .ric-icon + .ric-card-title {
  margin-top: 18px;
}

.ric-grid--5 .ric-card-main {
  padding-left: 20px;
  padding-right: 20px;
}

.ric-grid--5 .ric-approach {
  margin-left: 12px;
  margin-right: 12px;
  margin-bottom: 12px;
  padding: 14px;
}

.ric-grid--5 .ric-approach-text {
  font-size: 14.5px;
}

/* -- Scroll reveal (transform only - no opacity) ------------- */
@media (prefers-reduced-motion: no-preference) {
  .ric-animate .ric-card {
    transform: translateY(24px);
    transition: transform .6s cubic-bezier(.22, .61, .36, 1) var(--d, 0ms),
                box-shadow .35s ease, border-color .35s ease;
  }

  .ric-animate .ric-card.is-visible {
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ric-icon,
  .ric-icon i {
    transition: background .35s ease, color .35s ease;
  }

  .ric-card:hover .ric-icon,
  .ric-card:focus-within .ric-icon,
  .ric-card:hover .ric-icon i,
  .ric-card:focus-within .ric-icon i {
    transform: none;
  }
}

/* -- Responsive ---------------------------------------------- */
@media (max-width: 1180px) {
  .ric-grid--5 {
    --ric-cols: 3;
    gap: 20px;
  }
}

@media (max-width: 1024px) {
  .ric-grid--3,
  .ric-grid--4,
  .ric-grid--5 {
    --ric-cols: 2;
    gap: 20px;
  }

  /* An odd last card fills the row (not needed for 2-up rows) */
  .ric-grid--3 .ric-card:last-child:nth-child(odd),
  .ric-grid--4 .ric-card:last-child:nth-child(odd),
  .ric-grid--5 .ric-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  /* Back to the standard card size once there are only 2 per row */
  .ric-grid--4 .ric-card,
  .ric-grid--5 .ric-card {
    --ric-pad-x: 28px;
  }

  .ric-grid .ric-card-main {
    padding: 28px var(--ric-pad-x) 22px;
  }

  .ric-grid--4 .ric-card-title,
  .ric-grid--5 .ric-card-title {
    font-size: 20px;
  }

  .ric-grid--4 .ric-card-desc,
  .ric-grid--5 .ric-card-desc {
    font-size: 16px;
    line-height: 1.75;
  }

  .ric-grid .ric-approach {
    margin-left: 16px;
    margin-right: 16px;
    margin-bottom: 16px;
    padding: 18px;
  }

  .ric-grid--5 .ric-approach-text {
    font-size: 15px;
  }
}

@media (max-width: 640px) {
  .ric-section {
    padding: 48px 20px;
  }

  .ric-grid--2,
  .ric-grid--3,
  .ric-grid--4,
  .ric-grid--5 {
    --ric-cols: 1;
  }

  .ric-grid .ric-card {
    --ric-pad-x: 22px;
  }

  .ric-grid .ric-card-main {
    padding-top: 26px;
  }

  .ric-grid .ric-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .ric-grid .ric-icon i {
    font-size: 22px;
  }

  .ric-grid .ric-icon + .ric-card-title {
    margin-top: 18px;
  }

  .ric-grid .ric-card-title {
    font-size: 18px;
  }

  .ric-grid .ric-card-desc {
    font-size: 15px;
    line-height: 1.7;
  }

  .ric-grid .ric-approach {
    margin-left: 14px;
    margin-right: 14px;
    margin-bottom: 14px;
    padding: 16px;
  }
}
