.rcgsm-media-gallery {
  --rcgsm-gallery-card-bg: #f8f2ea;
  --rcgsm-gallery-card-border: rgba(62, 45, 33, 0.12);
  --rcgsm-gallery-shadow: 0 16px 40px rgba(36, 26, 18, 0.10);
  --rcgsm-gallery-shadow-hover: 0 22px 52px rgba(36, 26, 18, 0.16);
  --rcgsm-gallery-text: #2f241d;
  --rcgsm-gallery-muted: #78675a;
  --rcgsm-gallery-accent: #5c3825;
  --rcgsm-gallery-overlay: rgba(22, 16, 12, 0.72);
  margin: 28px 0;
}

.rcgsm-media-gallery__grid {
  column-gap: 18px;
  column-count: 3;
}

.rcgsm-media-gallery--cols-2 .rcgsm-media-gallery__grid { column-count: 2; }
.rcgsm-media-gallery--cols-4 .rcgsm-media-gallery__grid { column-count: 4; }

.rcgsm-media-gallery__tile {
  break-inside: avoid;
  display: block;
  margin: 0 0 18px;
}

.rcgsm-media-gallery__link {
  background: var(--rcgsm-gallery-card-bg);
  border: 1px solid var(--rcgsm-gallery-card-border);
  border-radius: 20px;
  box-shadow: var(--rcgsm-gallery-shadow);
  color: inherit;
  display: block;
  overflow: hidden;
  position: relative;
  text-decoration: none !important;
  transform: translateY(0);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.rcgsm-media-gallery__link:hover,
.rcgsm-media-gallery__link:focus-visible {
  border-color: rgba(92, 56, 37, 0.30);
  box-shadow: var(--rcgsm-gallery-shadow-hover);
  outline: 2px solid rgba(199, 66, 53, 0.55);
  outline-offset: 3px;
  transform: translateY(-4px);
}

/* Mouse clicks still set :focus (Safari always draws its default blue ring);
 * only the keyboard path keeps a ring, in the brick accent. */
.rcgsm-media-gallery__link:focus,
.rcgsm-media-gallery__more:focus {
  outline: none;
}

.rcgsm-media-gallery__image-wrap {
  display: block;
  overflow: hidden;
  position: relative;
}

.rcgsm-media-gallery__image {
  display: block;
  height: auto;
  transition: transform .5s ease;
  width: 100%;
}

.rcgsm-media-gallery__link:hover .rcgsm-media-gallery__image,
.rcgsm-media-gallery__link:focus-visible .rcgsm-media-gallery__image {
  transform: scale(1.03);
}

.rcgsm-media-gallery__caption {
  color: var(--rcgsm-gallery-text);
  display: grid;
  gap: 4px;
  padding: 14px 16px 16px;
}

.rcgsm-media-gallery__caption-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.28;
}

.rcgsm-media-gallery__caption-subtitle {
  color: var(--rcgsm-gallery-muted);
  font-size: 13px;
  line-height: 1.45;
}

.rcgsm-media-gallery__more-wrap {
  margin: 22px 0 0;
  text-align: center;
}

.rcgsm-media-gallery.is-enhanced .rcgsm-media-gallery__more-wrap {
  display: block;
}

.rcgsm-media-gallery__more {
  appearance: none;
  background: #fff;
  border: 1px solid rgba(92, 56, 37, 0.18);
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(36, 26, 18, 0.08);
  color: var(--rcgsm-gallery-accent);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  min-width: 220px;
  padding: 14px 22px;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.rcgsm-media-gallery__more:hover,
.rcgsm-media-gallery__more:focus-visible {
  border-color: rgba(92, 56, 37, 0.34);
  box-shadow: 0 12px 28px rgba(36, 26, 18, 0.12);
  outline: 2px solid rgba(199, 66, 53, 0.55);
  outline-offset: 3px;
  transform: translateY(-1px);
}

/* ---------------------------------------------------------------------------
 * Lightbox — shares the Call for Price modal design language
 * (modules/call-for-price/assets/cfp.css): warm-white rounded card on a dark
 * charcoal overlay, terracotta #c74235 accents, navy #24324a ink, Libre
 * Baskerville headings, circular bordered icon buttons, and warm-gradient
 * chips. The artwork sits in a matted white frame like the CFP artwork
 * thumbnails rather than on a black stage.
 * ------------------------------------------------------------------------- */

.rcgsm-media-lightbox {
  inset: 0;
  position: fixed;
  z-index: 99999;
}

.rcgsm-media-lightbox[hidden] {
  display: none;
}

.rcgsm-media-lightbox__backdrop {
  animation: rcgsm-lightbox-fade .22s ease both;
  background: rgba(10, 12, 16, .62);
  inset: 0;
  position: absolute;
}

.rcgsm-media-lightbox__dialog {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  position: absolute;
}

.rcgsm-media-lightbox__layout {
  animation: rcgsm-lightbox-rise .28s ease both;
  background: #fffaf7;
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .34);
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, .78fr);
  height: min(86vh, 780px);
  height: min(86dvh, 780px);
  overflow: hidden;
  position: relative;
  width: min(1120px, calc(100% - 28px));
}

