/* Shared Tér full-screen project viewer layered over the existing GLightbox instance. */

html.glightbox-open {
  scrollbar-gutter: stable;
}

.glightbox-container.ter-project-viewer {
  --ter-viewer-edge-x: clamp(20px, 3vw, 48px);
  --ter-viewer-edge-y: clamp(18px, 3vw, 42px);
  --ter-viewer-ink: rgba(246, 242, 234, 0.72);
  --ter-viewer-ink-bright: rgba(255, 252, 246, 0.98);
  --ter-viewer-progress: #a6a182;
  --ter-viewer-progress-track: rgba(166, 161, 130, 0.14);
  background: #0c0c0b;
  color: var(--ter-viewer-ink);
  isolation: isolate;
  overscroll-behavior: contain;
}

.glightbox-container.ter-project-viewer .goverlay {
  background: rgba(9, 9, 8, 0.96);
}

.ter-project-viewer__backdrop {
  position: absolute;
  z-index: 0;
  inset: -3%;
  background-position: center;
  background-size: cover;
  filter: blur(18px);
  opacity: 0.12;
  transform: scale(1.035);
  transition: background-image 220ms linear, opacity 700ms ease;
  pointer-events: none;
}

.ter-project-viewer__backdrop::after {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 7, 0.5);
  content: "";
}

.glightbox-container.ter-project-viewer .gcontainer,
.glightbox-container.ter-project-viewer .gslider {
  z-index: 1;
}

.glightbox-container.ter-project-viewer .gslide {
  padding: max(56px, calc(var(--ter-viewer-edge-y) + env(safe-area-inset-top)))
    clamp(54px, 8vw, 126px)
    max(42px, calc(var(--ter-viewer-edge-y) + env(safe-area-inset-bottom)));
}

.glightbox-container.ter-project-viewer .gslide-inner-content,
.glightbox-container.ter-project-viewer .ginner-container,
.glightbox-container.ter-project-viewer .gslide-media,
.glightbox-container.ter-project-viewer .gslide-image {
  max-width: 100%;
  max-height: 100%;
  background: transparent;
  box-shadow: none;
}

.glightbox-container.ter-project-viewer .gslide-media {
  display: flex;
  align-items: center;
  justify-content: center;
}

.glightbox-container.ter-project-viewer .gslide-image img {
  width: auto;
  height: auto;
  max-width: min(82vw, 100%);
  max-height: min(89vh, 100%);
  object-fit: contain;
  background: transparent;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.18);
  transform: scale(1);
  transform-origin: 50% 50%;
}

.glightbox-container.ter-project-viewer .gslide-description,
.glightbox-container.ter-project-viewer .gclose,
.glightbox-container.ter-project-viewer .gprev,
.glightbox-container.ter-project-viewer .gnext,
.glightbox-container.ter-project-viewer .portfolio-viewer__meta {
  display: none !important;
}

.glightbox-container.ter-project-viewer .gfadeIn,
.glightbox-container.ter-project-viewer .gfadeOut {
  animation-duration: 760ms !important;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1) !important;
}

@keyframes ter-project-viewer-fade-in {
  from {
    opacity: 0;
    transform: scale(1.004);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.glightbox-container.ter-project-viewer .gslide.current .gslide-image img {
  animation: ter-project-viewer-fade-in 760ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ter-project-viewer__ui {
  position: absolute;
  z-index: 5;
  inset: 0;
  font-family: Qanelas-Regular, qanelas-light, sans-serif;
  pointer-events: none;
}

.ter-project-viewer__slideshow-progress {
  position: absolute;
  z-index: 7;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  overflow: hidden;
  background: var(--ter-viewer-progress-track);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
}

.ter-project-viewer__slideshow-progress-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--ter-viewer-progress);
  box-shadow: 0 0 8px rgba(166, 161, 130, 0.16);
  transform: scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
}

.ter-project-viewer--progress-active .ter-project-viewer__slideshow-progress {
  opacity: 0.92;
}

.ter-project-viewer__counter,
.ter-project-viewer__top-controls,
.ter-project-viewer__navigation {
  transition: opacity 300ms ease, transform 300ms ease;
}

.ter-project-viewer__counter {
  position: absolute;
  top: max(var(--ter-viewer-edge-y), env(safe-area-inset-top));
  left: var(--ter-viewer-edge-x);
  z-index: 3;
  margin: 0;
  color: var(--ter-viewer-ink);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.055em;
  line-height: 1;
  pointer-events: none;
}

.ter-project-viewer__top-controls {
  position: absolute;
  z-index: 4;
  top: max(calc(var(--ter-viewer-edge-y) - 15px), env(safe-area-inset-top));
  right: calc(var(--ter-viewer-edge-x) - 15px);
  display: flex;
  align-items: center;
  gap: clamp(8px, 0.8vw, 14px);
  pointer-events: auto;
}

.ter-project-viewer__control,
.ter-project-viewer__navigation,
.ter-project-viewer__thumbnail {
  appearance: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ter-viewer-ink);
  cursor: pointer;
}

