/**
 * Portfolio listing + detail.
 *
 * organico-base.css already ships the reference theme's portfolio styling
 * (.ftc-portfolio-wrapper, .filter-bar, .portfolio-inner .item .thumbnail
 * .figcaption, .single-portfolio ...). This file only adds what that CSS
 * cannot cover on its own:
 *
 *   1. the Isotope masonry sizing, since the bundled rules assume a plain
 *      flex-wrap grid with a fixed 270px card cap;
 *   2. the green active/hover state on the filter bar, which the reference
 *      site paints from its Customizer accent (#82b53f) rather than from the
 *      stylesheet, whose own rule is black;
 *   3. touch behaviour — the bundled caption is hover-only, so on a phone the
 *      title would never appear;
 *   4. a grid (rather than an Owl carousel) for the gallery and related rows,
 *      so neither needs a slider to be initialised.
 *
 * Everything is scoped to .organik-portfolio / .single-ftc_portfolio so the
 * homepage's own .ftc-portfolio-element widget styling stays untouched.
 */

/* ---------------------------------------------------------------- Listing */

.organik-portfolio {
	padding: 70px 0 40px;
}

.organik-portfolio .filter-bar {
	padding: 0;
	list-style: none;
}

/*
 * The reference site's accent colour. The bundled rule for this selector is
 * black, so both states are restated here rather than only the colour.
 */
.organik-portfolio .filter-bar li.current,
.organik-portfolio .filter-bar li:hover,
.organik-portfolio .filter-bar li:focus-visible {
	color: #fff;
	background: #82b53f;
}

.organik-portfolio .filter-bar li:focus-visible {
	outline: 2px solid #333;
	outline-offset: 2px;
}

/*
 * Isotope absolutely positions the cards, so the container has to be a plain
 * block — organico-base.css and themeftc/css/default.css both make
 * .portfolio-inner a flex row, which would fight the layout engine.
 *
 * The negative margin cancels the 5px side padding this theme puts on #main,
 * which lands the cards' 15px inner gutter exactly on the .container content
 * edge the rest of the page aligns to. It deliberately does NOT match the 15px
 * gutter: pulling out by a full 15 overhangs #main by 10px on each side, and
 * once the container goes full-bleed (below its max-width breakpoints) that
 * overhang becomes a 10px horizontal scroll on the whole page.
 */
.organik-portfolio .portfolio-inner {
	display: block;
	margin: 0 -5px 65px;
}

.organik-portfolio .portfolio-inner::after {
	content: "";
	display: block;
	clear: both;
}

.organik-portfolio .grid-sizer {
	width: 25%;
	height: 0;
	padding: 0;
	margin: 0;
}

/*
 * Overrides the bundled "width:25%; max-width:270px; margin:15px" (and the
 * max-width:100%/padding:15px it switches to under 1199px) — a percentage
 * width capped in pixels cannot track Isotope's percentPosition maths.
 */
.organik-portfolio.ftc-portfolio-wrapper.columns-4 .portfolio-inner .item {
	display: block;
	float: left;
	width: 25%;
	max-width: none;
	margin: 0;
	padding: 0 15px 30px;
}

.organik-portfolio .portfolio-inner .item .thumbnail figure {
	position: relative;
	margin: 0;
	overflow: hidden;
}

.organik-portfolio .portfolio-inner .item .thumbnail img {
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
}

/*
 * The caption sits above the tile-wide click target, so it must not swallow
 * clicks aimed at the card — only its own links stay interactive.
 */
.organik-portfolio .portfolio-inner .item .figcaption {
	pointer-events: none;
}

.organik-portfolio .portfolio-inner .item .figcaption a {
	pointer-events: auto;
}

.organik-portfolio .portfolio-inner .item .figcaption .term {
	font-size: 14px;
	font-weight: 400;
	color: #e1e1e1;
}

.organik-portfolio .portfolio-inner .item .figcaption .term span + span::before {
	content: "/";
	padding: 0 5px;
}

.organik-portfolio .portfolio-tile-link {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 5;
}

/* Isotope moves cards with transforms; fading them in avoids a first-paint jump. */
.organik-portfolio.portfolio-ready .portfolio-inner .item {
	transition: opacity 0.3s ease-in-out;
}

.organik-portfolio .load-more-wrapper {
	margin: 0 0 20px;
}

.organik-portfolio .load-more.button {
	max-width: 100%;
}

.organik-portfolio .load-more.button.loading {
	pointer-events: none;
	opacity: 0.75;
}

.portfolio-empty {
	padding: 80px 0;
	text-align: center;
	font-size: 17px;
	color: #666;
}

.portfolio-archive-description {
	max-width: 770px;
	margin: 60px auto 0;
	text-align: center;
	color: #666;
	line-height: 28px;
}

