/*
 * Hub posts grid ([textual_hub_grid]).
 * Typography and colors inherit from the theme/Elementor kit; this file lays
 * out the category pills + search, the responsive card grid, the photo-fill
 * card (overlaid chip/title + excerpt strip) and the load-more button.
 */

.thg {
	--thg-gap: 2rem;
	--thg-media-bg: #e9e9e9;
	--thg-muted: #6b6b6b;
	--thg-border: rgba(0, 0, 0, 0.25);
	--thg-accent: #fbb118;
	--thg-radius: 22px;
}

/* Filters ------------------------------------------------------------------ */

.thg-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem 1.5rem;
	margin-bottom: var(--thg-gap);
}

.thg-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}

/* Pills echo the site's bordered rounded label component. */
.thg .thg-pills .thg-pill {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	padding: 0.55rem 1.15rem;
	border: 1px solid var(--thg-border);
	border-radius: 30px;
	background: transparent;
	color: #000;
	font: inherit;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.thg .thg-pills .thg-pill:hover {
	border-color: #000;
}

.thg .thg-pills .thg-pill:focus-visible {
	outline: none;
	border-color: var(--thg-accent);
	box-shadow: 0 0 0 3px rgba(251, 177, 24, 0.35);
}

.thg .thg-pills .thg-pill.is-active {
	background: #000;
	border-color: #000;
	color: #fff;
}

/* Search — pill input matching the pills' border language. */
.thg-search {
	position: relative;
	flex: 0 1 18rem;
	min-width: 12rem;
}

.thg-search__icon {
	position: absolute;
	top: 50%;
	left: 1rem;
	transform: translateY(-50%);
	display: flex;
	color: var(--thg-muted);
	pointer-events: none;
}

/* Component scope (0,4,1) outranks the kit (0,3,1), preserving icon clearance. */
.thg .thg-filters .thg-search input[type="search"] {
	width: 100%;
	padding: 0.7rem 1.1rem 0.7rem 2.7rem;
	border: 1px solid var(--thg-border);
	border-radius: 999px;
	background: #fff;
	font: inherit;
	font-size: 0.95rem;
	line-height: 1.2;
	color: #000;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.thg .thg-filters .thg-search input[type="search"]:hover {
	border-color: #000;
}

.thg .thg-filters .thg-search input[type="search"]:focus {
	outline: none;
	border-color: var(--thg-accent);
	box-shadow: 0 0 0 3px rgba(251, 177, 24, 0.3);
}

.thg-search input::placeholder {
	color: var(--thg-muted);
	opacity: 1;
}

.thg-search input[type="search"]::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

/* Grid --------------------------------------------------------------------- */

.thg-grid {
	display: grid;
	grid-template-columns: repeat(var(--hub-cols, 3), 1fr);
	gap: var(--thg-gap);
}

@media (max-width: 1024px) {
	.thg-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 767px) {
	.thg-grid {
		grid-template-columns: 1fr;
	}
}

/* Card --------------------------------------------------------------------- */

/* .thg prefix outranks hello-elementor's `.page-content a` underline rule. */
.thg .thg-card {
	position: relative;
	display: flex;
	flex-direction: column;
	border-radius: var(--thg-radius);
	overflow: hidden;
	background: #fff;
	box-shadow: 0 12px 30px -20px rgba(0, 0, 0, 0.4);
	color: #000;
	text-decoration: none;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.thg .thg-card:hover,
.thg .thg-card:focus-visible {
	transform: translateY(-6px);
	box-shadow: 0 22px 44px -22px rgba(0, 0, 0, 0.45);
}

.thg .thg-card:focus-visible {
	outline: 3px solid var(--thg-accent);
	outline-offset: 3px;
}

.thg-card[hidden] {
	display: none;
}

/* Photo block with the chip + title overlaid. */
.thg-card__media {
	position: relative;
	display: block;
	aspect-ratio: 3 / 2;
	background: var(--thg-media-bg);
	overflow: hidden;
}

.thg-card__media img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.thg-card:hover .thg-card__media img,
.thg-card:focus-visible .thg-card__media img {
	transform: scale(1.05);
}

/* Legibility scrim under the overlaid text. */
.thg-card__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.78) 100%);
}

.thg-card__overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
	mix-blend-mode: hard-light;
}

