/*
 * Month calendar. design/DESIGN-SYSTEM.md §4.17, grid §3.4 (repeat(7,1fr), 6px).
 *
 * Week starts Monday. Five cell states: available, selected, fully booked, past
 * (which the theme also uses for "beyond the booking horizon" -- the same
 * "not offered" meaning, and the design has no sixth state for it) and the
 * leading blank.
 *
 * §4.17 RECOMMENDs the hover the prototype lacks; it is applied to selectable
 * cells only.
 *
 * TODO token: rgba(255,255,255,0.22), the sub-label colour of a full day, has no
 * token (tokens.css has 0.27 as --sp-text-disabled and 0.40 as --sp-text-40).
 */

.sp-cal__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--sp-3);
	margin-bottom: var(--sp-4);
}

.sp-cal__head .sp-modal__field-label {
	margin: 0;
}

.sp-cal__nav {
	display: flex;
	align-items: center;
	gap: 10px;
}

.sp-cal__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	background: none;
	border: var(--sp-border-ghost);
	border-radius: var(--sp-radius);
	color: var(--sp-text);
	font-size: var(--sp-fs-md);
	line-height: 1;
	cursor: pointer;
	transition: border-color var(--sp-dur-fast) var(--sp-ease);
}

.sp-cal__arrow:hover,
.sp-cal__arrow:focus-visible {
	border-color: var(--sp-red);
}

.sp-cal__arrow[aria-disabled="true"] {
	opacity: .4;
	cursor: not-allowed;
}

.sp-cal__arrow[aria-disabled="true"]:hover {
	border-color: var(--sp-line-ghost);
}

.sp-cal__month {
	min-width: 170px;
	margin: 0;
	text-align: center;
	font-family: var(--sp-font-display);
	font-style: italic;
	font-weight: 800;
	font-size: var(--sp-fs-lg);
	line-height: var(--sp-lh-display);
	text-transform: uppercase;
	color: var(--sp-text);
}

/* --------------------------------------------------------------- the grid */

.sp-cal__dow,
.sp-cal__grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 6px;
}

.sp-cal__dow {
	margin-bottom: 6px;
}

.sp-cal__dow-cell {
	padding: var(--sp-1) 0;
	text-align: center;
	font-size: var(--sp-fs-tiny);
	letter-spacing: var(--sp-ls-eyebrow);
	text-transform: uppercase;
	color: var(--sp-text-40);
}

.sp-cal__grid.is-loading {
	opacity: .5;
}

.sp-cal__cell {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	aspect-ratio: 1;
	padding: 0;
	background: var(--sp-bg-deep);
	border: 1px solid var(--sp-line-strong);
	border-radius: var(--sp-radius);
	color: var(--sp-text);
	font-family: var(--sp-font-display);
	font-style: italic;
	font-weight: 700;
	font-size: var(--sp-fs-btn);
	line-height: var(--sp-lh-display);
	cursor: pointer;
	transition: border-color var(--sp-dur-fast) var(--sp-ease);
}

.sp-cal__cell:hover:not(:disabled),
.sp-cal__cell:focus-visible {
	border-color: var(--sp-line-hover);
}

.sp-cal__cell:disabled {
	cursor: not-allowed;
}

.sp-cal__cell--blank {
	background: transparent;
	border-color: transparent;
	cursor: default;
}

.sp-cal__free {
	font-family: var(--sp-font-body);
	font-style: normal;
	font-weight: 400;
	font-size: var(--sp-fs-nano);
	letter-spacing: var(--sp-ls-nav);
	line-height: 1;
	color: var(--sp-red-sublabel);
}

.sp-cal__cell.is-past {
	color: var(--sp-text-disabled);
}

.sp-cal__cell.is-full {
	background: var(--sp-tint-white-3);
	color: var(--sp-text-disabled);
}

.sp-cal__cell.is-full .sp-cal__free {
	color: rgba(255, 255, 255, .22); /* TODO token */
}

.sp-cal__cell.is-selected {
	background: var(--sp-tint-red-20);
	border-color: var(--sp-red);
	color: var(--sp-text);
}

/* ------------------------------------------------- loading / error banner */

.sp-cal__status {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-3);
	margin: var(--sp-4) 0 0;
	font-size: var(--sp-fs-xs);
	color: var(--sp-text-55);
}

.sp-cal__retry {
	padding: var(--sp-2) var(--sp-5);
	background: none;
	border: var(--sp-border-ghost);
	border-radius: var(--sp-radius);
	color: var(--sp-text);
	font-family: var(--sp-font-display);
	font-style: italic;
	font-weight: 700;
	font-size: var(--sp-fs-sm);
	text-transform: uppercase;
	cursor: pointer;
	transition: border-color var(--sp-dur-fast) var(--sp-ease);
}

.sp-cal__retry:hover,
.sp-cal__retry:focus-visible {
	border-color: var(--sp-red);
}
