/**
 * Calendanse Flash — fil d’actualité éditorial (préfixe csn- / csn-flash-).
 * Dans le flux, non sticky par défaut. z-index sous Simple Nav et #wpadminbar.
 */

html.csn-banner-dismissed-storage #csn-site-notice-root {
	display: none !important;
}

.csn-site-notice,
.csn-site-notice * {
	box-sizing: border-box;
}

.csn-flash {
	--csn-ink: #2c1810;
	--csn-muted: #6b5348;
	--csn-line: rgba(44, 24, 16, 0.1);
	--csn-bg: #f7f1ea;
	--csn-badge: #fff;
	width: 100%;
	margin: 0;
	padding: 0;
	position: relative;
	z-index: 20;
	background: var(--csn-bg);
	color: var(--csn-ink);
	border-bottom: 1px solid var(--csn-line);
	font-size: 0.9375rem;
	line-height: 1.35;
}

.csn-flash.csn-site-notice--sticky {
	position: sticky;
	top: 0;
	z-index: 100;
}

body.admin-bar .csn-flash.csn-site-notice--sticky {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .csn-flash.csn-site-notice--sticky {
		top: 46px;
	}
}

.csn-flash__inner {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0.65rem 0.85rem;
	max-width: 1180px;
	margin: 0 auto;
	padding: 0.4rem 1rem 0.4rem 0.85rem;
	min-height: 2.5rem;
}

.csn-flash__brand {
	flex: 0 0 auto;
	font-size: 0.62rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: #8a5a3a;
	padding: 0.18rem 0.4rem 0.14rem;
	border: 1px solid rgba(138, 90, 58, 0.28);
	border-radius: 3px;
	line-height: 1;
}

.csn-news-feed__viewport {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
}

.csn-flash__item {
	display: none;
	width: 100%;
	align-items: center;
	gap: 0.7rem 0.9rem;
	min-width: 0;
}

.csn-flash__item.is-active {
	display: flex;
}

.csn-flash__badge {
	display: inline-flex;
	align-items: center;
	gap: 0.32rem;
	flex: 0 0 auto;
	background: var(--csn-badge);
	border: 1px solid var(--csn-line);
	border-radius: 999px;
	padding: 0.18rem 0.55rem 0.18rem 0.4rem;
	line-height: 1.2;
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.csn-flash__emoji {
	font-size: 1rem;
	line-height: 1;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
}

.csn-flash__type {
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--csn-muted);
	white-space: nowrap;
}

.csn-flash__copy {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	align-items: baseline;
	gap: 0.4rem 0.55rem;
	color: var(--csn-ink);
}

.csn-flash__title {
	font-weight: 600;
	flex: 0 0 auto;
}

.csn-flash__text,
.csn-flash__text p {
	margin: 0;
	min-width: 0;
	font-weight: 500;
}

.csn-flash__text p {
	display: inline;
}

.csn-flash__cta {
	flex: 0 0 auto;
	font-size: 0.8rem;
	font-weight: 600;
	color: #8a5a3a;
	text-decoration: none;
	white-space: nowrap;
	border-bottom: 1px solid rgba(138, 90, 58, 0.35);
	padding-bottom: 1px;
}

.csn-flash__cta:hover,
.csn-flash__cta:focus-visible {
	color: #2c1810;
	border-bottom-color: currentColor;
	outline: 2px solid #8a5a3a;
	outline-offset: 3px;
}

.csn-news-feed__controls {
	display: flex;
	align-items: center;
	gap: 0.1rem;
	flex: 0 0 auto;
	opacity: 0.72;
}

.csn-news-feed__controls:hover,
.csn-news-feed__controls:focus-within {
	opacity: 1;
}

.csn-news-feed__prev,
.csn-news-feed__pause,
.csn-news-feed__next,
.csn-site-notice__close {
	appearance: none;
	border: 0;
	margin: 0;
	width: 1.75rem;
	height: 1.75rem;
	padding: 0;
	border-radius: 999px;
	cursor: pointer;
	font: inherit;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	color: var(--csn-muted);
}

