.upcoming-events-list {
  font-family: 'Nunito';
  margin-bottom: 3em;
}

html[lang="ru_RU"].upcoming-events-list .weekday {
  text-transform: lowercase;
}

.upcoming-events-list .date-anchor {
  --links-dashed-underline: rgba(0, 0, 0, 0.4);
  color: black;
}

.calendar-settings {
  font-family: Nunito;
  font-size: 0.875em;
  margin-top: 2em;
  margin-bottom: 1em;
  min-height: calc(1.5em + 1px); /* to fix the bug with moving bottom on link hover */
}

.time-switcher #timezone_set,
.time-switcher #client-timezone-code {
  font-size: 0.875em;
}

.time-switcher input[type="radio"] {
  display: none;
}

.time-switcher input[type="radio"] + label {
  color: var(--accent-color);
  cursor: pointer;
  background: inherit;
  padding: 5px;
  box-decoration-break: clone;
}

.time-switcher input[type="radio"] + label > span {
  border-bottom: 1px dashed var(--links-dashed-underline);
}

.time-switcher input[type="radio"]:checked + label {
  pointer-events: none;
  color: black;
  background: #f1f3f6;
  border-radius: 5px;
}

.time-switcher input[type="radio"]:checked + label span {
  border-bottom: none;
}

.time-switcher .delimiter {
  margin-left: -5px;
}

.calendar {
  border: none;
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  font-family: 'Nunito';
}

.calendar + .calendar {
  margin-top: 30px;
}

.calendar-embed {
  margin-top: 1em;
  margin-bottom: 2em;
}

