// ==========================================================================
// Icon Card Component
// Reusable card with icon and title/link
// Uses Google Material Symbols for icons
// ==========================================================================

.c-icon-card {
  $self: &;
  position: relative;
  text-align: center;
  padding: $spacer * 2 $spacer;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;

  // Give cards with bg color min-height
  &[class*="--bg-"] {
    min-height: 250px;
  }

  @include media-breakpoint-up(lg) {
    padding: $spacer * 2.5 0;
  }

  &:hover {
    #{$self}__icon {
      .material-symbols-outlined {
        transform: scale(1.1);
      }
    }
  }

  &:has(#{$self}__title--link:hover),
  &:has(#{$self}__title--link:focus-visible) {
    transform: translateY(-5px);
    box-shadow: 0 16px 32px rgba($black, 0.1);

    #{$self}__icon .material-symbols-outlined {
      transform: translateY(-4px) scale(1.05);
    }
  }

  &__icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;

    .material-symbols-outlined {
      font-size: 4rem;
      color: $color-accent;
      font-variation-settings:
        "FILL" 0,
        "wght" 400,
        "GRAD" 0,
        "opsz" 48;
      transition:
        color 0.2s ease-in-out,
        transform 0.3s ease;

      @include media-breakpoint-up(lg) {
        font-size: 4rem;
      }
    }
  }

  &__title {
    color: $primary;
    font-size: $font-size-lg;
    font-weight: $font-weight-bold;
    line-height: 1.5;
    margin: 0;
    @include media-breakpoint-up(md) {
      font-size: $font-size-base;
    }
    @include media-breakpoint-up(lg) {
      font-size: $font-size-lg;
      width: 100%;
      display: flex;
      align-items: flex-start;
      justify-content: center;
      flex: 1 1 auto;
    }

    &--link {
      text-decoration: none;
      display: block;
      transition: color 0.2s ease;

      @include media-breakpoint-up(lg) {
        display: flex;
        align-items: center;
        justify-content: center;
      }

      // Stretched link — covers the entire card
      &::after {
        content: "";
        position: absolute;
        inset: 0;
      }
      &:focus-visible {
        @include focus-visible($color: $secondary-rosenrot);
        outline-offset: 3px;
      }
      &:focus {
      }
    }
  }

  // Background cards have a fixed minimum card height; title should not stretch
  // to fill remaining space there.
  &[class*="--bg-"] &__title {
    @include media-breakpoint-up(lg) {
      flex: 0 0 auto;
    }
  }

  // ==========================================================================
  // Background Color Variants
  // ==========================================================================

  // Green background
  &--bg-green {
    background-color: $secondary-grasgruen;

    #{$self}__icon .material-symbols-outlined {
      color: $white;
    }

    #{$self}__title {
      color: $white;
    }
  }

  // Wine/Burgundy background
  &--bg-wine {
    background-color: $secondary-purpurrot;

    #{$self}__icon .material-symbols-outlined {
      color: $white;
    }

    #{$self}__title {
      color: $white;
    }
  }

  // Blue background
  &--bg-blue {
    background-color: $primary;

    #{$self}__icon .material-symbols-outlined {
      color: $white;
    }

    #{$self}__title {
      color: $white;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .c-icon-card {
    &,
    &__icon .material-symbols-outlined {
      transition: none;
    }
  }
}
