/* Root CSS variables for spacing */
.emg-masonry {
  --emg-gutter: 12px;
}

/* Masonry via CSS multi-columns */
.emg-masonry {
  column-gap: var(--emg-gutter);
}

/* Items should avoid column breaks inside */
.emg-item {
  break-inside: avoid;
  display: inline-block;
  margin: 0 0 var(--emg-gutter) 0;
  width: 100%;
  position: relative;
}

/* Images responsive */
.emg-item .emg-img,
.emg-item .emg-link .emg-img {
  display: block;
  width: 100%;
  height: auto;
}

/* Hidden items for "Load more" */
.emg-item.is-hidden {
  display: none;
}

/* Captions */
.emg-item .emg-caption {
  font-size: 0.875rem;
  line-height: 1.4;
  padding: 0.5em 0.6em;
}

/* Actions */
.emg-actions {
  margin-top: 1rem;
  text-align: center;
}

.emg-actions .emg-more {
  padding: 0.6em 1.1em;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  font-size: 0.95rem;
}

.emg-actions .emg-more:focus {
  outline: 2px solid #000;
  outline-offset: 2px;
}

/* Responsive columns via data attributes (JS sets exact counts) */
@media (max-width: 767px) {
  .emg-masonry { column-count: 2; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .emg-masonry { column-count: 3; }
}
@media (min-width: 1024px) {
  .emg-masonry { column-count: 4; }
}

/* Editor performance note */
.emg-editor-note {
  margin: 0 0 10px 0;
  padding: 8px 10px;
  font-size: 12px;
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: 4px;
}