.vws-wrap {
	--vws-bg: #1d2029;
	--vws-text: #f3f3f4;
	--vws-text-muted: #9a9ea8;
	--vws-accent: #e0455a;
	color: var(--vws-text) !important;
}

.vws-empty { text-align: center; color: var(--vws-text-muted) !important; padding: 30px 0; }

/* ============ Grille "pinterest" (colonnes CSS, sans JS) ============ */
.vws-style-pinterest {
	column-count: var(--vws-columns, 4);
	column-gap: 14px;
}
.vws-style-pinterest .vws-item {
	break-inside: avoid;
	margin-bottom: 14px;
	display: inline-block;
	width: 100%;
}

/* ============ Grille classique (cases égales) ============ */
.vws-style-grid {
	display: grid;
	grid-template-columns: repeat(var(--vws-columns, 4), 1fr);
	gap: 14px;
}
.vws-style-grid .vws-item-link { aspect-ratio: 1 / 1; display: block; }
.vws-style-grid .vws-item-link img { width: 100%; height: 100%; object-fit: cover; }

/*
 * ============ Masonry (vrai algorithme JS, "colonne la plus courte") ============
 * Positionnement en absolute calculé par vws-frontend.js (layoutMasonry) :
 * par opposition au style "pinterest" (colonnes CSS natives, ordre de
 * lecture colonne par colonne), le masonry respecte l'ordre de lecture
 * ligne par ligne, au prix d'un calcul JS après chargement des images.
 */
.vws-style-masonry {
	position: relative;
}
.vws-style-masonry .vws-item {
	position: absolute;
	transition: top .25s ease, left .25s ease;
}

/* ============ Grille "justifiée" (hauteur commune) ============ */
.vws-style-justified {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
}
.vws-style-justified .vws-item { flex: 1 1 220px; max-width: 320px; }
.vws-style-justified .vws-item-link { display: block; height: 200px; }
.vws-style-justified .vws-item-link img { width: 100%; height: 100%; object-fit: cover; }

/* ============ Item ============ */
.vws-item {
	position: relative;
	border-radius: 12px;
	overflow: hidden;
	background: var(--vws-bg);
	box-shadow: 0 6px 18px rgba(0,0,0,.2);
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .45s ease, transform .45s ease;
}
.vws-item.vws-visible {
	opacity: 1;
	transform: translateY(0);
}
/* Repli : si le script ne se charge pas (JS bloqué, erreur réseau...),
   les images restent visibles plutôt que bloquées à opacité 0. */
.vws-item { animation: vws-fallback-visible 0s 2.5s forwards; }
@keyframes vws-fallback-visible { to { opacity: 1; transform: none; } }
.vws-item-link { display: block; }
.vws-item-link img {
	width: 100%;
	display: block;
	transition: transform .25s ease;
}
.vws-item:hover .vws-item-link img { transform: scale(1.03); }

.vws-item figcaption {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 10px;
}
.vws-item-name {
	color: var(--vws-text) !important;
	font-weight: 600;
	font-size: 13px;
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex: 1 1 auto;
	min-width: 0; /* essentiel : sans ça, un flex-item avec ellipsis ne peut
	                 pas réellement rétrécir (min-width:auto par défaut) et
	                 se fait entièrement pousser hors champ par les boutons
	                 de vote — c'est ce qui rendait le titre invisible. */
}
.vws-item-type {
	display: block;
	font-size: 10px;
	font-weight: 400;
	color: var(--vws-text-muted) !important;
	text-transform: uppercase;
	letter-spacing: .04em;
}

/* Titre sur une seule ligne par défaut (voir --vws-title-lines, réglable
   depuis le shortcode) ; au-delà de 1, bascule sur un clamp multi-lignes. */
.vws-item-name {
	--vws-title-lines: 1;
}
.vws-item-name[data-lines="1"] {
	display: block;
}
.vws-item-name:not([data-lines="1"]) {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--vws-title-lines, 2);
	white-space: normal;
}

/* Légende superposée sur l'image */
.vws-caption-overlay figcaption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(to top, rgba(0,0,0,.75), transparent);
	padding-top: 24px;
}
.vws-caption-overlay .vws-item-name,
.vws-caption-overlay .vws-item-type { color: #fff !important; }

/* ============ Votes (compacts) ============ */
.vws-item-votes { display: flex; gap: 4px; flex-shrink: 0; }
.vws-vote {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	background: rgba(255,255,255,.1);
	border: none;
	border-radius: 999px;
	padding: 3px 6px;
	font-size: 10px;
	line-height: 1;
	color: inherit !important;
	cursor: pointer;
	white-space: nowrap;
}
.vws-vote-like:hover, .vws-vote-like.vws-voted { color: #ff5c7a !important; }
.vws-vote-dislike:hover, .vws-vote-dislike.vws-voted { color: #8fa4ff !important; }
.vws-vote-icon { display: inline-flex; align-items: center; }
.vws-vote-icon svg { width: 12px; height: 12px; }
.vws-vote[disabled] { cursor: default; opacity: .8; }

/* Tailles réglables depuis le shortcode (attribut vote_size) */
.vws-vote-size-small .vws-vote { padding: 2px 5px; font-size: 9px; }
.vws-vote-size-small .vws-vote-icon svg { width: 11px; height: 11px; }
.vws-vote-size-medium .vws-vote { padding: 3px 7px; font-size: 11px; }
.vws-vote-size-medium .vws-vote-icon svg { width: 14px; height: 14px; }
.vws-vote-size-large .vws-vote { padding: 5px 10px; font-size: 13px; }
.vws-vote-size-large .vws-vote-icon svg { width: 17px; height: 17px; }

/* ============ Chargement ============ */
.vws-loading-indicator {
	text-align: center;
	padding: 16px;
	color: var(--vws-text-muted) !important;
	font-size: 13px;
}
.vws-sentinel { height: 1px; }
.vws-load-more-wrap { text-align: center; margin-top: 18px; }
.vws-load-more {
	background: var(--vws-accent);
	color: #fff !important;
	border: none;
	border-radius: 999px;
	padding: 10px 24px;
	font-weight: 600;
	cursor: pointer;
}

/* ============ Lightbox ============ */
.vws-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	background: rgba(0,0,0,.92);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 30px;
}
.vws-lightbox img {
	max-width: 100%;
	max-height: 85vh;
	object-fit: contain;
	border-radius: 6px;
}
.vws-lightbox-caption {
	color: #fff !important;
	margin-top: 12px;
	font-size: 14px;
}
.vws-lightbox-close {
	position: absolute;
	top: 16px;
	right: 20px;
	background: rgba(255,255,255,.12);
	color: #fff !important;
	border: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	font-size: 22px;
	cursor: pointer;
}
body.vws-lightbox-open { overflow: hidden; }

/* ============ Mobile ============ */
@media (max-width: 900px) {
	.vws-style-pinterest { column-count: min(var(--vws-columns, 4), 3); }
	.vws-style-grid { grid-template-columns: repeat(min(var(--vws-columns, 4), 3), 1fr); }
}
@media (max-width: 600px) {
	.vws-style-pinterest { column-count: min(var(--vws-columns, 4), 2); column-gap: 10px; }
	.vws-style-pinterest .vws-item { margin-bottom: 10px; }
	.vws-style-grid { grid-template-columns: repeat(min(var(--vws-columns, 4), 2), 1fr); gap: 10px; }
	.vws-style-justified .vws-item { flex-basis: 45%; }
	.vws-item-name { font-size: 12px; max-width: 55%; }
	.vws-vote { padding: 3px 6px; font-size: 10px; }
}
