/* Journal Editorial Encarts — styles feutrés, compatibles thèmes */

.jencart {
  --jencart-radius: 14px;
  --jencart-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --jencart-text: #1e293b;
  --jencart-muted: #64748b;
  --jencart-link: #1565c0;
  box-sizing: border-box;
  max-width: 100%;
  margin: 28px 0;
  padding: 20px 22px;
  border-radius: var(--jencart-radius);
  color: var(--jencart-text);
  font-size: 0.96rem;
  line-height: 1.65;
  border: 1px solid transparent;
  box-shadow: var(--jencart-shadow);
}

.jencart *,
.jencart *::before,
.jencart *::after {
  box-sizing: border-box;
}

.jencart__media {
  margin: -6px -6px 14px -6px;
  border-radius: calc(var(--jencart-radius) - 4px);
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.jencart__image {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.jencart__kicker {
  margin: 0 0 10px 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--jencart-muted);
}

.jencart__body {
  font-size: inherit;
}

.jencart__body > :first-child {
  margin-top: 0;
}

.jencart__body > :last-child {
  margin-bottom: 0;
}

.jencart__body p {
  margin: 0 0 0.75em 0;
}

.jencart__body ul,
.jencart__body ol {
  margin: 0.35em 0 0 0;
  padding-left: 1.25rem;
}

.jencart__body a {
  color: var(--jencart-link);
  font-weight: 600;
  text-decoration: none;
  text-underline-offset: 2px;
}

.jencart__body a:hover {
  text-decoration: underline;
}

/* --- Tableaux : grille seule, sans cadre « carte » autour du <table> --- */
.jencart__body:has(> table) {
  overflow-x: auto;
  margin: 0;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

.jencart__body table {
  --jt-line: #e2e8f0;
  --jt-line-soft: #f1f5f9;
  --jt-head: #f8fafc;
  --jt-head-ink: #0f172a;
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.jencart__body table:has(thead) {
  min-width: max(100%, 34rem);
}

.jencart__body thead th {
  background: var(--jt-head);
  color: var(--jt-head-ink);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 2px solid var(--jt-line);
  border-right: 1px solid var(--jt-line-soft);
  white-space: nowrap;
}

.jencart__body thead th:last-child {
  border-right: none;
}

.jencart__body tbody tr {
  transition: background-color 0.12s ease;
}

.jencart__body tbody tr:hover {
  background: rgba(248, 250, 252, 0.75);
}

.jencart__body tbody td,
.jencart__body tbody th {
  padding: 13px 14px;
  border-bottom: 1px solid var(--jt-line-soft);
  border-right: 1px solid var(--jt-line-soft);
  vertical-align: middle;
  color: #334155;
}

.jencart__body table:has(thead) tbody td:last-child,
.jencart__body table:has(thead) tbody th:last-child {
  border-right: none;
}

.jencart__body table:has(thead) tbody tr:last-child td,
.jencart__body table:has(thead) tbody tr:last-child th {
  border-bottom: none;
}

.jencart__body table:has(thead) tbody td:first-child,
.jencart__body table:has(thead) tbody th:first-child {
  font-weight: 600;
  background: rgba(255, 255, 255, 0.5);
  color: #1e293b;
}

.jencart__body table:not(:has(thead)) tbody td,
.jencart__body table:not(:has(thead)) tbody th {
  font-weight: 500;
  font-size: 0.86rem;
  text-align: center;
  padding: 9px 10px;
  border: 1px solid var(--jt-line-soft);
}

.jencart__body table tbody td:last-child a:only-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.42rem 1rem;
  border-radius: 999px;
  background: #0f172a;
  color: #f8fafc !important;
  font-weight: 600;
  font-size: 0.8rem;
  text-decoration: none;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.jencart__body table tbody td:last-child a:only-child:hover {
  background: #1e293b;
  color: #fff !important;
  text-decoration: none;
}

.jencart__cta {
  margin: 14px 0 0 0;
}

.jencart__cta-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-weight: 600;
  color: var(--jencart-link);
  text-decoration: none;
}

.jencart__cta-link:hover {
  text-decoration: underline;
}

/* L’essentiel */
.jencart--essential {
  background: linear-gradient(180deg, #fafbfc 0%, #f4f6f8 100%);
  border-color: rgba(15, 23, 42, 0.08);
  border-left: 4px solid #334155;
}

.jencart--essential .jencart__kicker {
  color: #475569;
}

/* À lire aussi */
.jencart--read_also {
  background: linear-gradient(135deg, #f4f8fb 0%, #eef4f9 100%);
  border-color: #d0dde7;
}

.jencart--read_also .jencart__kicker {
  color: #556273;
}

/* Le saviez-vous */
.jencart--did_you_know {
  background: linear-gradient(180deg, #fffaf0 0%, #fff7e6 100%);
  border-color: rgba(200, 148, 31, 0.28);
  border-left: 4px solid #c8941f;
}

.jencart--did_you_know .jencart__kicker {
  color: #8a6914;
}

/* Neutre */
.jencart--neutral {
  background: #f8fafc;
  border-color: rgba(148, 163, 184, 0.35);
  border-left: 4px solid #94a3b8;
}

/* Comparatif : aucune boîte autour — uniquement le tableau dans le flux */
.jencart--comparison {
  padding: 0;
  margin: 22px 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.jencart--comparison .jencart__kicker {
  color: #64748b;
  margin-bottom: 8px;
}

.jencart--comparison .jencart__body:has(> table) {
  margin: 0;
  padding: 0;
}

@media (max-width: 600px) {
  .jencart {
    padding: 16px 16px;
    border-radius: 12px;
  }

  .jencart--comparison {
    padding: 0;
    border-radius: 0;
  }
}
