.npc-post-calendar {
  --npc-calendar-text: #f7e4f1;
  --npc-post-title: #00ffff;
  --npc-highlight: #00ffff;
  --npc-inactive-opacity: 0.5;
  --npc-post-title-size: 20px;
  --npc-arrow-size: 30px;
  box-sizing: border-box;
  max-width: 760px;
  margin: 0 auto;
  color: var(--npc-calendar-text);
}

.npc-post-calendar *,
.npc-post-calendar *::before,
.npc-post-calendar *::after {
  box-sizing: border-box;
}

.npc-calendar__body {
  width: 100%;
}

.npc-calendar__controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(112px, auto) auto;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.npc-calendar__month,
.npc-calendar__year {
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid currentColor;
  border-radius: 0;
  padding: 0.45rem 0.7rem;
  font: inherit;
  line-height: 1.25;
}

.npc-calendar__month {
  color: var(--npc-calendar-text);
  background: transparent;
}

.npc-calendar__month option {
  color: #1d2327;
  background: #ffffff;
}

/* The native year menu stays independently styled and scrolls in the browser. */
.npc-calendar__year {
  color: #1d2327;
  border-color: #ffffff;
  background: #ffffff;
}

.npc-calendar__nav {
  display: inline-grid;
  width: calc(var(--npc-arrow-size) + 10px);
  height: calc(var(--npc-arrow-size) + 10px);
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--npc-calendar-text);
  background: transparent;
  font-family: inherit;
  font-size: var(--npc-arrow-size);
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

.npc-calendar__nav:hover,
.npc-calendar__nav:focus-visible {
  color: var(--npc-highlight);
  background: color-mix(in srgb, var(--npc-highlight) 15%, transparent);
  outline: none;
}

.npc-calendar__nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.npc-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  width: 100%;
}

.npc-calendar__weekday {
  padding: 0.4rem 0.1rem;
  color: var(--npc-calendar-text);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.npc-calendar__blank,
.npc-calendar__day {
  aspect-ratio: 1 / 1;
  min-height: 2.45rem;
}

.npc-calendar__day {
  display: grid;
  place-items: center;
  width: 100%;
  margin: 0;
  padding: 0.15rem;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--npc-calendar-text);
  background: transparent;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, opacity 160ms ease, border-color 160ms ease;
}

.npc-calendar__day:hover,
.npc-calendar__day:focus-visible {
  border-color: var(--npc-calendar-text);
  outline: none;
}

/* Dates that contain posts use the requested highlight at 50% opacity until selected. */
.npc-calendar__day--has-posts {
  color: var(--npc-highlight);
  border-color: currentColor;
  opacity: var(--npc-inactive-opacity);
  font-weight: 700;
}

.npc-calendar__day--has-posts:hover,
.npc-calendar__day--has-posts:focus-visible {
  opacity: 1;
}

/* A selected date with posts becomes fully #00ffff by default. */
.npc-calendar__day--selected {
  color: #061416;
  border-color: var(--npc-highlight);
  background: var(--npc-highlight);
  opacity: 1;
}

.npc-calendar__day--selected:hover,
.npc-calendar__day--selected:focus-visible {
  color: #061416;
}

.npc-posts {
  margin-top: 1.5rem;
}

.npc-posts__heading,
.npc-posts__empty {
  margin: 0 0 0.8rem;
  color: var(--npc-calendar-text);
}

.npc-posts__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.npc-posts__item + .npc-posts__item {
  margin-top: 0.65rem;
}

.npc-posts__link {
  color: var(--npc-post-title) !important;
  font-size: var(--npc-post-title-size);
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}

.npc-posts__link:hover,
.npc-posts__link:focus-visible {
  color: var(--npc-post-title) !important;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.npc-post-calendar.is-loading {
  pointer-events: none;
}

.npc-post-calendar.is-loading .npc-calendar__body,
.npc-post-calendar.is-loading .npc-posts {
  opacity: 0.55;
}

.npc-posts__error {
  color: #ffb6c1;
}

@media (max-width: 480px) {
  .npc-calendar__controls {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .npc-calendar__month {
    grid-column: 2 / 3;
  }

  .npc-calendar__year {
    grid-column: 2 / 3;
    grid-row: 2;
  }

  .npc-calendar__controls .npc-calendar__nav:last-child {
    grid-column: 3;
    grid-row: 1 / 3;
  }

  .npc-calendar__controls .npc-calendar__nav:first-child {
    grid-column: 1;
    grid-row: 1 / 3;
  }

  .npc-calendar__weekday {
    font-size: 0.7rem;
  }

  .npc-calendar__grid {
    gap: 0.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .npc-post-calendar *,
  .npc-post-calendar *::before,
  .npc-post-calendar *::after {
    transition-duration: 0.01ms !important;
  }
}
