/* ============================================================
   LJ TechHub News Widget — Styles v2.0
   ============================================================ */

/* ── Reset ─────────────────────────────────────────────────── */
.ljnw-root *, .ljnw-root *::before, .ljnw-root *::after { box-sizing: border-box; }
.ljnw-root a { text-decoration: none; }
.ljnw-root { display: block; }
.ljnw-no-posts { color:#888; font-style:italic; text-align:center; padding:32px; }

/* ── Badge ─────────────────────────────────────────────────── */
.ljnw-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 3px;
  margin-bottom: 8px;
  line-height: 1.5;
  /* Empêche le badge de s'étirer en largeur dans un flex-column */
  align-self: flex-start;
  max-width: fit-content;
  width: auto;
}
/* Badge carte à la une : fond solid rouge */
.ljnw-featured-card .ljnw-badge {
  background-color: #ff4b5c;
  color: #fff;
}
/* Badge cartes secondaires : fond light, texte rouge */
.ljnw-badge-secondary,
.ljnw-badge-custom {
  border-radius: 4px;
  align-self: flex-start;
  display: inline-block;
  width: auto;
  max-width: fit-content;
}
.ljnw-badge-secondary {
  background-color: rgba(255,75,92,0.12);
  color: #e63c4a;
}

/* ── Temps relatif ─────────────────────────────────────────── */
.ljnw-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  margin-top: 8px;
  color: rgba(255,255,255,0.7);
}
.ljnw-secondary-card .ljnw-time,
.ljnw-secondary-only .ljnw-time {
  color: #888;
  margin-top: 6px;
}

/* ══════════════════════════════════════════════════════════════
   CARTE À LA UNE
══════════════════════════════════════════════════════════════ */
.ljnw-featured-card {
  position: relative;
  display: flex;
  min-height: 500px;
  background-size: cover;
  background-position: center;
  background-color: #1a1a2e;
  overflow: hidden;
  border-radius: 12px;
  width: 100%;
}

/* Overlay adaptatif selon position */
.ljnw-featured-card .ljnw-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* Positions — contrôle justify-content (axe horizontal) & align-items (vertical) */
.ljnw-featured-card { justify-content: flex-start; align-items: flex-end; }

/* ── Haut ── */
.ljnw-pos-top-left    { justify-content: flex-start; align-items: flex-start; }
.ljnw-pos-top-center  { justify-content: center;     align-items: flex-start; }
.ljnw-pos-top-right   { justify-content: flex-end;   align-items: flex-start; }

/* ── Centre ── */
.ljnw-pos-center-left  { justify-content: flex-start; align-items: center; }
.ljnw-pos-center       { justify-content: center;     align-items: center; }
.ljnw-pos-center-right { justify-content: flex-end;   align-items: center; }

/* ── Bas ── */
.ljnw-pos-bottom-left   { justify-content: flex-start; align-items: flex-end; }
.ljnw-pos-bottom-center { justify-content: center;     align-items: flex-end; }
.ljnw-pos-bottom-right  { justify-content: flex-end;   align-items: flex-end; }

/* Overlay direction par position */
.ljnw-pos-top-left .ljnw-overlay,
.ljnw-pos-top-center .ljnw-overlay,
.ljnw-pos-top-right .ljnw-overlay {
  background: linear-gradient(to bottom, rgba(0,0,0,0.72) 0%, transparent 60%);
}
.ljnw-pos-center-left .ljnw-overlay,
.ljnw-pos-center .ljnw-overlay,
.ljnw-pos-center-right .ljnw-overlay {
  background: rgba(0,0,0,0.45);
}
.ljnw-pos-bottom-left .ljnw-overlay,
.ljnw-pos-bottom-center .ljnw-overlay,
.ljnw-pos-bottom-right .ljnw-overlay {
  background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, transparent 60%);
}

.ljnw-featured-card .ljnw-content {
  position: relative;
  z-index: 2;
  padding: 20px 24px 24px;
  /* largeur contrôlée via inline style depuis le widget */
}

.ljnw-featured-card .ljnw-title {
  color: #ff4b5c;
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 8px;
}
.ljnw-featured-card .ljnw-excerpt {
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
}