.ter-project-viewer__control {
  display: grid;
  width: 48px;
  height: 48px;
  padding: 14px;
  place-items: center;
  transition: opacity 220ms ease, transform 220ms ease, color 220ms ease;
}

.ter-project-viewer__control svg {
  display: block;
  width: 19px;
  height: 19px;
  overflow: visible;
}

.ter-project-viewer__control path,
.ter-project-viewer__navigation path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.ter-project-viewer__play path:first-child {
  fill: currentColor;
  stroke: none;
}

.ter-project-viewer--playing .ter-project-viewer__play path:first-child {
  fill: none;
  stroke: currentColor;
}

.ter-project-viewer__grid-toggle path {
  stroke-width: 0.9;
}

.ter-project-viewer__navigation {
  position: absolute;
  z-index: 3;
  top: 50%;
  display: grid;
  width: 56px;
  height: 72px;
  padding: 22px 17px;
  place-items: center;
  pointer-events: auto;
  transform: translateY(-50%);
}

.ter-project-viewer__navigation--previous {
  left: max(2px, calc(var(--ter-viewer-edge-x) - 16px));
}

.ter-project-viewer__navigation--next {
  right: max(2px, calc(var(--ter-viewer-edge-x) - 16px));
}

.ter-project-viewer__navigation svg {
  width: 20px;
  height: 28px;
}

.ter-project-viewer__control:hover,
.ter-project-viewer__navigation:hover,
.ter-project-viewer__control:focus-visible,
.ter-project-viewer__navigation:focus-visible {
  color: var(--ter-viewer-ink-bright);
  opacity: 1;
}

.ter-project-viewer__control:hover {
  transform: translateY(-1px);
}

.ter-project-viewer__control:focus-visible,
.ter-project-viewer__navigation:focus-visible,
.ter-project-viewer__thumbnail:focus-visible {
  outline: 1px solid rgba(247, 243, 235, 0.72);
  outline-offset: -5px;
}

.ter-project-viewer__overview {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding:
    max(94px, calc(72px + env(safe-area-inset-top)))
    var(--ter-viewer-edge-x)
    max(54px, calc(32px + env(safe-area-inset-bottom)));
  background: rgba(11, 11, 10, 0.985);
  overscroll-behavior: contain;
  pointer-events: auto;
  scrollbar-color: rgba(246, 242, 234, 0.2) transparent;
  scrollbar-width: thin;
}

.ter-project-viewer__overview[hidden] {
  display: none;
}

.ter-project-viewer__overview-grid {
  display: grid;
  width: min(1440px, 100%);
  margin: 0 auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 32px);
  align-items: start;
}

.ter-project-viewer__thumbnail {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  opacity: 0.62;
  transition: opacity 260ms ease;
}

.ter-project-viewer__thumbnail::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: rgba(247, 243, 235, 0.76);
  content: "";
  opacity: 0;
  transform: scaleX(0.2);
  transform-origin: 50% 50%;
  transition: opacity 260ms ease, transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ter-project-viewer__thumbnail img {
  display: block;
  width: 100%;
  height: auto;
  background: #121210;
}

