/* =========================================================
   NORTH COAST FABRICATIONS
   FABRICATION GALLERY
   ========================================================= */

/* =========================================================
   GALLERY SECTION
   ========================================================= */

.ncfab-gallery-section {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 70px 20px 60px;
  box-sizing: border-box;
  overflow: hidden;
}

.ncfab-gallery-container {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  box-sizing: border-box;
}

.ncfab-gallery-container h2 {
  margin: 0 0 12px;
  text-align: center;
  color: var(--primary, #2e3092);
  font-family: "Montserrat", sans-serif;
  font-size: 2rem;
  font-weight: 800;
}

.ncfab-gallery-intro {
  max-width: 800px;
  margin: 0 auto 35px;
  text-align: center;
  color: var(--muted, #555);
  font-size: 1rem;
  line-height: 1.6;
}

/* =========================================================
   CAROUSEL
   ========================================================= */

.ncfab-gallery-carousel {
  position: relative;
  width: 100%;
  height: 430px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1400px;
  touch-action: pan-y;
  user-select: none;
  box-sizing: border-box;
}

.ncfab-gallery-track {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
}

/* =========================================================
   GALLERY ITEMS
   ========================================================= */

.ncfab-gallery-item {
  position: absolute;
  left: 50%;
  top: 50%;

  width: 420px;
  height: 290px;

  overflow: hidden;
  border-radius: 16px;

  background: #111;

  cursor: pointer;

  transform: translate(-50%, -50%) translateX(0) translateZ(0) scale(0.65);

  opacity: 0;

  filter: brightness(0.45);

  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);

  transition:
    transform 0.65s cubic-bezier(0.22, 0.61, 0.36, 1),
    opacity 0.65s ease,
    filter 0.65s ease,
    box-shadow 0.65s ease;

  will-change: transform;

  backface-visibility: hidden;

  box-sizing: border-box;
}

.ncfab-gallery-item img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;

  pointer-events: none;

  transition: transform 0.65s ease;
}

/* =========================================================
   CENTER ITEM
   ========================================================= */

.ncfab-gallery-item.ncfab-gallery-center {
  transform: translate(-50%, -50%) translateX(0) translateZ(180px) scale(1);

  opacity: 1;

  filter: brightness(1);

  z-index: 30;

  cursor: zoom-in;

  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

/* =========================================================
   LEFT ITEM
   ========================================================= */

.ncfab-gallery-item.ncfab-gallery-left {
  transform: translate(-50%, -50%) translateX(-390px) translateZ(-120px)
    rotateY(18deg) scale(0.78);

  opacity: 0.82;

  filter: brightness(0.68);

  z-index: 20;
}

/* =========================================================
   RIGHT ITEM
   ========================================================= */

.ncfab-gallery-item.ncfab-gallery-right {
  transform: translate(-50%, -50%) translateX(390px) translateZ(-120px)
    rotateY(-18deg) scale(0.78);

  opacity: 0.82;

  filter: brightness(0.68);

  z-index: 20;
}

/* =========================================================
   HIDDEN ITEMS
   ========================================================= */

.ncfab-gallery-item.ncfab-gallery-hidden {
  transform: translate(-50%, -50%) translateX(0) translateZ(-300px) scale(0.5);

  opacity: 0;

  filter: brightness(0.3);

  pointer-events: none;

  z-index: 1;
}

/* =========================================================
   IMAGE HOVER
   ========================================================= */

.ncfab-gallery-item.ncfab-gallery-center:hover img {
  transform: scale(1.04);
}

/* =========================================================
   IMAGE OVERLAY
   ========================================================= */

.ncfab-gallery-item::after {
  content: "";

  position: absolute;

  inset: 0;

  pointer-events: none;

  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.02) 35%,
    rgba(0, 0, 0, 0.4) 100%
  );
}

/* =========================================================
   NAVIGATION BUTTONS
   ========================================================= */

.ncfab-gallery-nav {
  position: absolute;

  top: 50%;

  z-index: 100;

  width: 54px;
  height: 54px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  border: 0;
  border-radius: 50%;

  background: rgba(0, 0, 0, 0.65);

  color: #fff;

  font-family: Arial, sans-serif;

  font-size: 28px;

  line-height: 1;

  cursor: pointer;

  transform: translateY(-50%);

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.ncfab-gallery-nav:hover {
  background: rgba(0, 0, 0, 0.9);

  transform: translateY(-50%) scale(1.08);
}

.ncfab-gallery-nav:focus-visible {
  outline: 3px solid var(--primary, #2e3092);
  outline-offset: 3px;
}

.ncfab-gallery-prev {
  left: 20px;
}

.ncfab-gallery-next {
  right: 20px;
}

/* =========================================================
   GALLERY HINT
   ========================================================= */

.ncfab-gallery-hint {
  margin-top: 20px;

  text-align: center;

  color: #777;

  font-size: 0.9rem;
}

/* =========================================================
   ERROR MESSAGE
   ========================================================= */

.ncfab-gallery-error {
  width: 100%;

  padding: 40px 20px;

  text-align: center;

  color: #777;

  font-size: 1rem;

  box-sizing: border-box;
}

/* =========================================================
   GALLERY VIEWER / MODAL
   ========================================================= */

#ncfab-gallery-viewer {
  position: fixed;

  /*
       50px from every edge of the screen.
    */
  top: 50px;
  right: 50px;
  bottom: 50px;
  left: 50px;

  width: auto;
  height: auto;

  display: none;

  align-items: center;
  justify-content: center;

  padding: 30px;

  box-sizing: border-box;

  background: rgba(0, 0, 0, 0.94);

  border-radius: 12px;

  z-index: 99999;

  overflow: hidden;
}

/*
   JavaScript adds this class when the viewer opens.
*/

#ncfab-gallery-viewer.ncfab-gallery-viewer-active {
  display: flex;
}

