/**
 * Christal Team – front-end styles
 *
 * Uitgangspunt is de huisstijl van christal.nl: Poppins, magenta #e40d75 met
 * blauw #2871e4 als tweede accent, foto's in 3:4 en een raster van vier
 * kolommen dat via twee naar één terugvalt. Strak betekent hier: rustige
 * verhoudingen, weinig randen, en beweging die je nauwelijks opmerkt.
 *
 * Alle instelbare waarden komen als CSS custom properties uit PHP.
 */

/* -------------------------------------------------------------------------
 *  1. Container & raster
 * ---------------------------------------------------------------------- */

.ct-team {
	--ct-cols: 4;
	--ct-cols-tablet: 2;
	--ct-cols-mobile: 1;
	--ct-gap: 29px;
	--ct-max-width: 1260px;
	--ct-ratio: 3 / 4;
	--ct-fit: cover;
	--ct-radius: 5px;
	--ct-photo-bg: #ffffff;
	--ct-accent: #e40d75;
	--ct-accent-alt: #2871e4;
	--ct-heading: #1a1a1a;
	--ct-role: #777777;
	--ct-ease: cubic-bezier(0.22, 1, 0.36, 1);

	/*
	 * Lettertype. Volgt eerst het kopletterype van het thema en dan het
	 * bodyletterype — op christal.nl is dat allebei Poppins. Staat geen van
	 * beide gedefinieerd, dan vragen we Poppins alsnog met sans-serif als
	 * vangnet. Vul je bij de instellingen een lettertype in, dan overschrijft
	 * PHP deze regel.
	 *
	 * Waarom expliciet en niet gewoon overerven: de naam is een <h3> en pakt
	 * de kopstijl van het thema, terwijl de functie een <p> is. Als een thema
	 * of pagebuilder daar een eigen lettertype op zet, gaan naam en functie
	 * uit elkaar lopen. Door beide dezelfde variabele te geven blijft dat gelijk.
	 */
	--ct-font: var(--h1-font-family, var(--font-family, Poppins, sans-serif));

	box-sizing: border-box;
	width: 100%;
	max-width: var(--ct-max-width);
	margin-inline: auto;
	font-family: var(--ct-font);
}

.ct-team *,
.ct-team *::before,
.ct-team *::after {
	box-sizing: border-box;
}

.ct-grid {
	display: grid;
	grid-template-columns: repeat(var(--ct-cols), minmax(0, 1fr));
	gap: var(--ct-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Thema's zetten graag bullets en marges op li's; die halen we weg. */
.ct-grid > li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ct-grid > li::before,
.ct-grid > li::marker {
	content: none;
}

/* -------------------------------------------------------------------------
 *  2. Kaart
 * ---------------------------------------------------------------------- */

.ct-card {
	position: relative;
	display: flex;
	flex-direction: column;
	transition: transform 0.5s var(--ct-ease);
}

/* -------------------------------------------------------------------------
 *  3. Foto
 * ---------------------------------------------------------------------- */

.ct-photo {
	position: relative;
	overflow: hidden;
	aspect-ratio: var(--ct-ratio);
	border-radius: var(--ct-radius);
	/* Zichtbaar bij transparante foto's, bij "volledig tonen" en heel even
	   terwijl de foto nog laadt. Standaard wit, zodat het kader opgaat in
	   een witte pagina. */
	background: var(--ct-photo-bg);
	/* Eigen stacking context, zodat de contactknoppen netjes bovenop liggen. */
	isolation: isolate;
}

.ct-photo__img,
.ct-photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: var(--ct-fit);
	object-position: center top;
	transition:
		transform 0.7s var(--ct-ease),
		filter 0.5s var(--ct-ease);
}

/* "Volledig tonen" hoort niet bovenaan uitgelijnd te worden. */
.ct-fit-contain .ct-photo__img {
	object-position: center;
}

/* Geen foto? Dan de initialen, in de accentkleur. */
.ct-photo__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--ct-font);
	font-size: clamp(1.6rem, 4vw, 2.4rem);
	font-weight: 600;
	letter-spacing: 0.04em;
	color: #fff;
	background: linear-gradient(135deg, var(--ct-accent), var(--ct-accent-alt));
}

