.ref-wrapper {
	--ref-gap: 12px;
	--ref-radius: 8px;
	--ref-page-bg: #080b10;
	--ref-card-bg: #12161d;
	--ref-card-border: rgba(255, 255, 255, 0.08);
	--ref-text: #fff;
	--ref-text-muted: rgba(255, 255, 255, 0.55);
	--ref-filter-inactive: #444444;
	--ref-filter-active: #de4f61;
}

/* Filters */
.ref-filters__list {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
	list-style: none;
	margin: 0 0 32px;
	padding: 0;
}

.ref-filters__item {
	list-style: none;
	list-style-image: none;
}

.ref-filters__item::marker {
	content: '';
}

.ref-filters__btn {
	background: transparent;
	border: none;
	font-size: 18px;
	font-weight: 700;
	padding: 8px 14px;
	color: var(--ref-filter-inactive);
	cursor: pointer;
	transition: color 0.2s ease;
}

.ref-filters__btn:hover {
	color: var(--ref-filter-active);
}

.ref-filters__item.is-active .ref-filters__btn {
	color: var(--ref-filter-active);
}

/* Grid - fixed 3 equal-width columns, cards keep a stable size */
.ref-grid {
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: var(--ref-gap);
	align-items: stretch;
}

.ref-card {
	background: var(--ref-card-bg);
	border: 1px solid var(--ref-card-border);
	border-radius: var(--ref-radius);
	padding: 30px;
	color: var(--ref-text);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ref-card.is-hidden {
	display: none;
}

.ref-card__media {
	aspect-ratio: 4 / 3;
	background: rgba(255, 255, 255, 0.04);
	overflow: hidden;
	border-radius: var(--ref-radius);
	margin: -30px -30px 20px;
	width: calc(100% + 60px);
}

.ref-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 0;
}

.ref-card__body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
}

.ref-card__title {
	margin: 0;
	font-size: 18px;
	line-height: 1.3;
	color: var(--ref-text);
}

.ref-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	color: var(--ref-text-muted);
}

.ref-card__cat::after {
	content: '\2022';
	margin-left: 8px;
}

.ref-card__meta .ref-card__rok:last-child::before {
	content: none;
}

.ref-card__more {
	margin-top: auto;
	align-self: flex-start;
}

.ref-empty {
	color: var(--ref-text-muted);
}

/*
 * Modal - native popover, rendered in the top layer.
 * The popover element IS the dialog box (not a full-viewport wrapper) -
 * that's what makes native light-dismiss on outside click work: a click
 * outside this box lands on the ::backdrop, which counts as "outside".
 */
.ref-modal[popover] {
	position: fixed;
	inset: 0;
	margin: auto;
	width: calc(100% - 32px);
	max-width: 720px;
	max-height: calc(100vh - 64px);
	overflow-y: auto;
	background: var(--ref-card-bg);
	border: 1px solid var(--ref-card-border);
	color: var(--ref-text);
	border-radius: var(--ref-radius);
	padding: 32px;
}

.ref-modal::backdrop {
	background: rgba(0, 0, 0, 0.7);
}

.ref-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	background: none;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: var(--ref-text);
}

.ref-modal__media img {
	width: 100%;
	height: auto;
	border-radius: var(--ref-radius);
	margin-bottom: 20px;
}

.ref-modal__title {
	margin: 0 0 8px;
	color: var(--ref-text);
}

.ref-modal__meta {
	display: flex;
	gap: 12px;
	font-size: 13px;
	color: var(--ref-text-muted);
	margin-bottom: 16px;
}

.ref-modal__content {
	line-height: 1.6;
}

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

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