/*
	Tour scheduler.

	Mobile-first throughout: the small-screen rule is the unconditional default
	and larger screens are layered on with min-width only.

	Note the focus handling below. This theme's reset.min.css predates
	:focus-visible and ships button:focus{outline:-webkit-focus-ring-color auto
	5px}, which paints a ring on mouse clicks. The reset-then-reinstate pair is
	scoped to these components; the theme-wide correction belongs in buttons.css.
*/

.tour {
	--tour-gap: 12px;
	--tour-radius: 2px;
	--tour-line: var(--theme-grey, #dadfe1);
	--tour-ink: var(--theme-black, #181b20);
	--tour-accent: var(--theme-dk-green, #003441);
	--tour-accent-ink: var(--theme-cream, #f8f7f0);

	color: var(--tour-ink);
}

/* ---------------------------------------------------------------
   Steps
   --------------------------------------------------------------- */

.tour--crumbs {
	display: flex;
	gap: var(--tour-gap);
	margin: 0 0 24px;
	padding: 0;
	list-style: none;
	font-size: 0.875rem;
}

.tour--crumb {
	display: flex;
	align-items: center;
	gap: 6px;
	opacity: 0.45;
}

.tour--crumb.is-current {
	opacity: 1;
	font-weight: 700;
}

.tour--crumb-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border: 1px solid currentColor;
	border-radius: 50%;
	font-size: 0.75rem;
}

.tour--step-title {
	margin: 0 0 16px;
	font-size: 1.25rem;
}

.tour--step-title:focus {
	outline: none;
}

.tour--back {
	margin: 0 0 12px;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-size: 0.875rem;
	text-decoration: underline;
	cursor: pointer;
}

.tour--chosen {
	margin: 0 0 20px;
	padding: 10px 12px;
	background: var(--theme-tan-bg, #f0e9e3);
	font-weight: 700;
}

.tour--chosen:empty {
	display: none;
}

/* ---------------------------------------------------------------
   Dates
   --------------------------------------------------------------- */

/*
	Horizontally scrollable by default. Thirty days of tabs will not fit a phone,
	and a scroll strip reads better than a wrapped grid of 30 boxes.
*/
.tour--days {
	display: flex;
	gap: 8px;
	margin: 0 0 20px;
	padding: 0 0 8px;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
}

.tour--day {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	min-width: 58px;
	padding: 10px 8px;
	border: 1px solid var(--tour-line);
	border-radius: var(--tour-radius);
	background: transparent;
	color: inherit;
	line-height: 1.1;
	cursor: pointer;
	scroll-snap-align: start;
}

.tour--day-weekday,
.tour--day-month {
	font-size: 0.6875rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.tour--day-num {
	font-size: 1.125rem;
	font-weight: 700;
}

.tour--day.is-active {
	border-color: var(--tour-accent);
	background: var(--tour-accent);
	color: var(--tour-accent-ink);
}

/* ---------------------------------------------------------------
   Times
   --------------------------------------------------------------- */

.tour--times {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
}

.tour--time {
	padding: 12px 8px;
	border: 1px solid var(--tour-line);
	border-radius: var(--tour-radius);
	background: transparent;
	color: inherit;
	font-size: 0.9375rem;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tour--time:hover {
	border-color: var(--tour-accent);
	background: var(--theme-tan-bg, #f0e9e3);
}

.tour--no-times,
.tour--empty,
.tour--empty-form,
.tour--loading {
	grid-column: 1 / -1;
	margin: 0;
}

/* ---------------------------------------------------------------
   Result
   --------------------------------------------------------------- */

.tour--result-title {
	margin: 0 0 8px;
	font-size: 1.25rem;
	font-weight: 700;
}

.tour--result-title:focus {
	outline: none;
}

.tour--result-when {
	margin: 0 0 16px;
	padding: 10px 12px;
	background: var(--theme-tan-bg, #f0e9e3);
	font-weight: 700;
}

.tour--result-calendar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 20px;
}

/* ---------------------------------------------------------------
   Modal
   --------------------------------------------------------------- */

.tour-modal {
	position: fixed;
	z-index: 9999;
	inset: 0;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.tour-modal--backdrop {
	position: absolute;
	inset: 0;
	background: rgba(24, 27, 32, 0.6);
}

/*
	Bottom sheet on a phone, centred panel from md up. A sheet keeps the times
	within thumb reach instead of pinned to the top of a tall viewport.
*/
.tour-modal--panel {
	position: relative;
	width: 100%;
	max-height: 92vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 24px 20px 32px;
	background: var(--theme-cream, #f8f7f0);
}

.tour-modal--close {
	position: absolute;
	top: 8px;
	right: 12px;
	padding: 4px 8px;
	border: 0;
	background: none;
	color: inherit;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
}

body.tour-modal-open {
	overflow: hidden;
}

/* ---------------------------------------------------------------
   Focus

   The reset must be declared before the :focus-visible rule that reinstates
   the ring — the two carry equal specificity, so order decides.
   --------------------------------------------------------------- */

.tour button:focus,
.tour-modal button:focus,
.tour a:focus,
.tour-modal a:focus {
	outline: none;
}

.tour button:focus-visible,
.tour-modal button:focus-visible,
.tour a:focus-visible,
.tour-modal a:focus-visible {
	outline: 2px solid var(--tour-accent);
	outline-offset: 2px;
}

/* ---------------------------------------------------------------
   Breakpoints
   --------------------------------------------------------------- */

@media (min-width: 768px) {

	.tour--times {
		grid-template-columns: repeat(3, 1fr);
	}

	.tour-modal {
		align-items: center;
		padding: 24px;
	}

	.tour-modal--panel {
		max-width: 620px;
		max-height: 86vh;
		padding: 32px 36px 36px;
	}

}

@media (min-width: 992px) {

	.tour--times {
		grid-template-columns: repeat(4, 1fr);
	}

	.tour--step-title {
		font-size: 1.5rem;
	}

}

@media (prefers-reduced-motion: reduce) {

	.tour--time {
		transition: none;
	}

}

/* ---------------------------------------------------------------
   Page surface

   Only the standalone page needs these — the modal panel sets its own
   width and padding, so .tour-page is applied by the shortcode alone.
   --------------------------------------------------------------- */

.tour-page {
	max-width: 720px;
	margin: 0 auto;
	padding: 40px 20px 56px;
}

@media (min-width: 768px) {

	.tour-page {
		padding: 56px 24px 72px;
	}

}

/* ---------------------------------------------------------------
   Gravity Forms fields

   The theme's forms.css sets type and padding but no widths, so GF's own
   size classes decide — and anything short of full width looks accidental
   in a narrow modal. Scoped to .tour so the contact form is untouched.
   --------------------------------------------------------------- */

.tour .gform_wrapper.gravity-theme input[type="text"],
.tour .gform_wrapper.gravity-theme input[type="email"],
.tour .gform_wrapper.gravity-theme input[type="tel"],
.tour .gform_wrapper.gravity-theme input[type="number"],
.tour .gform_wrapper.gravity-theme select,
.tour .gform_wrapper.gravity-theme textarea {
	width: 100%;
	max-width: 100%;
}

/*
	GF lays fields out on a 12-column grid. In a modal there is no room for
	two-up, so every field takes the full row regardless of what the form
	editor says.
*/
.tour .gform_wrapper.gravity-theme .gform_fields {
	grid-template-columns: 1fr;
}

.tour .gform_wrapper.gravity-theme .gfield {
	grid-column: 1 / -1;
}
