/* ——— The month picker ———
   The canvas's 2: the month is the control — the grid's title, each agenda
   heading — and opens a float of two years of twelve months between a
   year stepper. This month is underlined; the month in view wears the
   selected wash. Not <input type="month">, which macOS Safari and desktop
   Firefox draw as a bare text box. */
@layer components {
  /* The heading itself, a quiet button: the month in the medium step, a
     faint chevron that points up while the float is. */
  .calendar-month {
    --btn-padding: 0.25rem 0.375rem;
    --btn-font-size: var(--text-medium);
    --btn-color: var(--color-ink);
    --btn-color-hover: var(--color-ink);
    --btn-background: transparent;
    --btn-background-hover: var(--color-surface);
    --icon-size: 0.875rem;

    gap: 0.25rem;
    font-weight: 600;

    > .icon {
      color: var(--color-ink-subtle);
    }

    &:has(+ :popover-open) > .icon {
      rotate: 180deg;
    }
  }

  /* An agenda's month leads its days, a step larger, at their edge — the
     grid's step again on a phone (the canvas's 11). */
  .calendar-agenda__heading .calendar-month {
    --btn-font-size: var(--text-large);
    --icon-size: 0.9375rem;

    padding-inline-start: 0;

    @container main (width < 35rem) {
      --btn-font-size: var(--text-medium);
    }
  }

  /* Unseen until its years arrive (person-card.css does the same). */
  .month-picker:has(turbo-frame:empty) {
    opacity: 0;
  }

  .month-picker__body {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.25rem;
  }

  .month-picker__years {
    gap: 0.375rem;
  }

  .month-picker__year {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;

    > strong {
      inline-size: 2.75rem;
      font-weight: 600;
    }
  }

  .month-picker__month {
    padding: 3px 7px;
    color: var(--color-ink);
    text-decoration: none;
    border-radius: var(--border-radius);

    &:hover {
      background-color: var(--color-surface);
    }

    &[aria-current] {
      font-weight: 500;
      color: var(--color-selected-ink);
      background-color: var(--color-selected);
    }
  }

  .month-picker__month--now {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}
