/* ==========================================================================
   User photo gallery page (user-photo-gallery.html)
   Gallery grid, hover veil, "View All" and the photo modal.
   ========================================================================== */
.ug-page {
  font-family: var(--font-family-Lato, "Lato", sans-serif);
}

/* section heading (.re-cmn--heading is 24px on desktop): smaller on phones */
@media (max-width: 767.98px) {
  .ug-page .re-cmn--heading,
  .ug-section .re-cmn--heading {
    font-size: 16px;
    line-height: 24px;
    margin-bottom: 14px;
  }
}
@media (max-width: 575.98px) {
  .ug-page .re-cmn--heading,
  .ug-section .re-cmn--heading {
    font-size: 14px;
    line-height: 20px;
    margin-bottom: 12px;
  }
}

/* ----- gallery grid: 4 / 3 / 2 columns ----- */
.ug-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}
.ug-gallery__item {
  margin: 0;
}
.ug-gallery__link {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 190 / 131;
  background: #eef0f3;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}
.ug-gallery__link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* hover: blue veil with five white stars (no zoom) */
.ug-gallery__hover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 106, 155, 0.85);
  opacity: 0;
  transition: opacity 0.2s;
}
.ug-gallery__link:hover .ug-gallery__hover,
.ug-gallery__link:focus-visible .ug-gallery__hover {
  opacity: 1;
}
.ug-stars {
  display: inline-flex;
  gap: 4px;
}
.ug-stars svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: #fff;
}
/* rated stars are yellow, the rest stay white */
.ug-stars svg.is-on {
  fill: #ffc107;
}

/* ----- view all ----- */
.ug-viewall {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}
.ug-viewall__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: #5d6370;
  text-decoration: none;
}
.ug-viewall__link:hover {
  color: var(--color-blue-50, #1c6a9b);
}
.ug-viewall__link:hover svg{
  fill: var(--color-blue-50, #1c6a9b);
}
.ug-viewall__link svg {
  transition: transform 0.2s;
}
.ug-viewall__link:hover svg {
  transform: translateX(3px);
}

/* ----- tablet ----- */
@media (max-width: 991.98px) {
  .ug-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
}

/* ----- phone ----- */
@media (max-width: 575.98px) {
  .ug-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
  }
  .ug-gallery__link {
    border-radius: 6px;
  }
  .ug-viewall {
    margin-top: 20px;
  }
  .ug-viewall__link {
    font-size: 13px;
  }
}

/* ==========================================================================
   Photo modal: big photo on the left, car + rating + review on the right
   ========================================================================== */
.ug-modal .modal-dialog {
  max-width: 830px;
}
.ug-modal .modal-content {
  position: relative;
  padding: 12px;
  border: 0;
  border-radius: 12px;
}
/* close button: same round X as the inquiry account modal */
.ug-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: #6b7280;
  background: rgba(255, 255, 255, 0.9);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s;
}
.ug-modal__close:hover {
  color: #0c1529;
  background: #eef0f3;
}

.ug-modal__body {
  display: grid;
  grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
  gap: 24px;
}
.ug-modal__photo {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  overflow: hidden;
  background: #f0f0f0;
}
.ug-modal__photo img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 380px;
  object-fit: contain;
}

.ug-modal__info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding-right: 4px;
}
/* review card */
.ug-review {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 250px;
  padding: 16px 18px 14px;
  background: #f5f9ff;
  border: 1px solid #cdd6e2;
  border-radius: 10px;
}
.ug-review__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between; /* avatar on the left, name on the right */
  gap: 12px;
  margin-bottom: 10px;
}
.ug-review__avatar {
  flex: none;
  width: 44px;
  height: 44px;
  object-fit: cover;
  background: #fff;
  border-radius: 50%;
}
.ug-review__who {
  margin-top: 8px;
  text-align: right;
}
.ug-review__name {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: #0c1529;
}
.ug-review__role {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #4b5563;
}
.ug-review__text {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #2b3445;
}
.ug-review__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 12px;
}
.ug-review__flag {
  display: block;
  width: 24px;
  height: 16px;
  object-fit: cover;
}
.ug-share {
  display: flex;
  gap: 6px;
}
.ug-share__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
  text-decoration: none;
  border-radius: 3px;
}
.ug-share__btn:hover {
  color: #fff;
  opacity: 0.9;
}
.ug-share__btn--fb {
  background: #1877f2;
}
.ug-share__btn--x {
  background: #000;
}

/* tablet: narrower photo column */
@media (max-width: 991.98px) {
  .ug-modal__body {
    grid-template-columns: minmax(0, 36%) minmax(0, 1fr);
    gap: 18px;
  }
}

/* phone: one column, photo on top */
@media (max-width: 767.98px) {
  .ug-modal .modal-content {
    padding: 10px;
  }
  .ug-modal__body {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .ug-modal__photo {
    min-height: 0;
    aspect-ratio: 4 / 3;
  }
  .ug-review {
    min-height: 0;
    padding: 14px;
  }
  .ug-review__text,
  .ug-review__name,
  .ug-review__role {
    font-size: 12.5px;
  }
}

/* ==========================================================================
   Load more (user-photo-gallery.js): 8 photos at a time
   ========================================================================== */
/* before the script runs only the first 8 are shown (no flash of all 16) */
.ug-gallery:not(.is-ready) .ug-gallery__item:nth-child(n + 9) {
  display: none;
}
.ug-gallery__item[hidden] {
  display: none;
}
.ug-gallery__item.is-new {
  animation: ug-in 0.45s ease both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes ug-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* "View All" while loading: the arrow becomes a small spinner */
.ug-viewall[hidden] {
  display: none;
}
.ug-viewall__spin {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid #d5dae1;
  border-top-color: var(--color-blue-50, #1c6a9b);
  border-radius: 50%;
  animation: ug-spin 0.7s linear infinite;
}
.ug-viewall__link.is-loading {
  pointer-events: none;
  opacity: 0.85;
}
.ug-viewall__link.is-loading svg {
  display: none;
}
.ug-viewall__link.is-loading .ug-viewall__spin {
  display: inline-block;
}
@keyframes ug-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ug-gallery__item.is-new,
  .ug-viewall__spin {
    animation: none;
  }
}
