.nm-ag {
  /* Jetons de la maquette agence (B5, W2, W4, bordure claire). */
  --nm-ink: #111;
  --nm-muted: #909090;
  --nm-line: #dadcde;
  --nm-bg: #faf9f6;
  --nm-skel: #eceae5;

  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  font-family: inherit;
  color: var(--nm-ink);
  letter-spacing: -0.01em;
}

/* ---- Barre de filtres ---- */
.nm-ag__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.nm-ag__chips {
  display: flex;
  gap: 0.5rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nm-ag__chips::-webkit-scrollbar {
  display: none;
}
.nm-ag__chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--nm-line);
  border-radius: 2px;
  background: transparent;
  color: var(--nm-ink);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.3;
  letter-spacing: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
.nm-ag__chip:hover {
  border-color: var(--nm-ink);
}
.nm-ag__chip.is-active {
  background: var(--nm-ink);
  border-color: var(--nm-ink);
  color: #fff;
}
.nm-ag__chip:focus-visible,
.nm-ag__opt:focus-visible,
.nm-ag__morebtn:focus-visible,
.nm-ag__card:focus-visible {
  outline: 2px solid var(--nm-ink);
  outline-offset: 2px;
}

.nm-ag__sort {
  position: relative;
  flex: 0 0 auto;
}
.nm-ag__sortbtn svg {
  transition: transform 0.25s ease;
}
.nm-ag__sortbtn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}
.nm-ag__menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  z-index: 5;
  min-width: 100%;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  background: #fff;
  border: 1px solid var(--nm-line);
  border-radius: 2px;
  box-shadow: 0 8px 24px rgba(17, 17, 17, 0.08);
}
.nm-ag__opt {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 0;
  background: transparent;
  color: var(--nm-ink);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.nm-ag__opt:hover,
.nm-ag__opt.is-active {
  background: var(--nm-bg);
}

/* ---- Grille ---- */
.nm-ag__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem 1.25rem;
}
.nm-ag__card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  animation: nm-ag-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes nm-ag-in {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
}
.nm-ag__visual {
  position: relative;
  aspect-ratio: 418 / 460;
  overflow: hidden;
  background: var(--nm-skel);
}
.nm-ag__visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.55s ease;
}
.nm-ag__card:hover .nm-ag__visual img {
  transform: scale(1.05);
}
.nm-ag__tag {
  position: absolute;
  top: 1rem;
  left: 1rem;
  padding: 0.25rem 0.5rem;
  border-radius: 2px;
  background: var(--nm-bg);
  font-size: 0.75rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}
.nm-ag__infos {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  font-size: 1rem;
  line-height: 1.3;
}
.nm-ag__col {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
}
.nm-ag__col.is-right {
  align-items: flex-end;
  text-align: right;
}
.nm-ag__muted {
  color: var(--nm-muted);
}

/* Squelette pendant le chargement */
.nm-ag__card.is-skeleton {
  animation: none;
}
.nm-ag__card.is-skeleton .nm-ag__visual,
.nm-ag__line {
  animation: nm-ag-pulse 1.4s ease-in-out infinite;
}
.nm-ag__line {
  display: block;
  width: 60%;
  height: 0.875rem;
  border-radius: 2px;
  background: var(--nm-skel);
}
.nm-ag__line.is-short {
  width: 35%;
}
@keyframes nm-ag-pulse {
  50% {
    opacity: 0.55;
  }
}

.nm-ag__msg {
  margin: 0;
  color: var(--nm-muted);
}

.nm-ag__more {
  display: flex;
  justify-content: center;
}
.nm-ag__morebtn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6875rem 1rem;
  border: 1px solid var(--nm-ink);
  border-radius: 2px;
  background: transparent;
  color: var(--nm-ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease;
}
.nm-ag__morebtn:hover {
  background: var(--nm-ink);
  color: #fff;
}
.nm-ag__count {
  color: var(--nm-muted);
  font-size: 0.875rem;
}

/* ---- Tablette ---- */
@media (max-width: 991px) {
  .nm-ag__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nm-ag__bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .nm-ag__sort {
    align-self: flex-start;
  }
  .nm-ag__menu {
    right: auto;
    left: 0;
  }
}

/* ---- Mobile ---- */
@media (max-width: 767px) {
  .nm-ag {
    gap: 1.5rem;
  }
  .nm-ag__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .nm-ag__infos {
    font-size: 0.9375rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nm-ag__card,
  .nm-ag__line,
  .nm-ag__card.is-skeleton .nm-ag__visual {
    animation: none;
  }
  .nm-ag__visual img {
    transition: none;
  }
}

