/* =========================================================
   Tredway Homes – cards + gallery popup
   Headings: Cormorant Garamond | Text/UI: Arimo
   ========================================================= */
:root {
	--tch-cream: #F3EEE6;
	--tch-text: #CFC8BE;
	--tch-gold: #C9A97A;
	--tch-dark: #2B2825;
	--tch-maroon: #500000;
	--tch-head: "Cormorant Garamond", "Times New Roman", serif;
	--tch-body: "Arimo", Arial, sans-serif;
}

/* ---------- Grid ---------- */
.tch-homes {
	--tch-cols: 3;
	display: grid;
	grid-template-columns: repeat(var(--tch-cols), minmax(0, 1fr));
	gap: 48px 28px;
	width: 100%;
}

.tch-home {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	margin: 0;
}

.tch-home__media {
	position: relative;
	width: 100%;
	aspect-ratio: 408 / 300;
	overflow: hidden;
	background: #1F1D1B;
}
.tch-home__media img,
.tch-home__media .tch-home__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .9s cubic-bezier(.2, .7, .2, 1);
}
.tch-home__media.is-clickable { cursor: pointer; }
.tch-home__media.is-clickable:hover img { transform: scale(1.045); }

.tch-homes .tch-home__title {
	font-family: var(--tch-head);
	font-weight: 500;
	font-size: 30px;
	line-height: 1.2;
	color: var(--tch-cream);
	margin: 22px 0 12px;
	padding: 0;
}

.tch-homes .tch-home__desc {
	font-family: var(--tch-body);
	font-size: 15px;
	line-height: 1.65;
	color: var(--tch-text);
	margin: 0 0 12px;
}

/* Text-link style button (beats theme/Elementor button styles) */
.tch-homes button.tch-home__btn,
.tch-homes button.tch-home__btn:hover,
.tch-homes button.tch-home__btn:focus {
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	padding: 2px 0;
	margin: 0;
	min-height: 0;
	font-family: var(--tch-body);
	font-size: 13px;
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: .14em;
	text-transform: uppercase;
	text-decoration: underline;
	text-underline-offset: 4px;
	text-decoration-thickness: 1px;
	color: var(--tch-gold);
	cursor: pointer;
	transition: color .25s ease;
}
.tch-homes button.tch-home__btn:hover { color: var(--tch-cream); }
.tch-homes button.tch-home__btn:focus-visible { outline: 1px solid var(--tch-gold); outline-offset: 4px; }

@media (max-width: 1024px) {
	.tch-homes { grid-template-columns: repeat(min(var(--tch-cols), 2), minmax(0, 1fr)); gap: 40px 24px; }
	.tch-homes .tch-home__title { font-size: 27px; }
}
@media (max-width: 640px) {
	.tch-homes { grid-template-columns: 1fr; gap: 40px; }
	.tch-homes .tch-home__title { font-size: 26px; margin-top: 18px; }
	.tch-homes .tch-home__desc { font-size: 14.5px; }
}

/* ---------- Archive page (/homes/) ---------- */
.tch-homes-archive { background: var(--tch-dark); padding: 90px 24px 110px; }
.tch-homes-archive__inner { max-width: 1280px; margin: 0 auto; }
.tch-homes-archive__title {
	font-family: var(--tch-head);
	font-weight: 400;
	font-size: clamp(40px, 5vw, 68px);
	line-height: 1.1;
	color: var(--tch-cream);
	text-align: center;
	margin: 0 0 60px;
}

/* =========================================================
   Gallery popup
   ========================================================= */
body.tch-hg-lock { overflow: hidden; }

.tch-hg {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	background: rgba(24, 22, 20, .97);
	color: var(--tch-cream);
	font-family: var(--tch-body);
	opacity: 0;
	visibility: hidden;
	transition: opacity .35s ease, visibility .35s ease;
}
.tch-hg.is-open { opacity: 1; visibility: visible; }

