/**
 * RivCut Home Page Image Engagement Suite Styles
 * Premium, modular, zero-dependency visual system.
 */

/* ==========================================================================
   1. CAD-to-Part Before-and-After Slider
   ========================================================================== */
.cad-part-slider {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 12px;
  background: #0b1f3b;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 10px 30px rgba(11, 31, 59, 0.15);
}

.slider-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.slider-layer img {
  position: absolute;
  top: 0;
  width: 200%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.layer-back img {
  left: -100%;
}

.layer-fore {
  z-index: 2;
  /* Default initial clip is 50% */
  clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
  -webkit-clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
  transition: clip-path 0.05s ease-out, -webkit-clip-path 0.05s ease-out;
}

.layer-fore img {
  left: 0;
  object-position: left center;
}

/* Slider Handle Bar */
.slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: #0E4FB3;
  cursor: ew-resize;
  z-index: 10;
  transform: translateX(-50%);
  box-shadow: 0 0 12px rgba(14, 79, 179, 0.8), 0 0 20px rgba(0, 0, 0, 0.4);
  transition: left 0.05s ease-out;
}

/* Slider Circle Button */
.slider-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  background: #0E4FB3;
  border: 3px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(11, 31, 59, 0.35);
  cursor: ew-resize;
  pointer-events: none;
}

.slider-button::before,
.slider-button::after {
  content: "";
  display: block;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  padding: 3px;
}

.slider-button::before {
  transform: rotate(135deg);
  margin-right: -2px;
}

.slider-button::after {
  transform: rotate(-45deg);
  margin-left: -2px;
}

/* Label Overlays */
.slider-label-tag {
  position: absolute;
  bottom: 14px;
  padding: 6px 12px;
  background: rgba(11, 31, 59, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 6px;
  z-index: 5;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.label-cad {
  left: 14px;
}

.label-part {
  right: 14px;
}


/* ==========================================================================
   2. Toolmaker's Loupe (Hover Magnifier)
   ========================================================================== */
.home-proof-item {
  position: relative;
  cursor: zoom-in;
  overflow: hidden;
}

.toolmaker-loupe {
  position: absolute;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 4px solid #C8CDD4;
  box-shadow: 
    0 12px 36px rgba(11, 31, 59, 0.4), 
    inset 0 4px 12px rgba(255, 255, 255, 0.5),
    inset 0 -4px 12px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.6);
  transform-origin: center center;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 20;
  background-repeat: no-repeat;
  background-size: cover;
  display: block;
}

/* Metallic Bevel overlay reflections */
.toolmaker-loupe::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.1) 100%);
  pointer-events: none;
}

.home-proof-item:hover .toolmaker-loupe {
  opacity: 1;
  transform: scale(1);
}


/* ==========================================================================
   3. Glowing CMM Inspection Hotspots
   ========================================================================== */
.hotspot-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.inspection-hotspot {
  position: absolute;
  width: 24px;
  height: 24px;
  cursor: pointer;
  z-index: 15;
  transform: translate(-50%, -50%);
}

/* Pulsating Core */
.hotspot-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 10px #10B981;
}

/* Pulsating Concentric Rings */
.hotspot-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 2px solid #10B981;
  border-radius: 50%;
  opacity: 0;
  animation: hotspot-pulse 2.2s cubic-bezier(0.25, 0, 0, 1) infinite;
  box-sizing: border-box;
}

.hotspot-ring-delay {
  animation-delay: 1.1s;
}

@keyframes hotspot-pulse {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

/* Hotspot Tooltip Specs */
.hotspot-tooltip {
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  width: 220px;
  padding: 10px 14px;
  background: rgba(11, 31, 59, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #ffffff;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  z-index: 30;
}

.hotspot-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(11, 31, 59, 0.95);
}

.inspection-hotspot.active .hotspot-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

.hotspot-tooltip strong {
  display: block;
  color: #10B981;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}


/* ==========================================================================
   4. High-Fidelity Technical Spec Lightbox
   ========================================================================== */
.rivcut-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 20, 38, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
  padding: 24px;
}

.rivcut-lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-container {
  position: relative;
  width: 100%;
  max-width: 1080px;
  background: rgba(15, 32, 67, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2510;
}

.rivcut-lightbox-overlay.active .lightbox-container {
  transform: scale(1);
}

/* Close Button */
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
  z-index: 2530;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg);
}

