/*
 * tdn-event-types-grid — Phase C.6 Bloc 5a (Page Expertises)
 *
 * Grille zigzag 8 cards typologies événements.
 *   - Bg fixe Morgan : var(--tdn-color-pink-50-deep, #fbe9ec) (override Figma)
 *   - Header intro multi-couleur : pink-500 + midnight + pink-500 sur 4 lignes
 *   - 8 cards en zigzag : photo 620-681×350 rounded 24 + overlay caption box midnight
 *     absolute bottom avec cool-shape pink débordant à droite
 *   - Courbe pointillée décor SVG/PNG entre les cards (lien visuel zigzag)
 *
 * Spec Figma : node 8115:5576. Pattern réutilisable potentiel KP/PS.
 */

/* ===== 1. Section root ============================================
 * Background-color var(--tdn-color-pink-50-deep, #fbe9ec) imposé par Morgan, NON conforme Figma.
 * Décision Morgan figée : NE PAS revérifier ni re-aligner sur Figma.
 * !important forcé car un parent CSS (probablement GeneratePress / template-fullwidth)
 * applique un background blanc qui écrasait la règle sans force. */
.tdn-event-types-grid {
	position: relative;
	background-color: var(--tdn-color-pink-50-deep, #fbe9ec) !important;
	background-image: none !important;
	padding: 100px 0 120px;
	overflow: hidden;
	font-family: var(--tdn-font-family-brand, 'Nunito Sans', sans-serif);
}

/* ===== 2. Inner wrapper ========================================== */
.tdn-event-types-grid__inner {
	max-width: 1442px;
	margin: 0 auto;
	padding: 0 52px;
	position: relative;
}

/* ===== 3. Header intro multi-couleur ============================== */
.tdn-event-types-grid__intro {
	margin: 0 auto 80px;
	max-width: 1140px;
	font-weight: var(--tdn-h2-weight);
	font-size: clamp(32px, 4vw, 48px);
	line-height: 1.3;
	letter-spacing: -0.03em;
	text-align: center;
	font-style: normal;
}

.tdn-event-types-grid__intro-pink {
	color: var(--tdn-color-pink-500, #C06D80);
}

.tdn-event-types-grid__intro-midnight {
	color: var(--tdn-color-midnight-900, #1A1A2E);
}

/* ===== 4. Cards container ========================================= */
.tdn-event-types-grid__cards {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 60px;
	z-index: 1;
}

/* Courbe pointillée décor — RETIRÉE par décision Morgan 2026-05-06.
 * Le fond doit être un aplat plein var(--tdn-color-pink-50-deep, #fbe9ec), sans aucune image/texture/gradient.
 * Règle conservée commentée pour traçabilité, ne pas réactiver sans validation Morgan.
 *
 * .tdn-event-types-grid__curve {
 *     position: absolute; top: 0; left: 0; right: 0; height: 100%;
 *     pointer-events: none; user-select: none; z-index: 0; opacity: 0.6;
 * }
 */

/* ===== 5. Card individuelle ======================================= */
.tdn-event-types-grid__card {
	position: relative;
	width: 100%;
	max-width: 781px;
	height: 420px;
}

/* Alternance gauche/droite (modifiers --left / --right) */
.tdn-event-types-grid__card--left {
	align-self: flex-start;
}

.tdn-event-types-grid__card--right {
	align-self: flex-end;
}

/* ===== 6. Photo principale ========================================
 * Defaults width + min-height pour défendre contre :
 *  - cas où modifiers --left/--right ne matchent pas (cache CSS stale)
 *  - chargement lazy : si img pas encore chargée, figure conserve dimensions */
.tdn-event-types-grid__card-photo {
	position: absolute;
	top: 0;
	width: 681px; /* défaut, override par --left (681) / --right (620) */
	height: 350px;
	min-height: 350px;
	border-radius: 24px;
	overflow: hidden;
	margin: 0;
	background-color: var(--tdn-color-pink-100, #F6C9D0); /* fallback si img fail load */
}

.tdn-event-types-grid__card--left .tdn-event-types-grid__card-photo {
	left: 0;
	width: 681px;
}

.tdn-event-types-grid__card--right .tdn-event-types-grid__card-photo {
	left: 81px;
	width: 620px;
}

.tdn-event-types-grid__card-photo img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 350px; /* défense lazy load */
	object-fit: cover;
	border-radius: inherit;
}

/* Overlay gradient bottom : pink-500 0→0.3 */
.tdn-event-types-grid__card-photo::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(192, 109, 128, 0) 50%, rgba(192, 109, 128, 0.3) 100%);
	border-radius: inherit;
	pointer-events: none;
}

/* ===== 7. Caption box (midnight, absolute bottom) =================
 * overflow: hidden requis : Figma utilise `overflow-clip` sur ce bloc
 * pour CONTENIR le cool-shape qui déborde légèrement (right: -18px).
 * L'effet visuel = silhouette filigrane intégrée dans le bloc, pas dehors. */
.tdn-event-types-grid__card-caption {
	position: absolute;
	top: 281px;
	background: var(--tdn-color-midnight-900, #1A1A2E);
	border-radius: 16px;
	padding: 24px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	overflow: hidden;
	z-index: 2;
}

.tdn-event-types-grid__card--left .tdn-event-types-grid__card-caption {
	left: 90px;
	max-width: 440px;
}

.tdn-event-types-grid__card--right .tdn-event-types-grid__card-caption {
	left: 0;
	max-width: 440px;
}

/* Cool-shape filigrane intégrée dans le caption sombre.
 * Span vide + mask-image SVG (8 silhouettes uniques) + bg-color subtle white-alpha
 * pour donner un voile blanc très léger sur fond midnight = effet filigrane Figma.
 * Position right: -18px + size 127×127 (valeurs exactes Figma) ; le débordement
 * est CLIPPÉ par overflow:hidden du caption parent. */
.tdn-event-types-grid__card-shape {
	display: block;
	position: absolute;
	right: -18px;
	top: 50%;
	transform: translateY(-50%);
	width: 127px;
	height: 127px;
	background-color: rgba(255, 255, 255, 0.07); /* filigrane subtil sur midnight */
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-size: contain;
	mask-size: contain;
	pointer-events: none;
	user-select: none;
	z-index: 0; /* sous le texte du caption */
}

.tdn-event-types-grid__card-shape--1 {
	-webkit-mask-image: url("../../images/event-types/icons/icon-1-convention.svg");
	mask-image: url("../../images/event-types/icons/icon-1-convention.svg");
}

.tdn-event-types-grid__card-shape--2 {
	-webkit-mask-image: url("../../images/event-types/icons/icon-2-seminaire.svg");
	mask-image: url("../../images/event-types/icons/icon-2-seminaire.svg");
}

.tdn-event-types-grid__card-shape--3 {
	-webkit-mask-image: url("../../images/event-types/icons/icon-3-kick-off.svg");
	mask-image: url("../../images/event-types/icons/icon-3-kick-off.svg");
}

.tdn-event-types-grid__card-shape--4 {
	-webkit-mask-image: url("../../images/event-types/icons/icon-4-lancement.svg");
	mask-image: url("../../images/event-types/icons/icon-4-lancement.svg");
}

.tdn-event-types-grid__card-shape--5 {
	-webkit-mask-image: url("../../images/event-types/icons/icon-5-roadshow.svg");
	mask-image: url("../../images/event-types/icons/icon-5-roadshow.svg");
}

.tdn-event-types-grid__card-shape--6 {
	-webkit-mask-image: url("../../images/event-types/icons/icon-6-soiree-gala.svg");
	mask-image: url("../../images/event-types/icons/icon-6-soiree-gala.svg");
}

.tdn-event-types-grid__card-shape--7 {
	-webkit-mask-image: url("../../images/event-types/icons/icon-7-assemblee.svg");
	mask-image: url("../../images/event-types/icons/icon-7-assemblee.svg");
}

.tdn-event-types-grid__card-shape--8 {
	-webkit-mask-image: url("../../images/event-types/icons/icon-8-incentive.svg");
	mask-image: url("../../images/event-types/icons/icon-8-incentive.svg");
}

/* ===== 8. Caption titre + description ============================= */
.tdn-event-types-grid__card-title {
	margin: 0;
	font-weight: var(--tdn-h2-weight);
	font-size: 24px;
	line-height: 1;
	letter-spacing: -0.03em;
	color: var(--tdn-color-pink-100, #F6C9D0);
	text-transform: none;
	font-style: normal;
}

.tdn-event-types-grid__card-description {
	margin: 0;
	font-weight: var(--tdn-font-weight-medium);
	font-size: 16px;
	line-height: 1.3;
	letter-spacing: -0.03em;
	color: #fff;
	text-transform: none;
	font-style: normal;
}

/* ===== 9. Responsive <1024 (tablette) ============================= */
@media (max-width: 1023px) {
	.tdn-event-types-grid {
		padding: 80px 0 100px;
	}

	.tdn-event-types-grid__inner {
		padding: 0 32px;
	}

	.tdn-event-types-grid__intro {
		margin-bottom: 60px;
		font-size: 36px;
	}

	.tdn-event-types-grid__cards {
		gap: 40px;
	}

	.tdn-event-types-grid__card {
		max-width: 620px;
		height: 380px;
	}

	.tdn-event-types-grid__card--left .tdn-event-types-grid__card-photo,
	.tdn-event-types-grid__card--right .tdn-event-types-grid__card-photo {
		left: 0;
		width: 100%;
	}

	.tdn-event-types-grid__card--left .tdn-event-types-grid__card-caption,
	.tdn-event-types-grid__card--right .tdn-event-types-grid__card-caption {
		left: 24px;
		max-width: calc(100% - 80px);
	}

	.tdn-event-types-grid__curve {
		display: none;
	}
}

/* ===== 10. Responsive <768 (mobile — CAR0 carrousel horizontal) ====
 * Markup CAR0 : <section class="... gk-carousel"> wrap les cards dans
 * .gk-carousel__viewport (scroll-snap horizontal) + .gk-carousel__track
 * (display: contents). gk-carousel-mobile.css gère le viewport flex,
 * scroll-snap, padding et nav arrows. Ici on neutralise les positions
 * absolute desktop et les modifiers --left/--right pour avoir une card
 * "carte" simple : photo en haut, caption sous la photo (overlap léger). */
@media (max-width: 767px) {
	.tdn-event-types-grid {
		padding: 60px 0 80px;
	}

	.tdn-event-types-grid__inner {
		padding: 0;
	}

	.tdn-event-types-grid__intro {
		padding: 0 16px;
		font-size: 28px;
		line-height: 1.25;
	}

	/* Override flex-direction desktop column → gk-carousel mobile row.
	 * scroll-padding-inline-start élevé à 40px (edge 16 + peek 24) pour rendre
	 * la card précédente partiellement visible à gauche dès la slide 2 (peek
	 * symétrique au peek droit). Override le default 16px de gk-carousel-mobile.css. */
	.tdn-event-types-grid__cards.gk-carousel__viewport {
		flex-direction: row;
		gap: var(--gk-carousel-gap);
		scroll-padding-inline-start: 40px;
	}

	/* Variables CAR0 spécifiques (peek symétrique 24px gauche + droite).
	 * Formule : viewport(100vw) = peek_gauche(24) + gap(16) + card + gap(16) + peek_droite(24)
	 * → card = 100vw - 80. Combiné à scroll-padding-inline-start: 40px (cf. viewport),
	 *   peek gauche apparaît dès la slide 2, peek droite reste constant. */
	.tdn-event-types-grid.gk-carousel {
		--gk-carousel-card-width: calc(100vw - 80px);
		--gk-carousel-gap: 16px;
		--gk-carousel-peek: 24px;
		--gk-carousel-arrow-color: var(--tdn-color-midnight-900, #1A1A2E);
	}

	/* Card mobile : reset des contraintes desktop + modifiers --left/--right */
	.tdn-event-types-grid__card,
	.tdn-event-types-grid__card--left,
	.tdn-event-types-grid__card--right {
		align-self: auto;
		width: auto;
		max-width: none;
		height: auto;
		min-height: 360px;
		padding-bottom: 80px;
	}

	/* Photo : reset position absolute desktop, prend la pleine largeur card */
	.tdn-event-types-grid__card-photo,
	.tdn-event-types-grid__card--left .tdn-event-types-grid__card-photo,
	.tdn-event-types-grid__card--right .tdn-event-types-grid__card-photo {
		position: relative;
		left: 0;
		top: 0;
		width: 100%;
		height: 240px;
		min-height: 240px;
	}

	.tdn-event-types-grid__card-photo img {
		min-height: 240px;
	}

	/* Caption : reset top/left desktop, overlap léger sous la photo */
	.tdn-event-types-grid__card-caption,
	.tdn-event-types-grid__card--left .tdn-event-types-grid__card-caption,
	.tdn-event-types-grid__card--right .tdn-event-types-grid__card-caption {
		position: relative;
		top: auto;
		left: auto;
		margin: -40px 16px 0;
		max-width: none;
		padding: 20px;
	}

	.tdn-event-types-grid__card-shape {
		width: 96px;
		height: 96px;
		right: -16px;
	}

	.tdn-event-types-grid__card-title {
		font-size: 20px;
	}

	.tdn-event-types-grid__card-description {
		font-size: 14px;
	}

	/* iOS : bloquer tap preview sur photo */
	.tdn-event-types-grid__card-photo,
	.tdn-event-types-grid__card-photo img {
		pointer-events: none;
		-webkit-touch-callout: none;
		-webkit-user-select: none;
		user-select: none;
	}

	.tdn-event-types-grid__card {
		-webkit-tap-highlight-color: transparent;
	}

	/* Indicators : hitbox compactée 28×28 + gap 0 pour resserrer 8 dots
	 * (default 44×44 + gap 4 = ~340px de range, trop étalé). 28×28 reste
	 * cliquable au pouce (cf. Material Design 32, Apple HIG min 28). */
	.tdn-event-types-grid .gk-carousel__indicators {
		gap: 0;
	}

	.tdn-event-types-grid .gk-carousel__dot {
		width: 28px;
		height: 28px;
	}
}

/* ===== 11. Ajouts défensifs ======================================= */
.tdn-event-types-grid,
.tdn-event-types-grid__intro,
.tdn-event-types-grid__card-title,
.tdn-event-types-grid__card-description {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}
