/*
 * The studio's date picker (js/sc-calendar.js).
 *
 * Two parts: the button that replaces a date field, and the panel that opens from it. The panel is
 * position: fixed and appended to <body>, so nothing on the page can clip it — these open inside
 * the quote pop-up, which has its own stacking context and its own scrolling.
 */

/* The native <input type="date">, kept for its value and taken out of sight.
   Not display:none — a hidden form control is skipped by some browsers' validation and, more to
   the point, cannot be focused to report an error against. */
.sc-cal-native {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ── The field ─────────────────────────────────────────────────────────────────────────────── */

.sc-cal-field {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .75rem;
	width: 100%;
	min-height: 48px;
	padding: .6rem .9rem;
	border: 2px solid #ece5e6;
	border-radius: .75rem;
	background: #fff;
	color: #9a9092;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	text-align: left;
	cursor: pointer;
}

.sc-cal-field.is-set {
	border-color: #ffc3c9;
	color: #231f20;
}

.sc-cal-field:hover { border-color: #ffc3c9; }

.sc-cal-field:focus-visible {
	outline: 2px solid #fe415f;
	outline-offset: 1px;
}

/* Drawn rather than an icon font: the theme loads Bootstrap Icons on some pages and not others,
   and a missing glyph renders as an empty box right where the calendar is meant to be. */
.sc-cal-icon {
	flex: 0 0 auto;
	position: relative;
	width: 17px;
	height: 16px;
	border: 2px solid currentColor;
	border-radius: 3px;
	opacity: .75;
}

.sc-cal-icon::before {
	content: '';
	position: absolute;
	top: -4px;
	left: 2px;
	right: 2px;
	height: 4px;
	border-left: 2px solid currentColor;
	border-right: 2px solid currentColor;
}

.sc-cal-icon::after {
	content: '';
	position: absolute;
	top: 2px;
	left: -2px;
	right: -2px;
	height: 2px;
	background: currentColor;
}

/* ── The panel ─────────────────────────────────────────────────────────────────────────────── */

.sc-cal {
	position: fixed;
	z-index: 20000;          /* above the quote pop-up, which sits at 10000 */
	width: 310px;
	max-width: calc(100vw - 16px);
	padding: .85rem;
	border: 1px solid #f3e7e9;
	border-radius: 1rem;
	background: #fff;
	box-shadow: 0 18px 44px rgba(35, 31, 32, .18);
	font-family: inherit;
}

.sc-cal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .5rem;
	margin-bottom: .6rem;
}

.sc-cal-title {
	margin: 0;
	font-size: .98rem;
	font-weight: 700;
	color: #231f20;
}

.sc-cal-nav {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: #fff5f6;
	color: #fe415f;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
}

.sc-cal-nav:hover:not(:disabled) { background: #ffe3e7; }

.sc-cal-nav:disabled {
	opacity: .3;
	cursor: default;
}

.sc-cal-dow,
.sc-cal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 2px;
}

.sc-cal-dow {
	margin-bottom: .25rem;
}

.sc-cal-dow span {
	text-align: center;
	font-size: .68rem;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: #9a9092;
}

.sc-cal-day {
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: none;
	color: #231f20;
	font-family: inherit;
	font-size: .9rem;
	font-weight: 600;
	cursor: pointer;
}

.sc-cal-day:hover:not(:disabled) { background: #fff5f6; }

.sc-cal-day:focus-visible {
	outline: 2px solid #fe415f;
	outline-offset: -2px;
}

/* A past date. Greyed and unclickable, and NOT given the hover state — a cursor change on
   something that cannot be chosen is the interface arguing with itself. */
.sc-cal-day.is-out {
	color: #cfc7c8;
	cursor: default;
}

.sc-cal-day.is-today {
	box-shadow: inset 0 0 0 2px #ffc3c9;
}

.sc-cal-day.is-on,
.sc-cal-day.is-on:hover {
	background: #fe415f;
	color: #fff;
}

.sc-cal-clear {
	display: block;
	width: 100%;
	margin-top: .6rem;
	padding: .5rem;
	border: 0;
	border-top: 1px solid #f3e7e9;
	border-radius: 0;
	background: none;
	color: #fe415f;
	font-family: inherit;
	font-size: .9rem;
	font-weight: 700;
	cursor: pointer;
}

.sc-cal-clear:hover { color: #d9304b; }

@media (prefers-reduced-motion: no-preference) {
	.sc-cal { animation: sc-cal-in .12s ease-out; }
	@keyframes sc-cal-in {
		from { opacity: 0; transform: translateY(-4px); }
		to   { opacity: 1; transform: none; }
	}
}
