/* ==========================================================================
   Magengrim — solutions
   A heading, a narrow left rail, and a horizontally scrolling row of cards.
   The first card is the feature: it carries an image and stands taller than
   the rest. Controls sit beneath the track and hide themselves when every
   card already fits.
   ========================================================================== */

.mg-sol {
  --sol-ink: var(--mg-ink);
  --sol-muted: var(--mg-muted);
  --sol-line: var(--mg-line);
  --sol-purple: var(--mg-purple);
  --sol-indigo: var(--mg-indigo);
  --sol-radius: var(--mg-radius);
  --sol-gap: 20px;
  --sol-card: 300px;

  padding: clamp(56px, 7vw, 104px) 0 clamp(56px, 7vw, 96px);
  background: var(--mg-bg-alt);
}

.mg-sol .mg-sol__inner {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Heading ------------------------------------------------------------ */

.mg-sol .mg-sol__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px 40px;
  margin-bottom: clamp(26px, 3.4vw, 44px);
}

/* The note and the pill fill the width the old left rail was wasting. */
.mg-sol .mg-sol__meta {
  display: flex;
  align-items: center;
  gap: 26px;
  padding-bottom: 6px;
}

.mg-sol .mg-sol__note {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: rgba(13, 11, 26, 0.42);
  max-width: 30ch;
  text-align: right;
}

.mg-sol .mg-sol__title {
  display: flex;
  align-items: center;
  gap: 0.32em;
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: clamp(1.9rem, 4.2vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--sol-ink);
}

/* The mark reads as "keep going" — it points at the row below. */
.mg-sol .mg-sol__titlemark {
  flex: none;
  width: 0.62em;
  height: 0.62em;
  stroke-width: 2.2;
  transform: rotate(-45deg);
}

/* --- Body: rail + track ------------------------------------------------- */

.mg-sol .mg-sol__pill {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  align-self: flex-start;
  padding: 10px 14px 10px 18px;
  border: 1px solid var(--sol-line);
  border-radius: 999px;
  background: transparent;
  font-family: "DM Sans", sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1;
  color: var(--sol-ink);
  text-decoration: none;
  transition:
    background-color 260ms cubic-bezier(0.22, 0.61, 0.36, 1),
    border-color 260ms cubic-bezier(0.22, 0.61, 0.36, 1),
    color 260ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.mg-sol .mg-sol__pill svg {
  flex: none;
  transition: transform 260ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.mg-sol .mg-sol__pill:hover,
.mg-sol .mg-sol__pill:focus-visible {
  background: var(--sol-ink);
  border-color: var(--sol-ink);
  color: #ffffff;
}

.mg-sol .mg-sol__pill:hover svg,
.mg-sol .mg-sol__pill:focus-visible svg {
  transform: translate(2px, -2px);
}

/* --- Track -------------------------------------------------------------- */



/* Three across, then two, then stacked. Never a carousel: every card is
   readable without scrolling sideways at any width. */
.mg-sol .mg-sol__track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sol-gap);
  align-items: start;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mg-sol .mg-sol__item {
  min-width: 0;
}

/* --- Card --------------------------------------------------------------- */

.mg-sol .mg-sol__card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 318px;
  padding: 26px 24px 22px;
  border-radius: var(--sol-radius);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(13, 11, 26, 0.05);
  transition:
    box-shadow 320ms cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 320ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.mg-sol .mg-sol__item:hover .mg-sol__card {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -14px rgba(13, 11, 26, 0.28);
}

/* The feature card leads the row: it is taller, lifted, and carries the
   image the others do without. */
.mg-sol .mg-sol__card--feature {
  min-height: 430px;
  padding: 14px 24px 22px;
  box-shadow: 0 18px 40px -20px rgba(13, 11, 26, 0.32);
}

.mg-sol .mg-sol__media {
  position: relative;
  margin: 0 -10px 20px;
  border-radius: 13px;
  overflow: hidden;
  background:
    radial-gradient(120% 120% at 82% 110%, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(142deg, var(--sol-purple) 0%, var(--sol-indigo) 100%);
  aspect-ratio: 264 / 168;
}

.mg-sol .mg-sol__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    72deg,
    rgba(29, 16, 68, 0.55) 0%,
    rgba(29, 16, 68, 0.12) 46%,
    rgba(29, 16, 68, 0) 68%
  );
  pointer-events: none;
}

.mg-sol .mg-sol__media img {
  position: absolute;
  right: -5%;
  bottom: -24%;
  width: 55%;
  height: auto;
  object-fit: contain;
}

.mg-sol .mg-sol__mediacap {
  position: absolute;
  left: 16px;
  bottom: 15px;
  z-index: 1;
  margin: 0;
  max-width: 46%;
  font-family: "Sora", sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.015em;
  color: #ffffff;
}

.mg-sol .mg-sol__cardtitle {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -0.012em;
  color: var(--sol-ink);
  max-width: 20ch;
}

/* A short keyline, not a full-width divider — it separates without carving
   the card in two. */
.mg-sol .mg-sol__rule {
  width: 26px;
  height: 0;
  margin: 18px 0;
  border: 0;
  border-top: 1px solid rgba(13, 11, 26, 0.32);
}

.mg-sol .mg-sol__cardtext {
  margin: 0 0 22px;
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--sol-muted);
}

/* Pushes the button to the card's floor so every card's action lines up. */
.mg-sol .mg-sol__go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-top: auto;
  border-radius: 11px;
  background: #f1f2f5;
  color: var(--sol-ink);
  text-decoration: none;
  transition:
    background-color 260ms cubic-bezier(0.22, 0.61, 0.36, 1),
    color 260ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.mg-sol .mg-sol__go:hover,
.mg-sol .mg-sol__go:focus-visible {
  background: var(--sol-purple);
  color: #ffffff;
}

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 1100px) {
  .mg-sol {
    --sol-gap: 16px;
  }

  .mg-sol .mg-sol__note {
    max-width: 26ch;
  }
}

@media (max-width: 900px) {
  .mg-sol .mg-sol__head {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
  }

  .mg-sol .mg-sol__meta {
    flex-direction: row-reverse;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    padding-bottom: 0;
  }

  .mg-sol .mg-sol__note {
    text-align: left;
    max-width: 32ch;
  }

  .mg-sol .mg-sol__track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .mg-sol .mg-sol__track {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Stacked, the feature card no longer needs extra height to lead the row. */
  .mg-sol .mg-sol__card--feature {
    min-height: 0;
  }

  .mg-sol .mg-sol__card {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .mg-sol .mg-sol__meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .mg-sol .mg-sol__note {
    max-width: 40ch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mg-sol .mg-sol__track {
    scroll-behavior: auto;
  }

  .mg-sol .mg-sol__card,
.mg-sol .mg-sol__pill,
.mg-sol .mg-sol__pill svg,
.mg-sol .mg-sol__go,
  .mg-sol .mg-sol__item:hover .mg-sol__card {
    transform: none;
  }
}
