/* ==========================================================================
   Gallery viewer (js/gallery.js)
   Used by the hero projects (photo opens in place over its card) and by the
   service cards (gallery opens centred on screen).
   ========================================================================== */
.pv {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.pv:focus { outline: none; }

.pv__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(38 39 57 / .72);
  opacity: 0;
  transition: opacity 350ms ease;
}

.pv.is-open .pv__backdrop { opacity: 1; }

.pv__close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / .24);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 250ms ease, background-color 150ms ease;
}

.pv.is-open .pv__close { opacity: 1; }
.pv__close:hover { background: rgb(255 255 255 / .36); }

/* same X everywhere, kept next to the gallery instead of the screen corner,
   never over a photo or card */
.pv__above .pv__close { top: 0; right: auto; left: calc(100% + 12px); } /* services: beside the top card */
.pv__stage > .pv__close { top: -52px; right: 0; }                       /* hero: above the photo's corner */

.pv__close svg,
.pv__nav svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* stage = box of the current photo; position and size set from JS */
.pv__stage {
  --peek: calc(var(--sw) * .5);
  --reach: calc(var(--sg) + var(--peek));
  position: absolute;
  width: var(--sw);
  height: var(--sw);
}

/* wider window that shows the neighbours and fades them away */
.pv__viewport {
  position: absolute;
  top: 0;
  left: calc(var(--reach) * -1);
  width: calc(var(--sw) + var(--reach) * 2);
  height: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 calc(var(--peek) * .82), #000 calc(100% - var(--peek) * .82), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 calc(var(--peek) * .82), #000 calc(100% - var(--peek) * .82), transparent 100%);
}

.pv__slide {
  position: absolute;
  top: 0;
  left: var(--reach);
  width: var(--sw);
  height: 100%;
  margin: 0;
  overflow: hidden;
  border-radius: 20px;
  background: var(--surface-subtle);
  transition: transform 600ms var(--ease), opacity 450ms ease;
}

.pv__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pv__slide.is-peek { cursor: pointer; }

.pv__placeholder {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  height: 100%;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
}

.pv__placeholder img { width: 96px; height: 96px; }

/* arrows sit on the seam between the photo and its neighbour */
.pv__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-strong);
  box-shadow: var(--shadow-key);
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: opacity 200ms ease, background-color 150ms ease;
}

.pv__nav:hover { background: var(--surface-subtle); }
.pv__nav--prev { left: calc(var(--sg) / -2); }
.pv__nav--next { left: calc(100% + var(--sg) / 2); }

.pv__nav[hidden] { display: grid; opacity: 0; pointer-events: none; }
.pv:not(.is-open) .pv__nav { opacity: 0; }

/* ---- under the photo: caption row (services) + information card --------- */
.pv__below {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 350ms ease 60ms, transform 500ms var(--ease) 60ms;
}

.pv.is-open .pv__below { opacity: 1; transform: none; }

/* card above the photo (services) */
.pv__above {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 0;
  width: 100%;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 350ms ease 60ms, transform 500ms var(--ease) 60ms;
}

.pv.is-open .pv__above { opacity: 1; transform: none; }

/* centred galleries: the cards keep a comfortable width even when the photo
   has to shrink to fit a short screen */
.pv--centered .pv__stage { --cw: max(var(--sw), min(520px, 100vw - 32px)); }

.pv--centered .pv__above,
.pv--centered .pv__below {
  left: calc((var(--sw) - var(--cw)) / 2);
  width: var(--cw);
}

/* ---- call to action about the service: Moisés + call / WhatsApp ---------- */
.pv__cta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pv__cta-avatar {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-soft);
}

.pv__cta-msg {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--text-strong);
}

.pv__cta-msg strong { font-weight: 600; }

.pv__cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.pv__cta-actions .hbtn { flex: 1 1 auto; justify-content: center; }

/* sits on the dimmed page: soft darker strip, white caption, light grey number */
.pv__capbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 12px 18px;
  border-radius: 14px;
  background: rgb(18 19 32 / .5);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
}

.pv__capbar .pv__count {
  flex: none;
  margin: 0;
  color: #C9CCDA;
}

.pv__info {
  padding: 20px 24px 22px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  font-size: 15px;
  line-height: 1.5;
}

.pv__meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pv__tile {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg);
}

.pv__tile img { width: 30px; height: 30px; }

.pv__badge {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
}

.pv__count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.pv__title {
  margin: 14px 0 0;
  color: var(--text-strong);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
}

.pv__meta .pv__title { margin: 0; }

.pv__capbar .pv__caption {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pv__text { margin: 4px 0 0; }

.pv__facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 0;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.pv__facts dt { color: var(--text-muted); font-weight: 500; }

.pv__facts dd {
  margin: 2px 0 0;
  color: var(--text-strong);
  font-weight: 500;
}

.pv__review { margin: 14px 0 0; }

.pv__stars { display: flex; gap: 2px; }
.pv__stars svg { width: 16px; height: 16px; fill: var(--amber); }
.pv__stars svg.is-off { fill: var(--border); }

.pv__review blockquote { margin: 8px 0 0; }

.pv__review figcaption {
  margin-top: 6px;
  color: var(--text-muted);
  font-weight: 500;
}

@media (max-width: 720px) {
  .pv__info { padding: 16px 16px 18px; }
  .pv__cta-avatar { width: 40px; height: 40px; }
  /* phones: cards always full width (the photo may be narrower) */
  .pv__stage { --cw: calc(100vw - 32px); }
  .pv__below { left: calc((var(--sw) - var(--cw)) / 2); width: var(--cw); }
  .pv__above .pv__close { top: -52px; right: 0; left: auto; } /* full-width card: above its right end */
  .pv--centered .pv__info { padding: 14px 16px 16px; }
  .pv__cta-actions { margin-top: 12px; }
}
