/*
 * The designed date picker (assets/src/datepicker.js).
 *
 * The button and the card are the dropdown's (ecc-select.css), so a date
 * field is the same height, border and radius as the selects beside it and
 * opens the same card. What is here is the calendar inside it, drawn in the
 * page's own vocabulary: a chosen day is filled like the checked option of
 * the All / Upcoming / Past control, today is ringed, and the days between a
 * From and a To are shaded in the site's soft green.
 */

.ecc-datepicker__button .ecc-select__value.is-placeholder {
	color: var(--ecc-muted, #5A5A54);
}

.ecc-datepicker__icon {
	flex: 0 0 auto;
	color: var(--ecc-muted, #5A5A54);
	transition: color 0.15s ease;
}

.ecc-datepicker.is-open .ecc-datepicker__icon,
.ecc-datepicker__button:hover .ecc-datepicker__icon {
	color: var(--ecc-accent, #4A7326);
}

/* --- the card ---------------------------------------------------------------- */

.ecc-datepicker-menu {
	width: 316px;
	padding: 14px 14px 10px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.ecc-datepicker__head {
	display: flex;
	align-items: center;
	gap: 4px;
	margin: 0 0 8px;
}

.ecc-datepicker__month {
	flex: 1 1 auto;
	order: -1;
	padding: 0 6px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.01em;
	color: var(--ecc-ink, #0A1312);
}

.ecc-datepicker__nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--color-pill-border, #D9D6CC);
	border-radius: 9px;
	background: var(--ecc-surface, #fff);
	color: var(--ecc-ink, #0A1312);
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ecc-datepicker__nav:hover {
	border-color: #BDB9AC;
	background: var(--color-pill-bg, #EFEBE0);
}

.ecc-datepicker__nav:focus-visible {
	outline: none;
	border-color: var(--ecc-fill, #7CB342);
	box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.25);
}

/* --- the month --------------------------------------------------------------- */

.ecc-datepicker__grid {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	border-spacing: 0;
	table-layout: fixed;
	background: none;
}

/* The theme styles tables in articles; none of that belongs here. */
.ecc-datepicker__grid th,
.ecc-datepicker__grid td {
	padding: 0;
	border: 0;
	background: none;
	text-align: center;
	vertical-align: middle;
}

.ecc-datepicker__grid th {
	padding: 4px 0 8px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ecc-muted, #5A5A54);
}

.ecc-datepicker__grid td {
	padding: 2px 0;
}

/* The range is a band behind the days, cut square between them and rounded
   at its two ends, so a week of it reads as one stretch rather than a row of
   separate pills. */
.ecc-datepicker__grid td.is-in-range {
	background: linear-gradient(var(--ecc-soft, #E6F4EA), var(--ecc-soft, #E6F4EA)) center / 100% 38px no-repeat;
}

.ecc-datepicker__grid td.is-range-start {
	background: linear-gradient(var(--ecc-soft, #E6F4EA), var(--ecc-soft, #E6F4EA)) right center / 50% 38px no-repeat;
}

.ecc-datepicker__grid td.is-range-end {
	background: linear-gradient(var(--ecc-soft, #E6F4EA), var(--ecc-soft, #E6F4EA)) left center / 50% 38px no-repeat;
}

.ecc-datepicker__day {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ecc-ink, #0A1312);
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
	-webkit-tap-highlight-color: transparent;
}

.ecc-datepicker__day:hover:not(:disabled) {
	background: var(--color-pill-bg, #EFEBE0);
}

.ecc-datepicker__grid td.is-in-range .ecc-datepicker__day:hover:not(:disabled) {
	background: rgba(124, 179, 66, 0.28);
}

.ecc-datepicker__day.is-outside {
	color: #A9A69B;
}

.ecc-datepicker__day.is-today {
	box-shadow: inset 0 0 0 1.5px var(--ecc-accent, #4A7326);
	color: var(--ecc-accent, #4A7326);
	font-weight: 700;
}

.ecc-datepicker__day.is-endpoint {
	background: rgba(124, 179, 66, 0.35);
}

.ecc-datepicker__day.is-selected,
.ecc-datepicker__day.is-selected:hover:not(:disabled) {
	background: var(--ecc-fill, #7CB342);
	color: var(--ecc-fill-ink, #0A1312);
	font-weight: 700;
	box-shadow: none;
}

.ecc-datepicker__day:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px var(--ecc-surface, #fff), 0 0 0 4px var(--ecc-fill, #7CB342);
}

.ecc-datepicker__day:disabled {
	color: #C9C6BC;
	cursor: default;
}

/* --- Clear / Today ----------------------------------------------------------- */

.ecc-datepicker__foot {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	margin: 8px -4px 0;
	padding: 8px 0 0;
	border-top: 1px solid var(--ecc-line, rgba(10, 19, 18, 0.10));
}

.ecc-datepicker__action {
	margin: 0;
	padding: 8px 10px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--ecc-muted, #5A5A54);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.ecc-datepicker__action--today {
	color: var(--ecc-accent, #4A7326);
}

.ecc-datepicker__action--done {
	display: none;
}

.ecc-datepicker__action:hover:not(:disabled) {
	background: var(--color-pill-bg, #EFEBE0);
	color: var(--ecc-ink, #0A1312);
}

.ecc-datepicker__action:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.35);
}

.ecc-datepicker__action:disabled {
	opacity: 0.4;
	cursor: default;
}

/* --- a sheet on a phone ------------------------------------------------------ */

.ecc-select-layer.is-sheet .ecc-datepicker-menu {
	width: auto;
	max-height: calc(100vh - 24px);
	padding-left: 16px;
	padding-right: 16px;
}

.ecc-select-layer.is-sheet .ecc-datepicker__head {
	margin-top: 4px;
}

.ecc-select-layer.is-sheet .ecc-datepicker__month {
	font-size: 17px;
}

.ecc-select-layer.is-sheet .ecc-datepicker__nav {
	width: 44px;
	height: 44px;
}

.ecc-select-layer.is-sheet .ecc-datepicker__day {
	width: 44px;
	height: 44px;
	font-size: 16px;
}

.ecc-select-layer.is-sheet .ecc-datepicker__grid td.is-in-range,
.ecc-select-layer.is-sheet .ecc-datepicker__grid td.is-range-start,
.ecc-select-layer.is-sheet .ecc-datepicker__grid td.is-range-end {
	background-size: 100% 44px;
}

.ecc-select-layer.is-sheet .ecc-datepicker__grid td.is-range-start,
.ecc-select-layer.is-sheet .ecc-datepicker__grid td.is-range-end {
	background-size: 50% 44px;
}

.ecc-select-layer.is-sheet .ecc-datepicker__action {
	min-height: 44px;
	font-size: 16px;
}

/* Clear and Today on the left, Done on the right where the thumb is. */
.ecc-select-layer.is-sheet .ecc-datepicker__foot {
	justify-content: flex-start;
}

.ecc-select-layer.is-sheet .ecc-datepicker__action--done {
	display: block;
	margin-left: auto;
	padding: 8px 22px;
	border-radius: 999px;
	background: var(--ecc-fill, #7CB342);
	color: var(--ecc-ink, #0A1312);
}

.ecc-select-layer.is-sheet .ecc-datepicker__action--done:hover {
	background: var(--ecc-fill, #7CB342);
	color: var(--ecc-ink, #0A1312);
	filter: brightness(0.95);
}

@media (prefers-reduced-motion: reduce) {
	.ecc-datepicker__day,
	.ecc-datepicker__nav,
	.ecc-datepicker__action,
	.ecc-datepicker__icon {
		transition: none;
	}
}
