/* TGM Bookings widget. Every colour and size is a custom property the Elementor controls can set. */

.tgmb {
	--tgmb-primary: var(--tgmb-brand, #2271b1);
	--tgmb-on-primary: #fff;
	--tgmb-text: #1e1e1e;
	--tgmb-muted: #50575e;
	--tgmb-bg: #fff;
	--tgmb-surface: #f6f7f7;
	--tgmb-border: #8c8f94;
	--tgmb-available: var(--tgmb-primary);
	--tgmb-error: #b32d2e;
	--tgmb-radius: 8px;
	--tgmb-gap: 16px;
	--tgmb-btn-bg: var(--tgmb-primary);
	--tgmb-btn-text: var(--tgmb-on-primary);
	--tgmb-btn-border: var(--tgmb-btn-bg);
	--tgmb-btn-hover-bg: var(--tgmb-text);
	--tgmb-btn-hover-text: var(--tgmb-bg);
	--tgmb-btn-hover-border: var(--tgmb-btn-hover-bg);

	container: tgmb / inline-size;
	box-sizing: border-box;
	padding: calc(var(--tgmb-gap) * 1.5);
	color: var(--tgmb-text);
	background: var(--tgmb-bg);
	border-radius: var(--tgmb-radius);
	line-height: 1.5;
	overflow-wrap: anywhere;
}

.tgmb *,
.tgmb *::before,
.tgmb *::after {
	box-sizing: inherit;
}

/* :where() keeps this reset at class-level specificity, so component colours below win. */
.tgmb :where(button, input, select, textarea) {
	font: inherit;
	color: inherit;
	letter-spacing: inherit;
}

.tgmb :focus-visible {
	outline: 2px solid var(--tgmb-primary);
	outline-offset: 2px;
}

/* Reserve space while the script starts, so the page does not jump. */
.tgmb__boot {
	min-height: 360px;
	color: var(--tgmb-muted);
}

.tgmb__heading,
.tgmb__title,
.tgmb__subtitle {
	margin: 0 0 calc(var(--tgmb-gap) * 0.75);
	color: inherit;
	line-height: 1.25;
}

.tgmb__heading {
	font-size: 1.5em;
}

.tgmb__title {
	font-size: 1.25em;
}

.tgmb__title:focus {
	outline: none;
}

.tgmb__subtitle {
	font-size: 1.05em;
}

.tgmb p {
	margin: 0 0 calc(var(--tgmb-gap) * 0.75);
}

.tgmb__preview {
	padding: 8px 12px;
	font-size: 0.9em;
	background: var(--tgmb-surface);
	border-left: 4px solid var(--tgmb-primary);
}

.tgmb__live,
.tgmb__hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Event summary */
.tgmb__summary {
	margin-bottom: var(--tgmb-gap);
	padding-bottom: var(--tgmb-gap);
	border-bottom: 1px solid color-mix(in srgb, var(--tgmb-border) 50%, transparent);
}

.tgmb__host,
.tgmb__meta {
	color: var(--tgmb-muted);
}

.tgmb__host {
	margin: 0;
}

.tgmb__type-name {
	margin: 0 0 4px;
	font-size: 1.15em;
	font-weight: 700;
}

.tgmb__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	margin: 0 0 8px;
	padding: 0;
	list-style: none;
}

.tgmb__meta-when {
	flex-basis: 100%;
	color: var(--tgmb-text);
}

.tgmb__desc > :last-child {
	margin-bottom: 0;
}

/* Generic controls */
.tgmb__btn,
.tgmb__card,
.tgmb__time,
.tgmb__back,
.tgmb__link,
.tgmb__nav,
.tgmb__day {
	cursor: pointer;
}

