/**
 * @file
 * Styles for the horizontal calendar strip.
 * Adjust the custom properties to the theme.
 */

.calendar-strip {
  --calendar-strip-day-width: 5.5rem;
  --calendar-strip-accent: #b52764;
  --calendar-strip-accent-text: #fff;
  --calendar-strip-weekend: #2b59c3;
  --calendar-strip-muted: #9a9a9a;
  --calendar-strip-border: #e6e6e6;

  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  border: 1px solid var(--calendar-strip-border);
  border-radius: 0.5rem;
  background: #fff;
}

/* Scrollable area with the days. */
.calendar-strip__viewport {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.calendar-strip__viewport::-webkit-scrollbar {
  display: none;
}

.calendar-strip__days {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.calendar-strip__day {
  flex: 0 0 var(--calendar-strip-day-width);
  margin: 0;
  scroll-snap-align: start;
}

.calendar-strip__day + .calendar-strip__day {
  border-left: 1px solid var(--calendar-strip-border);
}

/* Day cell: month, number, weekday. */
.calendar-strip__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin: 0 0.25rem;
  padding: 0.6rem 0;
  border-radius: 0.375rem;
  color: inherit;
  text-decoration: none;
  text-transform: uppercase;
}

.calendar-strip__month,
.calendar-strip__weekday {
  font-size: 0.75rem;
}

.calendar-strip__number {
  font-size: 1.75rem;
  line-height: 1.2;
}

/* Days without events are not clickable. */
.calendar-strip__day:not(.has-events) .calendar-strip__item {
  color: var(--calendar-strip-muted);
}

/* Days with events: a dot below the weekday. */
.calendar-strip__day.has-events .calendar-strip__item::after {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: var(--calendar-strip-accent);
}

.calendar-strip__day.has-events a.calendar-strip__item:hover,
.calendar-strip__day.has-events a.calendar-strip__item:focus-visible {
  background: #f6e7ee;
}

a.calendar-strip__item:focus-visible {
  outline: 2px solid var(--calendar-strip-accent);
  outline-offset: -2px;
}

.calendar-strip__day.is-weekend.has-events .calendar-strip__item {
  color: var(--calendar-strip-weekend);
}

.calendar-strip__day.is-today .calendar-strip__number {
  font-weight: 700;
}

/* Selected day (or today when no day is selected). */
.calendar-strip__day.is-active .calendar-strip__item,
.calendar-strip:not([data-active]) .calendar-strip__day.is-today .calendar-strip__item,
.calendar-strip[data-active=""] .calendar-strip__day.is-today .calendar-strip__item {
  background: var(--calendar-strip-accent);
  color: var(--calendar-strip-accent-text);
}

.calendar-strip__day.is-active .calendar-strip__item::after,
.calendar-strip[data-active=""] .calendar-strip__day.is-today .calendar-strip__item::after {
  background: var(--calendar-strip-accent-text);
}

/* Arrows. */
.calendar-strip__nav {
  flex: 0 0 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.calendar-strip__nav::before {
  content: "";
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
}

.calendar-strip__nav--prev::before {
  transform: rotate(-45deg);
}

.calendar-strip__nav--next::before {
  transform: rotate(135deg);
}

.calendar-strip__nav:focus-visible {
  outline: 2px solid var(--calendar-strip-accent);
  border-radius: 0.25rem;
}

@media (max-width: 600px) {
  .calendar-strip {
    --calendar-strip-day-width: 3.75rem;
  }

  .calendar-strip__number {
    font-size: 1.375rem;
  }

  .calendar-strip__nav {
    flex-basis: 2rem;
  }
}
