/* Sélecteur « Liste / Grille » (js/view-toggle.js) */
.vt-bar {
  display: flex;
  margin: 0 0 0.75rem auto;
  width: max-content;
  border: 1px solid #e5e7eb;
  border-radius: 0.6rem;
  overflow: hidden;
  background: #fff;
}
.vt-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #4b5563;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.vt-btn + .vt-btn { border-left: 1px solid #e5e7eb; }
.vt-btn:hover { background: #f0fdf4; color: #15803d; }
.vt-btn.vt-on { background: #16a34a; color: #fff; }
.vt-btn:focus-visible { outline: 2px solid #16a34a; outline-offset: -2px; }

/* ── Grille : mise en page d'origine de la liste ; avec data-view-min, autant de colonnes que possible ── */
.vt-container.vt-auto[data-view="grid"] {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--vt-min, 300px), 100%), 1fr)) !important;
}
/* Cartes de texte long (projets de l'admin) : description coupée à quelques lignes en grille */
.vt-container.vt-auto[data-view="grid"] > * .whitespace-pre-wrap {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Liste : une carte par ligne, sur toute la largeur ── */
.vt-container[data-view="list"] {
  display: flex !important;
  flex-direction: column;
}
.vt-container[data-view="list"] > * { width: 100%; }

/* Cartes avec image en premier bloc : image à gauche, texte à droite (à partir de 640 px) */
@media (min-width: 640px) {
  .vt-container[data-view="list"] > :has(> :first-child img) {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch;
  }
  .vt-container[data-view="list"] > :has(> :first-child img) > :first-child {
    flex: 0 0 clamp(150px, 28%, 280px);
    max-height: 220px;
    overflow: hidden;
  }
  .vt-container[data-view="list"] > :has(> :first-child img) > :first-child img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .vt-container[data-view="list"] > :has(> :first-child img) > :not(:first-child) { flex: 1 1 auto; min-width: 0; }
}

@media (max-width: 480px) {
  .vt-label { display: none; }
  .vt-btn { padding: 0.45rem 0.65rem; }
}
