/* ===========================
   ACE ELECTRICAL PROJECTS
   Ultra-Modern Design System
   =========================== */

/* --- Typography custom properties --- */
:root {
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  line-height: 1.65;
}

/* Display headings (Playfair Display) */
.font-display {
  font-family: 'Playfair Display', Georgia, serif;
}

h1, h2, h3 {
  line-height: 1.2;
}

/* Placeholder colour */
::placeholder {
  color: #9ca3af;
}

/* Breadcrumb hover */
nav[aria-label] a:hover,
.breadcrumb a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ============================
   ELECTRIC PULSE ANIMATIONS
   ============================ */

/* Pulse glow — used on CTAs, buttons, headings */
@keyframes electricPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(220, 38, 38, 0.3), 0 0 10px rgba(220, 38, 38, 0.1); }
  50% { box-shadow: 0 0 15px rgba(220, 38, 38, 0.5), 0 0 30px rgba(220, 38, 38, 0.2), 0 0 45px rgba(220, 38, 38, 0.1); }
}

@keyframes electricPulseSubtle {
  0%, 100% { text-shadow: 0 0 0px transparent; }
  50% { text-shadow: 0 0 8px rgba(220, 38, 38, 0.3), 0 0 20px rgba(220, 38, 38, 0.1); }
}

/* Spark line — horizontal travelling spark */
@keyframes sparkLine {
  0% { left: -20%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { left: 120%; opacity: 0; }
}

/* Flicker — subtle electrical flicker on text */
@keyframes flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.85; }
}

/* Section reveal from bottom */
@keyframes revealUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================
   ELECTRIC SPARK DIVIDERS
   ============================ */

.spark-divider {
  position: relative;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(220, 38, 38, 0.3), transparent);
  overflow: hidden;
}

.spark-divider::after {
  content: '';
  position: absolute;
  top: -1px;
  width: 40px;
  height: 4px;
  background: linear-gradient(90deg, transparent, #dc2626, #ff6b6b, #dc2626, transparent);
  border-radius: 2px;
  animation: sparkLine 3s ease-in-out infinite;
  box-shadow: 0 0 10px #dc2626, 0 0 20px rgba(220, 38, 38, 0.5);
}

/* ============================
   ELECTRIC GLOW BUTTONS
   ============================ */

.btn-electric {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-electric::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn-electric:hover::before {
  left: 100%;
}

.btn-electric:hover {
  box-shadow: 0 0 15px rgba(220, 38, 38, 0.4), 0 0 30px rgba(220, 38, 38, 0.2);
  transform: translateY(-1px);
}

/* ============================
   ELECTRIC HEADING ACCENTS
   ============================ */

.heading-electric {
  position: relative;
  display: inline-block;
}

.heading-electric::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #dc2626, #ef4444);
  margin: 0.75rem auto 0;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(220, 38, 38, 0.25);
  transition: width 0.4s var(--ease-spring), box-shadow 0.3s ease;
}

.heading-electric:hover::after {
  width: 100px;
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.4);
}

/* ============================
   SECTION TRANSITIONS
   ============================ */

/* Scroll animations */
[data-animate] {
  opacity: 0;
  transform: translateY(2rem);
  transition: opacity 0.6s var(--ease-spring), transform 0.6s var(--ease-spring);
}

[data-animate].animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Section border glow */
.section-glow {
  border-top: 1px solid rgba(220, 38, 38, 0.15);
  position: relative;
}

.section-glow::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #dc2626, transparent);
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.3);
}

/* ============================
   CARD EFFECTS
   ============================ */

.card-hover {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(220, 38, 38, 0.08);
}

/* Service card image overlay with electric border on hover */
.card-hover:hover img {
  filter: brightness(1.05);
}

.card-hover::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #dc2626, #ff6b6b);
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.4);
}

.card-hover:hover::after {
  width: 100%;
}

/* ============================
   GALLERY
   ============================ */

/* Gallery masonry grid */
.gallery-grid {
  column-count: 2;
  column-gap: 0.75rem;
}

@media (min-width: 640px) {
  .gallery-grid {
    column-count: 3;
    column-gap: 1rem;
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    column-count: 3;
  }
}

/* Side-by-side gallery columns */
.grid > div > .gallery-grid {
  column-count: 2;
}

@media (min-width: 640px) {
  .grid > div > .gallery-grid {
    column-count: 2;
  }
}

@media (min-width: 1280px) {
  .grid > div > .gallery-grid {
    column-count: 3;
  }
}

.gallery-grid .gallery-item {
  break-inside: avoid;
  margin-bottom: 0.75rem;
  opacity: 0;
  transform: translateY(30px) scale(0.97);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out, box-shadow 0.3s ease;
  border-radius: 0.375rem;
  overflow: hidden;
}

.gallery-grid .gallery-item.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (min-width: 640px) {
  .gallery-grid .gallery-item {
    margin-bottom: 1rem;
  }
}

/* Gallery hover — electric glow border */
.gallery-grid .gallery-item img {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
}

