/**
 * KMOnlineSolutions - Self-rendering post content gallery (V1: grid only).
 *
 * The gallery must not depend on theme support. Layout is driven entirely by
 * the enum-validated data attributes (data-wm-gallery="grid" data-columns="2|3|4")
 * emitted by the manager and enforced in includes/content-sanitizer.php.
 * Without this stylesheet the images degrade to a readable stacked list.
 */

[data-wm-gallery="grid"] {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

[data-wm-gallery="grid"][data-columns="2"] {
  grid-template-columns: repeat(2, 1fr);
}

[data-wm-gallery="grid"][data-columns="3"] {
  grid-template-columns: repeat(3, 1fr);
}

[data-wm-gallery="grid"][data-columns="4"] {
  grid-template-columns: repeat(4, 1fr);
}

[data-wm-gallery="grid"] img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  margin: 0;
  max-width: 100%;
  cursor: zoom-in;
}

/* Single-post featured image opens the same lightbox (single image, no nav). */
.single-feature-image img {
  cursor: zoom-in;
}

/* Standalone Add Image block images open the same lightbox (single image, no
   nav). The container selectors cover legacy post content saved before the
   Add Image marker class survived sanitization. */
img.post-inline-image,
.entry-content img,
.post-content img {
  cursor: zoom-in;
}
.entry-content a img,
.post-content a img {
  cursor: pointer;
}

@media (max-width: 600px) {
  [data-wm-gallery="grid"] {
    grid-template-columns: 1fr;
  }
}

/**
 * KMOnlineSolutions - Self-rendering CTA buttons.
 *
 * Buttons are real clickable link-buttons (anchor + data-wm-button), not just
 * bold/styled text. data-wm-button picks the color (enum-validated),
 * data-wm-button-shape the corners and data-wm-button-size the padding.
 * Missing shape/size fall back to rounded/medium so older buttons keep
 * rendering. Mirrors the manager preview so posts agree. Inline-block
 * respects the paragraph text-align the editor sets.
 */
a[data-wm-button] {
  display: inline-block;
  border: 0;
  border-radius: 6px;
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
  padding: 10px 22px;
  margin: 6px 2px;
  cursor: pointer;
}
a[data-wm-button]:hover {
  filter: brightness(.92);
  color: #fff !important;
}
a[data-wm-button="primary"] { background: #2f7f83; }
a[data-wm-button="ink"] { background: #252525; }
a[data-wm-button="red"] { background: #c62828; }
a[data-wm-button="orange"] { background: #c65f1e; }
a[data-wm-button="green"] { background: #2e7d32; }
a[data-wm-button="blue"] { background: #1565c0; }
a[data-wm-button="indigo"] { background: #3949ab; }
a[data-wm-button="violet"] { background: #7b1fa2; }
a[data-wm-button-shape="pill"] { border-radius: 999px; }
a[data-wm-button-shape="square"] { border-radius: 2px; }
a[data-wm-button-size="small"] { font-size: 13px; padding: 7px 16px; }
a[data-wm-button-size="large"] { font-size: 16px; padding: 13px 28px; }
/* Text color/size come last so they win equal-specificity ties against the
   button-size font size above. White is the base default, hence no rule. */
a[data-wm-button-text="ink"] { color: #252525 !important; }
a[data-wm-button-text="red"] { color: #c62828 !important; }
a[data-wm-button-text="orange"] { color: #c65f1e !important; }
a[data-wm-button-text="yellow"] { color: #ffeb3b !important; }
a[data-wm-button-text="green"] { color: #2e7d32 !important; }
a[data-wm-button-text="blue"] { color: #1565c0 !important; }
a[data-wm-button-text="indigo"] { color: #3949ab !important; }
a[data-wm-button-text="violet"] { color: #7b1fa2 !important; }
a[data-wm-button-text-size="small"] { font-size: 13px; }
a[data-wm-button-text-size="medium"] { font-size: 14px; }
a[data-wm-button-text-size="large"] { font-size: 16px; }
a[data-wm-button-text-size="xl"] { font-size: 20px; }

/* Gallery lightbox (group-aware, keyboard + swipe; see assets/js/content-gallery.js) */
.wm-lightbox{position:fixed;inset:0;background:rgba(0,0,0,.9);display:flex;align-items:center;justify-content:center;z-index:99999}
.wm-lb-img{max-width:90vw;max-height:85vh;object-fit:contain}
.wm-lb-close{position:absolute;top:16px;right:20px;background:none;border:0;color:#fff;font-size:32px;cursor:pointer;line-height:1}
.wm-lb-prev,.wm-lb-next{position:absolute;top:50%;transform:translateY(-50%);background:none;border:0;color:#fff;font-size:48px;cursor:pointer;padding:0 16px}
.wm-lb-prev{left:8px}
.wm-lb-next{right:8px}
.wm-lb-count{position:absolute;bottom:20px;left:50%;transform:translateX(-50%);color:#fff;font-size:14px;opacity:.8}
@media(max-width:600px){.wm-lb-prev,.wm-lb-next{font-size:36px}}
