/* ===== GALLERY ===== */
:root {
  --ui: Verdana, Geneva, Tahoma, sans-serif;
}
 
.gallery{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap:16px;
  justify-content:space-between;
}

.thumb{
  position:relative;
  border:0;
  padding:0;
  background:transparent;
  cursor:pointer;
  border-radius:14px;
  overflow:hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,.10);
}

.thumb img{
  width:100%;
  height:140px;
  object-fit:cover;
  display:block;
  transition:transform .18s ease;
}

.thumb:hover img{
  transform:scale(1.03);
}

.thumb::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  height:60%;
  background:linear-gradient(to top, rgba(0,0,0,.55), transparent);
  pointer-events:none;
}

.g-cap{
  position:absolute;
  left:12px;
  right:12px;
  bottom:10px;
  z-index:2;

  font-family:var(--ui);
  font-size:14px;
  font-weight:500;
  color:#fff;
  line-height:1.3;

  text-shadow:
    0 2px 6px rgba(0,0,0,.65),
    0 0 2px rgba(0,0,0,.8);

  pointer-events:none;
}

/* ===== MODAL ===== */
.img-modal{
  position:fixed;
  inset:0;
  display:none;
  z-index:9999;
}

.img-modal.is-open{
  display:flex;
  align-items:center;
  justify-content:center;
}

.img-modal__overlay{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.68);
  backdrop-filter:blur(4px);
}

.img-modal__dialog{
  position:relative;
  width:min(1100px, 96vw);
  height:min(88vh, 820px);
  background:#0e0f12;
  color:#e9eef7;
  border-radius:18px;
  overflow:hidden;
  box-shadow:0 18px 80px rgba(0,0,0,.45);
  display:flex;
  flex-direction:column;
  border:1px solid rgba(255,255,255,.08);
}

.img-modal__topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px;
  background:rgba(255,255,255,.03);
  border-bottom:1px solid rgba(255,255,255,.08);
}

.img-modal__title{
  font-weight:600;
  font-size:14px;
  opacity:.9;
  padding-left:6px;
}

.img-modal__controls{
  display:flex;
  gap:8px;
  align-items:center;
}

.icon-btn{
  appearance:none;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.05);
  color:#e9eef7;
  height:34px;
  min-width:34px;
  padding:0 10px;
  border-radius:10px;
  cursor:pointer;
  font-size:16px;
  line-height:32px;
  user-select:none;
}

.icon-btn:hover{
  background:rgba(255,255,255,.09);
}

.icon-btn:active{
  transform:translateY(1px);
}

.icon-btn.danger{
  border-color:rgba(255,80,80,.35);
}

.img-modal__viewport{
  position:relative;
  flex:1;
  overflow:hidden;
  touch-action:none;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.06), transparent 42%),
    radial-gradient(circle at 80% 30%, rgba(255,255,255,.05), transparent 40%),
    #0b0c0f;
  cursor:grab;
}

.img-modal__viewport.is-dragging{
  cursor:grabbing;
}

.img-modal__viewport.is-video{
  cursor:default;
}

.img-modal__img,
.img-modal__video{
  display:none;
}

.img-modal__img.is-active{
  display:block;
  position:absolute;
  top:50%;
  left:50%;
  max-height:100%;
  max-width:100%;
  height:auto;
  width:auto;
  transform:translate(-50%, -50%) scale(1);
  transform-origin:center center;
  will-change:transform;
  user-select:none;
  -webkit-user-drag:none;
  pointer-events:none;
}

.img-modal__video.is-active{
  display:block;
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:contain;
  background:#000;
}

.img-modal__hint{
  padding:10px 14px;
  font-size:12px;
  opacity:.75;
  border-top:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.02);
}