@keyframes rcgsm-lightbox-fade {
  from { opacity: 0; }
}

@keyframes rcgsm-lightbox-rise {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.985);
  }
}

.rcgsm-media-lightbox__stage-pane {
  align-items: center;
  background: linear-gradient(135deg, rgba(255, 250, 247, .96), rgba(248, 240, 234, .92));
  column-gap: clamp(10px, 1.6vw, 18px);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 0;
  padding: clamp(18px, 3vw, 34px);
}

.rcgsm-media-lightbox__stage {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  position: relative;
}

.rcgsm-media-lightbox__image {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(36, 50, 74, .14);
  display: block;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  padding: clamp(8px, 1.4vw, 14px);
  width: auto;
}

.rcgsm-media-lightbox__badge {
  background: linear-gradient(135deg, rgba(255, 250, 247, .96), rgba(248, 240, 234, .92));
  border: 1px solid rgba(199, 66, 53, .18);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(36, 50, 74, .07);
  color: #c74235;
  font-size: 11px;
  font-weight: 800;
  left: 16px;
  letter-spacing: .12em;
  line-height: 1;
  padding: 9px 14px;
  position: absolute;
  text-transform: uppercase;
  top: 16px;
  z-index: 2;
}

.rcgsm-media-lightbox__panel {
  background: #fff;
  border-left: 1px solid rgba(36, 50, 74, .08);
  color: #24324a;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  padding: clamp(24px, 3vw, 36px) clamp(22px, 2.6vw, 32px) clamp(20px, 2.4vw, 28px);
}

.rcgsm-media-lightbox__panel-head {
  display: grid;
  gap: 10px;
  /* Keeps the title clear of the close button anchored to the card corner. */
  padding-right: 46px;
}

.rcgsm-media-lightbox__title {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.15;
  margin: 0;
}

.rcgsm-media-lightbox__caption {
  color: rgba(36, 50, 74, .72);
  font-size: 14.5px;
  line-height: 1.6;
  margin: 0;
}

.rcgsm-media-lightbox__body {
  border-top: 1px solid rgba(36, 50, 74, .08);
  color: rgba(36, 50, 74, .88);
  flex: 1 1 auto;
  font-size: 14.5px;
  line-height: 1.65;
  min-height: 0;
  overflow: auto;
  padding-top: 16px;
  scrollbar-color: rgba(36, 50, 74, .28) rgba(36, 50, 74, .06);
  scrollbar-width: thin;
}

.rcgsm-media-lightbox__body::-webkit-scrollbar {
  width: 10px;
}

.rcgsm-media-lightbox__body::-webkit-scrollbar-track {
  background: rgba(36, 50, 74, .06);
  border-radius: 999px;
}

.rcgsm-media-lightbox__body::-webkit-scrollbar-thumb {
  background: rgba(36, 50, 74, .26);
  border-radius: 999px;
}

.rcgsm-media-lightbox__body p {
  margin: 0 0 1em;
}

.rcgsm-media-lightbox__body p:last-child {
  margin-bottom: 0;
}

.rcgsm-media-lightbox__meta {
  align-items: center;
  border-top: 1px solid rgba(36, 50, 74, .08);
  color: rgba(36, 50, 74, .62);
  display: flex;
  font-size: 12.5px;
  gap: 12px;
  justify-content: space-between;
  padding-top: 14px;
}

.rcgsm-media-lightbox__count {
  background: rgba(199, 66, 53, .07);
  border: 1px solid rgba(199, 66, 53, .16);
  border-radius: 999px;
  color: #c74235;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 6px 12px;
}

