.events {
  // keep the footer below the fold while the event list renders
  min-height: 100vh;
}

.eventWrapper {
  //margin: calc(var(--spacing-sitepadding-block)*-1) calc(var(--spacing-sitepadding-inline)*-1);
}

.noEvents {
  padding-bottom: var(--spacing-sitepadding-block);
}

.eventList {
  padding: var(--spacing-sitepadding-block) 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: var(--spacing-gap-column);
  row-gap: var(--spacing-gap-row);
  padding-bottom: var(--spacing-section-bottom);
}

.displayOptions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  align-items: center;
  position: relative;
  z-index: 10;
  transition: background-color .5s ease;

  >div {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
  }

  button {
    margin-bottom: 0;
  }

  .filterButtons {
    margin: 0 0 0 auto;
  }

  &[data-showFilter=true] {
    background-color: var(--color-background-secondary);
  }
}

.eventCalendar {
  position: relative;
  margin: var(--spacing-sitepadding-block) 0 var(--spacing-section-bottom);
}

.calendarYearMonth {
  border-top: var(--border);
  &:last-child {
    border-bottom: var(--border);
  }

  h2 {
    font-size: var(--font-size-h3);
    padding: var(--spacing-s) 0;
    position: relative;
    cursor: pointer;

    &:first-letter {
      text-transform: capitalize;
    }

    &:before {
      content: "";
      display: block;
      position: absolute;
      width: var(--size-icon);
      height: var(--size-icon);
      background-size: 100%;
      background-image: url("/assets/icons/circle-arrow-right.svg");
      right: 0;
      transform: rotate(-90deg);
      transition: transform .3s ease;
    }
  }

  &[data-collapsed=true] {
    > .calendarWeek,
    > .calendarWeekEmpty {
      display: none;
    }
    h2:before {
      transform: rotate(90deg);
    }
  }
}

.calendarWeek {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--color-background-secondary);

  .calendarDay {
    background: var(--color-background-secondary);

    &:nth-of-type(even) {
      background: var(--color-background);
    }
  }

  &:nth-of-type(even) {
    .calendarDay {
      background: var(--color-background);

      &:nth-of-type(even) {
        background: var(--color-background-secondary);
      }
    }
  }

  &:first-of-type {
    margin-top: var(--spacing-s);
  }

  &:last-child {
    margin-bottom: var(--spacing-section-bottom);
  }
}

.calendarWeekEmpty {}

.calendarDay {
  min-height: 11rem;
  padding: .4rem;

  &:nth-of-type(even) {
    background: var(--color-background);
  }

  h3 {
    font-family: var(--font-main);
    font-size: var(--font-size-caption);
    font-weight: 500;
    margin: -.3rem -.3rem .4rem -.3rem;
    text-align: center;
    background: var(--color-chateauBlue);
    color: var(--color-betongGray);
    padding: .3em .4em;


    &:first-letter {
      text-transform: capitalize;
    }
  }
}

.eventCounter {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--font-size-body);
  display: inline-block;
  vertical-align: middle;
}

@media (max-width: 1200px) {
  .eventList {
    grid-template-columns: 1fr 1fr;
  }

  .calendarWeek {
    grid-template-columns: 1fr;
  }

  .calendarDay {

    min-height: 0;
    padding: 0 0 calc(var(--spacing-gap-column)/2);

    h3 {
      margin: 0 0 .4rem;
    }

    &.empty {
      display: none;
    }

    ul {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      column-gap: var(--spacing-gap-column);
      row-gap: var(--spacing-gap-row);
    }

    &:first-child,
    &:last-child {
      padding: 0 0 calc(var(--spacing-gap-column)/2);
    }
  }
}

@media (max-width: 700px) {
  .eventList {
    grid-template-columns: 1fr;
  }
  .calendarDay {
    ul {
      display: flex;
      flex-wrap: wrap;
      column-gap: var(--spacing-gap-column);
      row-gap: var(--spacing-gap-row);
    }
  }
  .displayOptions {
    .displayButtons {
      width: 100%;
      flex-wrap: wrap;
    }
    .filterButtons {
      margin: 0;
    }
  }
}
