/* ==========================================================================
   JB AUTOMOTIVE & SERVICE - Main Stylesheet
   Modern, Ultra-Fast, Responsive Auto Repair Website with 60fps Animations
   Fully Optimized for All Mobile Devices, Tablets & Desktops
   ========================================================================== */

:root {
  --primary: #070709;
  --primary-light: #121318;
  --accent-yellow: #FED100;
  --accent-yellow-hover: #E5BD00;
  --accent-red: #E51924;
  --accent-red-hover: #C4121C;
  --accent-blue: #0284c7;
  --text-dark: #f8fafc;
  --text-muted: #9ca3af;
  --bg-light: #070709;
  --bg-white: #121318;
  --card-border: #26272e;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.35);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.45), 0 2px 4px -2px rgb(0 0 0 / 0.35);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.45);
  --radius-lg: 12px;
  --radius-xl: 18px;
  --transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Custom Reset & Base with Authentic Shop Typography */
html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-dark);
  background-color: var(--bg-light);
  -webkit-text-size-adjust: 100%;
}

/* Authentic Signboard Typography */
.font-automotive {
  font-family: 'Kanit', 'Barlow Condensed', 'Impact', sans-serif;
  font-style: italic;
  font-weight: 900;
}

.font-script {
  font-family: 'Caveat', cursive, sans-serif;
  font-weight: 700;
}

.font-condensed {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
}

*, *::before, *::after {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
  position: relative;
  width: 100%;
}

/* Form inputs on mobile: 16px minimum to prevent iOS Safari auto-zoom */
@media screen and (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* ==========================================================================
   Header Glass & Scroll Effect
   ========================================================================== */
.site-header {
  transition: padding 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
  background: rgba(7, 7, 9, 0.98) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.8);
  border-bottom-color: rgba(254, 209, 0, 0.25);
}

.site-header.scrolled .nav-inner {
  height: 4.25rem !important;
}

/* ==========================================================================
   Modern Keyframe Animations
   ========================================================================== */

/* 1. Subtle Floating Effect for Hero Badge */
@keyframes floatAnimation {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}

.animate-float {
  animation: floatAnimation 4s ease-in-out infinite;
}

.animate-float-delayed {
  animation: floatAnimation 4.5s ease-in-out 1.5s infinite;
}

/* 2. Pulsing Glow for Shop Features */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(254, 209, 0, 0.25), 0 0 30px rgba(254, 209, 0, 0.1);
  }
  50% {
    box-shadow: 0 0 25px rgba(254, 209, 0, 0.5), 0 0 50px rgba(254, 209, 0, 0.2);
  }
}

.animate-glow {
  animation: pulseGlow 3s infinite ease-in-out;
}

/* 3. Luxury Shimmer / Light Beam passing through CTA buttons */
.btn-shimmer {
  position: relative;
  overflow: hidden;
}

.btn-shimmer::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    60deg,
    transparent 30%,
    rgba(255, 255, 255, 0.45) 50%,
    transparent 70%
  );
  transform: rotate(30deg);
  animation: shineSweep 5s infinite ease-in-out;
  pointer-events: none;
}

@keyframes shineSweep {
  0% {
    transform: translateX(-150%) rotate(30deg);
  }
  20%, 100% {
    transform: translateX(150%) rotate(30deg);
  }
}

/* 4. Ambient Hero Background Glow Animation */
@keyframes heroOrbMotion {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0.2;
  }
  50% {
    transform: translate(25px, -35px) scale(1.15);
    opacity: 0.35;
  }
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.2;
  }
}

.hero-glow-orb-1 {
  animation: heroOrbMotion 12s ease-in-out infinite alternate;
}

.hero-glow-orb-2 {
  animation: heroOrbMotion 15s ease-in-out 3s infinite alternate-reverse;
}

/* 5. Slow Rotation for subtle automotive gear element */
@keyframes spinSlow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-spin-slow {
  animation: spinSlow 24s linear infinite;
}

/* ==========================================================================
   Scroll Reveal Animations (Intersection Observer)
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.reveal-left {
  transform: translateX(-30px);
}

.reveal.reveal-right {
  transform: translateX(30px);
}

.reveal.reveal-scale {
  transform: scale(0.94);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}

/* Delay modifiers */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }

/* ==========================================================================
   Service Filter Horizontal Chip Scroll on Mobile
   ========================================================================== */
.mobile-chip-scroll {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.25rem;
}

.mobile-chip-scroll::-webkit-scrollbar {
  display: none;
}

/* ==========================================================================
   Service Cards & Hover Micro-Interactions
   ========================================================================== */
.service-card {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.35s ease;
  border: 1px solid var(--card-border);
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-yellow), var(--accent-red));
  opacity: 0;
  transition: opacity 0.3s ease;
}

