/* Systical — Post Grid (tabs, search, paged cards) */

.sys-pg {
	--pg-accent: #9afd0d;
	--pg-max: 1400px;
	--pg-cols: 3;
	--pg-gap: 26px;
	--pg-radius: 16px;
	--pg-ratio: 16 / 10;
	--pg-tab-color: #fff;
	--pg-tab-active-bg: #fff;
	--pg-tab-active-color: #070707;
	--pg-field-bg: #0e0e0e;
	--pg-field-border: #2e2e2e;
	--pg-ease: cubic-bezier(0.22, 1, 0.36, 1);
	padding: 60px 40px 110px;
	background-color: #070707;
}

.sys-pg__inner {
	max-width: var(--pg-max);
	margin: 0 auto;
}

/* ---------- tabs + search ---------- */

.sys-pg__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	margin-bottom: 38px;
}

/* One line, always. At 36px the tabs will not fit a laptop, so the row scrolls
   sideways instead of wrapping — the bar keeps its height whatever the number
   of categories. */
.sys-pg__tabs {
	position: relative;
	display: flex;
	flex-wrap: nowrap;
	gap: 16px;
	min-width: 0;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	-ms-overflow-style: none;
	/* Room for the focus ring, which would otherwise be clipped by the
	   scroll container. */
	padding: 3px;
	margin: -3px;
	-webkit-overflow-scrolling: touch;
}

.sys-pg__tabs::-webkit-scrollbar {
	display: none;
}

/* Fade whichever edge still has tabs behind it, so a clipped label reads as
   "there is more" rather than as a rendering fault. The classes are toggled by
   the script, so a row that fits gets no fade at all. */
.sys-pg__tabs.has-right {
	-webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent 100%);
	mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent 100%);
}

.sys-pg__tabs.has-left {
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 56px);
	mask-image: linear-gradient(to right, transparent 0, #000 56px);
}

.sys-pg__tabs.has-left.has-right {
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);
	mask-image: linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);
}

.sys-pg--draggable .sys-pg__tabs {
	cursor: grab;
}

.sys-pg.is-dragging .sys-pg__tabs {
	cursor: grabbing;
	user-select: none;
}

/* A drag would otherwise land as a click on whichever tab is under the
   pointer when it stops. */
.sys-pg.is-dragging .sys-pg__tab {
	pointer-events: none;
}

/* Inactive tabs are plain text — only the active one wears the pill. The
   padding is kept identical on both so switching tabs cannot shift the row. */
.sys-pg__tab {
	flex: 0 0 auto;
	padding: 13px 24px;
	border: 0;
	border-radius: 999px;
	color: var(--pg-tab-color);
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
	font-size: 36px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	transition:
		background-color 200ms ease,
		border-color 200ms ease,
		color 200ms ease;
}

.sys-pg__tab:hover,
.sys-pg__tab:focus-visible {
	background-color: rgba(255, 255, 255, 0.08);
	color: var(--pg-tab-color);
}

.sys-pg__tab.is-active,
.sys-pg__tab.is-active:hover {
	background-color: var(--pg-tab-active-bg);
	color: var(--pg-tab-active-color);
}

.sys-pg__search {
	position: relative;
	flex: 0 0 auto;
	width: min(320px, 40vw);
}

/* Two classes deep so the theme's own input styling does not win. */
.sys-pg .sys-pg__field {
	box-sizing: border-box;
	width: 100%;
	padding: 15px 46px 15px 22px;
	border: 1px solid var(--pg-field-border);
	border-radius: 999px;
	background-color: var(--pg-field-bg);
	color: #fff;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.2;
	transition: border-color 200ms ease;
}

.sys-pg .sys-pg__field::placeholder {
	color: #7c7c7c;
}

.sys-pg .sys-pg__field:focus {
	border-color: var(--pg-accent);
	outline: none;
}

.sys-pg__submit {
	position: absolute;
	top: 50%;
	right: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: #a5a5a5;
	transform: translateY(-50%);
	cursor: pointer;
	transition: color 200ms ease, background-color 200ms ease;
}

