/* =============================================
   Widget Actualités — Design System
   Modifier uniquement le bloc :root pour
   adapter aux couleurs du client.
   ============================================= */

/* ----- TOKENS ----- */
:root {
  --accent:       #2d7a3a;
  --text:         #111827;
  --text-strong:  #030712;
  --muted:        #6b7280;
  --border:       #e5e7eb;
  --bg:           #ffffff;
  --bg-hover:     #f9fafb;
  --radius:       6px;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --feat-img-h:   200px;
  --list-img-w:   84px;
  --list-img-h:   80px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text:        #f3f4f6;
    --text-strong: #f9fafb;
    --muted:       #9ca3af;
    --border:      #374151;
    --bg:          #111827;
    --bg-hover:    #1f2937;
  }
}
:root[data-theme="dark"] {
  --text:        #f3f4f6;
  --text-strong: #f9fafb;
  --muted:       #9ca3af;
  --border:      #374151;
  --bg:          #111827;
  --bg-hover:    #1f2937;
}

/* ----- RESET ----- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ----- WIDGET SHELL ----- */
.widget {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}

.widget.detail-view {
  max-width: 560px;
}

@media (min-width: 640px) {
  .widget.detail-view { max-width: 720px; }
}

@media (min-width: 900px) {
  .widget.detail-view { max-width: 900px; }
}

.widget__header {
  padding: 12px 16px 11px;
  border-bottom: 2px solid var(--accent);
}

.widget__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ----- FEED LIST ----- */
.feed {
  list-style: none;
}

.feed__item {
  border-bottom: 1px solid var(--border);
}
.feed__item:last-child {
  border-bottom: none;
}

/* ----- CARD (shared link/div wrapper) ----- */
a.card,
div.card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  transition: background .12s ease;
  cursor: default;
}
a.card { cursor: pointer; }
a.card:hover,
a.card:focus-visible {
  background: var(--bg-hover);
  outline: none;
}
a.card:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* ----- FEATURED CARD OVERRIDE ----- */
.feed__item--featured a.card,
.feed__item--featured div.card {
  flex-direction: column;
  gap: 0;
  padding: 0 0 14px;
}

.feed__item--featured .card__img-wrap {
  width: 100%;
  height: var(--feat-img-h);
  border-radius: 0;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.feed__item--featured .card__body {
  padding: 0 16px;
  gap: 5px;
}

.feed__item--featured .card__title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  -webkit-line-clamp: 3;
  color: var(--text-strong);
}

/* ----- IMAGE WRAPPER ----- */
.card__img-wrap {
  width: var(--list-img-w);
  height: var(--list-img-h);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--border);
  position: relative;
}

.card__img-wrap--placeholder {
  width: 100%;
  height: var(--feat-img-h);
  background: linear-gradient(135deg, var(--border) 0%, var(--bg-hover) 100%);
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
a.card:hover .card__img {
  transform: scale(1.03);
}

/* ----- CARD BODY ----- */
.card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.card__cat {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.card__title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.card__chapo {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin-top: 2px;
}

.card__chapo--compact {
  font-size: 12px;
  -webkit-line-clamp: 2;
}

/* ----- META (date + source) ----- */
.card__meta {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: auto;
  padding-top: 5px;
}

.card__date {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.card__sig {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.card__sig::before {
  content: '\00b7';
  margin: 0 5px;
  opacity: .5;
}

/* =============================================
   CAROUSEL PAGINÉ
   ============================================= */

.feed-page {
  display: none;
}
.feed-page--active {
  display: block;
  animation: fadeIn .18s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.feed-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.feed-nav__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  flex-shrink: 0;
}
.feed-nav__btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.feed-nav__btn:disabled {
  opacity: .3;
  cursor: default;
}

.feed-nav__dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.feed-nav__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background .15s, transform .15s;
}
.feed-nav__dot--active {
  background: var(--accent);
  transform: scale(1.3);
}
.feed-nav__dot:hover:not(.feed-nav__dot--active) {
  background: var(--muted);
}

/* =============================================
   VUE DETAIL
   ============================================= */

.detail__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.detail__back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 4px 0;
}
.detail__back:hover { opacity: .75; }

.detail__external {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.detail__external:hover { color: var(--text); border-color: var(--text); }

.detail__hero {
  width: 100%;
  overflow: hidden;
  background: var(--border);
}
.detail__hero img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
}

@media (min-width: 640px) {
  .detail__hero img { height: 420px; }
}

@media (min-width: 900px) {
  .detail__hero img { height: 500px; }
}

.detail__content {
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail__cat {
  font-size: 10px;
  display: block;
}

.detail__title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-strong);
  margin: 0;
}

.detail__meta {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 12px;
  color: var(--muted);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.detail__chapo {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text);
  margin: 4px 0 0;
}

/* ----- ARTICLE BODY (HTML from API) ----- */
.detail__body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  margin-top: 8px;
}

.detail__body p {
  margin: 0 0 14px;
}

.detail__body h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 20px 0 8px;
  color: var(--text-strong);
}

.detail__body h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 6px;
}

.detail__body img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  margin: 12px 0;
}

.detail__body figure {
  margin: 12px 0;
}

.detail__body figcaption {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

.detail__body blockquote {
  border-left: 3px solid var(--accent);
  margin: 16px 0;
  padding: 8px 14px;
  color: var(--muted);
  font-style: italic;
}

.detail__body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 12px 0;
  overflow-x: auto;
  display: block;
}

.detail__body td, .detail__body th {
  padding: 6px 8px;
  border: 1px solid var(--border);
  text-align: left;
}

.detail__body iframe {
  max-width: 100%;
  display: block;
  margin: 12px 0;
}

/* ----- EMPTY STATE ----- */
.widget--empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* =============================================
   RESPONSIVE
   ============================================= */

/* --- 480px+ --- */
@media (min-width: 480px) {
  :root {
    --feat-img-h: 220px;
    --list-img-w: 96px;
    --list-img-h: 72px;
  }

  .feed__item--featured .card__title { font-size: 16px; }
  .card__title { font-size: 13.5px; }
}