@media (hover: hover) {
  .service-card:hover {
    transform: translateY(-8px);
    border-color: rgba(254, 209, 0, 0.6);
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.7), 0 0 18px rgba(254, 209, 0, 0.14);
  }

  .service-card:hover::before {
    opacity: 1;
  }

  .service-card:hover .service-icon {
    background-color: var(--accent-yellow);
    color: #0f172a;
    transform: scale(1.15) rotate(4deg);
  }
}

.service-card .service-icon {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease, color 0.3s ease;
}

.service-card-item {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* ==========================================================================
   Gallery Card Hover Zoom & Reveal
   ========================================================================== */
.gallery-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}

@media (hover: hover) {
  .gallery-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.25);
  }

  .gallery-card:hover img {
    transform: scale(1.08);
  }

  .gallery-card:hover .gallery-overlay {
    opacity: 1;
  }

  .gallery-card:hover .gallery-overlay .gallery-text {
    transform: translateY(0);
  }
}

.gallery-card img {
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11, 19, 43, 0.92) 0%, rgba(11, 19, 43, 0.4) 60%, transparent 100%);
  opacity: 0.9;
  transition: opacity 0.35s ease;
  display: flex;
  align-items: flex-end;
  padding: 1.25rem;
}

@media (min-width: 768px) {
  .gallery-overlay {
    opacity: 0;
  }
}

.gallery-overlay .gallery-text {
  transform: translateY(0);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 768px) {
  .gallery-overlay .gallery-text {
    transform: translateY(12px);
  }
}

/* ==========================================================================
   Lightbox & Booking Modals (Touch-Friendly)
   ========================================================================== */
#imageModal, #bookingModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(5, 5, 7, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  padding: 1rem;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#imageModal.active, #bookingModal.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

#imageModal .modal-container, #bookingModal .modal-container {
  transform: scale(0.92) translateY(15px);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 100%;
}

#imageModal.active .modal-container, #bookingModal.active .modal-container {
  transform: scale(1) translateY(0);
}

/* ==========================================================================
   Back-To-Top Button (Mobile Safe Positioning)
   ========================================================================== */
#backToTopBtn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 45;
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background: #FED100;
  color: #0A0A0A;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px) scale(0.85);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.3s ease, background-color 0.2s ease;
}

#backToTopBtn.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

@media (max-width: 768px) {
  #backToTopBtn {
    bottom: 5.75rem; /* Sits cleanly above sticky bottom bar */
    right: 1rem;
    width: 2.75rem;
    height: 2.75rem;
  }
}

/* ==========================================================================
   Sticky Mobile Bottom Bar (iOS Safe Area Enabled)
   ========================================================================== */
.mobile-call-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(7, 7, 9, 0.98);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 2px solid var(--accent-yellow);
  padding: 0.75rem 1rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.4);
}

@media (min-width: 768px) {
  .mobile-call-bar {
    display: none;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #070709;
}
::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #FED100;
}

/* Accessibility: Respect Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal,
  .hero-stagger {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ==========================================================================
   Premium Dark-Mode Automotive Animations
   ========================================================================== */

/* Top Scroll Progress Indicator */
#scrollProgressBar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 60;
  background: linear-gradient(90deg, #FED100 0%, #f59e0b 50%, #E51924 100%);
  box-shadow: 0 0 12px rgba(254, 209, 0, 0.7);
  transform-origin: left center;
  transform: scaleX(0);
  pointer-events: none;
  will-change: transform;
}

/* Hero Staggered Entrance */
@keyframes heroFadeUp {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-stagger {
  opacity: 0;
  animation: heroFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--stagger, 0) * 90ms);
}

/* Hero Mouse-Follow Showroom Spotlight */
.hero-spotlight {
  background: radial-gradient(
    600px circle at var(--hero-x, 50%) var(--hero-y, 40%),
    rgba(254, 209, 0, 0.09),
    rgba(229, 25, 36, 0.04) 40%,
    transparent 70%
  );
  transition: opacity 0.35s ease;
}

/* Interactive 3D Tilt Container for Hero Image */
#heroMediaCard {
  transform-style: preserve-3d;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

/* Dark-Mode Card Cursor Spotlight Effect */
.spotlight-card {
  position: relative;
  overflow: hidden;
}

.spotlight-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    360px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(254, 209, 0, 0.12),
    transparent 65%
  );
  transition: opacity 0.3s ease;
}

@media (hover: hover) {
  .spotlight-card:hover::after {
    opacity: 1;
  }
}

/* Animated Marquee Specialty Ticker */
@keyframes marqueeScroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.marquee-wrapper {
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marqueeScroll 32s linear infinite;
  will-change: transform;
}

.marquee-wrapper:hover .marquee-track {
  animation-play-state: paused;
}

/* Subtle Animated Accent Line Between Sections */
@keyframes beamSlide {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

.section-beam {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(254, 209, 0, 0.55), rgba(229, 25, 36, 0.55), transparent);
  background-size: 200% 100%;
  animation: beamSlide 6s linear infinite;
}

/* Smooth FAQ Accordion Reveal */
@keyframes faqSlideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.faq-content:not(.hidden) {
  animation: faqSlideDown 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
