.sg-gallery-root {
  --sg-accent: #0f3f5f;
  --sg-text: #1f2a37;
  --sg-bg: #ffffff;
  --sg-border: #d9e1ea;
  --sg-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  color: var(--sg-text);
}

.sg-menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
  margin-bottom: 1.2rem;
}

.sg-menu-item {
  border: 1px solid var(--sg-accent);
  background: #ffffff !important;
  color: var(--sg-accent) !important;
  cursor: pointer;
  font-weight: 600;
  padding: 0.65rem 1.6rem;
  border-radius: 8px;
}

.sg-menu-item.is-active {
  background: #ffffff !important;
  color: var(--sg-accent) !important;
  border-color: var(--sg-accent);
}

.sg-group {
  display: none;
}

.sg-group.is-active {
  display: block;
}

.sg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.sg-card {
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: transparent !important;
  box-shadow: none;
}

.sg-card-button {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
  background: transparent !important;
}

.sg-card-button img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.sg-card-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  padding: 0.75rem 0;
  font-weight: 600;
  color: #1e1e1e !important;
  text-align: center;
  line-height: 1.25;
  min-height: calc(1.25em * 2);
  text-wrap: balance;
}

.sg-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--sg-border);
  border-radius: 10px;
}

.sg-modal[hidden] {
  display: none;
}

.sg-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.sg-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.sg-modal-dialog {
  position: relative;
  z-index: 2;
  width: min(960px, calc(100% - 2rem));
  margin: 5vh auto;
  background: #fff;
  border-radius: 14px;
  padding: 1rem 1rem 1.2rem;
  box-shadow: var(--sg-shadow);
}

.sg-modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
}

.sg-modal-title {
  margin: 0 2rem 0.8rem 0;
  font-size: 1.05rem;
}

.sg-modal-main {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #f4f7fa;
  position: relative;
}

.sg-modal-main img {
  display: block;
  width: 100%;
  max-height: 66vh;
  object-fit: contain;
  background: #f4f7fa;
}

.sg-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
}

.sg-modal-prev {
  left: 10px;
}

.sg-modal-next {
  right: 10px;
}

.sg-modal-thumbs {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 0.45rem;
}

.sg-thumb {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent !important;
  min-height: 68px;
  overflow: hidden;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.sg-thumb.is-active {
  border-color: var(--sg-accent);
}

body.sg-modal-open {
  overflow: hidden;
}

@media (max-width: 767px) {
  .sg-grid {
    grid-template-columns: 1fr;
  }

  .sg-card-button img {
    height: 200px;
  }

  .sg-modal-dialog {
    width: calc(100% - 1rem);
    margin: 2.5vh auto;
    padding: 0.85rem;
  }

  .sg-modal-main img {
    max-height: 45vh;
  }

  .sg-modal-thumbs {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding-bottom: 0.3rem;
  }

  .sg-thumb {
    flex: 0 0 72px;
    min-height: 72px;
  }
}