.rcgsm-media-lightbox__hint {
  color: #c74235 !important;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}

/* These are bare <button> elements injected into the page by
 * rcgsm-media-gallery.js, so every theme and page-builder button rule on the
 * site also matches them. A single class is specificity (0,1,0) — enough to
 * beat Astra's `button { background: var(--ast-global-color-0); color: #fff }`
 * but NOT a page-builder rule like `.elementor-kit-8 button` at (0,1,1),
 * which sets exactly background and color and would repaint the close control
 * as a solid blue pill while leaving the round shape intact. Scoping to the
 * lightbox root and marking the paint properties !important keeps the control
 * looking like ours no matter what button styling the site picks up. Size and
 * type scale stay unforced so the responsive rules below still apply. */
.rcgsm-media-lightbox .rcgsm-media-lightbox__nav,
.rcgsm-media-lightbox .rcgsm-media-lightbox__close {
  align-items: center;
  appearance: none !important;
  background: rgba(255, 250, 247, .96) !important;
  border: 1px solid rgba(36, 50, 74, .16) !important;
  border-radius: 999px !important;
  box-shadow: 0 8px 22px rgba(36, 50, 74, .12) !important;
  color: #24324a !important;
  cursor: pointer;
  display: inline-flex;
  font-size: 24px;
  font-weight: 700;
  height: 42px;
  justify-content: center;
  line-height: 1;
  padding: 0 !important;
  text-shadow: none !important;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
  width: 42px;
}

.rcgsm-media-lightbox .rcgsm-media-lightbox__nav:hover,
.rcgsm-media-lightbox .rcgsm-media-lightbox__nav:focus-visible,
.rcgsm-media-lightbox .rcgsm-media-lightbox__close:hover,
.rcgsm-media-lightbox .rcgsm-media-lightbox__close:focus-visible {
  background: #fff !important;
  border-color: rgba(199, 66, 53, .24) !important;
  box-shadow: 0 12px 26px rgba(36, 50, 74, .18) !important;
  color: #c74235 !important;
  outline: 2px solid rgba(199, 66, 53, .22);
  outline-offset: 2px;
  transform: translateY(-1px);
}

/* Deliberately left unscoped at one class: this must stay LESS specific than
 * the :focus-visible rule above, or it would strip the keyboard focus ring. */
.rcgsm-media-lightbox__nav:focus,
.rcgsm-media-lightbox__close:focus {
  outline: none;
}

.rcgsm-media-lightbox .rcgsm-media-lightbox__close {
  font-size: 26px;
  height: 38px;
  position: absolute;
  right: 14px;
  top: 14px;
  width: 38px;
  z-index: 4;
}

html.rcgsm-lightbox-open,
body.rcgsm-lightbox-open {
  overflow: hidden;
}

@media (max-width: 1100px) {
  .rcgsm-media-gallery__grid,
  .rcgsm-media-gallery--cols-4 .rcgsm-media-gallery__grid {
    column-count: 2;
  }

  .rcgsm-media-lightbox__layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1.15fr) minmax(0, 1fr);
    height: min(90vh, 860px);
    height: min(90dvh, 860px);
  }

  .rcgsm-media-lightbox__stage-pane {
    padding: clamp(14px, 2.4vw, 22px);
  }

  .rcgsm-media-lightbox__panel {
    border-left: 0;
    border-top: 1px solid rgba(36, 50, 74, .08);
  }
}

@media (max-width: 767px) {
  .rcgsm-media-gallery__grid,
  .rcgsm-media-gallery--cols-2 .rcgsm-media-gallery__grid,
  .rcgsm-media-gallery--cols-3 .rcgsm-media-gallery__grid,
  .rcgsm-media-gallery--cols-4 .rcgsm-media-gallery__grid {
    column-count: 1;
  }

  .rcgsm-media-gallery__caption-title {
    font-size: 15px;
  }

  .rcgsm-media-lightbox__layout {
    grid-template-rows: minmax(0, 1fr) minmax(0, auto);
    height: auto;
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 20px);
    width: calc(100% - 20px);
  }

  .rcgsm-media-lightbox__stage-pane {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    padding: 12px 10px;
  }

  .rcgsm-media-lightbox__image {
    max-height: 42vh;
    padding: 7px;
  }

  .rcgsm-media-lightbox__badge {
    font-size: 10px;
    left: 10px;
    padding: 8px 11px;
    top: 10px;
  }

  .rcgsm-media-lightbox .rcgsm-media-lightbox__close {
    font-size: 22px;
    height: 34px;
    right: 10px;
    top: 10px;
    width: 34px;
  }

  .rcgsm-media-lightbox .rcgsm-media-lightbox__nav {
    font-size: 20px;
    height: 36px;
    width: 36px;
  }

  .rcgsm-media-lightbox__panel {
    gap: 12px;
    max-height: 48vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px 18px 18px;
  }

  .rcgsm-media-lightbox__body {
    flex: 0 1 auto;
    overflow: visible;
  }

  .rcgsm-media-lightbox__meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rcgsm-media-lightbox__backdrop,
  .rcgsm-media-lightbox__layout {
    animation: none;
  }

  .rcgsm-media-gallery__link,
  .rcgsm-media-gallery__image,
  .rcgsm-media-gallery__more,
  .rcgsm-media-lightbox .rcgsm-media-lightbox__nav,
  .rcgsm-media-lightbox .rcgsm-media-lightbox__close {
    transition: none;
  }
}

/* ---------------------------------------------------------------------------
 * v0.7.14 — /media/ page section heads
 *
 * The /media/ page (page ID 300) builds its intro head and the "Media gallery"
 * head above the grid from Elementor HTML widgets that reuse this plugin's
 * rcg-refresh design classes, so the plugin hides them from its own
 * stylesheet. Split into two rules on purpose: browsers without :has()
 * support would drop the whole selector list, and the page-ID rule must keep
 * working there. The :has() rule also covers the gallery head if the page is
 * ever rebuilt under a different ID.
 * ------------------------------------------------------------------------- */
body.page-id-300 .rcg-refresh .rcg-head {
  display: none;
}

.rcg-refresh:has(.rcgsm-media-gallery) .rcg-head {
  display: none;
}

/* v0.7.15 — the three intro cards on the same page drop the red accent bar
 * that rcg-site-global.css paints on generic .rcg-grid--3 card tops. The
 * !important is required: the accent rule's :not() chain outweighs any
 * same-specificity kill, and the section opt-out class only works from page
 * markup the plugin does not control. */
body.page-id-300 .rcg-refresh .rcg-grid--3 > .rcg-card::before {
  display: none !important;
}
