//
// CivicTheme Event Card component styles.
//

@use 'sass:map';

.ct-event-card {
  $root: &;

  & {
    @include ct-elevation(2);

    position: relative;
    border-radius: var(--ct-event-card-border-radius);
    width: 100%;

    // Event image from "spilling" over the border radius.
    overflow: hidden;
    display: flex;
    flex-direction: column;

    &:hover {
      outline: 1px solid transparent;
    }
  }

  &--card-clickable {
    @include ct-elevation-interaction();

    #{$root}__title-link {
      @include ct-link-cover-parent();
    }
  }

  &:not(#{$root}--with-image) {
    @include ct-highlight-stripe-horizontal(var(--ct-event-card-stripe-height), var(--ct-event-card-border-radius), 0);
  }

  #{$root}__image {
    @include ct-image-fit();

    & {
      position: relative;
      height: var(--ct-event-card-image-height-mobile);
      width: var(--ct-event-card-image-width-mobile);
    }

    @include ct-breakpoint(m) {
      height: var(--ct-event-card-image-height-desktop);
      width: var(--ct-event-card-image-width-desktop);
    }
  }

  #{$root}__content {
    padding: ct-spacing(3);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: ct-spacing(2);
  }

  #{$root}__title {
    @include ct-typography('heading-4');
  }

  #{$root}__title-link {
    @include ct-font-size-inherit();

    text-decoration: none;

    &:focus-visible {
      @include ct-outline();
      @include ct-outline-border();
    }

    &:hover {
      text-decoration: underline;
    }

    &:visited {
      color: inherit;
    }
  }

  #{$root}__location {
    @include ct-typography('label-regular');
  }

  #{$root}__tags {
    display: flex;
    margin-top: auto;
    align-items: flex-end;
    gap: ct-spacing(1);
  }

  #{$root}__link-graphic {
    @include ct-flex-align-right();

    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: ct-spacing(4);
    height: ct-spacing(4);
    pointer-events: none;

    &::before {
      content: '';
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      opacity: var(--ct-event-card-link-graphic-hover-opacity);
      border-radius: 100%;
    }
  }

  @include ct-component-theme($root) using($root, $theme) {
    @include ct-component-property($root, $theme, background-color);

    &#{$root}--card-clickable {
      &:hover {
        @include ct-component-property($root, $theme, hover, outline-color);

        #{$root}__title-link {
          @include ct-component-property($root, $theme, title, hover, color);
        }

        #{$root}__link-graphic {
          &::before {
            @include ct-component-property($root, $theme, link, graphic, hover, background-color);
          }
        }
      }
    }

    &:not(#{$root}--card-clickable) {
      #{$root}__title-link {
        &:hover {
          @include ct-component-property($root, $theme, title, hover, color);
        }
      }
    }

    #{$root}__title,
    #{$root}__title-link {
      @include ct-component-property($root, $theme, title, color);
    }

    #{$root}__link-graphic {
      @include ct-component-property($root, $theme, link, graphic, color);
    }

    &#{$root}:not(#{$root}--with-image) {
      @include ct-highlight-stripe-background-color(ct-component-var($root, $theme, stripe, background-color));
    }
  }
}
