/**
 * EdGEL events components
 */

@use "sass:math";

@use "../settings" as *;
@use "../tools" as *;

.card-event {
  margin-bottom: $grid-gutter-height;
}

/* Image, date and title wrapper */
.card-event-header {
  display: flex;
  flex-basis: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
}

.event-img {
  @include edgel-topline();
  width: 100%;
}

.event-date-title {
  display: flex;
  flex-basis: auto;
  align-items: center;
  justify-content: flex-start;
  padding: $card-spacer-y $card-spacer-x;
}

@include media-breakpoint-up(md) {
  .event-img {
    width: percentage(math.div(1, 3));
  }
  .card-event-header {
    flex-wrap: nowrap;
  }
}

@include media-breakpoint-up(lg) {
  .event-img {
    width: percentage(math.div(1, 4));
  }
}

/* Event title */
.event-title {
  @include font-size(1.25rem);
  @include padding-left(.75rem);
  margin: 0 0 0 -2px;
  border-left: solid 2px $brand-color;
}

/* Date section */
.event-date {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  @include padding-right(.75rem);
  white-space: nowrap;
  border-right: solid 2px $brand-color;
}

.event-date-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: $font-weight-semibold;
  line-height: .9;
}

.event-month {
  font-size: 1.05em;
  line-height: .6;
  text-transform: uppercase;
}

.event-day {
  font-size: 1.9em;
  font-weight: $font-weight-bold;
  color: $brand-color;
}

.event-year {
  line-height: .7;
}

.event-time {
  padding-top: .4em;
  margin-top: .5em;
  font-size: .9em;
  font-weight: $font-weight-normal;
  border-top: solid 1px $gray-300;
}

.event-date-separator {
  padding: 0 2px;
  font-size: 1.9em;
  font-weight: $font-weight-bold;
  color: $brand-color;
}

.event-link {
  --#{$prefix}link-font-weight: #{$font-weight-base};
  --#{$prefix}link-hover-color-rgb: #{to-rgb($brand-link-color)};
  --#{$prefix}link-decoration-opacity: 0;
  display: block;
  padding: space(1) space(1) space(1) 2.5em;
  margin-top: space(1);
  color: $brand-bg-text;
  background: $brand-color;
  border-color: $brand-color;
  @include box-shadow($btn-box-shadow);

  &::before {
    display: inline-block;
    width: 1em;
    height: 1.2em;
    margin-right: .5em;
    margin-left: -1.7em;
    vertical-align: middle;
    content: "";
    background-repeat: no-repeat;
    background-size: contain;
  }
}

.event-link-info::before {
  background-image: escape-svg($uoe-chevron-icon-brand-bg);
}

.event-link-location::before {
  background-image: escape-svg($uoe-location-icon-brand-bg);
}

/* Event panel elements when used in listings */
.event-listing-img {
  @include edgel-topline();
  height: 0;
  // Ensure badly-sized images are cropped
  padding-bottom: percentage(math.div(4, 9));
  overflow: hidden;

  /* Fallback display calendar icon on grey background */
  background-color: $gray-200;
  background-image: escape-svg($uoe-calendar-icon-bg);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 30%;
}

/* Ensure the image is rendered over the calendar icon and padding */
.event-listing-img > * {
  width: 100%;
}

/* Event summary in listing */
.event-listing {
  flex-grow: 3;
  @include padding-left(.75rem);
  margin: 0 0 0 -2px;
  border-left: solid 2px $brand-color;
}

.event-listing-title {
  @include font-size(1.25rem);
}

.event-listing-img-col {
  display: none;
  flex-shrink: 0;
  width: 25%;
  margin: -#{$card-spacer-y} -#{$card-spacer-x} -#{$card-spacer-y} #{$card-spacer-x};

  @include media-breakpoint-up("lg") {
    display: block;
  }
}

/* Related events block */
.event-related {
  padding-top: 60px;
}