/* Split Pane Layout */
.lightbox-split {
  display: flex;
  flex-direction: row;
  min-height: 520px;
  max-height: 85vh;
}

/* Left side: Visual zoom pane */
.lightbox-visual-pane {
  flex: 1.2;
  background: #061224;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 350px;
}

.lightbox-zoom-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: zoom-in;
}

.lightbox-zoom-container img {
  max-width: 90%;
  max-height: 80%;
  object-fit: contain;
  transition: transform 0.1s ease-out;
  transform-origin: center center;
  user-select: none;
  pointer-events: auto;
}

.lightbox-zoom-container.panning {
  cursor: grab;
}

.lightbox-zoom-container.panning img {
  transition: none;
}

.lightbox-zoom-tip {
  position: absolute;
  bottom: 16px;
  background: rgba(11, 31, 59, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: rgba(255, 255, 255, 0.7);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  padding: 6px 14px;
  border-radius: 20px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Right side: Engineering Spec Card */
.lightbox-spec-pane {
  flex: 0.9;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #ffffff;
  overflow-y: auto;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(15, 32, 67, 0.4) 0%, rgba(7, 20, 38, 0.5) 100%);
}

.lightbox-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 10px;
  background: rgba(14, 79, 179, 0.2);
  border: 1px solid rgba(14, 79, 179, 0.5);
  color: #3B82F6;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 4px;
  margin-bottom: 16px;
}

.lightbox-spec-pane h3 {
  font-family: 'Barlow', sans-serif;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 10px 0;
  color: #ffffff;
}

.lightbox-spec-pane p {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.78);
  margin: 0 0 24px 0;
}

/* Specification Grid Table */
.lightbox-spec-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
}

.lightbox-spec-table td {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
}

.lightbox-spec-table tr:last-child td {
  border-bottom: none;
}

.lightbox-spec-table td strong {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}

.lightbox-spec-table td:last-child {
  text-align: right;
  font-weight: 600;
  color: #ffffff;
}

/* spec highlights */
.spec-highlight-green {
  color: #10B981 !important;
}

/* CTA */
.lightbox-cta {
  align-self: stretch;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 14px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  background: #0E4FB3;
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(14, 79, 179, 0.3);
  transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.lightbox-cta:hover {
  background: #125bc4;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(14, 79, 179, 0.4);
}


/* ==========================================================================
   5. 3D Hover Parallax Tilt
   ========================================================================== */
.tilt-card {
  transition: transform 0.15s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.15s ease;
  transform-style: preserve-3d;
  will-change: transform;
}

.tilt-inner {
  transform: translateZ(20px);
}


/* ==========================================================================
   6. Touch-Device Fallbacks & Responsiveness
   ========================================================================== */

/* Tablet & Mobile Breakpoints */
@media (max-width: 900px) {
  .rivcut-lightbox-overlay {
    padding: 12px;
  }

  .lightbox-container {
    max-height: 94vh;
  }

  .lightbox-split {
    flex-direction: column;
    min-height: auto;
    max-height: 94vh;
  }

  .lightbox-visual-pane {
    flex: none;
    height: 280px;
  }

  .lightbox-spec-pane {
    flex: 1;
    padding: 24px;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .lightbox-spec-pane h3 {
    font-size: 20px;
  }

  .lightbox-spec-table td {
    padding: 8px 0;
    font-size: 12px;
  }

  /* Disable hover magnification entirely on touch screens and smaller devices */
  .toolmaker-loupe {
    display: none !important;
  }

  .home-proof-item {
    cursor: pointer;
  }

  /* Slider enhancements for touch compatibility */
  .slider-button {
    width: 38px;
    height: 38px;
  }

  /* Disable dynamic parallax card tilt on tablet and mobile */
  .tilt-card {
    transform: none !important;
    transition: none !important;
  }
}

@media (max-width: 480px) {
  .lightbox-visual-pane {
    height: 200px;
  }

  .lightbox-spec-pane {
    padding: 20px;
  }

  .lightbox-close {
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  .slider-label-tag {
    font-size: 9px;
    padding: 4px 8px;
    bottom: 8px;
  }

  .label-cad {
    left: 8px;
  }

  .label-part {
    right: 8px;
  }
}
