:host(:not(:is([hydrated], .hydrated))) {
  @apply not-hydrated;
}


mds-button,
mds-calendar-cell {
  &:not(:is([hydrated], .hydrated)) {
    @apply not-hydrated;
  }
}


/**
 * @prop --mds-calendar-day-number-color: The color of the day numbers of the current month, weekend days aside (`--mds-calendar-cell-weekend-color`); `--mds-calendar-cell-color` wins over it.
 * @prop --mds-calendar-cell-gap: The spacing between calendar day cells.
 * @prop --mds-calendar-cell-other-month-visibility: Public. Controls visibility of days from other months (e.g. "visible", "hidden").
 * @prop --mds-calendar-border-radius: Public. The border-radius of the calendar container.
 * @prop --mds-calendar-background: Public. The background color of the calendar container.
 * @prop --mds-calendar-max-width: The maximum inline size of the calendar; it fills its container up to this width.
 * @prop --mds-calendar-padding: Public. The internal padding of the calendar container.
 * @prop --mds-calendar-select-month-or-year-height: The height of the month/year selector in the calendar header.
 * @prop --mds-calendar-select-month-or-year-width: The width of the month/year selector in the calendar header.
 */

:host {
  --mds-calendar-day-number-color: rgb(var(--magma-text-default, var(--text-neutral-default, 5 5 5)));
  --mds-calendar-cell-gap: --spacing(50);
  --mds-calendar-cell-other-month-visibility: visible;
  --mds-calendar-border-radius: var(--magma-radius-lg, var(--radius-squircle-lg, 28px));
  --mds-calendar-background: rgb(var(--magma-surface-raised, var(--surface-neutral-raised, 248 248 248)));
  --mds-calendar-padding: --spacing(400);
  --mds-calendar-select-month-or-year-height: --spacing(900);
  --mds-calendar-select-month-or-year-width: --spacing(5600);
  --mds-calendar-max-width: --spacing(12000);

  background-color: rgb(var(--magma-wash-base, var(--tone-neutral-09, 225 225 225)));
  border-radius: var(--mds-calendar-border-radius, var(--magma-radius-lg, var(--radius-squircle-lg, 28px)));
  corner-shape: var(--magma-corner-shape, squircle);
  cursor: auto;
  display: inline-flex;
  inline-size: 100%;
  max-width: var(--mds-calendar-max-width, --spacing(12000));
  min-width: min-content;
  overflow: hidden;
}

.calendar-view {

  /* two calendars side by side are stretched to the taller one: a month of five weeks next to one
     of six spread the extra height between its rows and started its grid lower (#341) */
  align-content: start;
  background-color: var(--mds-calendar-background, rgb(var(--magma-surface-raised, var(--surface-neutral-raised, 248 248 248))));
  border-radius: inherit;
  box-sizing: border-box;
  corner-shape: inherit;
  display: grid;
  flex: 1 1 auto;
  padding: var(--mds-calendar-padding, --spacing(400));
  width: 100%;
}

.calendar-preselection {
  display: none;
  gap: --spacing(50);
  grid-auto-rows: min-content;
  padding: var(--mds-calendar-padding, --spacing(400));
}

.calendar-preselection--has-preselection {
  display: grid;
}

nav {
  display: flex;
  gap: --spacing(200);
  justify-content: space-between;
  min-width: 0;
}

.action {
  justify-content: left;
  min-width: min-content;
  padding-left: --spacing(200);
  padding-right: --spacing(200);
}

.action-back,
.action-forward {
  flex-shrink: 0;
}

.select-month-or-year {
  align-items: stretch;
  background-color: rgb(var(--magma-wash-base, var(--tone-neutral-09, 225 225 225)));
  block-size: var(--mds-calendar-select-month-or-year-height, --spacing(900));

  /* a control of the height of a button: capped as mds-button's (#913) */
  border-radius: min(
    var(--mds-calendar-border-radius, var(--magma-radius-lg, var(--radius-squircle-lg, 28px))),
    var(--magma-corner-cap, 0.5) * var(--mds-calendar-select-month-or-year-height, --spacing(900))
  );
  box-sizing: border-box;
  corner-shape: var(--magma-corner-shape, squircle);
  display: flex;
  flex: 0 0 var(--mds-calendar-select-month-or-year-width, --spacing(5600));
  height: var(--mds-calendar-select-month-or-year-height, --spacing(900));
  inline-size: var(--mds-calendar-select-month-or-year-width, --spacing(5600));
  justify-content: flex-start;
  max-block-size: var(--mds-calendar-select-month-or-year-height, --spacing(900));
  max-height: var(--mds-calendar-select-month-or-year-height, --spacing(900));
  max-inline-size: var(--mds-calendar-select-month-or-year-width, --spacing(5600));
  min-block-size: var(--mds-calendar-select-month-or-year-height, --spacing(900));
  min-height: var(--mds-calendar-select-month-or-year-height, --spacing(900));
  min-inline-size: var(--mds-calendar-select-month-or-year-width, --spacing(5600));
  overflow: hidden;
}

.action-month,
.action-year {
  --mds-button-radius: 0;

  align-self: stretch;
  block-size: 100%;
  box-sizing: border-box;
  cursor: default;
  height: 100%;
  max-block-size: 100%;
  max-height: 100%;
  min-block-size: 0;
  min-height: 0;
  padding-left: --spacing(200);
  padding-right: --spacing(200);
}

.action-month {
  flex: 1 1 auto;
  min-width: 0;
}

.action-year {
  flex: 0 0 --spacing(1800);
}

.action-month::part(label),
.action-year::part(label) {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.week-day-name {
  align-items: center;
  block-size: --spacing(1200);
  inline-size: 100%;
  min-height: auto;
  padding: 0;
}

.month-view {
  display: grid;
}

.month-view__days-names,
.month-view__cells {
  display: grid;
  gap: var(--mds-calendar-cell-gap);
  grid-template-columns: repeat(7, minmax(1px, 100%));
  min-width: 0;
}

.month-view {
  display: grid;
}

.month-view__month-names,
.month-view__years {
  display: grid;
  gap: var(--mds-calendar-cell-gap);
  grid-template-columns: repeat(3, minmax(1px, 100%));
  min-width: 0;
}