.ter-project-viewer__thumbnail:hover,
.ter-project-viewer__thumbnail:focus-visible,
.ter-project-viewer__thumbnail.is-active {
  opacity: 1;
}

.ter-project-viewer__thumbnail.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.ter-project-viewer--overview .gcontainer,
.ter-project-viewer--overview .ter-project-viewer__backdrop,
.ter-project-viewer--overview .ter-project-viewer__counter,
.ter-project-viewer--overview .ter-project-viewer__navigation {
  opacity: 0;
  pointer-events: none;
}

.ter-project-viewer--ui-hidden {
  cursor: none;
}

.ter-project-viewer--ui-hidden .ter-project-viewer__counter,
.ter-project-viewer--ui-hidden .ter-project-viewer__top-controls,
.ter-project-viewer--ui-hidden .ter-project-viewer__navigation {
  opacity: 0;
  pointer-events: none;
}

.ter-project-viewer--ui-hidden .ter-project-viewer__top-controls {
  transform: translateY(-3px);
}

.ter-project-viewer--ui-hidden .ter-project-viewer__navigation--previous {
  transform: translate(-3px, -50%);
}

.ter-project-viewer--ui-hidden .ter-project-viewer__navigation--next {
  transform: translate(3px, -50%);
}

.ter-project-viewer__status {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 991.98px) {
  .ter-project-viewer__overview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px), (hover: none) and (pointer: coarse) {
  .glightbox-container.ter-project-viewer {
    --ter-viewer-edge-x: max(13px, env(safe-area-inset-left));
    --ter-viewer-edge-y: 14px;
  }

  .glightbox-container.ter-project-viewer .gslide {
    padding:
      max(70px, calc(54px + env(safe-area-inset-top)))
      14px
      max(64px, calc(42px + env(safe-area-inset-bottom)));
  }

  .glightbox-container.ter-project-viewer .gslide-image img {
    max-width: 100%;
    max-height: calc(100dvh - 134px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  .ter-project-viewer__counter {
    top: max(29px, calc(17px + env(safe-area-inset-top)));
    left: max(20px, calc(13px + env(safe-area-inset-left)));
    font-size: 11px;
  }

  .ter-project-viewer__top-controls {
    top: max(12px, env(safe-area-inset-top));
    right: max(2px, env(safe-area-inset-right));
    gap: 0;
  }

  .ter-project-viewer__control {
    width: 46px;
    height: 46px;
    padding: 14px;
  }

  .ter-project-viewer__navigation {
    top: auto;
    bottom: max(4px, env(safe-area-inset-bottom));
    width: 54px;
    height: 54px;
    padding: 17px;
    transform: none;
  }

  .ter-project-viewer__navigation--previous {
    left: max(2px, env(safe-area-inset-left));
  }

  .ter-project-viewer__navigation--next {
    right: max(2px, env(safe-area-inset-right));
  }

  .ter-project-viewer__overview {
    padding:
      max(78px, calc(58px + env(safe-area-inset-top)))
      14px
      max(36px, calc(20px + env(safe-area-inset-bottom)));
  }

  .ter-project-viewer__overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .ter-project-viewer__thumbnail {
    opacity: 0.82;
  }

  .ter-project-viewer--ui-hidden {
    cursor: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .glightbox-container.ter-project-viewer .gfadeIn,
  .glightbox-container.ter-project-viewer .gfadeOut,
  .glightbox-container.ter-project-viewer .gslide.current .gslide-image img,
  .ter-project-viewer__counter,
  .ter-project-viewer__top-controls,
  .ter-project-viewer__navigation,
  .ter-project-viewer__control,
  .ter-project-viewer__thumbnail,
  .ter-project-viewer__thumbnail::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }

  .ter-project-viewer__slideshow-progress {
    transition: none;
  }

  .ter-project-viewer--progress-active .ter-project-viewer__slideshow-progress-fill {
    transform: scaleX(1);
  }

  .glightbox-container.ter-project-viewer .gslide.current .gslide-image img {
    animation: none !important;
    transform: none;
  }
}
