/**
 * TD Elements frontend styles.
 *
 * Columns and gap come in as custom properties set by Elementor's own
 * selector mechanism, so responsive values work without extra media queries.
 */

/* ---------------------------------------------------------------- gallery */

.td-gallery__wrap {
	width: 100%;
}

.td-gallery {
	--td-columns: 4;
	--td-gap: 10px;
}

.td-gallery--full {
	width: 100%;
}

.td-gallery--grid {
	display: grid;
	grid-template-columns: repeat(var(--td-columns), minmax(0, 1fr));
	gap: var(--td-gap);
}

/*
 * Masonry without a library: CSS columns flow items top-to-bottom per column.
 * Reading order differs from a grid, which is the accepted trade for having
 * no JavaScript layout step and no reflow on image load.
 */
.td-gallery--masonry {
	column-count: var(--td-columns);
	column-gap: var(--td-gap);
}

.td-gallery--masonry .td-gallery__item {
	break-inside: avoid;
	margin-bottom: var(--td-gap);
	display: inline-block;
	width: 100%;
}

.td-gallery__item {
	position: relative;
	margin: 0;
	padding: 0;
	overflow: hidden;
	box-sizing: border-box;
}

.td-gallery__link {
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
	line-height: 0;
}

.td-gallery__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

/*
 * The ratio goes on the tile, not on the link inside it. A grid item stretches
 * to its row height, so a ratio set on the inner element leaves bare space
 * below the image whenever the row is taller than the ratio allows -- which is
 * the white strip inside the border.
 */
/*
 * No percentage heights anywhere in the grid path. A percentage height only
 * resolves against a parent with a definite height, and a stretched grid item
 * has none -- so the image fell back to its natural height and left the strip
 * of tile visible underneath it. The tile carries the ratio; the link is taken
 * out of flow and pinned to the tile's box, which always has a resolved size.
 */
.td-gallery--grid .td-gallery__item {
	position: relative;
}

.td-gallery--grid .td-gallery__link {
	position: absolute;
	inset: 0;
	height: auto;
}

.td-gallery--grid .td-gallery__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.td-gallery--ratio-1-1 .td-gallery__item { aspect-ratio: 1 / 1; }
.td-gallery--ratio-3-2 .td-gallery__item { aspect-ratio: 3 / 2; }
.td-gallery--ratio-4-3 .td-gallery__item { aspect-ratio: 4 / 3; }
.td-gallery--ratio-9-16 .td-gallery__item { aspect-ratio: 9 / 16; }
.td-gallery--ratio-16-9 .td-gallery__item { aspect-ratio: 16 / 9; }
.td-gallery--ratio-21-9 .td-gallery__item { aspect-ratio: 21 / 9; }

/*
 * A bordered tile must include its border in the ratio box, otherwise the
 * border is added on top of the height and the images no longer line up
 * across a row.
 */
.td-gallery__item {
	box-sizing: border-box;
}

/* hover animations */

.td-gallery__item--grow:hover .td-gallery__image {
	transform: scale(1.1);
}

.td-gallery__item--shrink:hover .td-gallery__image {
	transform: scale(0.9);
}

/*
 * "Shrink contained" scales the image up first so that shrinking never
 * reveals the container behind it.
 */
.td-gallery__item--shrink-contained .td-gallery__image {
	transform: scale(1.1);
}

.td-gallery__item--shrink-contained:hover .td-gallery__image {
	transform: scale(1);
}

.td-gallery__item--zoom-in:hover .td-gallery__image {
	transform: scale(1.2);
}

.td-gallery__item--zoom-out .td-gallery__image {
	transform: scale(1.2);
}

.td-gallery__item--zoom-out:hover .td-gallery__image {
	transform: scale(1);
}

/* overlay */

.td-gallery__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	justify-content: center;
	padding: 1em;
	opacity: 0;
	transition: opacity 0.3s ease;
	line-height: 1.4;
	text-align: center;
	box-sizing: border-box;
}

.td-gallery__item:hover .td-gallery__overlay,
.td-gallery__item:focus-within .td-gallery__overlay {
	opacity: 1;
}

