/* Catalogue styles: course details used on course and school pages (price table, facts, start dates, fees, expandable rows). Loaded after catalog.css. */
/* "Planning a longer stay? Prices drop to as low as …" above the price table. */
.ee-longer-stay {
	display: inline-block;
	margin: 0 0 0.75rem;
	padding: 0.4rem 0.75rem;
	border-radius: 999px;
	background: color-mix(in srgb, var(--wp--preset--color--accent-3, #32936f) 12%, transparent);
	font-weight: 600;
	font-size: 0.95em;
}

/* Facts */
.ee-facts {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 1rem 1.5rem;
	margin: 0;
	padding: 1.25rem;
	border: 1px solid var(--ee-line);
	border-radius: var(--ee-radius);
	background: var(--ee-soft);
}

.ee-facts dt {
	color: var(--ee-muted);
	font-size: 0.85em;
}

.ee-facts dd {
	margin: 0.15rem 0 0;
	font-weight: 600;
}

/* Price table */
.ee-table-wrap {
	position: relative;
	overflow-x: auto;
}

.ee-table-wrap:focus-visible {
	outline: 2px solid var(--ee-blue, currentColor);
	outline-offset: 2px;
}

/* The caption names the table for screen readers (and the scrollable region); sighted visitors see the heading above. */
.ee-prices caption {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.ee-prices {
	width: 100%;
	max-width: 640px;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.ee-prices th,
.ee-prices td {
	padding: 0.5rem 0.75rem 0.5rem 0;
	border-bottom: 1px solid var(--ee-line);
	text-align: left;
}

/* Layout: duration | school direct | our price (big, with the saving and the weekly rate under it) | chevron */
.ee-prices th:first-child {
	font-weight: 400;
	white-space: nowrap;
}

.ee-prices thead th {
	font-size: 0.85em;
	font-weight: 600;
	color: var(--ee-muted);
	white-space: normal;
}

.ee-prices__ours {
	font-size: 1.1em;
	font-weight: 700;
	white-space: nowrap;
}

/* Under our price: what the student saves and the weekly rate, small. */
.ee-prices__sub {
	display: block;
	margin-top: 0.1rem;
	font-size: 0.85em;
	font-weight: 400;
	line-height: 1.35;
	color: #595959;
}

.ee-prices td.ee-prices__school,
.ee-prices__week {
	white-space: nowrap;
}

@media (max-width: 520px) {
	/* Narrow phones: the saving and the weekly rate each get their own line instead of wrapping in the middle. */
	.ee-prices__sub > span {
		display: block;
	}
	.ee-prices__dot {
		display: none !important;
	}
	/* Every duration is shown (no "show all" button), so the widest row (4-digit prices) must still fit a 360 px phone. */
	.ee-prices th,
	.ee-prices td {
		padding-right: 0.4rem;
	}
}

.ee-prices__save {
	font-weight: 700;
	white-space: nowrap;
	/* Savings are green (the price colour); same darkening as the booking link for 4.5:1 on the tint. */
	color: color-mix(in srgb, var(--ee-green) 68%, #000);
}

/* Our column (only when we are cheaper): soft terracotta tint, a terracotta line on top, dark header text. */
.ee-prices .ee-prices__us {
	padding-left: 0.75rem;
	background: color-mix(in srgb, var(--wp--preset--color--accent-7, #b8492a) 10%, #fff);
}

.ee-prices thead .ee-prices__us {
	border-top: 3px solid var(--wp--preset--color--accent-7, #b8492a);
	color: var(--wp--preset--color--contrast, #1c1c1c);
}

/* Start dates, fees */
.ee-dates,
.ee-fees {
	margin: 0;
	padding-left: 1.2rem;
}

.ee-dates li,
.ee-fees li {
	margin-bottom: 0.3rem;
}

@media (min-width: 600px) {
	.ee-dates {
		columns: 2;
		column-fill: balance;
	}
	.ee-dates li {
		break-inside: avoid; /* a date is never split across the two columns */
	}
}

.ee-cta {
	margin: 2.5rem 0;
	text-align: center;
}

.ee-cta .wp-element-button {
	padding: 0.9rem 1.8rem;
	font-weight: 600;
}

/* Courses and accommodation: rows that open in place */
.ee-expand {
	margin-bottom: 0.75rem;
	border: 1px solid var(--ee-line);
	border-radius: var(--ee-radius);
	background: var(--wp--preset--color--base, #fff);
}

.ee-expand[open] {
	border-color: color-mix(in srgb, currentColor 30%, transparent);
}

.ee-expand summary {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto auto;
	gap: 0.5rem 1rem;
	align-items: center;
	padding: 1rem 1.25rem;
	cursor: pointer;
	list-style: none;
}

.ee-expand summary::-webkit-details-marker {
	display: none;
}

.ee-expand summary:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -2px;
	border-radius: var(--ee-radius);
}

.ee-expand__main {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.25rem 0.5rem;
}

.ee-expand .ee-item__title {
	font-weight: 600;
	font-size: 1.1em;
}

.ee-expand .ee-item__meta {
	flex-basis: 100%;
	margin: 0;
}

.ee-expand .ee-item__price {
	text-align: right;
	font-size: 0.95em;
}

/* Chevron that turns when the row opens */
.ee-expand__icon {
	width: 0.6rem;
	height: 0.6rem;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
	transition: transform 0.2s;
}

.ee-expand[open] .ee-expand__icon {
	transform: rotate(225deg) translateY(-2px);
}

.ee-expand__body {
	padding: 0 1.25rem 1.25rem;
	border-top: 1px solid var(--ee-line);
}

.ee-expand__body > :first-child {
	margin-top: 1rem;
}

.ee-expand__body h3 {
	font-size: 1.05em;
	margin: 1.25rem 0 0.5rem;
}

.ee-expand__body .ee-facts {
	margin-block: 1rem;
}

.ee-expand__body .ee-cta {
	margin: 1.25rem 0 0;
	text-align: left;
}

.ee-expand__image {
	display: block;
	width: 100%;
	max-width: 480px;
	height: auto;
	border-radius: 6px;
}

@media (max-width: 599px) {
	/* Price moves under the name on narrow screens; the chevron stays top right. */
	.ee-expand summary {
		grid-template-columns: minmax(0, 1fr) auto;
	}
	.ee-expand .ee-item__price {
		grid-column: 1;
		grid-row: 2;
		text-align: left;
	}
	.ee-expand__icon {
		grid-column: 2;
		grid-row: 1;
	}
}

.ee-expand,
.ee-facts {
	border-color: var(--ee-border);
	border-radius: var(--ee-r);
	background: var(--wp--preset--color--base, #fff);
	box-shadow: var(--ee-shadow);
}

.ee-facts {
	background: color-mix(in srgb, var(--ee-pale) 35%, #fff);
	box-shadow: none;
}

.ee-expand {
	transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.ee-expand:hover {
	box-shadow: var(--ee-shadow-lg);
	border-color: transparent;
}

.ee-expand summary {
	padding: 1.1rem 1.4rem;
}

.ee-expand[open] {
	box-shadow: var(--ee-shadow-lg);
}

/* Price tables: every duration books straight away */
/* No stretched-link overlay on purpose: older Safari/iOS does not make a <tr> the containing block of an absolutely
   positioned ::after, so all overlays piled up and a tap on "2 weeks" booked the last visible row. Each row has one real
   link that fills the price cell; a click on the rest of the row is forwarded to that link by catalog.js. */
.ee-prices tr.is-bookable a {
	color: inherit;
	text-decoration: none;
}

.ee-prices tr.is-bookable th a {
	color: var(--ee-blue);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: color-mix(in srgb, var(--ee-green) 50%, transparent);
	text-underline-offset: 0.2em;
}

/* The pointer cursor is required, not cosmetic: iOS Safari only delivers click events to non-interactive elements
   (the row's cells, for the delegated handler in catalog.js) when they look clickable. */
.ee-prices tr.is-bookable {
	cursor: pointer;
}

.ee-prices tr.is-bookable:hover {
	background: color-mix(in srgb, var(--ee-pale) 45%, #fff);
}

/* Our tinted column keeps its colour on hover, a little stronger. */
.ee-prices tr.is-bookable:hover .ee-prices__us {
	background: color-mix(in srgb, var(--wp--preset--color--accent-7, #b8492a) 16%, #fff);
}

/* Keyboard focus on the price shows on the whole row. */
.ee-prices tr.is-bookable:has(:focus-visible) {
	outline: 2px solid var(--ee-green);
	outline-offset: -2px;
}

.ee-prices tr.is-bookable .ee-prices__book {
	font-weight: 700;
	/* The brand green is only about 3.8:1 on white: darkened to pass WCAG 1.4.3 (4.5:1) for price text. */
	color: color-mix(in srgb, var(--ee-green) 68%, #000);
}

/* The price cell is the link: it carries the cell padding, so the whole cell is the tap target (at least 44 px high). */
.ee-prices td.ee-prices__cell {
	padding: 0;
}

.ee-prices a.ee-prices__book {
	display: block;
	box-sizing: border-box;
	min-height: 44px;
	padding: 0.5rem 0.75rem 0.5rem 0;
}

.ee-prices .ee-prices__us .ee-prices__book {
	padding-left: 0.75rem;
}

/* A link must not rely on colour alone (WCAG 1.4.1): the price figure is underlined, the lines under it are not. */
.ee-prices tr.is-bookable a.ee-prices__book .ee-prices__ours {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.ee-prices tr.is-bookable a.ee-prices__book:hover .ee-prices__ours,
.ee-prices tr.is-bookable a.ee-prices__book:focus-visible .ee-prices__ours {
	text-decoration-thickness: 2px;
}

/* A chevron at the right end of every row, always visible (a phone has no hover): "this row leads on". */
.ee-prices .ee-prices__go {
	width: 1.4rem;
	padding-left: 0;
	padding-right: 0.2rem;
	text-align: right;
	background: none;
}

.ee-prices td.ee-prices__go::after {
	content: "›";
	display: inline-block;
	font-size: 1.6em;
	line-height: 1;
	color: color-mix(in srgb, var(--ee-green) 68%, #000);
	transition: transform 0.15s;
}

.ee-prices tr.is-bookable:hover td.ee-prices__go::after,
.ee-prices tr.is-bookable:has(:focus-visible) td.ee-prices__go::after {
	transform: translateX(3px);
}

@media print {
	.ee-prices td.ee-prices__go::after {
		content: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ee-expand__icon {
		transition: none;
	}
}
