/* Accommodation photo browser + full-screen viewer (aipPhotoBrowser.js).
   Ported from CyprusParadise-NewDesigns/prototypes/hotel-highlights-pia-bella
   (october-21-refinements.css + the interaction-rules.css close/radius rules it relies on). */
.cp-photo-dialog {
  padding: 0;
  width: min(1200px, calc(100vw - 48px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  border: 1px solid #d8e0e0;
  border-radius: 10px;
  background: #fff;
  color: #3c4e5a;
  font-family: Lato, "Segoe UI", sans-serif;
  overflow: hidden;
}
.cp-photo-dialog::backdrop { background: rgba(25, 35, 39, .68); }
.cp-photo-dialog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid #d8e0e0;
}
.cp-photo-dialog h2 { margin: 0; font: 600 22px/1.3 Montserrat, Lato, sans-serif; color: inherit; }

/* Transparent 44px close with a drawn X (prototype's shared close control). */
.cp-photo-dialog .cp-photo-close {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #3c4e5a;
  font-size: 0;
  line-height: 1;
  cursor: pointer;
}
.cp-photo-dialog .cp-photo-close::before {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 6 12 12M18 6 6 18' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 6 12 12M18 6 6 18' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
}
.cp-photo-dialog button:focus-visible { outline: 3px solid #218887; outline-offset: 3px; }

.cp-photo-dialog .cp-chevron {
  display: inline-block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Category tiles */
.cp-photo-categories {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  overflow-x: auto;
  border-bottom: 1px solid #e1e6e6;
}
.cp-category {
  flex: 1 0 116px;
  max-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #fff;
  font: 600 13px/1.4 Lato, "Segoe UI", sans-serif;
  color: #3c4e5a;
  text-align: center;
  cursor: pointer;
}
.cp-category img { width: 100%; height: 72px; object-fit: cover; border-radius: 6px; }
.cp-category[aria-pressed="true"] { border-color: #02aaa9; color: #218887; }

/* Fixed-size browser: same height whatever category is picked; header + category row stay put
   and only the photo area scrolls. */
#cpPhotoBrowser[open] {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 48px);
}
#cpPhotoBrowser > header,
#cpPhotoBrowser .cp-photo-categories { flex: 0 0 auto; }

/* Photo grid */
.cp-photo-results {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 20px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable; /* no width jump when a category needs/doesn't need a scrollbar */
}
.cp-photo-grid { align-content: start; }
.cp-photo-results-label { margin: 0 0 14px; font-size: 15px; }
.cp-photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cp-grid-photo {
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #edf3f3;
  cursor: zoom-in;
}
.cp-grid-photo img { display: block; width: 100%; aspect-ratio: 1.5; object-fit: cover; }

/* Full-screen viewer */
.cp-photo-dialog.cp-full-viewer {
  width: calc(100vw - 48px);
  max-height: calc(100dvh - 32px);
  background: transparent;
  border: 0;
  color: #fff;
}
#cpPhotoViewer::backdrop { background: rgb(60 78 90 / 80%); }
.cp-full-viewer > header { border: 0; padding: 0 0 10px; }
.cp-full-viewer h2 { color: #fff; font-size: 18px; }
.cp-full-viewer .cp-photo-close { color: #fff; }
.cp-full-photo { position: relative; padding: 0 64px; }
.cp-full-photo > img { display: block; width: 100%; height: calc(100dvh - 160px); object-fit: contain; }
.cp-photo-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 54px;
  height: 64px;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background-color .15s ease;
  touch-action: manipulation; /* no double-tap zoom delay */
}
.cp-photo-arrow:hover { background: rgb(255 255 255 / 14%); }
.cp-photo-arrow:active { background: rgb(255 255 255 / 24%); }
.cp-photo-arrow:focus:not(:focus-visible) { outline: none; }
/* No text/image highlight or tap flash from fast clicks anywhere in the viewer. */
.cp-full-viewer,
.cp-full-viewer * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.cp-full-photo > img { -webkit-user-drag: none; }
.cp-photo-arrow--prev { left: 0; }
.cp-photo-arrow--prev svg { transform: rotate(180deg); }
.cp-photo-arrow--next { right: 0; }
.cp-full-caption { text-align: center; margin: 10px 0 0; color: #fff; font-size: 14px; }

@media (max-width: 900px) {
  .cp-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .cp-photo-dialog h2 { font-size: 18px; }
  .cp-photo-dialog > header { padding: 10px 14px; }
}