.td-gallery__overlay--top { align-items: flex-start; }
.td-gallery__overlay--middle { align-items: center; }
.td-gallery__overlay--bottom { align-items: flex-end; }

.td-gallery__overlay-text {
	display: block;
}

/* filters */

.td-gallery__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: var(--td-gap, 10px);
}

.td-gallery__filter {
	background: none;
	border: 1px solid currentColor;
	border-radius: 3px;
	padding: 6px 14px;
	cursor: pointer;
	font: inherit;
	color: inherit;
	opacity: 0.6;
	transition: opacity 0.2s ease;
}

.td-gallery__filter:hover,
.td-gallery__filter.is-active {
	opacity: 1;
}

.td-gallery__item.is-hidden {
	display: none;
}

/* ----------------------------------------------------------------- slides */

.td-slides {
	--td-slides-height: 400px;
	position: relative;
	width: 100%;
}

/*
 * Only the image area clips; the dot row lives outside it so it is not cut
 * off by the slider's own overflow.
 */
.td-slides__viewport {
	position: relative;
	overflow: hidden;
}

.td-slides__track {
	position: relative;
	height: var(--td-slides-height);
}

.td-slides__slide {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background-size: cover;
	background-position: center;
	opacity: 0;
	transition: opacity 0.6s ease;
	pointer-events: none;
}

.td-slides__slide.is-active {
	opacity: 1;
	pointer-events: auto;
}

.td-slides__shade {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
}

.td-slides__content {
	position: relative;
	z-index: 1;
	text-align: center;
	padding: 2em;
	max-width: 80%;
}

.td-slides__heading {
	margin: 0 0 0.4em;
	color: inherit;
}

.td-slides__text {
	margin-bottom: 1em;
}

.td-slides__button {
	display: inline-block;
	padding: 0.7em 1.6em;
	border: 2px solid currentColor;
	border-radius: 3px;
	color: inherit;
	text-decoration: none;
}

/*
 * The dark plate is kept. Removing it left a bare chevron, and the theme's own
 * button styling showed through on hover. Every state is declared here so
 * nothing is inherited from the theme.
 */
.td-slides__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	border: 0;
	cursor: pointer;
	font-size: 26px;
	/*
	 * A fixed box with flex centring, not padding. The chevron glyph does not
	 * sit in the middle of its own line box, so padding alone leaves it
	 * visibly high or low inside the plate.
	 */
	width: 38px;
	height: 44px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	border-radius: 3px;
	box-shadow: none;
	transition: background-color 0.2s ease;
}

.td-slides__arrow:hover,
.td-slides__arrow:focus,
.td-slides__arrow:active {
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	border: 0;
	box-shadow: none;
	outline: none;
}

.td-slides__arrow--prev { left: 14px; }
.td-slides__arrow--next { right: 14px; }

/* the glyph's own descender offset, removed so it centres on the plate */
.td-slides__arrow > * {
	display: block;
}

/*
 * The dots sit BELOW the slider, not on top of the image. Pro puts them in
 * the flow underneath, and an absolutely positioned row inside the slide
 * covers the bottom of every photo.
 */
.td-slides__dots {
	display: flex;
	justify-content: center;
	gap: 9px;
	padding: 12px 0 4px;
}

/*
 * An explicit grey, NOT currentColor: below the slider the inherited text
 * colour is whatever the page uses, which on a white section made the dots
 * invisible.
 */
.td-slides__dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	border: 0;
	background: #c9c9c9;
	cursor: pointer;
	padding: 0;
	transition: background-color 0.2s ease;
}

.td-slides__dot:hover,
.td-slides__dot.is-active {
	background: #6b6b6b;
}

@media (prefers-reduced-motion: reduce) {
	.td-slides__slide,
	.td-gallery__image,
	.td-gallery__overlay {
		transition: none;
	}
}

/* ken burns: only the visible slide animates, so an idle slider costs nothing */

.td-slides__slide--kenburns {
	background-size: cover;
	will-change: transform;
}

.td-slides__slide--kenburns.is-active {
	animation-duration: 20s;
	animation-timing-function: linear;
	animation-fill-mode: forwards;
}

