.cig-gallery {
  --cig-columns: 3;
  --cig-gap: clamp(14px, 2vw, 28px);
  --cig-radius: 18px;
  --cig-card-bg: #fff;
  --cig-card-text: #111;
  --cig-card-muted: #666;
  --cig-card-border: #eee;
  --cig-button-bg: #111;
  --cig-button-color: #fff;
  display: grid;
  grid-template-columns: repeat(var(--cig-columns), minmax(0, 1fr));
  gap: var(--cig-gap);
  width: 100%;
}
.cig-columns-1 { --cig-columns: 1; }
.cig-columns-2 { --cig-columns: 2; }
.cig-columns-3 { --cig-columns: 3; }
.cig-columns-4 { --cig-columns: 4; }
.cig-columns-5 { --cig-columns: 5; }
.cig-columns-6 { --cig-columns: 6; }
.cig-gap-tight { --cig-gap: 6px; }
.cig-gap-normal { --cig-gap: clamp(10px, 1.4vw, 18px); }
.cig-gap-lush { --cig-gap: clamp(16px, 2.2vw, 32px); }
.cig-item {
  min-width: 0;
  position: relative;
}
.cig-link {
  display: block;
  color: inherit;
  text-decoration: none;
  outline-offset: 5px;
}
.cig-image-wrap {
  display: block;
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: linear-gradient(135deg, #f4f4f4, #e9e9e9);
  border-radius: var(--cig-radius);
  isolation: isolate;
  box-shadow: 0 18px 45px rgba(0,0,0,.12);
}
.cig-image-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,.18) 42%, rgba(0,0,0,0) 72%),
    radial-gradient(circle at 25% 15%, rgba(255,255,255,.2), rgba(255,255,255,0) 38%);
  opacity: 0;
  transition: opacity .28s ease;
  z-index: 1;
}
.cig-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.001);
  transition: transform .45s ease, filter .45s ease;
}
.cig-link:hover .cig-image-wrap img,
.cig-link:focus .cig-image-wrap img {
  transform: scale(1.075);
  filter: saturate(1.08) contrast(1.04);
}
.cig-link:hover .cig-image-wrap::after,
.cig-link:focus .cig-image-wrap::after {
  opacity: 1;
}
.cig-badge {
  position: absolute;
  right: .75rem;
  top: .75rem;
  z-index: 3;
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1;
  min-width: 1rem;
  min-height: 1rem;
  padding: .48rem .58rem;
  border-radius: 999px;
  background: rgba(0,0,0,.68);
  color: #fff;
  backdrop-filter: blur(10px);
}
.cig-badge-carousel {
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cig-badge-carousel::before,
.cig-badge-carousel::after {
  content: "";
  position: absolute;
  width: .82rem;
  height: .82rem;
  border: 2px solid currentColor;
  border-radius: 3px;
  background: transparent;
}
.cig-badge-carousel::before {
  transform: translate(-2px, 2px);
  opacity: .74;
}
.cig-badge-carousel::after {
  transform: translate(3px, -3px);
}
.cig-meta-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: .42rem;
  padding: 1rem;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .28s ease, transform .28s ease;
}
.cig-link:hover .cig-meta-overlay,
.cig-link:focus .cig-meta-overlay {
  opacity: 1;
  transform: translateY(0);
}
.cig-overlay-caption {
  font-size: .96rem;
  line-height: 1.25;
  text-shadow: 0 1px 18px rgba(0,0,0,.45);
}
.cig-overlay-date {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .86;
}
.cig-caption {
  margin: .72rem .12rem 0;
  color: var(--cig-card-text);
  font-size: .94rem;
  line-height: 1.42;
}
.cig-date {
  display: block;
  color: var(--cig-card-muted);
  margin: .35rem .12rem 0;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .66;
}
.cig-error,
.cig-empty {
  padding: .85rem 1rem;
  border: 1px solid currentColor;
  border-radius: 10px;
}

/* Style: sexy overlay. Captions live inside the hover state. */
.cig-style-overlay .cig-caption,
.cig-style-overlay .cig-date {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Style: soft cards. */
.cig-style-cards .cig-item {
  background: var(--cig-card-bg);
  border-radius: calc(var(--cig-radius) + 8px);
  padding: clamp(8px, 1.2vw, 14px);
  box-shadow: 0 14px 38px rgba(0,0,0,.10);
  border: 1px solid var(--cig-card-border);
  color: var(--cig-card-text);
  transition: transform .28s ease, box-shadow .28s ease;
}
.cig-style-cards .cig-item:hover,
.cig-style-cards .cig-item:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 24px 54px rgba(0,0,0,.14);
}
.cig-style-cards .cig-image-wrap {
  box-shadow: none;
}
.cig-style-cards .cig-meta-overlay { display: none; }
.cig-style-cards .cig-image-wrap::after { display: none; }

