/* DB Copyright Images - Frontend
   -------------------------------------------------- */

:root {
	--db-copyright-accent: #DBFD4F;   /* vert Destination Béthune */
	--db-copyright-accent-text: #111; /* texte sur fond vert */
}

.db-copyright-wrap {
	position: relative;
	display: inline-block;
	max-width: 100%;
	line-height: 0;
	vertical-align: top;
}

.db-copyright-wrap > img {
	max-width: 100%;
	height: auto;
}

/* ---------- Bulle ⓘ ---------- */

.db-copyright-bubble {
	position: absolute;
	bottom: 16px;
	right: 16px;
	width: 36px;
	height: 36px;
	padding: 0;
	margin: 0;
	border: 1px solid rgba(0, 0, 0, 0.12);
	background: #ffffff;
	color: #111;
	border-radius: 50%;
	font-family: Georgia, "Times New Roman", serif;
	font-size: 20px;
	font-style: italic;
	font-weight: 700;
	line-height: 34px;
	text-align: center;
	cursor: pointer;
	z-index: 10;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
	/* Pas de background-color dans les transitions : changement instantané vers le vert */
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.db-copyright-bubble::before {
	content: "i";
	display: inline-block;
}

.db-copyright-bubble:hover,
.db-copyright-bubble:focus {
	background: #f3f3f3;
	transform: scale(1.08);
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
	outline: none;
}

/* État "ouvert" : bulle en vert DB, apparition instantanée + pop */
.db-copyright-wrap.is-open .db-copyright-bubble {
	background: var(--db-copyright-accent);
	color: var(--db-copyright-accent-text);
	border-color: var(--db-copyright-accent);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
	animation: db-pop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Tooltip ---------- */

.db-copyright-tooltip {
	position: absolute;
	box-sizing: border-box;
	/* Juste au-dessus de la bulle : 16 (bubble bottom) + 36 (bubble height) + 10 (gap) */
	bottom: 62px;
	right: 16px;
	min-width: 220px;
	/* Cap à 440px ET ne dépasse jamais la largeur de l'image (wrap) */
	max-width: min(440px, calc(100% - 32px));
	width: max-content;
	padding: 16px 48px 16px 20px; /* respire + place pour la croix */
	background: rgba(0, 0, 0, 0.88);
	color: #fff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 13.5px;
	font-weight: 400;
	font-style: normal;
	line-height: 1.55;
	text-align: left;
	border-radius: 8px;
	white-space: pre-line;
	word-wrap: break-word;
	overflow-wrap: break-word;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(6px);
	/* Pas de background-color / color dans les transitions : changement instantané */
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
	z-index: 11;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.db-copyright-tooltip::after {
	content: "";
	position: absolute;
	top: 100%;
	right: 18px; /* centré approximativement sur la bulle 36px à right:10 */
	border: 7px solid transparent;
	border-top-color: rgba(0, 0, 0, 0.88);
}

/* Click only : la tooltip ne s'affiche QU'à l'ouverture, pas au hover */
.db-copyright-wrap.is-open .db-copyright-tooltip {
	background: var(--db-copyright-accent);
	color: var(--db-copyright-accent-text);
	pointer-events: auto;
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	animation: db-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.db-copyright-wrap.is-open .db-copyright-tooltip::after {
	border-top-color: var(--db-copyright-accent);
}

@keyframes db-pop {
	0% {
		transform: translateY(0) scale(0.85);
	}
	60% {
		transform: translateY(0) scale(1.03);
	}
	100% {
		transform: translateY(0) scale(1);
	}
}

/* ---------- Bouton croix ---------- */

.db-copyright-close {
	display: none;
	position: absolute;
	top: 10px;
	right: 10px;
	width: 26px;
	height: 26px;
	padding: 0;
	margin: 0;
	border: none;
	background: rgba(0, 0, 0, 0.12);
	color: var(--db-copyright-accent-text);
	border-radius: 50%;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 18px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.db-copyright-wrap.is-open .db-copyright-close {
	display: flex;
	align-items: center;
	justify-content: center;
	animation: db-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Caractère × : on le décale très légèrement pour le centrage optique */
.db-copyright-close::before {
	content: "×";
	display: block;
	line-height: 1;
	margin-top: -2px; /* compensation optique du × */
}

.db-copyright-close:hover,
.db-copyright-close:focus {
	background: rgba(0, 0, 0, 0.28);
	transform: scale(1.1);
	outline: none;
}

/* ---------- Bascule à gauche si débord ---------- */

.db-copyright-wrap.tooltip-left .db-copyright-tooltip {
	right: auto;
	left: 16px;
}

.db-copyright-wrap.tooltip-left .db-copyright-tooltip::after {
	right: auto;
	left: 18px;
}

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
	.db-copyright-tooltip {
		font-size: 13.5px;
		/* Width explicite (iOS Safari ne calcule pas width:auto avec left+right
		   correctement sur des inline-block — bug connu) */
		left: 14px;
		right: auto;
		width: calc(100% - 28px);
		max-width: none;
		min-width: 0;
		padding: 14px 44px 14px 16px;
		/* 14 (bubble bottom) + 38 (bubble height) + 8 (gap) */
		bottom: 60px;
	}

	/* Tooltip-left désactivé en mobile : le width explicite gère déjà tout */
	.db-copyright-wrap.tooltip-left .db-copyright-tooltip {
		left: 14px;
		right: auto;
	}

	.db-copyright-bubble {
		width: 38px;
		height: 38px;
		line-height: 36px;
		font-size: 21px;
		bottom: 14px;
		right: 14px;
	}

	.db-copyright-close {
		top: 8px;
		right: 8px;
	}
}