/* Header */
.tch-hg__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	padding: 22px 32px 18px;
	border-bottom: 1px solid rgba(243, 238, 230, .12);
	flex-shrink: 0;
}
.tch-hg__titles { min-width: 0; }
.tch-hg__eyebrow {
	display: block;
	font-family: var(--tch-body);
	font-size: 11px;
	letter-spacing: .24em;
	text-transform: uppercase;
	color: var(--tch-gold);
	margin-bottom: 6px;
}
.tch-hg__title {
	font-family: var(--tch-head);
	font-weight: 500;
	font-size: 34px;
	line-height: 1.1;
	color: var(--tch-cream);
	margin: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.tch-hg__right { display: flex; align-items: center; gap: 22px; flex-shrink: 0; }
.tch-hg__count {
	font-family: var(--tch-body);
	font-size: 13px;
	letter-spacing: .2em;
	color: var(--tch-text);
}

/* Shared round buttons */
.tch-hg button.tch-hg__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	margin: 0;
	border-radius: 50%;
	border: 1px solid rgba(243, 238, 230, .5);
	background: rgba(43, 40, 37, .55);
	color: var(--tch-cream);
	box-shadow: none;
	cursor: pointer;
	transition: background .25s ease, color .25s ease, border-color .25s ease;
}
.tch-hg button.tch-hg__btn:hover,
.tch-hg button.tch-hg__btn:focus-visible {
	background: var(--tch-cream);
	color: var(--tch-dark);
	border-color: var(--tch-cream);
	outline: none;
}
.tch-hg__btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.4; }

/* Stage */
.tch-hg__stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 100px;
	touch-action: pan-y;
}
.tch-hg__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	opacity: 0;
	transform: scale(.985);
	transition: opacity .4s ease, transform .5s ease;
	user-select: none;
	-webkit-user-drag: none;
}
.tch-hg__img.is-loaded { opacity: 1; transform: none; }

.tch-hg__spinner {
	position: absolute;
	top: 50%; left: 50%;
	width: 34px; height: 34px;
	margin: -17px 0 0 -17px;
	border: 1px solid rgba(243, 238, 230, .2);
	border-top-color: var(--tch-gold);
	border-radius: 50%;
	animation: tch-spin .9s linear infinite;
	pointer-events: none;
}
.tch-hg__stage.is-ready .tch-hg__spinner { display: none; }
@keyframes tch-spin { to { transform: rotate(360deg); } }

.tch-hg button.tch-hg__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 54px; height: 54px; z-index: 2; }
.tch-hg button.tch-hg__prev { left: 28px; }
.tch-hg button.tch-hg__next { right: 28px; }
.tch-hg.is-single .tch-hg__nav,
.tch-hg.is-single .tch-hg__thumbs { display: none; }

/* Thumbnails */
.tch-hg__thumbs {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	padding: 16px 32px 24px;
	flex-shrink: 0;
	justify-content: safe center;
	scrollbar-width: thin;
	scrollbar-color: rgba(243, 238, 230, .25) transparent;
}
.tch-hg button.tch-hg__thumb {
	flex: 0 0 auto;
	width: 96px;
	height: 66px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: #1F1D1B;
	opacity: .45;
	cursor: pointer;
	outline: 1px solid transparent;
	outline-offset: 3px;
	transition: opacity .25s ease, outline-color .25s ease;
}
.tch-hg button.tch-hg__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tch-hg button.tch-hg__thumb:hover { opacity: .8; }
.tch-hg button.tch-hg__thumb.is-active { opacity: 1; outline-color: var(--tch-gold); }

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
	.tch-hg__head { padding: 18px 24px 14px; }
	.tch-hg__title { font-size: 28px; }
	.tch-hg__stage { padding: 20px 80px; }
	.tch-hg button.tch-hg__prev { left: 16px; }
	.tch-hg button.tch-hg__next { right: 16px; }
	.tch-hg button.tch-hg__thumb { width: 84px; height: 58px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
	.tch-hg__head { padding: 14px 16px 12px; gap: 12px; }
	.tch-hg__eyebrow { font-size: 10px; margin-bottom: 4px; }
	.tch-hg__title { font-size: 23px; }
	.tch-hg__right { gap: 12px; }
	.tch-hg__count { font-size: 11px; letter-spacing: .14em; }
	.tch-hg button.tch-hg__btn { width: 40px; height: 40px; }
	.tch-hg__stage { padding: 12px 0; }
	.tch-hg button.tch-hg__nav { width: 40px; height: 40px; background: rgba(24, 22, 20, .6); }
	.tch-hg button.tch-hg__prev { left: 10px; }
	.tch-hg button.tch-hg__next { right: 10px; }
	.tch-hg__btn svg { width: 17px; height: 17px; }
	.tch-hg__thumbs { padding: 12px 16px 18px; gap: 8px; justify-content: flex-start; }
	.tch-hg button.tch-hg__thumb { width: 64px; height: 46px; }
}

/* ---------- Phones in landscape / short screens ---------- */
@media (max-height: 520px) {
	.tch-hg__head { padding: 8px 16px; }
	.tch-hg__eyebrow { display: none; }
	.tch-hg__title { font-size: 20px; }
	.tch-hg__stage { padding: 6px 64px; }
	.tch-hg__thumbs { display: none; }
}
