/* ==========================================================================
   v.geekfei.cn — Gallery 单页「图片集」改造
   仅作用于 Gallery 单篇（.gk-gal），不影响其它模板
   ========================================================================== */

.gk-gal {
  --gk-gal-gap: 10px;
  --gk-gal-pad: 30px;
  --gk-gal-max: 1320px;
  --gk-gal-accent: #ef8b64;
  --gk-gal-ink: #1a1a1a;
  --gk-gal-mute: #8d8d8d;
  --gk-gal-line: rgba(0, 0, 0, .09);
  padding-bottom: 40px;
}

/* ------------------------------ 头部 ------------------------------ */
.gk-gal-hd {
  max-width: var(--gk-gal-max);
  margin: 0 auto;
  padding: 26px var(--gk-gal-pad) 16px;
}

.gk-gal-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  letter-spacing: .08em;
  color: var(--gk-gal-mute);
  text-decoration: none;
  transition: color .25s ease;
}
.gk-gal-back:hover,
.gk-gal-back:focus { color: var(--gk-gal-accent); text-decoration: none; }

.gk-gal-title {
  margin: 8px 0 8px;
  font-size: 26px;
  line-height: 1.28;
  font-weight: 400;
  color: var(--gk-gal-ink);
  letter-spacing: .01em;
  word-break: break-word;
}

.gk-gal-sub {
  font-size: 12.5px;
  color: var(--gk-gal-mute);
  line-height: 1.6;
}
.gk-gal-sub > span + span:before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 9px 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
  vertical-align: middle;
}
.gk-gal-sub a { color: var(--gk-gal-mute); text-decoration: none; }
.gk-gal-sub a:hover { color: var(--gk-gal-accent); }

.gk-gal-hint {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: #b0b0b0;
  letter-spacing: .02em;
}

/* 视频 / 短代码等“其它正文” */
.gk-gal-extra {
  max-width: var(--gk-gal-max);
  margin: 0 auto 18px;
  padding: 0 var(--gk-gal-pad);
}
.gk-gal-extra video,
.gk-gal-extra iframe,
.gk-gal-extra img { max-width: 100%; height: auto; }

/* ------------------------------ 网格 ------------------------------ */
.gk-gal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gk-gal-gap);
  max-width: var(--gk-gal-max);
  margin: 0 auto;
  padding: 0 var(--gk-gal-pad);
}

.gk-gal-cell {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #f2f2f2;
  border-radius: 2px;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

.gk-gal-cell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .55s cubic-bezier(.2, .7, .3, 1), opacity .35s ease;
  opacity: 0;
}
.gk-gal-cell img.is-on { opacity: 1; }

@media (hover: hover) {
  .gk-gal-cell:hover img { transform: scale(1.05); }
}

/* 细边框，避免浅色照片与白底糊在一起 */
.gk-gal-cell:after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05);
  pointer-events: none;
  border-radius: 2px;
}

/* ------------------------- 上一册 / 下一册 ------------------------- */
.gk-gal-nav {
  display: flex;
  align-items: stretch;
  gap: 10px;
  max-width: var(--gk-gal-max);
  margin: 30px auto 0;
  padding: 22px var(--gk-gal-pad) 0;
  border-top: 1px solid var(--gk-gal-line);
}

.gk-gal-navbtn {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 11px 14px;
  border: 1px solid var(--gk-gal-line);
  border-radius: 3px;
  text-decoration: none;
  color: var(--gk-gal-ink);
  transition: border-color .25s ease, color .25s ease, background .25s ease;
}
.gk-gal-navbtn:hover,
.gk-gal-navbtn:focus {
  border-color: var(--gk-gal-accent);
  color: var(--gk-gal-accent);
  text-decoration: none;
}
.gk-gal-navbtn.is-next { text-align: right; align-items: flex-end; }
.gk-gal-navbtn.is-off { visibility: hidden; }

