@layer unstyled-web-components {
  uwc-datepicker {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: fit-content;

    & > ul[role="grid"] {
      display: grid;
      padding: 0;
      width: fit-content;

      [view="day"] & {
        grid-template-columns: repeat(8, 1fr);
      }

      [view="month"] & {
        grid-template-columns: repeat(3, 1fr);
      }

      [view="year"] & {
        grid-template-columns: repeat(3, 1fr);
      }

      li {
        list-style: none;
        height: auto;
        padding: 0.5rem;
        align-self: stretch;
        text-align: center;

        &:where(.previous-month, .next-month) {
          color: gray;
        }
        border: 1px dashed transparent;

        &:where(:not([data-value]), [aria-disabled="true"]) {
          cursor: default;
          pointer-events: none;
          color: lightgray;
        }

        &.weekday {
          pointer-events: unset;
        }

        &[data-value] {
          cursor: pointer;

          &[aria-current="time"] {
            background: highlight;
            color: highlightText;
          }

          &[aria-selected="true"] {
            border-color: blue;
          }
        }
      }
    }

    [part="selection"] {
      display: flex;
      width: 100%;

      [part="current"] {
        flex: 1 1;
        white-space: nowrap;
      }
    }
  }
}
