/* ============================================================
   Shared site styles — NW Granite & Marble
   Centralised here so updates apply everywhere at once.
   ============================================================ */

/* Font smoothing & image rendering */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Smooth scrolling */
html { scroll-behavior: smooth; }

/* Logo enhancements */
#menu-logo {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  transition: transform 0.2s ease, filter 0.2s ease;
}
#menu-logo:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

/* Touch tap highlight */
button, a, [role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ---- Mobile / responsive global fixes ---- */

/* Prevent any element from causing horizontal page overflow */
html, body { overflow-x: hidden; }

/* reCAPTCHA widget is 304px wide by default — scale it down on very narrow screens */
@media (max-width: 360px) {
  .g-recaptcha {
    transform: scale(0.82);
    transform-origin: left center;
  }
}

/* Keep iframes and embeds within their containers */
iframe { max-width: 100%; }

/* ---- Before/After comparison slider (project-detail.html) ---- */
.ba-slider {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  aspect-ratio: 16 / 10;
  max-height: 560px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}
.ba-slider img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.ba-slider .ba-after { position: absolute; inset: 0; }
.ba-slider .ba-before { position: absolute; inset: 0; overflow: hidden; width: 50%; }
.ba-slider .ba-before img { width: 200%; max-width: none; }
.ba-slider .ba-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  transform: translateX(-50%);
  pointer-events: none;
}
.ba-slider .ba-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  cursor: ew-resize;
}
.ba-slider .ba-handle svg { width: 16px; height: 16px; fill: #1f2937; }
.ba-slider .ba-tag {
  position: absolute;
  top: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(17, 24, 39, 0.6);
  padding: 5px 12px;
  border-radius: 99px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.ba-slider .ba-tag.ba-before-tag { left: 14px; }
.ba-slider .ba-tag.ba-after-tag { right: 14px; }
.ba-slider .ba-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #fff;
  background: rgba(17, 24, 39, 0.55);
  padding: 5px 12px;
  border-radius: 99px;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .ba-slider .ba-before, .ba-slider .ba-divider, .ba-slider .ba-handle {
    transition: none !important;
  }
}