.calendar.monthly .wrapper {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.calendar td.has-events:target {
  /* make animation */
}

.calendar.monthly tr {
  height: calc(5.5em + 10px);
  box-sizing: border-box;
}

.calendar.monthly th,
.calendar.monthly td {
  border: 1px solid #ccc;
  padding: 5px;
  vertical-align: top;
  height: 100%;
}

.calendar.monthly .flex {
  justify-content: space-between;
}

.calendar.monthly .month-name {
  font-size: 0.75em;
  color: #999;
  align-self: center;
}

.calendar.monthly .new-month {
  border-left-width: 3px;
}

.calendar.monthly .new-month-row + .new-month-row td {
  border-top-width: 3px;
}

.calendar.monthly td.new-month-before,
.calendar.monthly .previous-month {
  border-bottom-width: 3px;
}

.calendar.monthly td.new-month-before:last-child:not(:nth-child(7)) {
  border-right-width: 3px;
}

.calendar.monthly td.new-month,
.calendar.monthly td.new-month-after {
  border-top-width: 3px;
}

.calendar.monthly .new-month-row + .new-month-row td.new-month {
  border-left-width: 1px;
}

.calendar td.today {
  outline: 3px solid var(--accent-color);
}

.calendar.monthly td.has-events a {
  padding: 5px;
  margin: -5px;
  display: block;
  border-bottom: none;
}

.calendar.monthly td.has-events a .bordered {
  color: inherit;
  fill: inherit;
  /* when the new design is ready, probably count the border color */
}


.calendar.monthly td.continuous {
  background: linear-gradient(90deg, currentcolor 0%, #fff 200%);
  color: #f1f3f6;
}

.calendar.monthly td.continuous:not(.has-events.repeated-weekly) + td {
  background: linear-gradient(90deg, currentcolor -100%, #fff 100%)
}

.calendar.yearly td.continuous .wrapper::after {
  content: '';
  width: 200%;
  display: block;
  background: linear-gradient(90deg, currentColor 0%, #fff 100%);
  height: 100%;
  position: absolute;
  top: 0;
  z-index: -1;
  margin: 0 -5px;
  border-radius: 30px 0 0 30px;
}

.has-events .wrapper > :not(a) > *:not(a),
.has-events .wrapper > :not(a) {
  color: black;
}

.calendar.monthly td.past {
  background: #f6f6f6;
}

.calendar td.past,
.calendar td.past .day-number,
.calendar td.past .event .time,
.calendar td.past .event .title,
.calendar td.past .event .title * {
  color: #999 !important;
  border-bottom-color: var(--links-underline-meta);
}

.calendar td.past a .event .title .bordered {
  border-bottom-color: rgba(153, 153, 153, 0.2) !important;
}

.calendar.monthly .has-events a .day-number,
.calendar.monthly td.has-events.continuous + td .day-number,
.calendar.yearly .has-events .event .date,
.calendar .has-events .event .time {
  color: black;
}

.calendar.monthly .event {
  font-size: 0.75em;
  line-height: 1.25;
}

.calendar.monthly .event:not(:only-child) {
  margin: 0 -5px;
  padding: 5px;
  flex-grow: 1;
}

.calendar.monthly .event:not(:only-child):last-child {
  margin-bottom: -5px;
  padding-bottom: 5px;
}

.calendar .has-events .event .time {
  font-size: smaller;
  color: black;
}

.calendar.monthly .event .title {
  display: inline;
}

.calendar .event .timezone {
  text-transform: uppercase;
  font-size: smaller;
}

.calendar.yearly {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  justify-content: space-between;
  align-items: flex-start;
  gap: 25px;
}

.calendar.yearly th,
.calendar.yearly td {
  text-align: center;
  box-sizing: border-box;
}

.calendar.yearly th {
  padding: 5px;
}

.calendar.yearly td {
  padding: 0;
  vertical-align: middle;
  height: calc(1.5em + 10px);
  width: calc(100% / 7);
}

.calendar.yearly .wrapper {
  width: calc(1.5em + 10px);
  max-height: calc(1.5em + 10px); /* max- because otherwise, it gets sticked to the bottom somehow */
  box-sizing: border-box;
  cursor: default;
  display: inline-block;
}

.calendar.yearly .has-multiple-events .wrapper,
.calendar.yearly .wrapper > a {
  display: inline-block;
  padding: 5px;
  margin: -5px;
}

.calendar.yearly .has-events:hover {
  cursor: pointer;
}

.calendar.yearly .has-events .wrapper {
  border-radius: 30px;
  cursor: pointer;
  outline: 1px solid var(--links-underline);
  margin: -5px;
  padding: 5px;
}

.calendar.yearly .has-events:hover .wrapper {
  outline: none;
}

.calendar.yearly .has-events {
  position: relative;
}

.calendar.yearly .has-events a,
article .calendar.yearly .has-events a /* for greater specificity when embedding into LD */{
  border-bottom: none;
}

.calendar.yearly .has-multiple-events .day-number::after {
  content: attr(data-events-count);
  position: absolute;
  display: block;
  text-align: center;
  bottom: -10%;
  width: 100%;
  left: 0;
}

.calendar.yearly .has-events .events {
  display: none;
  position: absolute;
  bottom: 22px;
  left: 22px;
  z-index: 99999;
  padding: 10px;
  border-radius: 5px;
  background: white;
  margin: 0px;
  -webkit-box-shadow: 0px 0px 5px 0px rgba(164, 164, 164, 1);
  box-shadow: 0px 0px 5px 0px rgba(164, 164, 164, 1);
  width: 250px;
  text-align: left;
}

.calendar.yearly .has-events .events .event + .event {
  padding-top: 1em;
  margin-top: 1em;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.calendar.yearly .has-events:hover .events,
.calendar.yearly .has-events:focus-within .events {
  display: block;
  display: flex;
  flex-direction: column;
}

.calendar.yearly .has-events:not(.has-multiple-events):hover .events .event .title .bordered,
.calendar.yearly .has-events:not(.has-multiple-events):focus-within .events .event .title .bordered {
  border-bottom: none;
}

.calendar.yearly .has-events:hover > .event {
  /* not a */
  cursor: auto;
}

.calendar.yearly .has-events .event .time {
  order: 3;
}

.calendar.yearly .has-events .event .title {
  font-size: 1.5em;
  line-height: 1.25;
  margin-bottom: 0.25em;
  box-sizing: border-box;

}

.calendar.yearly .has-events .event .title {
  display: inline-block;
  width: fit-content;
}

.calendar.yearly .has-events:hover a:not(:hover) .title .bordered,
.calendar.yearly .has-events:focus-within .title .bordered {
  color: currentcolor;
  fill: currentcolor;
  border-bottom: 1px solid;
  border-bottom-color: var(--links-underline);
}

.calendar.yearly .has-events:hover a .event:hover .title .bordered {
  color: currentcolor;
  fill: currentcolor;
}

@media screen and (max-width: 750px) {
  .calendar-settings .time-switcher {
    margin-top: 1em;
  }

  .calendar.monthly {
    display: none;
  }

  .calendar.yearly {
    grid-template-columns: 1fr;
  }

  .calendar.yearly td {
    height: calc(1.5em + 10px + 2vw);
  }

  .calendar.yearly .month {
    width: 100%;
  }

  .calendar.yearly .month .year-3 {
    display: none;
  }

  .calendar.yearly .has-events:hover .event,
  .calendar.yearly .has-events:focus-within .event {
    display: block;
    display: flex;
    flex-direction: column;
  }

  .calendar.yearly .has-events .events {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
  }

  .calendar.yearly .has-events:focus-within a .title .bordered:hover {
    /* removing border-bottom on click */
    border-bottom: none;
  }

  .calendar.yearly td.continuous:last-child .wrapper::after {
    width: 100%;
    background: linear-gradient(90deg, currentColor 50%, #fff 100%);
  }
}


@media screen and (min-width: 751px) {
  .calendar-settings {
    display: flex;
    justify-content: space-between;
  }

  .calendar.yearly {
    font-size: 0.8em;
  }

  .calendar.yearly:not(.calendar-embed) .month:nth-child(-n+3) {
    display: none;
  }

  .upcoming-events-list .date-anchor {
    pointer-events: none;
    border-bottom: none;
    border-bottom-style: none !important;
  }
}