/* WKAD — Actualités, présentation v0.1.2.
   Images bord à bord, chevrons latéraux sur ordinateur et tablette ;
   commandes au-dessus des cartes pleine largeur sur petit écran.
   Le défilement natif reste utilisable sans JavaScript. */

.wkad-home .wkad-news-carousel {
  --wkad-news-columns: 3;
  --wkad-news-gap: clamp(1rem, 2vw, 1.5rem);
  --wkad-news-control-size: 48px;
  --wkad-news-control-gap: 12px;
  --wkad-news-side-space: calc(2 * (var(--wkad-news-control-size) + var(--wkad-news-control-gap)));
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  container-type: inline-size;
  min-width: 0;
  padding-inline: 6px;
}
.wkad-home .wkad-news-carousel[data-columns="2"] { --wkad-news-columns: 2; }
.wkad-home .wkad-news-carousel[data-columns="4"] { --wkad-news-columns: 4; }

.wkad-home .wkad-news-carousel .wkad-news-carousel__track {
  display: grid;
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--wkad-news-columns) - 1) * var(--wkad-news-gap)) / var(--wkad-news-columns));
  align-items: stretch;
  gap: var(--wkad-news-gap);
  width: 100%;
  margin: 0;
  padding: .375rem .25rem 1rem;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: .25rem;
}
.wkad-home .wkad-news-carousel[data-wkad-news-ready="1"] .wkad-news-carousel__track {
  width: calc(100% - var(--wkad-news-side-space));
  margin-inline: calc(var(--wkad-news-control-size) + var(--wkad-news-control-gap));
}
.wkad-home .wkad-news-carousel__item { min-width: 0; scroll-snap-align: start; }

