/**
 * @file
 * Link Group paragraph component — element_link_group.
 *
 * Renders a responsive grid of link cards with an orange-box arrow icon,
 * bold title, and optional PDF indicator. State styling:
 *   Static  — white background, black title, orange arrow box.
 *   Hover   — gray background, purple underlined title.
 *   Focus   — 3 px solid black border (keyboard navigation).
 *   Clicked — 3 px solid black border (:active state).
 *
 * This file is self-contained: it re-declares the .sml-arrow /
 * .sml-arrow__box rules from homepage.css because link-group is loaded
 * on interior pages where homepage.css is not present.
 *
 * Tokens used (defined in css/base/variables.css):
 *   --sml-black, --sml-white, --sml-gray, --sml-orange, --sml-orange-dark,
 *   --sml-purple, --sml-font-display-heading, --sml-font-jost.
 */

/* ---------------------------------------------------------------------------
 * Section wrapper
 * ------------------------------------------------------------------------ */

.sml-link-group {
  width: 100%;
  margin-block: 2rem;
  container-type: inline-size;
}

/* Consecutive groups within an Elemental row form one resource section. */
.field--name-field-row-elements
  > .field__item:has(+ .field__item)
  > .sml-link-group {
  margin-block-end: 0.75rem;
}

.field--name-field-row-elements
  > .field__item:has(> .sml-link-group)
  + .field__item
  > .sml-link-group {
  margin-block-start: 0.75rem;
}

@media (min-width: 768px) {
  .sml-row
    > .sml-col:has(> .sml-link-group):has(
      + .sml-col
        > :is(
            .sml-contacts,
            .sml-link-group,
            .sml-element-text,
            .sml-news-block,
            .sml-gallery,
            .sml-card-element
          )
        > .component-header
    )
    > .sml-link-group,
  .sml-row
    > .sml-col:has(
      > :is(
          .sml-contacts,
          .sml-link-group,
          .sml-element-text,
          .sml-news-block,
          .sml-gallery,
          .sml-card-element
        )
        > .component-header
    )
    + .sml-col:has(> .sml-link-group)
    > .sml-link-group {
    margin-block-start: 0;
    /* Size containment from container-type blocks grid-template-rows: subgrid. */
    container-type: normal;
  }
}

.sml-link-group__cta:not(:has(*)) {
  display: none;
}

/* ---------------------------------------------------------------------------
 * Grid column count follows the available content width rather than the
 * viewport, so it adapts when the page has a sidebar.
 * ------------------------------------------------------------------------ */

.sml-link-group__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

@container (min-width: 32rem) {
  .sml-link-group__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .sml-col--50 > .sml-link-group .sml-link-group__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container (min-width: 52rem) {
  .sml-link-group__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@container (min-width: 68rem) {
  .sml-link-group__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.sml-link-group__item {
  display: flex;
}

/* ---------------------------------------------------------------------------
 * Individual link card
 * ------------------------------------------------------------------------ */

.sml-link-group__card {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  min-height: 86px;
  padding: 0.625rem;

  /* Reserve 3 px on all sides so the focus/active border does not cause
     layout shift. Transparent by default; colored on :focus/:active. */
  border: 3px solid transparent;
  border-radius: 10px;

  background: var(--sml-white);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  text-decoration: none;
  color: var(--sml-black);
  cursor: pointer;
}

/* Hover state: gray background, purple underlined title. */
.sml-link-group__card:hover {
  background: var(--sml-gray);
  color: var(--sml-black);
  text-decoration: none;
  border-color: transparent;
}

.sml-link-group__card:hover .sml-link-group__label {
  color: var(--sml-purple);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Focus and active (clicked) state: 3 px solid black border. */
.sml-link-group__card:focus,
.sml-link-group__card:focus-visible,
.sml-link-group__card:active {
  outline: none;
  border-color: var(--sml-black);
  background: var(--sml-white);
  text-decoration: none;
}

/* ---------------------------------------------------------------------------
 * Card label (link title text)
 * ------------------------------------------------------------------------ */

.sml-link-group__label {
  flex: 1 1 0;
  font-family: var(--sml-font-jost);
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.2;
  color: var(--sml-black);
  text-decoration: none;
  word-break: break-word;
}

/* ---------------------------------------------------------------------------
 * Arrow icon — orange filled box with black arrow stroke.
 * Mirrors homepage.css rules so this file is self-contained.
 * ------------------------------------------------------------------------ */

.sml-link-group__card .sml-arrow {
  flex: 0 0 auto;
  width: 2.875rem;
  height: auto;
}

.sml-link-group__card .sml-arrow .sml-arrow__box {
  fill: var(--sml-orange);
}

/* ---------------------------------------------------------------------------
 * PDF icon (optional, right-aligned inside the card)
 * ------------------------------------------------------------------------ */

.sml-link-group__pdf-icon {
  flex: 0 0 auto;
  width: 2.125rem;
  height: auto;
  margin-inline-start: auto;
  color: var(--sml-black);
}

/* ---------------------------------------------------------------------------
 * Optional CTA area rendered below the grid
 * ------------------------------------------------------------------------ */

.sml-link-group__cta {
  margin-block-start: 1.5rem;
}

/* Add depth only when the Link Group has ample available space. */
@container (min-width: 70rem) {
  .sml-link-group__card {
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.35);
  }
}
