/* ==========================================================================
   BEST ENERGY SOLUTIONS LLC — custom styles (complements Tailwind utilities)
   ========================================================================== */

html {
  scroll-behavior: smooth;
}

/* Anchor-link offset so the sticky header never covers the section title --- */
main section[id],
footer[id] {
  scroll-margin-top: 96px;
}

body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

.font-display {
  font-family: "Plus Jakarta Sans", "Inter", ui-sans-serif, system-ui, sans-serif;
}

/* Scroll-reveal --------------------------------------------------------------
   Deliberately no CSS here. assets/js/animations.js (GSAP + ScrollTrigger)
   owns the entire hidden -> revealed animation via gsap.from(), applied at
   runtime as inline styles. That means .reveal elements render at their
   normal opacity/position by default — if the GSAP CDN ever fails to load,
   content simply displays with no animation instead of staying invisible. */

/* Sticky header shadow ------------------------------------------------------ */
#site-header {
  transition: background-color 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}
#site-header.is-scrolled {
  box-shadow: 0 4px 24px -8px rgba(16, 42, 67, 0.15);
}

/* Header row + logo: compact slightly once the page is scrolled. The actual
   scrubbed animation is GSAP/ScrollTrigger (assets/js/animations.js,
   navScrollAnimation) tied to scroll position, not a CSS transition — a
   competing CSS transition on the same `height` property GSAP is scrubbing
   every frame would fight it and produce laggy, rubber-banding motion. These
   discrete values stay only as a no-animation fallback (instant, not eased)
   for the rare case the GSAP CDN fails to load. */
#site-header.is-scrolled .header-row {
  height: 4rem; /* 64px, down from the resting 5rem/80px */
}
#site-header.is-scrolled .header-logo {
  height: 2rem; /* 32px on desktop/tablet while scrolled (was 2.25–2.5rem) */
}

/* Nav underline hover -------------------------------------------------------- */
.nav-link {
  position: relative;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background-color: #1595E7;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-link:hover::after {
  width: 100%;
}