.gallery-grid .gallery-item:hover img {
  transform: scale(1.06);
  filter: brightness(1.1) contrast(1.02);
}

.gallery-grid .gallery-item:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15), 0 0 0 2px rgba(220, 38, 38, 0.3);
  z-index: 1;
}

/* ============================
   LIGHTBOX
   ============================ */

.lightbox {
  opacity: 0;
  transition: opacity 0.4s ease;
  backdrop-filter: blur(8px);
}

.lightbox.active {
  opacity: 1;
}

.lightbox img {
  transform: scale(0.85);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.lightbox.active img {
  transform: scale(1);
  opacity: 1;
}

.lightbox img.slide-left {
  animation: slideLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.lightbox img.slide-right {
  animation: slideRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideLeft {
  0% { transform: translateX(60px) scale(0.95); opacity: 0; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes slideRight {
  0% { transform: translateX(-60px) scale(0.95); opacity: 0; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}

/* ============================
   NAVIGATION
   ============================ */

/* Mobile nav */
.mobile-nav {
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav.open {
  transform: translateX(0);
}

/* Nav link hover underline effect */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: #dc2626;
  transition: width 0.3s ease;
  box-shadow: 0 0 4px rgba(220, 38, 38, 0.3);
}

.nav-link:hover::after {
  width: 100%;
}

/* Hero slider */
#hero-slider {
  position: relative;
}

/* ============================
   BACK TO TOP — ELECTRIC PULSE
   ============================ */

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 30;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #dc2626;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease, box-shadow 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  animation: electricPulse 2s ease-in-out infinite;
}

.back-to-top:hover {
  background: #b91c1c;
  box-shadow: 0 0 20px rgba(220, 38, 38, 0.6), 0 0 40px rgba(220, 38, 38, 0.3);
}

/* ============================
   CLIENT LOGOS
   ============================ */

.client-logos img {
  filter: grayscale(100%);
  opacity: 0.5;
  transition: filter 0.4s ease, opacity 0.4s ease, transform 0.3s ease;
}

.client-logos img:hover {
  filter: grayscale(0%);
  opacity: 1;
  transform: scale(1.05);
}

/* ============================
   WHY CHOOSE — NUMBER PULSE
   ============================ */

.number-pulse {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.number-pulse:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(220, 38, 38, 0.5), 0 0 40px rgba(220, 38, 38, 0.2);
}

/* ============================
   FORMS — ELECTRIC FOCUS
   ============================ */

input, textarea, select {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15), 0 0 15px rgba(220, 38, 38, 0.08);
}

.form-error {
  color: #dc2626;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: none;
}

.form-error.show {
  display: block;
  animation: revealUp 0.3s ease-out;
}

input.invalid,
textarea.invalid,
select.invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* ============================
   TESTIMONIAL CARDS
   ============================ */

.testimonial-card {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
  position: relative;
  overflow: hidden;
}

.testimonial-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, #dc2626, #ff6b6b);
  transition: height 0.4s ease;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.4);
}

.testimonial-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.testimonial-card:hover::before {
  height: 100%;
}

/* ============================
   FOCUS VISIBLE
   ============================ */

*:focus-visible {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.3), 0 0 15px rgba(220, 38, 38, 0.1);
}

/* ============================
   HERO OVERLAY — ELECTRIC GRID
   ============================ */

.hero-overlay {
  background:
    linear-gradient(rgba(0,0,0,0.45), rgba(0,0,0,0.45)),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 50px,
      rgba(220, 38, 38, 0.06) 50px,
      rgba(220, 38, 38, 0.06) 51px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 50px,
      rgba(220, 38, 38, 0.06) 50px,
      rgba(220, 38, 38, 0.06) 51px
    );
}

/* ============================
   FOOTER — SUBTLE GLOW
   ============================ */

footer a {
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

footer a:hover {
  text-shadow: 0 0 8px rgba(220, 38, 38, 0.3);
}

/* ============================
   REDUCED MOTION
   ============================ */

@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;
  }

  [data-animate] {
    opacity: 1;
    transform: none;
  }

  .gallery-grid .gallery-item {
    opacity: 1;
    transform: none;
  }

  .back-to-top {
    transition: none;
    animation: none;
  }

  .spark-divider::after {
    animation: none;
    display: none;
  }
}

/* ============================
   MOBILE STICKY CTA BAR
   ============================ */

.mobile-cta-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 35;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  padding: 0.75rem 1rem;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.3s var(--ease-spring);
}

.mobile-cta-bar.visible {
  transform: translateY(0);
}

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

/* Adjust back-to-top when mobile CTA bar is visible */
@media (max-width: 767px) {
  .back-to-top {
    bottom: 5rem;
  }
}

/* ============================
   PRINT STYLES
   ============================ */

@media print {
  nav, footer, .back-to-top, #hero-slider, .lightbox, .spark-divider {
    display: none !important;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  section {
    page-break-inside: avoid;
  }
}