.wkad-home .wkad-news-carousel .wkad-home-news-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid #d3e0df;
  border-radius: .75rem;
  background: #fff;
  box-shadow: none;
  transition: border-color .15s ease;
}
.wkad-home .wkad-news-carousel .wkad-home-news-card__media {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 3 / 2;
  padding: 0;
  margin: 0;
  overflow: hidden;
  background: #edf3f2;
}
.wkad-home .wkad-news-carousel .wkad-home-news-card__image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  padding: 0;
  object-fit: cover;
  object-position: center;
}
.wkad-home .wkad-news-carousel .wkad-home-news-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: .875rem;
  min-width: 0;
  padding: clamp(1.125rem, 1.6vw, 1.5rem);
}
.wkad-home .wkad-news-carousel .wkad-home-news-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .875rem;
  margin: 0;
  color: #405d66;
  font-size: .8125rem;
  line-height: 1.5;
}
.wkad-home .wkad-news-carousel .wkad-home-news-card__category {
  color: #5a267e;
  font-weight: 650;
}
.wkad-home .wkad-news-carousel .wkad-home-news-card__category a { color: inherit; }
.wkad-home .wkad-news-carousel .wkad-home-news-card__title {
  margin: 0;
  color: #163844;
  font-size: 1.125rem;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.wkad-home .wkad-news-carousel .wkad-home-news-card__title a {
  color: #163844;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
.wkad-home .wkad-news-carousel .wkad-home-news-card__title a:hover,
.wkad-home .wkad-news-carousel .wkad-home-news-card__title a:focus-visible {
  color: #5a267e;
  text-decoration-thickness: 2px;
}
.wkad-home .wkad-news-carousel .wkad-home-news-card__intro {
  width: 100%;
  color: #405d66;
  font-size: .9375rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.wkad-home .wkad-news-carousel .wkad-home-news-card__intro,
.wkad-home .wkad-news-carousel .wkad-home-news-card__intro p { text-align: start !important; }
.wkad-home .wkad-news-carousel .wkad-home-news-card__intro > :last-child { margin-bottom: 0; }
.wkad-home .wkad-news-carousel__readmore { margin: auto 0 0; padding-top: .25rem; }

.wkad-home .wkad-news-carousel__controls {
  display: block;
  grid-column: 1;
  grid-row: 2;
  margin-top: .75rem;
}
.wkad-home .wkad-news-carousel__controls[hidden] { display: none; }
.wkad-home .wkad-news-carousel__button {
  position: absolute;
  inset-block-start: calc(50% - 1.5rem);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--wkad-news-control-size);
  min-width: var(--wkad-news-control-size);
  height: var(--wkad-news-control-size);
  min-height: var(--wkad-news-control-size);
  padding: 10px;
  border: 1px solid #5a267e;
  border-radius: 50%;
  color: #5a267e;
  background: #fff;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.wkad-home .wkad-news-carousel__button[data-wkad-news-prev] { inset-inline-start: 6px; }
.wkad-home .wkad-news-carousel__button[data-wkad-news-next] { inset-inline-end: 6px; }

/* Une image 3:2 a son centre au tiers de sa largeur. Le calcul réserve les
   gouttières et tient compte des colonnes. Sans ces unités, les flèches
   restent centrées à côté du rail ; elles ne recouvrent jamais les cartes. */
@supports (width: 1cqw) {
  .wkad-home .wkad-news-carousel:has(.wkad-home-news-card__media) .wkad-news-carousel__button {
    inset-block-start: calc((100cqw - var(--wkad-news-side-space) - .5rem - (var(--wkad-news-columns) - 1) * var(--wkad-news-gap)) / var(--wkad-news-columns) / 3 + .375rem - var(--wkad-news-control-size) / 2);
  }
}
.wkad-home .wkad-news-carousel__chevron {
  display: block;
  flex: none;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.wkad-home .wkad-news-carousel__button:not([aria-disabled="true"]):hover {
  color: #fff;
  background: #5a267e;
  border-color: #5a267e;
}
.wkad-home .wkad-news-carousel__button[aria-disabled="true"] {
  color: #607780;
  border-color: #a5b6bc;
  background: #f3f7f6;
  cursor: default;
}
.wkad-home .wkad-news-carousel__status {
  max-width: 100%;
  margin: 0 auto;
  color: #405d66;
  font-size: .875rem;
  line-height: 1.5;
  text-align: center;
}
.wkad-home .wkad-news-carousel :is(button, a):focus-visible,
.wkad-home .wkad-news-carousel__track:focus-visible {
  outline: 3px solid #286b73;
  outline-offset: 3px;
}
.wkad-home .wkad-news-carousel .wkad-home-news-card:focus-within { border-color: #286b73; }

@media (hover: hover) and (pointer: fine) {
  .wkad-home .wkad-news-carousel .wkad-home-news-card:hover { border-color: #9aaeb3; }
}
@media (max-width: 61.99rem) {
  .wkad-home .wkad-news-carousel[data-columns] { --wkad-news-columns: 2; }
}
@media (max-width: 39.99rem) {
  .wkad-home .wkad-news-carousel[data-columns] {
    --wkad-news-columns: 1;
    --wkad-news-control-size: 44px;
    --wkad-news-control-gap: 6px;
    --wkad-news-side-space: 0px;
  }
  /* Le DOM place les commandes avant la liste : leur rangée mobile conserve
     le même ordre de lecture, sans masquer ni rétrécir l'image. */
  .wkad-home .wkad-news-carousel .wkad-news-carousel__track,
  .wkad-home .wkad-news-carousel[data-wkad-news-ready="1"] .wkad-news-carousel__track {
    grid-row: 2;
    width: 100%;
    margin-inline: 0;
  }
  .wkad-home .wkad-news-carousel__controls {
    display: grid;
    grid-row: 1;
    grid-template-columns: var(--wkad-news-control-size) minmax(0, 1fr) var(--wkad-news-control-size);
    align-items: center;
    gap: .5rem;
    margin: 0 .25rem .75rem;
  }
  .wkad-home .wkad-news-carousel__button {
    position: static;
    margin: 0;
  }
  .wkad-home .wkad-news-carousel__status {
    min-width: 0;
    width: 100%;
    overflow-wrap: anywhere;
  }
  .wkad-home .wkad-news-carousel .wkad-home-news-card__body { padding: .875rem; }
}
@media (prefers-reduced-motion: reduce) {
  .wkad-home .wkad-news-carousel .wkad-home-news-card,
  .wkad-home .wkad-news-carousel__button { transition: none; }
}
@media (forced-colors: active) {
  .wkad-home .wkad-news-carousel .wkad-home-news-card { border-color: CanvasText; }
  .wkad-home .wkad-news-carousel__button { border-color: ButtonText; color: ButtonText; }
  .wkad-home .wkad-news-carousel__button[aria-disabled="true"] { color: GrayText; border-color: GrayText; }
  .wkad-home .wkad-news-carousel :is(button, a):focus-visible,
  .wkad-home .wkad-news-carousel__track:focus-visible { outline-color: Highlight; }
}