.td-slides__slide--kenburns-in.is-active {
	animation-name: td-kenburns-in;
}

.td-slides__slide--kenburns-out.is-active {
	animation-name: td-kenburns-out;
}

@keyframes td-kenburns-in {
	from { transform: scale(1); }
	to   { transform: scale(1.18); }
}

@keyframes td-kenburns-out {
	from { transform: scale(1.18); }
	to   { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
	.td-slides__slide--kenburns.is-active {
		animation: none;
	}
}

/* a tile whose attachment is gone: keep the box so the grid does not shift */

.td-gallery__item--empty .td-gallery__link {
	display: block;
	width: 100%;
	background: transparent;
}

.td-gallery--masonry .td-gallery__item--empty .td-gallery__link {
	aspect-ratio: 4 / 3;
}

/* ------------------------------------------------------------ price list */

.td-price-list {
	--td-row-gap: 10px;
	--td-sep-style: dotted;
	--td-sep-color: #ddd;
	--td-sep-weight: 1px;
	--td-sep-spacing: 10px;
	list-style: none;
	margin: 0;
	padding: 0;
}

/*
 * Pro pads each row as well as spacing them, so a gap-only layout reads
 * tighter than the original at the same row_gap value. The padding is half
 * the gap top and bottom, which reproduces the original rhythm.
 */
.td-price-list__item {
	padding: calc(var(--td-row-gap) / 2) 0;
}

.td-price-list__item + .td-price-list__item {
	margin-top: var(--td-row-gap);
}

.td-price-list__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

/*
 * The leader line is a flexible middle element, so the title keeps its natural
 * width and the price stays hard right however long either one is.
 */
.td-price-list__header {
	display: flex;
	align-items: flex-end;
	width: 100%;
}

.td-price-list__separator {
	flex: 1 1 auto;
	align-self: center;
	margin: 0 var(--td-sep-spacing);
	border-bottom-style: var(--td-sep-style);
	border-bottom-width: var(--td-sep-weight);
	border-bottom-color: var(--td-sep-color);
	min-width: 12px;
}

.td-price-list__title,
.td-price-list__price {
	flex: 0 0 auto;
}

.td-price-list__description {
	display: block;
	margin-top: 4px;
}

/* ---------------------------------------------------------------- posts */

/*
 * These values are Elementor Pro's own, read from its widget-posts.min.css
 * rather than matched by eye: 21px card title, 14px #777 excerpt at 1.7,
 * 12px bold uppercase read-more, 30px side padding, 25px below title and
 * excerpt, 3px radius, and the card shadow at .15 with a 30px hover.
 */

.td-posts {
	--td-posts-columns: 3;
	--td-posts-col-gap: 30px;
	--td-posts-row-gap: 35px;
	display: grid;
	grid-template-columns: repeat(var(--td-posts-columns), minmax(0, 1fr));
	column-gap: var(--td-posts-col-gap);
	row-gap: var(--td-posts-row-gap);
	align-items: stretch;
}

.td-posts__card {
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	min-width: 0;
	min-height: 100%;
	background-color: #fff;
	border-radius: 3px;
	overflow: hidden;
	position: relative;
	box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.15);
	transition: box-shadow 0.25s;
}

.td-posts__card:hover {
	box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.15);
}

.td-posts__thumb {
	display: block;
	line-height: 0;
	position: relative;
	width: 100%;
}

.td-posts__thumb img {
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	display: block;
}

.td-posts__body {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	margin-top: 20px;
	padding: 0 30px;
}

.td-posts__title {
	font-size: 21px;
	margin: 0 0 25px;
	line-height: 1.3;
}

.td-posts__title a {
	color: inherit;
	text-decoration: none;
}

.td-posts__meta {
	color: #adadad;
	font-size: 12px;
	line-height: 1.3em;
	margin-bottom: 13px;
}

.td-posts__excerpt {
	color: #777;
	font-size: 14px;
	line-height: 1.7;
	margin: 0 0 25px;
}

.td-posts__more {
	align-self: flex-start;
	display: inline-block;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	text-decoration: none;
	margin-top: auto;
	margin-bottom: 20px;
}

.td-posts__more:hover {
	text-decoration: underline;
}