/* Mobile menu: slide + fade open instead of an instant show/hide ------------- */
.mobile-menu {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.mobile-menu.open {
  max-height: 32rem;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
  .mobile-menu {
    transition: opacity 0.2s ease;
    transform: none;
  }
}

/* Sliding active-nav indicator (desktop) — position/width animated by GSAP
   (main.js's moveNavIndicator) rather than a CSS transition. -------------- */
.nav-indicator {
  position: absolute;
  bottom: -1px;
  height: 2px;
  background-color: #1595E7;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
}
.nav-indicator.is-visible {
  opacity: 1;
  transition: opacity 0.2s ease; /* opacity only; position/width are GSAP-driven */
}

/* Hero background ------------------------------------------------------------ */
.hero-bg {
  background-size: cover;
  background-position: center;
}

/* Manufacturer logo marquee ------------------------------------------------------- */
.logo-marquee {
  position: relative;
  overflow: hidden;
}

.logo-marquee__viewport {
  overflow: hidden;
}

.logo-marquee__fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 120px;
  z-index: 2;
  pointer-events: none;
}
.logo-marquee__fade--left {
  left: 0;
  background: linear-gradient(to right, #ffffff, transparent);
}
.logo-marquee__fade--right {
  right: 0;
  background: linear-gradient(to left, #ffffff, transparent);
}
@media (max-width: 640px) {
  .logo-marquee__fade { width: 48px; }
}

.logo-track {
  display: flex;
  width: max-content;
  will-change: transform;
  animation: logo-scroll 55s linear infinite;
}
/* Pure CSS animation (not GSAP) so the carousel scrolls on load and keeps
   scrolling even if the GSAP/Lenis CDN is slow, blocked, or fails outright —
   this carousel previously depended on a GSAP tween for its motion, so any
   third-party script hiccup left it fully stopped with zero fallback. The
   two .logo-track__group copies in the HTML are identical, so animating
   exactly -50% loops seamlessly with no jump. translate3d forces GPU
   compositing the same way GSAP's transform-based tweens did. */
@keyframes logo-scroll {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}
.logo-marquee:hover .logo-track,
.logo-marquee:focus-within .logo-track {
  animation-play-state: paused;
}
/* Deliberately NOT gated behind prefers-reduced-motion: this is a slow,
   continuous horizontal drift (not a flash/parallax/zoom), and the carousel
   is required to always auto-scroll. A reduced-motion override here made the
   logos render but never move — indistinguishable from "broken" for anyone
   with that OS accessibility setting on, with no visual explanation why. */

.logo-track__group {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.logo-item {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 90px;
  width: 170px;
  margin: 0 20px;
}
@media (max-width: 640px) {
  .logo-item {
    height: 70px;
    width: 120px;
    margin: 0 12px;
  }
}

/* Card hover lift — the actual animation is GSAP (assets/js/animations.js,
   hoverInteractions()), triggered via delegated mouseover/mouseout on
   .card-hover elements. This class now only needs to exist as a JS hook +
   the will-change hint GSAP's own tween adds while it runs. No CSS
   transition is defined here, since GSAP is doing the tweening itself —
   a parallel CSS transition on the same properties would fight it. */

/* Button micro-interactions — likewise GSAP-driven (hoverInteractions() /
   mousedown+mouseup listeners) rather than a CSS :hover/:active transition. */

/* Fade-in-on-load images (product cards, modal gallery, related products) --------
   No CSS animation here either — assets/js/animations.js's images(root)
   tweens opacity + a subtle zoom-out-to-rest (1.04 -> 1) via GSAP once each
   <img> finishes loading. Same fail-safe logic as .reveal: nothing in CSS
   ever hides these images, so a GSAP load failure just skips the animation. */

/* Focus visibility for accessibility --------------------------------------------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #1595E7;
  outline-offset: 2px;
}

/* Product detail modal ------------------------------------------------------------ */
#product-modal .modal-backdrop {
  opacity: 0;
  transition: opacity 0.25s ease;
}
#product-modal .modal-panel {
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#product-modal.is-open .modal-backdrop {
  opacity: 1;
}
#product-modal.is-open .modal-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}
/* Footer social icon (LinkedIn) — subtle lift on hover ---------------------------- */
.social-icon {
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.social-icon:hover,
.social-icon:focus-visible {
  transform: translateY(-2px) scale(1.06);
}

.thumb-btn {
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.thumb-btn:hover {
  transform: translateY(-2px);
}

/* Product / tab micro-interactions ------------------------------------------------ */
.tab-pill {
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.tab-pill:active {
  transform: scale(0.96);
}
.product-card:hover img {
  will-change: transform;
}

/* Power calculator: stepper + range slider ---------------------------------------- */
.stepper button:active {
  transform: scale(0.92);
}
.equip-card {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.equip-card.is-active {
  border-color: #1595E7;
  box-shadow: 0 0 0 3px rgba(21, 149, 231, 0.1);
}

.range-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, #1595E7 0%, #1595E7 var(--fill, 15%), #D9E2EC var(--fill, 15%), #D9E2EC 100%);
  outline: none;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #1595E7;
  box-shadow: 0 2px 6px rgba(16, 42, 67, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}
.range-slider::-moz-range-thumb {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #1595E7;
  box-shadow: 0 2px 6px rgba(16, 42, 67, 0.25);
  cursor: pointer;
}
.range-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #D9E2EC;
}

/* Number input: hide native spinners for the quantity steppers -------------------- */
input[data-qty]::-webkit-outer-spin-button,
input[data-qty]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[data-qty] {
  -moz-appearance: textfield;
}

/* Custom cursor --------------------------------------------------------------------
   Only ever shown when main.js confirms a fine-pointer, hover-capable,
   non-reduced-motion desktop and adds .custom-cursor-enabled to <body>. The
   media query below is a second, CSS-only line of defense so a coarse
   pointer or touch device never gets a stuck/invisible native cursor even
   if the JS check were somehow bypassed. */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  color: #1595E7;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transform: translate3d(-50%, -50%, 0);
  filter: drop-shadow(0 0 6px rgba(21, 149, 231, 0.75)) drop-shadow(0 0 14px rgba(21, 149, 231, 0.4));
  transition: opacity 0.2s ease, width 0.25s cubic-bezier(0.16, 1, 0.3, 1), height 0.25s cubic-bezier(0.16, 1, 0.3, 1), filter 0.25s ease;
  will-change: transform;
}
.custom-cursor.is-active {
  opacity: 1;
}
.custom-cursor.is-hovering {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 10px rgba(21, 149, 231, 0.95)) drop-shadow(0 0 20px rgba(21, 149, 231, 0.55));
}
body.custom-cursor-enabled,
body.custom-cursor-enabled a,
body.custom-cursor-enabled button,
body.custom-cursor-enabled input,
body.custom-cursor-enabled textarea,
body.custom-cursor-enabled [role="tab"],
body.custom-cursor-enabled label {
  cursor: none !important;
}
@media (hover: none), (pointer: coarse) {
  .custom-cursor {
    display: none !important;
  }
}

/* Skip link ---------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: #102A43;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 0.5rem 0;
}
.skip-link:focus {
  left: 0;
}