/* Hover featured */
.ljnw-featured-card::after {
  content:''; position:absolute; inset:0;
  background:rgba(255,75,92,0.05);
  opacity:0; transition:opacity .3s ease; z-index:1; pointer-events:none;
}
.ljnw-featured-card:hover::after { opacity:1; }
.ljnw-featured-card:hover .ljnw-title { text-decoration:underline; }

/* ══════════════════════════════════════════════════════════════
   CARTE SECONDAIRE — Image gauche | Catégorie + Titre + Temps droite
   (correspondant exactement à l'image de référence)
══════════════════════════════════════════════════════════════ */
.ljnw-secondary-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  width: 100%;
}
.ljnw-secondary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.13);
}
.ljnw-secondary-card:hover .ljnw-title { color: #ff4b5c; }

/* Miniature — carré à gauche */
.ljnw-secondary-card .ljnw-thumb {
  width: 150px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: inherit;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.ljnw-secondary-card .ljnw-thumb img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
  transition: transform .3s ease;
  border-radius: inherit; /* hérite de .ljnw-thumb qui hérite de la carte */
}
.ljnw-secondary-card:hover .ljnw-thumb img { transform: scale(1.05); }

/* Corps droit */
.ljnw-secondary-card .ljnw-card-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  flex: 1;
  min-width: 0;
}