/* Style: clean minimal. */
.cig-style-minimal .cig-image-wrap {
  border-radius: var(--cig-radius);
  box-shadow: none;
}
.cig-style-minimal .cig-image-wrap::after,
.cig-style-minimal .cig-meta-overlay {
  display: none;
}
.cig-style-minimal .cig-badge {
  top: auto;
  bottom: .65rem;
  right: .65rem;
}

/* Style: editorial feature grid. */
.cig-style-editorial .cig-item:first-child {
  grid-column: span 2;
  grid-row: span 2;
}
.cig-style-editorial .cig-item:first-child .cig-image-wrap {
  aspect-ratio: 1 / 1;
}
.cig-style-editorial .cig-caption,
.cig-style-editorial .cig-date {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.cig-style-editorial .cig-meta-overlay {
  opacity: 1;
  transform: translateY(0);
}
.cig-style-editorial .cig-image-wrap::after {
  opacity: .78;
}

@media (max-width: 900px) {
  .cig-columns-4,
  .cig-columns-5,
  .cig-columns-6 {
    --cig-columns: 3;
  }
}
@media (max-width: 760px) {
  .cig-gallery {
    --cig-columns: 2;
  }
  .cig-style-editorial .cig-item:first-child {
    grid-column: span 2;
    grid-row: span 1;
  }
}
@media (max-width: 460px) {
  .cig-gallery {
    --cig-columns: 1;
  }
  .cig-style-editorial .cig-item:first-child {
    grid-column: span 1;
  }
  .cig-meta-overlay {
    opacity: 1;
    transform: none;
  }
  .cig-image-wrap::after {
    opacity: .8;
  }
}

/* Feed wrapper, hidden items, and load more controls. */
.cig-feed-wrap {
  width: 100%;
}
.cig-hidden {
  display: none !important;
}
.cig-revealed {
  animation: cigReveal .36s ease both;
}
@keyframes cigReveal {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.cig-load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: clamp(18px, 3vw, 34px);
}
.cig-load-more {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: .9rem 1.35rem;
  min-width: 11rem;
  cursor: pointer;
  background: var(--cig-button-bg);
  color: var(--cig-button-color);
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 14px 34px rgba(0,0,0,.18);
  transition: transform .22s ease, box-shadow .22s ease, opacity .22s ease;
}
.cig-load-more:hover,
.cig-load-more:focus {
  transform: translateY(-2px);
  box-shadow: 0 20px 46px rgba(0,0,0,.24);
}
.cig-load-more:active {
  transform: translateY(0);
}

/* Native lightbox. */
html.cig-lightbox-open,
html.cig-lightbox-open body {
  overflow: hidden;
}
.cig-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 3vw, 42px);
}
.cig-lightbox.is-open {
  display: flex;
}
.cig-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(8px);
}
.cig-lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(1060px, 96vw);
  max-height: 92vh;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, .55fr);
  background: #101010;
  color: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 100px rgba(0,0,0,.5);
}
.cig-lightbox-media {
  min-height: min(72vh, 760px);
  background: #050505;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cig-lightbox-media img,
.cig-lightbox-media video {
  max-width: 100%;
  max-height: 86vh;
  width: auto;
  height: auto;
  display: block;
}
.cig-lightbox-copy {
  padding: clamp(18px, 2.8vw, 34px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}
.cig-lightbox-caption {
  margin: 0;
  line-height: 1.45;
  font-size: clamp(.98rem, 1.2vw, 1.1rem);
}
.cig-lightbox-date {
  margin: 0;
  opacity: .72;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .76rem;
}
.cig-lightbox-link {
  align-self: flex-start;
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 999px;
  padding: .72rem 1rem;
  transition: background .2s ease, border-color .2s ease;
}
.cig-lightbox-link:hover,
.cig-lightbox-link:focus {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.75);
}
.cig-lightbox-close {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  background: rgba(0,0,0,.58);
  color: #fff;
  font-size: 30px;
  line-height: 1;
}
.cig-has-lightbox .cig-link {
  cursor: zoom-in;
}

@media (max-width: 760px) {
  .cig-lightbox-dialog {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .cig-lightbox-media {
    min-height: auto;
  }
  .cig-lightbox-media img,
  .cig-lightbox-media video {
    width: 100%;
    max-height: 64vh;
    object-fit: contain;
  }
  .cig-lightbox-copy {
    justify-content: flex-start;
  }
}


/* Admin color controls. */
.cig-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem 1rem;
  max-width: 760px;
}
.cig-color-grid label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem .65rem;
  border: 1px solid #dcdcde;
  border-radius: 8px;
  background: #fff;
}
.cig-color-grid input[type="color"] {
  width: 44px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
}
.cig-color-grid .description {
  grid-column: 1 / -1;
  margin: 0;
}