.thg-card__overlay svg {
	display: block;
	width: 100%;
	height: 100%;
}

.thg-card__caption {
	position: absolute;
	inset: auto 0 0 0;
	z-index: 1;
	display: grid;
	gap: 0.6rem;
	justify-items: start;
	padding: clamp(1rem, 2vw, 1.5rem);
}

.thg-card__chip {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.35rem 0.8rem;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.85);
	color: var(--thg-accent);
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	line-height: 1;
}

.thg-card__cat, .thg-card__cat+.thg-card__sep {
	display: none;
}

.thg-card__sep {
	opacity: 0.6;
}

.thg-card__date {
	color: #fff;
}

.thg-card__title {
	font-weight: 700;
	font-size: clamp(1.1rem, 1.6vw, 1.4rem);
	line-height: 1.22;
	letter-spacing: -0.015em;
	color: #fff;
	text-wrap: balance;
}

/* Excerpt strip below the photo. */
.thg-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	padding: clamp(1.1rem, 2vw, 1.5rem);
}

.thg-card__excerpt {
	color: #333;
	font-size: 0.95rem;
	line-height: 1.5;
}

.thg-card__more {
	margin-top: auto;
	color: #000;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.thg-card:hover .thg-card__more {
	color: var(--thg-accent-ink, #b97c00);
}

/* Load more ---------------------------------------------------------------- */

.thg-more {
	display: flex;
	justify-content: center;
	margin-top: var(--thg-gap);
}

.thg .thg-loadmore {
	display: inline-flex;
	align-items: center;
	gap: 0.7rem;
	padding: 0.85rem 1.1rem 0.85rem 1.75rem;
	border: none;
	border-radius: 999px;
	background: #000;
	color: #fff;
	font: inherit;
	font-size: 0.82rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.2s ease;
}

.thg .thg-loadmore:hover {
	background: #1a1a1a;
	transform: translateY(-2px);
}

.thg .thg-loadmore:focus-visible {
	outline: 3px solid var(--thg-accent);
	outline-offset: 3px;
}

.thg .thg-loadmore[hidden] {
	display: none;
}

.thg-loadmore__arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	background: var(--thg-accent);
	color: #000;
}

.thg-loadmore.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

/* Empty state -------------------------------------------------------------- */

.thg-empty {
	margin: var(--thg-gap) 0;
	color: var(--thg-muted);
}

/* Scroll reveal — hidden state only under .thg.is-js (set by hub-posts.js),
   so without JS (or with reduced motion) the cards are always visible. */
.thg.is-js .thg-card {
	opacity: 0;
	transform: translateY(26px);
	transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.25s ease;
}

.thg.is-js .thg-card.is-in {
	opacity: 1;
	transform: none;
}

.thg.is-js .thg-card.is-in:hover,
.thg.is-js .thg-card.is-in:focus-visible {
	transform: translateY(-6px);
}

@media (prefers-reduced-motion: reduce) {
	.thg.is-js .thg-card {
		opacity: 1;
		transform: none;
		transition: none;
	}

	.thg-card__media img {
		transition: none;
	}
}

/* Compact variant ---------------------------------------------------------- */

/* [textual_recent_posts] row: same cards as the hub grid, scaled down for the
   single-post footer. Four small cards distributed evenly across the content
   width (base grid, --hub-cols: 4); smaller media, type and spacing. Falls to
   two then one column on narrower screens via the grid's own breakpoints.
   No heading. */

.thg--compact {
	--thg-gap: 1rem;
	--thg-radius: 14px;
	margin-top: clamp(2rem, 5vw, 2.2rem);
}

.thg--compact .thg-card__media {
	aspect-ratio: 16 / 10;
}

.thg--compact .thg-card__caption {
	gap: 0.35rem;
	padding: 0.8rem;
}

.thg--compact .thg-card__chip {
	padding: 0.25rem 0.6rem;
	font-size: 0.6rem;
}

.thg--compact .thg-card__title {
	font-size: clamp(0.85rem, 1vw, 1rem);
	line-height: 1.2;
}

.thg--compact .thg-card__body {
	gap: 0.4rem;
	padding: 0.8rem;
}

.thg--compact .thg-card__excerpt {
	font-size: 0.78rem;
	line-height: 1.4;
}

.thg--compact .thg-card__more {
	font-size: 0.68rem;
}
