/* =========================================
   i7tou custom pic gallery
   ========================================= */

.twrv-custom-gallery .twrv-gallery-shell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.twrv-custom-gallery .twrv-gallery-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  padding: 4px 2px 8px;
  width: 100%;
  scrollbar-width: thin;
}

.twrv-custom-gallery .twrv-gallery-scroll::-webkit-scrollbar {
  height: 8px;
}

.twrv-custom-gallery .twrv-gallery-scroll::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 999px;
}

.twrv-custom-gallery .twrv-gallery-thumb {
  width: 148px;
  height: 148px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: #f3f4f6;
  box-shadow: none;
}

.twrv-custom-gallery .twrv-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.twrv-custom-gallery .twrv-gallery-thumb:hover img {
  transform: scale(1.03);
}

.twrv-custom-gallery .twrv-gallery-arrow {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.twrv-custom-gallery .twrv-gallery-arrow:hover {
  background: #f9fafb;
}

/* =========================================
   global lightbox
   ========================================= */

body.twrv-lightbox-open {
  overflow: hidden;
}

.twrv-lightbox[hidden] {
  display: none !important;
}

.twrv-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 20px 20px;
  box-sizing: border-box;
}

.twrv-lightbox-toolbar {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 100001;
  display: flex;
  gap: 8px;
}

.twrv-lightbox-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: rgba(255, 255, 255, 0.96);
  color: #222;
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.twrv-lightbox-btn-close {
  font-size: 36px;
}

.twrv-lightbox-main {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

.twrv-lightbox-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: calc(100vh - 130px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  touch-action: pan-x pan-y;
  box-sizing: border-box;
}

.twrv-lightbox-image {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0 auto;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  user-select: none;
  -webkit-user-drag: none;
  background: transparent;
}

.twrv-lightbox-credit[hidden] {
  display: none !important;
}

.twrv-lightbox-credit {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  max-width: calc(100% - 24px);
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.96);
  color: #111827;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.twrv-lightbox.is-zoomed .twrv-lightbox-stage {
  cursor: grab;
}

.twrv-lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100000;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: rgba(255, 255, 255, 0.94);
  color: #222;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  padding: 0;
}

.twrv-lightbox-nav.is-prev {
  left: 14px;
}

.twrv-lightbox-nav.is-next {
  right: 14px;
}

.twrv-lightbox-counter {
  margin-top: 14px;
  text-align: center;
  color: #ffffff;
  font-size: 15px;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .twrv-custom-gallery .twrv-gallery-thumb {
    width: 118px;
    height: 118px;
  }

  .twrv-custom-gallery .twrv-gallery-arrow {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: 18px;
  }

  .twrv-lightbox {
    padding: 64px 8px 14px;
  }

  .twrv-lightbox-stage {
    max-height: calc(100vh - 92px);
  }

  .twrv-lightbox-toolbar {
    top: 8px;
    left: 8px;
  }

  .twrv-lightbox-btn {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }

  .twrv-lightbox-btn-close {
    font-size: 32px;
  }

  .twrv-lightbox-nav {
    width: 38px;
    height: 38px;
    font-size: 20px;
    opacity: 0.92;
  }

  .twrv-lightbox-nav.is-prev {
    left: 6px;
  }

  .twrv-lightbox-nav.is-next {
    right: 6px;
  }

  .twrv-lightbox-credit {
    left: 8px;
    bottom: 8px;
    max-width: calc(100% - 16px);
    padding: 7px 10px;
    font-size: 13px;
    line-height: 1.4;
  }
}