/* =========================================================
   MODAL IMAGE

   IMPORTANT:
   max-width / max-height prevent large photographs
   from overflowing the modal.
   ========================================================= */

#ncfab-gallery-viewer-image {
  display: block;

  width: auto;
  height: auto;

  max-width: 100%;
  max-height: 100%;

  object-fit: contain;

  margin: 0 auto;

  border-radius: 8px;

  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.65);

  user-select: none;
}

/* =========================================================
   MODAL CLOSE BUTTON
   ========================================================= */

.ncfab-gallery-viewer-close {
  position: absolute;

  top: 12px;
  right: 16px;

  z-index: 100002;

  width: 44px;
  height: 44px;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 0;

  border: 0;

  background: rgba(0, 0, 0, 0.65);

  color: #fff;

  border-radius: 50%;

  font-family: Arial, sans-serif;

  font-size: 32px;

  line-height: 1;

  cursor: pointer;

  pointer-events: auto;

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.ncfab-gallery-viewer-close:hover {
  background: rgba(0, 0, 0, 0.95);

  transform: scale(1.08);
}

.ncfab-gallery-viewer-close:focus-visible {
  outline: 3px solid #fff;

  outline-offset: 2px;
}

/* =========================================================
   MODAL PREVIOUS / NEXT
   ========================================================= */

.ncfab-gallery-viewer-prev,
.ncfab-gallery-viewer-next {
  position: absolute;

  top: 50%;

  z-index: 100001;

  width: 52px;
  height: 52px;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 0;

  border: 0;

  border-radius: 50%;

  background: rgba(0, 0, 0, 0.65);

  color: #fff;

  font-family: Arial, sans-serif;

  font-size: 28px;

  line-height: 1;

  cursor: pointer;

  transform: translateY(-50%);

  pointer-events: auto;

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.ncfab-gallery-viewer-prev {
  left: 15px;
}

.ncfab-gallery-viewer-next {
  right: 15px;
}

.ncfab-gallery-viewer-prev:hover,
.ncfab-gallery-viewer-next:hover {
  background: rgba(0, 0, 0, 0.95);

  transform: translateY(-50%) scale(1.08);
}

/* =========================================================
   MODAL TITLE
   ========================================================= */

#ncfab-gallery-viewer-title {
  position: absolute;

  left: 50%;
  bottom: 12px;

  transform: translateX(-50%);

  z-index: 100001;

  max-width: calc(100% - 160px);

  padding: 8px 18px;

  box-sizing: border-box;

  border-radius: 6px;

  background: rgba(0, 0, 0, 0.7);

  color: #fff;

  font-family: "Montserrat", sans-serif;

  font-size: 0.95rem;

  font-weight: 600;

  text-align: center;

  pointer-events: none;
}

/* =========================================================
   PREVENT PAGE SCROLL WHILE MODAL IS OPEN
   ========================================================= */

body.ncfab-gallery-open {
  overflow: hidden;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 900px) {
  .ncfab-gallery-carousel {
    height: 360px;
  }

  .ncfab-gallery-item {
    width: 360px;
    height: 250px;
  }

  .ncfab-gallery-item.ncfab-gallery-left {
    transform: translate(-50%, -50%) translateX(-270px) translateZ(-100px)
      rotateY(15deg) scale(0.72);
  }

  .ncfab-gallery-item.ncfab-gallery-right {
    transform: translate(-50%, -50%) translateX(270px) translateZ(-100px)
      rotateY(-15deg) scale(0.72);
  }

  #ncfab-gallery-viewer {
    top: 50px;
    right: 50px;
    bottom: 50px;
    left: 50px;

    padding: 20px;
  }
}

@media (max-width: 600px) {
  .ncfab-gallery-section {
    padding-left: 10px;
    padding-right: 10px;
  }

  .ncfab-gallery-carousel {
    height: 300px;
  }

  .ncfab-gallery-item {
    width: 280px;
    height: 195px;
  }

  .ncfab-gallery-item.ncfab-gallery-left {
    transform: translate(-50%, -50%) translateX(-190px) translateZ(-80px)
      rotateY(12deg) scale(0.65);
  }

  .ncfab-gallery-item.ncfab-gallery-right {
    transform: translate(-50%, -50%) translateX(190px) translateZ(-80px)
      rotateY(-12deg) scale(0.65);
  }

  .ncfab-gallery-nav {
    width: 46px;
    height: 46px;

    font-size: 24px;
  }

  .ncfab-gallery-prev {
    left: 5px;
  }

  .ncfab-gallery-next {
    right: 5px;
  }

  #ncfab-gallery-viewer {
    top: 50px;
    right: 50px;
    bottom: 50px;
    left: 50px;

    padding: 15px;
  }

  .ncfab-gallery-viewer-close {
    top: 8px;
    right: 8px;

    width: 40px;
    height: 40px;

    font-size: 28px;
  }

  .ncfab-gallery-viewer-prev,
  .ncfab-gallery-viewer-next {
    width: 44px;
    height: 44px;

    font-size: 24px;
  }

  .ncfab-gallery-viewer-prev {
    left: 8px;
  }

  .ncfab-gallery-viewer-next {
    right: 8px;
  }

  #ncfab-gallery-viewer-title {
    bottom: 8px;

    max-width: calc(100% - 120px);

    font-size: 0.85rem;
  }
}