/* Zwart-wit tot je eroverheen gaat. */
.ct-img-grayscale .ct-photo__img {
	filter: grayscale(1);
}

.ct-img-grayscale .ct-card:hover .ct-photo__img,
.ct-img-grayscale .ct-card:focus-within .ct-photo__img {
	filter: grayscale(0);
}

/* Hover-effecten. */
.ct-hover-zoom .ct-card:hover .ct-photo__img,
.ct-hover-zoom .ct-card:focus-within .ct-photo__img {
	transform: scale(1.045);
}

/*
 * Chrome tekent een element eenmalig op de huidige schaal en rekt dat daarna
 * op met de GPU; tijdens het inzoomen oogt de foto daardoor zachter. Met deze
 * hint maakt Chrome vooraf een eigen laag aan en tekent hij op de uiteindelijke
 * schaal. Alleen tijdens hover, zodat er niet voor elke foto op de pagina
 * blijvend een laag in het geheugen staat.
 */
.ct-hover-zoom .ct-card:hover .ct-photo__img,
.ct-hover-zoom .ct-card:focus-within .ct-photo__img {
	will-change: transform;
	backface-visibility: hidden;
}

.ct-hover-lift .ct-card:hover,
.ct-hover-lift .ct-card:focus-within {
	transform: translateY(-6px);
}

.ct-hover-lift .ct-photo {
	transition: box-shadow 0.5s var(--ct-ease);
}

.ct-hover-lift .ct-card:hover .ct-photo,
.ct-hover-lift .ct-card:focus-within .ct-photo {
	box-shadow: 0 18px 38px -22px rgba(26, 26, 26, 0.5);
}

/* -------------------------------------------------------------------------
 *  4. Contactknoppen
 * ---------------------------------------------------------------------- */

.ct-contact {
	position: absolute;
	right: 10px;
	bottom: 10px;
	display: flex;
	gap: 6px;
	opacity: 0;
	transform: translateY(8px);
	transition:
		opacity 0.4s var(--ct-ease),
		transform 0.4s var(--ct-ease);
}

.ct-card:hover .ct-contact,
.ct-card:focus-within .ct-contact {
	opacity: 1;
	transform: translateY(0);
}

.ct-contact__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: var(--ct-heading);
	text-decoration: none;
	box-shadow: 0 2px 8px -2px rgba(26, 26, 26, 0.35);
	transition:
		background 0.25s ease,
		color 0.25s ease,
		transform 0.25s var(--ct-ease);
}

.ct-contact__link:hover,
.ct-contact__link:focus-visible {
	background: var(--ct-accent);
	color: #fff;
	transform: translateY(-2px);
}

.ct-contact__link svg {
	width: 17px;
	height: 17px;
	fill: currentColor;
}

/* Op touch is er geen hover: dan meteen tonen. */
@media (hover: none) {
	.ct-contact {
		opacity: 1;
		transform: none;
	}
}

/* -------------------------------------------------------------------------
 *  5. Naam, functie, afdeling
 * ---------------------------------------------------------------------- */

.ct-body {
	padding-top: 14px;
}

/* Het streepje dat op hover onder de naam doorloopt: het enige echte
   sierelement, in het verloop van de twee accentkleuren. */
.ct-body::before {
	content: "";
	display: block;
	width: 26px;
	height: 2px;
	margin-bottom: 12px;
	border-radius: 2px;
	background: linear-gradient(90deg, var(--ct-accent), var(--ct-accent-alt));
	transform-origin: left center;
	transform: scaleX(1);
	transition: transform 0.5s var(--ct-ease);
}