/* --------------------------------------------------------------- Detail */

/*
 * The bundled .thumbnails rule is a flex row of 570px-capped images, which
 * leaves a single-image portfolio sitting at half width. A wrapping grid keeps
 * one image full-bleed and pairs anything beyond that.
 */
.single-ftc_portfolio .single-portfolio .thumbnails figure {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 30px;
	margin: 0;
	align-items: start;
}

.single-ftc_portfolio .single-portfolio .thumbnails figure a {
	display: block;
	max-width: none;
	margin: 0;
}

.single-ftc_portfolio .single-portfolio .thumbnails figure a:only-child {
	grid-column: 1 / -1;
}

.single-ftc_portfolio .single-portfolio .thumbnails figure img {
	display: block;
	width: 100%;
	height: auto;
}

.single-ftc_portfolio .single-portfolio .meta-content {
	margin-bottom: 10px;
}

/*
 * The bundled arrows key off :first-child/:last-child, so a portfolio with
 * only one neighbour gets the "next" arrow whichever direction it points.
 * Keying off rel= instead makes each arrow match its own link.
 */
.single-ftc_portfolio .single-portfolio .single-navigation a[rel="prev"]::before {
	content: "\f104";
}

.single-ftc_portfolio .single-portfolio .single-navigation a[rel="next"]::before {
	content: "\f105";
}

/* Related row: a grid, so the strip needs no carousel to be initialised. */
.single-ftc_portfolio .related .blogs {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 30px;
}

.single-ftc_portfolio .related .blogs article {
	margin: 0;
}

.single-ftc_portfolio .related .blogs a.thumbnail {
	display: block;
	position: relative;
	margin: 0;
	overflow: hidden;
}

.single-ftc_portfolio .related .blogs figure {
	margin: 0;
	overflow: hidden;
}

.single-ftc_portfolio .related .blogs img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 0.4s ease-in-out;
}

.single-ftc_portfolio .related .blogs a.thumbnail:hover img {
	transform: scale(1.08);
}

.single-ftc_portfolio .related .blogs .related-title {
	display: block;
	margin-top: 14px;
	text-align: center;
	font-weight: 600;
	text-transform: uppercase;
	font-size: 15px;
	color: #333;
}

.single-ftc_portfolio .related .blogs a.thumbnail:hover .related-title {
	color: #82b53f;
}

.single-ftc_portfolio .related {
	margin-bottom: 70px;
}

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

@media only screen and (max-width: 1199px) {
	.organik-portfolio.ftc-portfolio-wrapper.columns-4 .portfolio-inner .item,
	.organik-portfolio .grid-sizer {
		width: 33.3333%;
	}
}

@media only screen and (max-width: 990px) {
	.organik-portfolio {
		padding-top: 50px;
	}

	.organik-portfolio.ftc-portfolio-wrapper.columns-4 .portfolio-inner .item,
	.organik-portfolio .grid-sizer {
		width: 50%;
	}

	.single-ftc_portfolio .related .blogs {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media only screen and (max-width: 767px) {
	.organik-portfolio .filter-bar li {
		min-width: 0;
		font-size: 15px;
		line-height: 38px;
		padding: 0 14px;
		margin-bottom: 8px;
	}

	.single-ftc_portfolio .single-portfolio .thumbnails figure {
		grid-template-columns: minmax(0, 1fr);
		gap: 20px;
	}

	.single-ftc_portfolio .single-portfolio .info-content h2.entry-title {
		margin: 45px 0 24px;
		font-size: 21px;
	}
}

@media only screen and (max-width: 575px) {
	.organik-portfolio {
		padding-top: 40px;
	}

	.organik-portfolio.ftc-portfolio-wrapper.columns-4 .portfolio-inner .item,
	.organik-portfolio .grid-sizer {
		width: 100%;
	}

	.organik-portfolio .portfolio-inner {
		margin-bottom: 40px;
	}

	.single-ftc_portfolio .related .blogs {
		grid-template-columns: minmax(0, 1fr);
	}
}

/*
 * Touch screens have no hover, so the bundled "opacity:0 until :hover" caption
 * would never be readable. There the overlay and title are simply always on.
 */
@media (hover: none) {
	.organik-portfolio .portfolio-inner .item .thumbnail::before,
	.organik-portfolio .portfolio-inner .item .figcaption {
		opacity: 1;
		visibility: visible;
	}

	.organik-portfolio .portfolio-inner .item .thumbnail::before {
		background: linear-gradient(to top, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0) 65%);
	}

	.organik-portfolio .portfolio-inner .item .figcaption {
		top: auto;
		bottom: 18px;
		left: 0;
		transform: none;
		text-align: left;
		padding: 0 18px;
	}
}