.tgmb__btn {
	display: inline-block;
	padding: 12px 20px;
	font-weight: 600;
	text-decoration: none;
	color: var(--tgmb-btn-text);
	background: var(--tgmb-btn-bg);
	border: 2px solid var(--tgmb-btn-border);
	border-radius: var(--tgmb-radius);
	transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.tgmb__btn:hover,
.tgmb__btn:focus-visible {
	color: var(--tgmb-btn-hover-text);
	background: var(--tgmb-btn-hover-bg);
	border-color: var(--tgmb-btn-hover-border);
}

.tgmb__btn[disabled] {
	cursor: progress;
	opacity: 0.7;
}

.tgmb__btn--ghost {
	color: var(--tgmb-primary);
	background: transparent;
	border-color: var(--tgmb-primary);
}

.tgmb__back,
.tgmb__link {
	padding: 0;
	color: var(--tgmb-primary);
	text-decoration: underline;
	background: none;
	border: 0;
}

.tgmb__back {
	margin-bottom: var(--tgmb-gap);
}

.tgmb__back::before {
	content: "‹ ";
}

/* Event type cards */
.tgmb__cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: var(--tgmb-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.tgmb__card {
	display: flex;
	flex-direction: column;
	gap: 4px;
	width: 100%;
	height: 100%;
	padding: var(--tgmb-gap);
	text-align: left;
	background: var(--tgmb-surface);
	border: 1px solid var(--tgmb-border);
	border-left: 4px solid var(--tgmb-primary);
	border-radius: var(--tgmb-radius);
}

.tgmb__card:hover {
	border-color: var(--tgmb-primary);
}

.tgmb__card-name {
	font-weight: 700;
}

.tgmb__card-meta,
.tgmb__card-desc {
	font-size: 0.9em;
	color: var(--tgmb-muted);
}

/* Date and time picker: stacked by default, side by side once the widget is wide enough. */
.tgmb__picker {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: calc(var(--tgmb-gap) * 1.5);
	align-items: start;
}

.tgmb__calnav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 8px;
}

.tgmb__calnav .tgmb__subtitle {
	margin: 0;
	text-align: center;
}

.tgmb__nav {
	width: 44px;
	height: 44px;
	font-size: 1.5em;
	line-height: 1;
	color: var(--tgmb-primary);
	background: transparent;
	border: 1px solid var(--tgmb-border);
	border-radius: 50%;
}

.tgmb__nav[disabled] {
	cursor: default;
	opacity: 0.35;
}

.tgmb__grid {
	width: 100%;
	margin: 0 0 8px;
	table-layout: fixed;
	border: 0;
	border-collapse: collapse;
}

.tgmb__grid tr,
.tgmb__grid th,
.tgmb__grid td {
	padding: 2px;
	text-align: center;
	background: none;
	border: 0;
}

.tgmb__grid th {
	font-size: 0.8em;
	font-weight: 600;
	color: var(--tgmb-muted);
}

.tgmb__day {
	position: relative;
	width: 100%;
	max-width: 48px;
	aspect-ratio: 1;
	padding: 0;
	color: var(--tgmb-muted);
	background: transparent;
	border: 0;
	border-radius: 50%;
}

.tgmb__day[disabled] {
	cursor: default;
	opacity: 0.6;
}

.tgmb__day.is-available {
	font-weight: 700;
	color: var(--tgmb-primary);
	background: color-mix(in srgb, var(--tgmb-available) 12%, transparent);
}

.tgmb__day.is-available::after {
	position: absolute;
	bottom: 15%;
	left: 50%;
	width: 4px;
	height: 4px;
	content: "";
	background: var(--tgmb-available);
	border-radius: 50%;
	transform: translateX(-50%);
}

.tgmb__day.is-available:hover {
	background: color-mix(in srgb, var(--tgmb-available) 24%, transparent);
}

.tgmb__day.is-selected {
	color: var(--tgmb-on-primary);
	background: var(--tgmb-primary);
}

.tgmb__day.is-selected::after {
	background: var(--tgmb-on-primary);
}

.tgmb__day[aria-current="date"] {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.tgmb__status,
.tgmb__hint,
.tgmb__help {
	font-size: 0.9em;
	color: var(--tgmb-muted);
}

.tgmb__status--error,
.tgmb__err,
.tgmb__formerr {
	color: var(--tgmb-error);
}

.tgmb__timelist {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tgmb__time {
	width: 100%;
	min-height: 44px;
	padding: 8px;
	font-weight: 600;
	color: var(--tgmb-primary);
	background: var(--tgmb-bg);
	border: 1px solid var(--tgmb-primary);
	border-radius: var(--tgmb-radius);
}

.tgmb__time:hover,
.tgmb__time:focus-visible {
	color: var(--tgmb-on-primary);
	background: var(--tgmb-primary);
}

.tgmb__tz {
	margin-top: var(--tgmb-gap);
}

.tgmb__tz label {
	display: block;
	margin-bottom: 4px;
	font-weight: 600;
}

/* Form */
.tgmb__form {
	max-width: 560px;
}

.tgmb__field {
	margin: 0 0 var(--tgmb-gap);
	padding: 0;
	border: 0;
}

.tgmb__field > label,
.tgmb__field > legend {
	display: block;
	margin-bottom: 4px;
	padding: 0;
	font-weight: 600;
}

.tgmb__opt {
	font-weight: 400;
	color: var(--tgmb-muted);
}

.tgmb input[type="text"],
.tgmb input[type="email"],
.tgmb input[type="tel"],
.tgmb input:not([type]),
.tgmb select,
.tgmb textarea {
	width: 100%;
	min-height: 44px;
	padding: 8px 12px;
	background: var(--tgmb-bg);
	border: 1px solid var(--tgmb-border);
	border-radius: calc(var(--tgmb-radius) / 2);
}

.tgmb [aria-invalid="true"] {
	border-color: var(--tgmb-error);
}

.tgmb__field--check {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0 10px;
	align-items: start;
}

.tgmb__field--check > label {
	font-weight: 400;
}

.tgmb__field--check .tgmb__err {
	grid-column: 2;
}

/* 24px meets the WCAG 2.2 minimum target size. */
.tgmb__field--check input,
.tgmb__choice input {
	width: 24px;
	height: 24px;
	margin: 0;
	accent-color: var(--tgmb-primary);
}

.tgmb__choice {
	display: flex;
	gap: 10px;
	align-items: center;
	margin: 0 0 6px;
}

.tgmb__err:empty,
.tgmb__formerr:empty {
	display: none;
}

.tgmb__err {
	margin: 4px 0 0;
	font-size: 0.9em;
}

.tgmb__formerr {
	margin-bottom: var(--tgmb-gap);
	font-weight: 600;
}

/* Confirmation */
.tgmb__cal-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.tgmb__message {
	margin-bottom: var(--tgmb-gap);
}

.tgmb-notice {
	padding: 12px;
	border: 1px dashed #b32d2e;
}

/* Side-by-side thresholds, chosen per widget ("Stack ... when narrower than"). */
@container tgmb (min-width: 481px) {
	.tgmb--stack-480 .tgmb__picker {
		grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
	}
}

@container tgmb (min-width: 641px) {
	.tgmb--stack-640 .tgmb__picker {
		grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
	}
}

@container tgmb (min-width: 769px) {
	.tgmb--stack-768 .tgmb__picker {
		grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
	}
}

@container tgmb (min-width: 901px) {
	.tgmb--stack-900 .tgmb__picker {
		grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
	}
}

@container tgmb (min-width: 1025px) {
	.tgmb--stack-1024 .tgmb__picker {
		grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.tgmb * {
		transition: none !important;
		scroll-behavior: auto !important;
	}
}
