/* TB fond Projects: /proekty/, project pages, post grid by tag. Colours follow the header (--tbf-accent). */

.tbf-projects,
.tbf-project {
	--tbf-p-accent: var(--tbf-accent, #2e3049);
	--tbf-p-muted: #6b7c8f;
	--tbf-p-line: rgba(0, 0, 0, .08);
	--tbf-p-card: #fff;
	--tbf-p-radius: 20px;
	line-height: 1.6;
}

/* Page-level builder CSS (e.g. ".sduv img { filter: brightness(40%) blur(3px) }" on /proekty/) must not dim our images. */
.tbf-projects img,
.tbf-project img,
.tbf-posts img {
	filter: none !important;
	opacity: 1 !important;
}

/* ---------- /proekty/ ---------- */

.tbf-projects__notice {
	margin: 0 0 32px;
	padding: 14px 20px;
	background: color-mix(in srgb, var(--tbf-p-accent) 8%, #fff);
	border-radius: 14px;
	color: var(--tbf-p-accent);
	font-weight: 500;
}

.tbf-projects__cols {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	gap: 40px;
	align-items: start;
}

.tbf-projects__heading {
	margin: 0 0 20px;
	font-size: 1.6rem;
	line-height: 1.25;
}

.tbf-projects__empty {
	color: var(--tbf-p-muted);
}

/* Desktop: every active project card has the same height; the image is cropped to fill, long text is cut. */
.tbf-project-card {
	display: grid;
	grid-template-columns: 300px minmax(0, 1fr);
	height: 260px;
	margin: 0 0 24px;
	overflow: hidden;
	background: var(--tbf-p-card);
	border: 1px solid var(--tbf-p-line);
	border-radius: var(--tbf-p-radius);
	box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}

.tbf-project-card__image {
	display: block;
	height: 100%;
	overflow: hidden;
	background: #eceef1;
}

.tbf-project-card__image img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none;
	object-fit: cover;
}

.tbf-project-card__body {
	display: flex;
	flex-direction: column;
	min-height: 0;
	padding: 22px 28px;
}

.tbf-project-card:not(:has(.tbf-project-card__image)) {
	grid-template-columns: 1fr;
}

.tbf-project-card__title,
.tbf-project-card__desc {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.tbf-project-card__title {
	-webkit-line-clamp: 2;
	flex-shrink: 0;
}

.tbf-project-card__desc {
	-webkit-line-clamp: 3;
	flex-shrink: 0;
	color: #444;
	font-size: .95rem;
}

/* Paragraph breaks would leave the clamp with blank lines: show the description as one run of text. */
.tbf-project-card__desc p {
	display: inline;
}

.tbf-project-card__desc p + p::before {
	content: ' ';
}

.tbf-project-card__more {
	margin-top: auto;
	padding-top: 8px;
}

.tbf-project-card__meta,
.tbf-project__meta {
	margin: 0 0 6px;
	color: var(--tbf-p-muted);
	font-size: .85rem;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: .04em;
}

.tbf-project-card__title {
	margin: 0 0 10px;
	font-size: 1.3rem;
	line-height: 1.3;
}

.tbf-project-card__title a,
.tbf-project-card__title a:hover {
	color: inherit;
	text-decoration: none;
}

.tbf-project-card__more {
	display: inline-block;
	color: var(--tbf-p-accent);
	font-weight: 600;
	text-decoration: none;
}

.tbf-projects__year {
	margin: 0 0 20px;
}

.tbf-projects__year-title {
	margin: 0 0 8px;
	padding-bottom: 6px;
	border-bottom: 2px solid var(--tbf-p-accent);
	font-size: 1.15rem;
}

.tbf-project-item {
	border-bottom: 1px solid var(--tbf-p-line);
}

.tbf-project-item summary {
	position: relative;
	padding: 12px 28px 12px 0;
	font-weight: 600;
	cursor: pointer;
	list-style: none;
}

.tbf-project-item summary::-webkit-details-marker {
	display: none;
}

.tbf-project-item summary::after {
	content: '+';
	position: absolute;
	right: 4px;
	top: 10px;
	color: var(--tbf-p-muted);
	font-size: 1.2rem;
	font-weight: 400;
}

.tbf-project-item[open] summary::after {
	content: '−';
}

.tbf-project-item__body {
	padding: 0 0 14px;
	color: #444;
	font-size: .95rem;
}

.tbf-project-item__body p {
	margin: 0 0 8px;
}

.tbf-project-item__body a {
	color: var(--tbf-p-accent);
	font-weight: 600;
	text-decoration: none;
}

/* ---------- Project page ---------- */

.tbf-project {
	max-width: 1270px;
	margin: 0 auto;
	padding: 24px 20px 60px;
}

.tbf-project__crumbs {
	display: flex;
	gap: 8px;
	margin: 0 0 20px;
	color: var(--tbf-p-muted);
	font-size: .9rem;
}

.tbf-project__crumbs a {
	color: var(--tbf-p-accent);
	text-decoration: none;
}

.tbf-project__head {
	display: grid;
	gap: 32px;
	margin: 0 0 48px;
	padding: 32px;
	background: var(--tbf-p-card);
	border: 1px solid var(--tbf-p-line);
	border-radius: var(--tbf-p-radius);
}

.tbf-project__head.has-image {
	grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
	align-items: start;
}

.tbf-project__meta.is-done {
	color: #2f7d4f;
}

.tbf-project__title {
	margin: 0 0 16px;
	font-size: 2.2rem;
	line-height: 1.2;
}

.tbf-project__desc p {
	margin: 0 0 12px;
}

.tbf-project__image img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 14px;
}

.tbf-project__subtitle {
	margin: 0 0 20px;
	font-size: 1.6rem;
}

.tbf-project__empty {
	color: var(--tbf-p-muted);
}

.tbf-project__donate {
	margin-top: 48px;
	padding: 32px;
	background: color-mix(in srgb, var(--tbf-p-accent) 6%, #fff);
	border-radius: var(--tbf-p-radius);
	text-align: center;
}

.tbf-project__donate p {
	margin: 0 0 20px;
	color: var(--tbf-p-muted);
}

.tbf-project__donate .tbf-project__donate-btn {
	display: inline-block;
	padding: 14px 36px;
	background: var(--tbf-p-accent);
	border-radius: 20px;
	color: #fff;
	font-weight: 500;
	text-decoration: none;
	transition: opacity .2s;
}

.tbf-project__donate .tbf-project__donate-btn:hover {
	color: #fff;
	opacity: .85;
}

/* ---------- Post cards (project page, [tbf_tag_posts]) ---------- */

.tbf-posts {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
}

.tbf-posts--cols-4 {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tbf-posts--cols-2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tbf-post {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, .08);
	border-radius: 16px;
	color: inherit;
	text-decoration: none;
	transition: transform .2s, box-shadow .2s;
}

.tbf-post:hover {
	color: inherit;
	transform: translateY(-3px);
	box-shadow: 0 12px 32px rgba(0, 0, 0, .08);
}

.tbf-post__image {
	display: block;
	aspect-ratio: 16 / 10;
	background: #eceef1 center / cover no-repeat;
}

.tbf-post__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 16px 18px;
}

.tbf-post__date {
	color: #6b7c8f;
	font-size: .8rem;
}

.tbf-post__title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
	font-weight: 600;
	line-height: 1.35;
}

.tbf-tag-posts__empty {
	padding: 24px;
	background: #f5f5f7;
	border-radius: 16px;
	color: #6b7c8f;
	text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
	.tbf-projects__cols {
		grid-template-columns: 1fr;
	}
	.tbf-posts--cols-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 768px) {
	.tbf-project-card,
	.tbf-project__head.has-image {
		grid-template-columns: 1fr;
	}
	.tbf-project-card {
		height: auto;
	}
	.tbf-project-card__title {
		-webkit-line-clamp: 3;
	}
	.tbf-project-card__image {
		height: auto;
		aspect-ratio: 16 / 9;
	}
	.tbf-project__head {
		padding: 20px;
	}
	.tbf-project__title {
		font-size: 1.7rem;
	}
	.tbf-posts {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 16px;
	}
}

@media (max-width: 480px) {
	.tbf-posts,
	.tbf-posts--cols-4,
	.tbf-posts--cols-2 {
		grid-template-columns: 1fr;
	}
}
