/* services_grid, Darstellung "Raster" (templates/blocks/services_grid_raster.html).
   Container queries on .agx-sg (the block's width): a card grid
   from 700px, a list below. Sizes via clamp() with cqi, no hard jumps where
   avoidable. Text always left-aligned, titles dark, no brand colour. */

/* The section (full block width) is the query container. */
.agx-sg { container: agx-sg / inline-size; }
.agx-sg__in { padding-block: clamp(40px, 7cqi, 104px); }

/* --- Head: eyebrow, heading, optional intro (always stacked) ------------- */
.agx-sg__title {
  max-width: 760px;
  margin: 0;
  font-size: clamp(26px, 3.2cqi, 40px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-align: left;
  color: #1d2327;
}
.agx-sg__intro {
  max-width: 60ch;
  margin-top: 18px;
  font-size: var(--agx-fs-16, 16px);
  line-height: 1.65;
  color: #5b6570;
}
.agx-sg__intro > :last-child { margin-bottom: 0; }

/* --- Cards: list below 700px block width ------------------------------- */
.agx-sg__cards {
  margin: clamp(24px, 6.86cqi, 48px) 0 0;  /* reaches 48px at 700px */
  padding: 0;
  list-style: none;
}
.agx-sg__item { border-top: 1px solid rgba(29, 35, 39, 0.12); }
.agx-sg__card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  color: inherit;
  text-decoration: none;
}
a.agx-sg__card:hover,
a.agx-sg__card:focus,
a.agx-sg__card:visited { color: inherit; text-decoration: none; }
a.agx-sg__card:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 4px;
  border-radius: 4px;
}
.agx-sg__img { display: block; object-fit: cover; }
.agx-sg__img--grid { display: none; }
.agx-sg__img--list {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 10px;
}
.agx-sg__text { min-width: 0; }
.agx-sg__card-title {
  margin: 0;
  font-size: var(--agx-fs-16, 16px);
  font-weight: 500;
  line-height: 22.4px;
  letter-spacing: -0.005em;
  text-align: left;
  color: #1d2327;
  overflow-wrap: break-word;
}
.agx-sg__arrow {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.85em;
  color: #6b757d;
  transition: transform 0.2s ease;
}
a.agx-sg__card:hover .agx-sg__arrow,
a.agx-sg__card:focus-visible .agx-sg__arrow { transform: translateX(4px); }
.agx-sg__desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin: 6px 0 0;
  font-size: var(--agx-fs-14, 14px);
  line-height: 21px;
  color: #5b6570;
}

/* --- Cards: grid from 700px block width -------------------------------- */
@container agx-sg (min-width: 700px) {
  .agx-sg__cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px 28px;
  }
  .agx-sg__item {
    border-top: 0;
    container: agx-card / inline-size;  /* card width drives the title size */
  }
  .agx-sg__card {
    display: block;
    padding: 0;
  }
  .agx-sg__img--list { display: none; }
  .agx-sg__img--grid {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    margin-bottom: 16px;
    border-radius: 12px;
  }
  .agx-sg__card-title {
    /* 18px from ~225px card width; slightly smaller in narrow tablet cards so
       long words and the arrow stay on one line. */
    font-size: clamp(16px, 8cqi, 18px);
    line-height: 24px;
  }
  .agx-sg__desc {
    font-size: 15px;
    line-height: 23px;
  }
}

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