.lynk-gallery-wrap {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 56px) clamp(16px, 3vw, 32px);
  padding-top: max(
    calc(2.3rem + env(safe-area-inset-top, 0px)),
    calc(var(--lynk-content-below-header) - 4.45rem)
  );
}

.lynk-gallery-wrap::before,
.lynk-gallery-wrap::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(42px);
  z-index: 0;
  pointer-events: none;
}

.lynk-gallery-wrap::before {
  width: 280px;
  height: 280px;
  left: -40px;
  top: -20px;
  background: radial-gradient(circle at 30% 30%, rgba(133, 189, 255, 0.34), rgba(133, 189, 255, 0));
}

.lynk-gallery-wrap::after {
  width: 320px;
  height: 320px;
  right: -30px;
  bottom: -20px;
  background: radial-gradient(circle at 70% 70%, rgba(255, 148, 212, 0.26), rgba(255, 148, 212, 0));
}

.lynk-gallery-head {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: clamp(18px, 2.8vw, 34px);
}

/* Tiêu đề / mô tả hero: lynk-video-anlie.css (.lynk-hero-title, .lynk-hero-sub) */

.lynk-gallery-sort {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 auto 34px;
}

.lynk-gallery-sort button {
  border: 1px solid rgba(247, 231, 206, 0.24);
  color: rgba(247, 231, 206, 0.92);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 999px;
  font-size: 12px;
  padding: 6px 14px;
  transition: all 0.25s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-tap-highlight-color: transparent;
}

.lynk-gallery-sort button.is-active {
  color: #065f46;
  border-color: rgba(52, 211, 153, 0.7);
  background: linear-gradient(135deg, #34d399, #10b981);
  text-shadow: none;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.lynk-gallery-sort button:hover,
.lynk-gallery-sort button:focus,
.lynk-gallery-sort button:focus-visible {
  color: #f7e7ce;
  background: rgba(247, 231, 206, 0.14);
  border-color: rgba(247, 231, 206, 0.36);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 6px 18px rgba(0, 0, 0, 0.2);
}

.lynk-gallery-sort button.is-active:hover,
.lynk-gallery-sort button.is-active:focus,
.lynk-gallery-sort button.is-active:focus-visible {
  color: #065f46;
  border-color: rgba(52, 211, 153, 0.7);
  background: linear-gradient(135deg, #34d399, #10b981);
  outline: none;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.lynk-gallery-clean-grid {
  position: relative;
  z-index: 1;
  column-count: 3;
  column-gap: clamp(12px, 1.6vw, 20px);
}

.lynk-gallery-card {
  position: relative;
  display: inline-block;
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  min-height: 240px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 14px 40px rgba(9, 16, 31, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.3s ease;
  margin: 0 0 clamp(12px, 1.6vw, 20px);
  break-inside: avoid;
}

.lynk-gallery-card.is-clean {
  width: 100%;
  margin: 0 0 clamp(12px, 1.6vw, 20px);
  min-height: 0;
}

.lynk-gallery-card.is-clean.shape-portrait {
  aspect-ratio: 3 / 4.2;
}

.lynk-gallery-card.is-clean.shape-landscape {
  aspect-ratio: 4 / 2.9;
}

.lynk-gallery-card.is-clean.shape-square,
.lynk-gallery-card.is-clean.shape-unknown {
  aspect-ratio: 1 / 1;
}

.lynk-gallery-liquid-border {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  padding: 1px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.65), rgba(146, 215, 255, 0.25), rgba(255, 173, 222, 0.35));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.9;
}

.lynk-gallery-media,
.lynk-gallery-media img,
.lynk-gallery-overlay {
  position: absolute;
  inset: 0;
}

.lynk-gallery-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  filter: saturate(1.1) contrast(1.02);
  transition: transform 0.55s ease;
}

.lynk-gallery-card.is-clean.shape-landscape .lynk-gallery-media img {
  object-fit: cover;
}

.lynk-gallery-overlay {
  background: linear-gradient(180deg, rgba(4, 7, 14, 0.02) 35%, rgba(3, 6, 14, 0.62) 100%);
}

.lynk-gallery-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 14px 12px;
  color: var(--lynk-color-text);
}

.lynk-gallery-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: rgba(247, 231, 206, 0.96);
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-shadow: 0 0 8px rgba(247, 231, 206, 0.32);
}

.lynk-gallery-content h3 {
  margin: 8px 0 6px;
  font-size: clamp(15px, 1.45vw, 19px);
  line-height: 1.2;
  color: #f7e7ce;
  text-shadow: 0 0 14px rgba(247, 231, 206, 0.35), 0 6px 18px rgba(0, 0, 0, 0.38);
}

.lynk-gallery-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(247, 231, 206, 0.92);
  text-shadow: 0 0 10px rgba(247, 231, 206, 0.28);
}

.lynk-gallery-card:hover {
  transform: translateY(-8px) scale(1.01);
  border-color: rgba(255, 255, 255, 0.36);
  box-shadow: 0 26px 56px rgba(6, 11, 24, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.lynk-gallery-card:hover .lynk-gallery-media img {
  transform: scale(1.08);
}

.lynk-gallery-empty {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  padding: 20px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: rgba(244, 248, 255, 0.9);
}

@media (min-width: 768px) and (max-width: 1024px) {
  .lynk-gallery-clean-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(10px, 1.4vw, 16px);
    column-count: unset;
  }

  .lynk-gallery-card.is-clean.shape-portrait,
  .lynk-gallery-card.is-clean.shape-landscape,
  .lynk-gallery-card.is-clean.shape-square,
  .lynk-gallery-card.is-clean.shape-unknown,
  .lynk-gallery-card {
    aspect-ratio: 3 / 2.4;
    min-height: 0;
    border-radius: 12px;
    break-inside: unset;
  }

  .lynk-gallery-content {
    padding: 8px 10px 10px;
  }

  .lynk-gallery-content h3 {
    font-size: 13px;
    margin: 4px 0 4px;
  }

  .lynk-gallery-pill {
    font-size: 9px;
    padding: 2px 7px;
  }

  .lynk-gallery-meta {
    font-size: 11px;
  }
}

@media (max-width: 767px) {
  /* Đổi sang grid 2 cột thay vì column-count */
  .lynk-gallery-clean-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    column-count: unset;
  }

  /* Ép tất cả card về tỉ lệ gọn */
  .lynk-gallery-card.is-clean.shape-portrait,
  .lynk-gallery-card.is-clean.shape-landscape,
  .lynk-gallery-card.is-clean.shape-square,
  .lynk-gallery-card.is-clean.shape-unknown,
  .lynk-gallery-card {
    aspect-ratio: 3 / 2.4;
    min-height: 0;
    border-radius: 12px;
    break-inside: unset;
  }

  .lynk-gallery-content {
    padding: 8px 10px 10px;
  }

  .lynk-gallery-content h3 {
    font-size: 13px;
    margin: 4px 0 4px;
  }

  .lynk-gallery-pill {
    font-size: 9px;
    padding: 2px 7px;
  }

  .lynk-gallery-meta {
    font-size: 11px;
  }
}