/* Titre secondaire — affiché en entier avec clamp max 3 lignes */
.ljnw-secondary-card .ljnw-title {
  color: #1a1a2e;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  transition: color .2s;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════
   MODE : CARTES SECONDAIRES UNIQUEMENT (.ljnw-secondary-only)
══════════════════════════════════════════════════════════════ */
.ljnw-secondary-only {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

/* ══════════════════════════════════════════════════════════════
   MODE COMBINÉ — LAYOUTS
══════════════════════════════════════════════════════════════ */
.ljnw-wrapper {
  display: grid;
  gap: 16px;
  width: 100%;
  align-items: stretch;
}

/* ── Layout 1 : Hero Latéral ── */
.ljnw-layout-hero_side {
  grid-template-columns: 1fr 340px;
}
.ljnw-layout-hero_side .ljnw-secondary {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
@media (max-width: 900px) {
  .ljnw-layout-hero_side { grid-template-columns: 1fr; }
}

/* ── Layout 2 : Hero Top ── */
.ljnw-layout-hero_top {
  grid-template-columns: 1fr;
}
.ljnw-layout-hero_top .ljnw-featured-card { min-height: 420px; }
.ljnw-layout-hero_top .ljnw-secondary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
/* En layout hero_top les cartes secondaires passent en vertical */
.ljnw-layout-hero_top .ljnw-secondary .ljnw-secondary-card { flex-direction: column; }
.ljnw-layout-hero_top .ljnw-secondary .ljnw-thumb { width: 100% !important; border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ljnw-layout-hero_top .ljnw-secondary .ljnw-thumb img { height: 160px; width: 100%; }

/* ── Layout 3 : Magazine ── */
.ljnw-layout-magazine {
  grid-template-columns: 1fr 1fr;
}
.ljnw-layout-magazine .ljnw-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
}
.ljnw-layout-magazine .ljnw-secondary .ljnw-secondary-card { flex-direction: column; }
.ljnw-layout-magazine .ljnw-secondary .ljnw-thumb { width: 100% !important; border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ljnw-layout-magazine .ljnw-secondary .ljnw-thumb img { height: 120px; width: 100%; }
@media (max-width: 900px) {
  .ljnw-layout-magazine { grid-template-columns: 1fr; }
  .ljnw-layout-magazine .ljnw-secondary { grid-template-columns: 1fr; }
}

/* ── Responsive global ── */
@media (max-width: 600px) {
  .ljnw-secondary-card { flex-direction: column; }
  .ljnw-secondary-card .ljnw-thumb { width: 100% !important; border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .ljnw-secondary-card .ljnw-thumb img { height: 160px; width: 100%; }
  .ljnw-featured-card { min-height: 300px !important; }
}

/* ══════════════════════════════════════════════════════════════
   ANTI-THEME OVERRIDES
   Force nos styles face aux thèmes WordPress agressifs
══════════════════════════════════════════════════════════════ */

/* Empêche le thème d'ajouter des marges/padding aux liens */
.elementor-widget-ljnw_news_grid .ljnw-featured-card,
.elementor-widget-ljnw_news_grid .ljnw-secondary-card {
	display: flex !important;
	text-decoration: none !important;
	color: inherit !important;
}

/* Force badge compact même dans les thèmes agressifs */
.elementor-widget-ljnw_news_grid .ljnw-badge {
	display: inline-block !important;
	width: auto !important;
	max-width: fit-content !important;
	align-self: flex-start !important;
}

/* Empêche les thèmes de redimensionner les images */
.elementor-widget-ljnw_news_grid .ljnw-thumb img {
	max-width: 100% !important;
	height: auto;
	object-fit: cover !important;
	display: block !important;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
	/* border-radius géré par le contrôle Elementor — pas de forçage ici */
	box-shadow: none !important;
}

/* Empêche les thèmes d'ajouter des styles aux h2/h3 */
.elementor-widget-ljnw_news_grid .ljnw-featured-card .ljnw-title,
.elementor-widget-ljnw_news_grid .ljnw-secondary-card .ljnw-title {
	margin: 0 0 6px !important;
	padding: 0 !important;
	border: none !important;
}

/* Empêche les thèmes de mettre des marges sur les paragraphes */
.elementor-widget-ljnw_news_grid .ljnw-excerpt {
	margin: 0 !important;
}

/* Assure que le thumb reste à taille fixe même avec flexbox du thème */
.elementor-widget-ljnw_news_grid .ljnw-secondary-card .ljnw-thumb {
	flex-shrink: 0 !important;
	overflow: hidden !important;
}

/* Assure que le card-body prend bien le reste de l'espace */
.elementor-widget-ljnw_news_grid .ljnw-secondary-card .ljnw-card-body {
	flex: 1 !important;
	min-width: 0 !important;
	overflow: hidden !important;
}

/* ══════════════════════════════════════════════════════════════
   ANIMATIONS AU SURVOL — 6 effets avec sens visuel
   Durée contrôlée par le slider Elementor (transition-duration)
══════════════════════════════════════════════════════════════ */

/* ── Base : désactive tous les anciens hovers hardcodés ─────── */
.ljnw-featured-card { transition: box-shadow 300ms ease, transform 300ms ease; }
.ljnw-featured-card .ljnw-overlay { transition: background 300ms ease, opacity 300ms ease; }
.ljnw-featured-card .ljnw-content { transition: transform 300ms ease, opacity 300ms ease; }
.ljnw-featured-card::after { transition: opacity 300ms ease; }

.ljnw-secondary-card { transition: transform 300ms ease, box-shadow 300ms ease; }
.ljnw-secondary-card .ljnw-thumb img { transition: transform 300ms ease; }
.ljnw-secondary-card .ljnw-thumb { position: relative; overflow: hidden; }
.ljnw-secondary-card .ljnw-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 300ms ease;
  pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────
   🔍 ZOOM IN
   Image de fond (featured) ou miniature (secondary) s'agrandit.
   Sensation d'entrée dans l'image, très classique médias.
───────────────────────────────────────────────────────────── */
/* Featured : l'image de fond est en background-image,
   on utilise background-size pour simuler le zoom */
.ljnw-featured-card.ljnw-hover-zoom-in {
  background-size: 100% !important;
  transition: background-size 300ms ease, box-shadow 300ms ease;
}
.ljnw-featured-card.ljnw-hover-zoom-in:hover {
  background-size: 110% !important;
}
/* Secondary : on zoom l'img directement */
.ljnw-secondary-card.ljnw-hover-zoom-in .ljnw-thumb img {
  transform: scale(1.0);
}
.ljnw-secondary-card.ljnw-hover-zoom-in:hover .ljnw-thumb img {
  transform: scale(1.09);
}

/* ─────────────────────────────────────────────────────────────
   🔭 ZOOM OUT
   Image légèrement surdimensionnée au départ, revient à la normale.
   Effet de "recul", plus élégant que zoom-in.
───────────────────────────────────────────────────────────── */
.ljnw-featured-card.ljnw-hover-zoom-out {
  background-size: 112% !important;
  transition: background-size 300ms ease, box-shadow 300ms ease;
}
.ljnw-featured-card.ljnw-hover-zoom-out:hover {
  background-size: 100% !important;
}
.ljnw-secondary-card.ljnw-hover-zoom-out .ljnw-thumb img {
  transform: scale(1.09);
}
.ljnw-secondary-card.ljnw-hover-zoom-out:hover .ljnw-thumb img {
  transform: scale(1.0);
}

/* ─────────────────────────────────────────────────────────────
   🌑 FADE REVEAL (featured uniquement)
   L'overlay s'assombrit au survol → image s'efface derrière le
   texte qui devient plus lisible, effet dramatique "focus".
   Complète l'idée : au repos = image principale ; au survol =
   contenu devient la star.
───────────────────────────────────────────────────────────── */
.ljnw-featured-card.ljnw-hover-fade-reveal .ljnw-overlay {
  opacity: 0.7;
}
.ljnw-featured-card.ljnw-hover-fade-reveal:hover .ljnw-overlay {
  opacity: 1;
}
/* Le contenu part légèrement vers le haut et gagne en clarté */
.ljnw-featured-card.ljnw-hover-fade-reveal .ljnw-content {
  transform: translateY(6px);
  opacity: 0.85;
}
.ljnw-featured-card.ljnw-hover-fade-reveal:hover .ljnw-content {
  transform: translateY(0);
  opacity: 1;
}

/* ─────────────────────────────────────────────────────────────
   ⬆️ SLIDE UP (featured uniquement)
   Le bloc texte remonte légèrement, comme s'il émerge de l'image.
   Sensation de "révélation progressive" très utilisée en presse.
───────────────────────────────────────────────────────────── */
.ljnw-featured-card.ljnw-hover-slide-up .ljnw-content {
  transform: translateY(12px);
}
.ljnw-featured-card.ljnw-hover-slide-up:hover .ljnw-content {
  transform: translateY(0);
}
/* Légère accentuation de l'overlay aussi */
.ljnw-featured-card.ljnw-hover-slide-up:hover .ljnw-overlay {
  opacity: 1.15; /* pas d'effet direct mais déclenche la transition */
}

/* ─────────────────────────────────────────────────────────────
   🎨 TINT
   Une teinte colorée (personnalisable) apparaît sur l'image.
   Donne une identité de marque forte. La couleur peut matcher
   la charte éditoriale (rouge pour la politique, vert sports…)
   Variable CSS --ljnw-tint définie via inline style ou Elementor.
───────────────────────────────────────────────────────────── */
.ljnw-featured-card.ljnw-hover-tint::after {
  background: var(--ljnw-tint, rgba(255,75,92,0.35));
  opacity: 0;
  z-index: 1;
}
.ljnw-featured-card.ljnw-hover-tint:hover::after {
  opacity: 1;
}
/* Le contenu doit rester AU DESSUS du tint */
.ljnw-featured-card.ljnw-hover-tint .ljnw-overlay,
.ljnw-featured-card.ljnw-hover-tint .ljnw-content {
  z-index: 2;
}

/* Tint secondary — sur la miniature uniquement */
.ljnw-secondary-card.ljnw-hover-tint .ljnw-thumb::after {
  background: var(--ljnw-tint, rgba(255,75,92,0.30));
}
.ljnw-secondary-card.ljnw-hover-tint:hover .ljnw-thumb::after {
  opacity: 1;
}

/* ─────────────────────────────────────────────────────────────
   🪄 LIFT
   La carte se soulève verticalement + ombre plus profonde.
   Pas de zoom d'image — donne un sens "cliquable" très fort.
   Idéal pour les cartes secondaires horizontales.
───────────────────────────────────────────────────────────── */
.ljnw-featured-card.ljnw-hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.22);
}
.ljnw-secondary-card.ljnw-hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.16) !important;
}

/* ─────────────────────────────────────────────────────────────
   ◀️ SLIDE LEFT (secondary uniquement)
   La carte glisse légèrement vers la droite au survol,
   comme si elle "répondait" au clic. Donne du dynamisme.
───────────────────────────────────────────────────────────── */
.ljnw-secondary-card.ljnw-hover-slide-left:hover {
  transform: translateX(6px);
  box-shadow: -4px 4px 16px rgba(0,0,0,0.10) !important;
}