.csn-news-feed__prev:hover,
.csn-news-feed__pause:hover,
.csn-news-feed__next:hover,
.csn-site-notice__close:hover,
.csn-news-feed__prev:focus-visible,
.csn-news-feed__pause:focus-visible,
.csn-news-feed__next:focus-visible,
.csn-site-notice__close:focus-visible {
	background: rgba(44, 24, 16, 0.08);
	color: var(--csn-ink);
	outline: 2px solid #8a5a3a;
	outline-offset: 1px;
}

.csn-news-feed__pause[aria-pressed="true"] {
	color: var(--csn-ink);
	background: rgba(44, 24, 16, 0.08);
}

.csn-news-feed--anim-fade .csn-flash__item.is-active {
	animation: csn-fade-in 0.36s ease;
}

.csn-news-feed--anim-slide .csn-flash__item.is-active {
	animation: csn-slide-in 0.36s ease;
}

@keyframes csn-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes csn-slide-in {
	from { opacity: 0; transform: translateY(0.35rem); }
	to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.csn-news-feed--anim-fade .csn-flash__item.is-active,
	.csn-news-feed--anim-slide .csn-flash__item.is-active {
		animation: none;
	}
}

/* Types : fond chaud léger + capsule */
.csn-flash.csn-site-notice--type-novelty { --csn-bg: #f6eef8; --csn-muted: #6a4a78; }
.csn-flash.csn-site-notice--type-info { --csn-bg: #eef4f8; --csn-muted: #3d5a72; }
.csn-flash.csn-site-notice--type-reminder { --csn-bg: #f7f2e4; --csn-muted: #6a5a32; }
.csn-flash.csn-site-notice--type-game { --csn-bg: #eaf6ef; --csn-muted: #2d6a48; }
.csn-flash.csn-site-notice--type-event { --csn-bg: #f8eee6; --csn-muted: #7a4a32; }
.csn-flash.csn-site-notice--type-important,
.csn-flash.csn-site-notice--type-alert { --csn-bg: #f8eee0; --csn-muted: #8a4a18; }
.csn-flash.csn-site-notice--type-maintenance { --csn-bg: #f4ecec; --csn-muted: #7a3a3a; }

@media (min-width: 781px) {
	.csn-flash__copy {
		white-space: nowrap;
	}

	.csn-flash__text {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
}

@media (max-width: 780px) {
	.csn-flash {
		font-size: 0.875rem;
	}

	.csn-flash__inner {
		flex-wrap: wrap;
		align-items: flex-start;
		gap: 0.2rem 0.45rem;
		padding: 0.32rem 0.55rem 0.38rem;
		min-height: 0;
	}

	.csn-flash__brand {
		display: none;
	}

	.csn-news-feed__viewport {
		flex: 1 1 calc(100% - 5.5rem);
		order: 1;
	}

	.csn-news-feed__controls {
		order: 2;
		margin-left: auto;
		align-self: flex-start;
		padding-top: 0.05rem;
	}

	.csn-flash__item.is-active {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			"badge badge"
			"copy cta";
		row-gap: 0.12rem;
		column-gap: 0.45rem;
		align-items: center;
	}

	.csn-flash__badge { grid-area: badge; justify-self: start; padding: 0.1rem 0.42rem 0.1rem 0.28rem; }
	.csn-flash__copy { grid-area: copy; display: block; }
	.csn-flash__cta { grid-area: cta; font-size: 0.75rem; }

	.csn-flash__title,
	.csn-flash__text {
		display: inline;
	}

	.csn-flash__copy {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
		white-space: normal;
	}

	.csn-news-feed__prev,
	.csn-news-feed__pause,
	.csn-news-feed__next,
	.csn-site-notice__close {
		width: 1.55rem;
		height: 1.55rem;
	}

	.csn-news-feed--anim-slide .csn-flash__item.is-active {
		animation: csn-slide-in 0.32s ease;
	}
}
