/* Date picker (js/ui/datepicker.js). Prefix .dp-. Used inline (Plan) and in a sheet (pickDate). */

.dp { width: 100%; max-width: 380px; user-select: none; -webkit-user-select: none; }

/* ---------- head: month on the left, arrows on the right ---------- */
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 0 10px; }
.dp-title { min-width: 0; padding-left: 4px; font-size: 17px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.25; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.dp-navs { display: flex; gap: 4px; flex: none; }
.dp-nav {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%; background: rgb(var(--fg-rgb) / 0.06); color: var(--fg); cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast), opacity var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
}
.dp-nav svg { width: 18px; height: 18px; }
.dp-nav:active { transform: scale(0.9); }
.dp-nav:disabled { opacity: 0.28; cursor: default; pointer-events: none; }
@media (hover: hover) { .dp-nav:hover { background: rgb(var(--fg-rgb) / 0.11); } }
[dir="rtl"] .dp-nav:not(.dp-close) svg { transform: scaleX(-1); }
.dp-close { margin-left: 8px; color: var(--muted); }
.dp-close svg { width: 15px; height: 15px; }
@media (hover: hover) { .dp-close:hover { color: var(--fg); } }

/* ---------- weekdays and days ---------- */
.dp-wd, .dp-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dp-wd span { padding: 4px 0 6px; text-align: center; font-size: 12px; font-weight: 550; letter-spacing: 0.01em; color: var(--muted); overflow: hidden; text-overflow: clip; white-space: nowrap; }
.dp-wd span:nth-child(n+6) { color: var(--faint); }
.dp-grid { display: grid; gap: 2px; touch-action: pan-y; }
.dp-cell { display: grid; place-items: center; min-width: 0; }
/* an empty cell is as tall as a day, so a month with 4 or 5 weeks keeps the height of a 6-week one */
.dp-pad { display: block; width: 100%; max-width: 48px; aspect-ratio: 1; min-height: 40px; visibility: hidden; }

.dp-day {
  position: relative; display: grid; place-items: center;
  width: 100%; max-width: 48px; aspect-ratio: 1; min-height: 40px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--fg); cursor: pointer;
  font: 550 16px/1 var(--f-sans); letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
}
.dp-day:active { transform: scale(0.9); }
@media (hover: hover) { .dp-day:not([aria-disabled]):not([aria-selected="true"]):hover { background: rgb(var(--fg-rgb) / 0.08); } }

/* today: a thin ring and a heavier number */
.dp-day[aria-current="date"] { box-shadow: inset 0 0 0 1.5px rgb(var(--fg-rgb) / 0.55); font-weight: 750; }

/* keyboard focus: a soft tint and a ring in the main-button colour (blue for Graphite, whose accent is grey),
   clearly unlike today's quiet grey ring */
.dp-day:focus-visible:not([aria-selected="true"]) {
  outline: none; background: rgb(var(--cta-rgb, var(--accent-rgb)) / 0.16);
  box-shadow: inset 0 0 0 2px rgb(var(--cta-rgb, var(--accent-rgb)));
}

/* days that cannot be picked */
.dp-day[aria-disabled="true"] { color: var(--faint); opacity: 0.55; cursor: default; }
.dp-day[aria-disabled="true"]:active { transform: none; }

/* the picked day: the colour and soft glossy edge of the main buttons (--cta-rgb) */
.dp-day[aria-selected="true"] {
  background: rgb(var(--cta-rgb, var(--accent-rgb)) / 0.9); color: var(--on-accent); font-weight: 700;
  box-shadow: inset 1.5px 2px 1.5px -1px rgb(255 255 255 / 0.55), inset -1.5px -2px 1.5px -1px rgb(255 255 255 / 0.25), 0 6px 16px -8px rgb(var(--cta-rgb, var(--accent-rgb)) / 0.8);
}
.dp-day[aria-selected="true"] { --ring: rgb(255 255 255 / 0.92); }   /* the shared focus ring, white on the filled day */

/* a day that already has something on it */
.dp-dot { position: absolute; left: 50%; bottom: 17%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; opacity: 0.6; }
.dp-day[aria-selected="true"] .dp-dot { opacity: 0.85; }

/* another month slides in */
.dp-grid.is-from-right { animation: dp-in-r 240ms var(--ease-out); }
.dp-grid.is-from-left { animation: dp-in-l 240ms var(--ease-out); }
@keyframes dp-in-r { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes dp-in-l { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
/* a tap on a day that cannot be picked: a small shake */
.dp.is-nope .dp-grid { animation: dp-nope 260ms var(--ease-out); }
@keyframes dp-nope { 20% { transform: translateX(-4px); } 60% { transform: translateX(3px); } }

@media (min-width: 720px) {
  .dp-day { font-size: 15px; max-width: 44px; }
  .dp-pad { max-width: 44px; }
}

/* in a sheet: centred */
.dp-sheet .dp { margin: 0 auto; padding-bottom: 8px; }

@media (prefers-reduced-motion: reduce) {
  .dp-nav, .dp-day { transition: none; }
  .dp-grid.is-from-right, .dp-grid.is-from-left, .dp.is-nope .dp-grid { animation: none; }
}