/* Restated because Hello Elementor's reset paints `button:hover` pink. */
.sys-pg__submit:hover,
.sys-pg__submit:focus-visible {
	background-color: rgba(255, 255, 255, 0.08);
	color: #fff;
}

.sys-pg__submit svg {
	width: 18px;
	height: 18px;
}

/* Results dim while a filter is in flight, so a slow request reads as
   "working" rather than "nothing happened". */
.sys-pg__results {
	transition: opacity 180ms ease;
}

.sys-pg.is-loading .sys-pg__results {
	opacity: 0.35;
	pointer-events: none;
}

/* ---------- grid ---------- */

.sys-pg__grid {
	display: grid;
	grid-template-columns: repeat(var(--pg-cols), minmax(0, 1fr));
	gap: var(--pg-gap);
}

.sys-pg__card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

/* The whole card opens the post — the title link is stretched over it so a
   click on the excerpt, or between two title lines, lands somewhere. */
.sys-pg__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.sys-pg__media {
	display: block;
	overflow: hidden;
	aspect-ratio: var(--pg-ratio);
	margin-bottom: 16px;
	border-radius: var(--pg-radius);
	background-color: #111;
}

/* Two classes deep: Elementor ships `.elementor img { height: auto }` at
   (0,1,1), which would beat a single-class rule and collapse the fill. */
.sys-pg .sys-pg__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 640ms var(--pg-ease);
}

.sys-pg__img--empty {
	background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
}

.sys-pg__card:hover .sys-pg__img {
	transform: scale(1.04);
}

.sys-pg__terms {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 12px;
	padding: 0;
	list-style: none;
}

.sys-pg__term {
	padding: 6px 14px;
	border: 1px solid var(--pg-field-border);
	border-radius: 999px;
	color: #fff;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
	font-size: 13px;
	line-height: 1;
	white-space: nowrap;
}

.sys-pg__title {
	margin: 0;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.28;
	letter-spacing: -0.015em;
	color: #fff;
}

.sys-pg__link {
	color: inherit;
	text-decoration: none;
}

.sys-pg__link:hover,
.sys-pg__link:focus-visible {
	color: var(--pg-accent);
}

.sys-pg__excerpt {
	margin: 10px 0 0;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
	font-size: 14.5px;
	line-height: 1.6;
	color: #9a9a9a;
	/* Clamped so an uneven set of excerpts cannot stagger the rows. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ---------- pagination ---------- */

.sys-pg__pager {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 52px;
}

.sys-pg__page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 14px;
	border: 1px solid var(--pg-field-border);
	border-radius: 999px;
	color: #fff;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	transition:
		background-color 200ms ease,
		border-color 200ms ease,
		color 200ms ease;
}

.sys-pg__page:hover,
.sys-pg__page:focus-visible {
	border-color: #4a4a4a;
	color: #fff;
}

.sys-pg__page.is-active {
	background-color: var(--pg-accent);
	border-color: var(--pg-accent);
	color: #070707;
}

.sys-pg__page.is-disabled {
	opacity: 0.35;
	pointer-events: none;
}

.sys-pg__empty {
	margin: 40px 0;
	color: #9a9a9a;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
	font-size: 16px;
	text-align: center;
}

/* ---------- responsive ---------- */

@media (max-width: 1200px) {
	.sys-pg__tab {
		font-size: 26px;
	}
}

@media (max-width: 900px) {
	/* Below this the tabs and the field cannot share a row without the field
	   squeezing to nothing. */
	.sys-pg__bar {
		flex-direction: column;
		align-items: stretch;
		gap: 16px;
	}

	.sys-pg__search {
		width: 100%;
	}

}

@media (max-width: 767px) {
	.sys-pg {
		padding: 34px 18px 64px;
	}

	.sys-pg__bar {
		margin-bottom: 24px;
	}

	.sys-pg__tab {
		padding: 11px 18px;
		font-size: 20px;
	}

	.sys-pg__title {
		font-size: 18px;
	}

	.sys-pg__pager {
		margin-top: 34px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sys-pg .sys-pg__img {
		transition: none;
	}
}