.gk-gal-navlab {
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gk-gal-mute);
  line-height: 1;
}
.gk-gal-navttl {
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.gk-gal-navbtn.is-all {
  flex: 0 0 46px;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.gk-gal-allgrid {
  display: grid;
  grid-template-columns: repeat(2, 7px);
  grid-template-rows: repeat(2, 7px);
  gap: 3px;
}
.gk-gal-allgrid i {
  display: block;
  background: currentColor;
  border-radius: 1px;
  opacity: .75;
}

/* --------------------------- 点赞 / 分享 --------------------------- */
.gk-gal-share {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: var(--gk-gal-max);
  margin: 20px auto 0;
  padding: 0 var(--gk-gal-pad);
}
.gk-gal-like { font-size: 13px; }
.gk-gal-socail ul { margin: 0; padding: 0; list-style: none; display: flex; gap: 14px; }
.gk-gal-socail a { color: var(--gk-gal-mute); }
.gk-gal-socail a:hover { color: var(--gk-gal-accent); }

/* ==========================================================================
   灯箱
   ========================================================================== */
html.gk-lb-open,
html.gk-lb-open body { overflow: hidden !important; }

.gk-lb {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #0a0a0a;
  display: none;
  opacity: 0;
  transition: opacity .22s ease;
}
.gk-lb.is-on { display: block; opacity: 1; }

.gk-lb-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 底部留出图注 + 提示的空间，图片不会压到文字上 */
  padding: 54px 68px 72px;
  cursor: zoom-out;
  /* 大图下载期间先用网格小图顶上，避免黑屏空等 */
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  background-origin: content-box;
  background-clip: content-box;
}

.gk-lb-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity .28s ease;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .65);
  cursor: zoom-out;
}
.gk-lb-img.is-ready { opacity: 1; }

.gk-lb-ui { position: absolute; z-index: 2; }

.gk-lb-top {
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  pointer-events: none;
}
.gk-lb-top > * { pointer-events: auto; }

.gk-lb-count {
  font-size: 12px;
  letter-spacing: .1em;
  color: rgba(255, 255, 255, .62);
}

.gk-lb-mid {
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 14px;
  pointer-events: none;
}
.gk-lb-mid > * { pointer-events: auto; }

.gk-lb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .82);
  cursor: pointer;
  transition: background .22s ease, color .22s ease, border-color .22s ease;
  -webkit-tap-highlight-color: transparent;
}
.gk-lb:focus { outline: none; }

.gk-lb-btn:hover,
.gk-lb-btn:focus-visible {
  background: var(--gk-gal-accent, #ef8b64);
  border-color: var(--gk-gal-accent, #ef8b64);
  color: #fff;
  outline: none;
}

.gk-lb-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 34px;
  padding: 0 24px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.5;
  letter-spacing: .02em;
  color: rgba(255, 255, 255, .7);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
}
.gk-lb-cap.is-on { display: block; }

.gk-lb-tip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: .06em;
  color: rgba(255, 255, 255, .34);
  pointer-events: none;
  transition: opacity .4s ease;
}
.gk-lb.was-moved .gk-lb-tip { opacity: 0; }

/* ------------------------------ 响应式 ------------------------------ */
@media only screen and (max-width: 1199.98px) {
  .gk-gal { --gk-gal-pad: 22px; }
  .gk-gal-grid { grid-template-columns: repeat(3, 1fr); }
  .gk-gal-title { font-size: 23px; }
}

@media only screen and (max-width: 991.98px) {
  .gk-gal { --gk-gal-pad: 16px; --gk-gal-gap: 8px; }
  .gk-gal-hd { padding: 18px var(--gk-gal-pad) 12px; }
  .gk-gal-title { font-size: 19px; margin: 6px 0 6px; }
  .gk-gal-sub { font-size: 12px; }
  .gk-gal-hint { font-size: 11px; margin-top: 8px; }
  .gk-gal-nav { margin-top: 22px; padding-top: 16px; }
  .gk-lb-stage { padding: 46px 6px 62px; }
  .gk-lb-count { font-size: 11.5px; }
  .gk-lb-tip { font-size: 11px; bottom: 10px; }
  .gk-lb-cap { font-size: 11.5px; bottom: 28px; padding: 0 16px; }
}

@media only screen and (max-width: 767.98px) {
  .gk-gal { --gk-gal-pad: 8px; --gk-gal-gap: 5px; }
  .gk-gal-hd { padding: 14px 12px 10px; }
  .gk-gal-title { font-size: 17px; }
  .gk-gal-grid { grid-template-columns: repeat(2, 1fr); }
  .gk-gal-nav { gap: 7px; padding-left: 12px; padding-right: 12px; }
  .gk-gal-navbtn { padding: 9px 10px; }
  .gk-gal-navttl { font-size: 12px; }
  .gk-gal-navbtn.is-all { flex-basis: 40px; }
  .gk-gal-share { padding: 0 12px; }
  .gk-lb-btn { width: 36px; height: 36px; }
  .gk-lb-mid { padding: 0 8px; }
  .gk-lb-top { padding: 10px 12px; }
}

@media only screen and (max-width: 360.98px) {
  .gk-gal-grid { grid-template-columns: repeat(2, 1fr); --gk-gal-gap: 4px; }
}