.ct-card:hover .ct-body::before,
.ct-card:focus-within .ct-body::before {
	transform: scaleX(2.4);
}

.ct-name {
	margin: 0;
	font-family: var(--ct-font);
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: -0.02em;
	color: var(--ct-heading);
}

.ct-role {
	margin: 5px 0 0;
	font-family: var(--ct-font);
	font-size: 0.875rem;
	font-weight: 400;
	line-height: 1.45;
	color: var(--ct-role);
}

.ct-department {
	margin: 6px 0 0;
	font-family: var(--ct-font);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ct-accent);
}

.ct-bio {
	margin-top: 10px;
	font-family: var(--ct-font);
	font-size: 0.875rem;
	line-height: 1.6;
	color: var(--ct-role);
}

.ct-bio p:last-child {
	margin-bottom: 0;
}

/* -------------------------------------------------------------------------
 *  6. Filterbalk
 * ---------------------------------------------------------------------- */

.ct-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: calc(var(--ct-gap) * 0.9);
}

.ct-filter__btn {
	padding: 7px 16px;
	border: 1px solid #e8e8e8;
	border-radius: 100px;
	background: transparent;
	color: var(--ct-heading);
	font: inherit;
	font-family: var(--ct-font);
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.4;
	cursor: pointer;
	transition:
		border-color 0.25s ease,
		background 0.25s ease,
		color 0.25s ease;
}

.ct-filter__btn:hover {
	border-color: var(--ct-accent);
	color: var(--ct-accent);
}

.ct-filter__btn.is-active {
	border-color: var(--ct-accent);
	background: var(--ct-accent);
	color: #fff;
}

.ct-filter__btn:focus-visible {
	outline: 2px solid var(--ct-accent-alt);
	outline-offset: 2px;
}

/* Uitgefilterde kaarten. */
.ct-card.is-hidden {
	display: none;
}

/* -------------------------------------------------------------------------
 *  7. Invaden bij scrollen
 * ---------------------------------------------------------------------- */

.ct-reveal .ct-card {
	opacity: 0;
	transform: translateY(16px);
}

.ct-reveal .ct-card.is-visible {
	opacity: 1;
	transform: translateY(0);
	transition:
		opacity 0.6s var(--ct-ease),
		transform 0.6s var(--ct-ease);
	/* Kleine trapsgewijze vertraging. PHP levert --ct-i al terugrekenend per
	   acht aan, zodat de laatste rij niet seconden hoeft te wachten (en we
	   hier geen mod() nodig hebben, dat nog te weinig browsers kennen). */
	transition-delay: calc(var(--ct-i, 0) * 60ms);
}

/* Zonder JavaScript zou het raster onzichtbaar blijven. De renderer zet
   daarom een <noscript>-regel in de pagina die dit terugdraait. */

/* -------------------------------------------------------------------------
 *  8. Responsive
 * ---------------------------------------------------------------------- */

@media (max-width: 1024px) {
	.ct-grid {
		grid-template-columns: repeat(var(--ct-cols-tablet), minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.ct-grid {
		grid-template-columns: repeat(var(--ct-cols-mobile), minmax(0, 1fr));
		gap: calc(var(--ct-gap) * 0.9);
	}

	.ct-name {
		font-size: 1rem;
	}
}

/* -------------------------------------------------------------------------
 *  9. Toegankelijkheid
 * ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.ct-card,
	.ct-photo__img,
	.ct-contact,
	.ct-body::before {
		transition: none !important;
		transform: none !important;
	}

	.ct-reveal .ct-card {
		opacity: 1;
		transform: none;
	}
}

/* -------------------------------------------------------------------------
 *  10. Lege staat (alleen zichtbaar voor redacteuren)
 * ---------------------------------------------------------------------- */

.ct-empty {
	padding: 18px 20px;
	border: 1px dashed rgba(26, 26, 26, 0.22);
	border-radius: 6px;
	color: rgba(26, 26, 26, 0.65);
	font-size: 0.9rem;
}
