<template>
  <div class="calendar">
    <p class="calendar__title">{{ monthLabel }}</p>

    <div class="calendar__week">
      <div
        v-for="(d, i) in days"
        :key="i"
        class="calendar__day"
        :class="{ 'calendar__day--active': d.selected }"
      >
        <span v-if="d.marker" class="calendar__marker" />
        <span class="calendar__weekday">{{ d.weekday }}</span>
        <span class="calendar__date">{{ d.day }}</span>
      </div>
    </div>
  </div>
</template>

<script setup>
defineProps({
  monthLabel: { type: String, default: '' },
  /** ordered right-to-left: { weekday, day, selected?, marker? } */
  days: { type: Array, default: () => [] },
})
</script>

<style lang="scss" scoped>
.calendar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.125rem 1rem;
  background: rgba(255, 255, 255, 58%);
  box-shadow: 0 6.75px 19.425px rgba(0, 0, 0, 4%);
  border-radius: 0.9375rem;

  &__title {
    margin: 0;
    text-align: start;
    font-family: var(--font-family-fa);
    font-weight: 500;
    font-size: 1.25rem;
    color: #000;
  }

  &__week {
    display: flex;
    justify-content: space-between;
    gap: 0.125rem;
  }

  &__day {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.125rem;
    border-radius: 999px;

    &--active {
      background: var(--color-secondary);
      box-shadow: 0 9px 9.75px rgba(0, 112, 116, 19%);

      .calendar__weekday,
      .calendar__date {
        color: #fff;
      }
    }
  }

  &__marker {
    position: absolute;
    inset-block-start: 0.125rem;
    inset-inline-start: 0.25rem;
    width: 0.25rem;
    height: 0.25rem;
    border-radius: 50%;
    background: var(--color-secondary);
  }

  &__weekday {
    font-family: var(--font-family-fa);
    font-weight: 400;
    font-size: 0.625rem;
    color: #828282;
    white-space: nowrap;
  }

  &__date {
    font-family: var(--font-family-number-fa);
    font-weight: 700;
    font-size: 0.875rem;
    color: #717171;
  }
}
</style>
