/*
Theme Name: KJP Engineering Ltd
Theme URI: https://kjpengineeringltd.com
Author: KJP Engineering Ltd
Description: Modern mobile-first WordPress theme for KJP Engineering Ltd - Commercial & Domestic Electrical Services in Harrow & UK.
Version: 1.0.0
Text Domain: kjp-engineering
*/

/* ==========================================================================
   1. CSS VARIABLES & BASE RESET (Mobile First)
   ========================================================================== */
:root {
  --color-primary: #0f172a;
  /* Deep Slate / Navy */
  --color-secondary: #f59e0b;
  /* Electrical Gold / Amber */
  --color-accent: #dc2626;
  /* Urgent Emergency Red */
  --color-dark: #1e293b;
  --color-light: #f8fafc;
  --color-white: #ffffff;
  --color-text: #334155;
  --color-muted: #64748b;
  --color-border: #e2e8f0;

  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-light);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================================================
   2. SCROLL ANIMATION & PRELOADER
   ========================================================================== */
.js-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  will-change: opacity, transform;
}

.js-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.js-reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.js-reveal-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

#site-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--color-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#site-loader.loaded {
  opacity: 0;
  visibility: hidden;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--color-secondary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   3. TOP HEADER BAR & CONTACT SVG ICONS
   ========================================================================== */
.top-header-bar {
  background-color: #0f172a;
  color: #ffffff;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid #1e293b;
}

.top-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.top-header-social {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.top-header-social a {
  color: #cbd5e1;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

.top-header-social a:hover {
  color: var(--color-secondary);
}

.top-header-contact {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  width: auto;
}

.contact-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: color 0.2s ease;
  font-size: 0.95rem;
}

.contact-email {
  color: #cbd5e1;
}

.contact-email:hover {
  color: #ffffff;
}

.contact-phone {
  color: #f59e0b;
  font-weight: 700;
  font-size: 1rem;
}

.contact-phone span {
  color: inherit;
}

.contact-phone:hover {
  color: #d97706;
}

/* SVG Icon Controls */
.contact-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  transition: transform 0.2s ease, fill 0.2s ease;
}

.email-icon {
  width: 18px;
  height: 18px;
  fill: #cbd5e1;
}

.contact-email:hover .email-icon {
  fill: #ffffff;
  transform: scale(1.1);
}

.phone-icon {
  width: 18px;
  height: 18px;
  fill: #f59e0b;
}

.contact-phone:hover .phone-icon {
  fill: #d97706;
  transform: scale(1.1);
}

/* Mobile Adjustments for Top Header Bar */
@media (max-width: 767px) {
  .contact-email {
    display: none !important;
  }

  .top-header-social {
    display: none !important;
  }

  .top-header-contact {
    width: 100%;
    justify-content: center;
    align-items: center;
  }

  .contact-link {
    width: 100%;
    justify-content: center;
    font-size: 0.9rem;
  }

  .contact-phone {
    width: 100%;
    justify-content: center;
    font-size: 1.3rem;
  }

  .email-icon,
  .phone-icon {
    width: 28px;
    height: 28px;
  }
}

/* ==========================================================================
   4. BASE LAYOUT COMPONENTS & BUTTONS
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  background: var(--color-primary);
  color: var(--color-white);
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  border: none;
  font-size: 0.95rem;
}

.btn-primary {
  background-color: var(--color-secondary);
  color: var(--color-primary);
}

.btn-primary:hover {
  background-color: #d97706;
}

.btn-emergency {
  background-color: var(--color-accent);
  color: var(--color-white);
  animation: pulse 2s infinite;
}

.btn-emergency:hover {
  background-color: #b91c1c;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
  }
}

.grid-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.card {
  background: var(--color-white);
  border-radius: 0.5rem;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 0.25rem;
  text-transform: uppercase;
}

.badge-commercial {
  background-color: #e0f2fe;
  color: #0369a1;
}

.badge-domestic {
  background-color: #fef3c7;
  color: #b45309;
}

/* ==========================================================================
   5. NAVIGATION SYSTEM (Desktop Dropdowns & Mobile Accordion)
   ========================================================================== */
.nav-menu-desktop,
.nav-menu-desktop ul,
.nav-menu-mobile,
.nav-menu-mobile ul {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

#menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 1.75rem;
  cursor: pointer;
}

/* --- Desktop Navigation (768px and wider) --- */
@media (min-width: 768px) {
  .nav-menu-desktop {
    display: flex !important;
    align-items: center;
    gap: 1.5rem;
  }

  .nav-menu-desktop li {
    position: relative;
    white-space: nowrap;
  }

  .nav-menu-desktop a {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.5rem 0;
    display: block;
  }

  .nav-menu-desktop a:hover {
    color: var(--color-secondary);
  }

  /* Right-Aligned Dropdown to Stay Inside Screen */
  .nav-menu-desktop .sub-menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    background-color: var(--color-primary);
    min-width: 270px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--color-dark);
    border-radius: 0.375rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.25s ease;
    z-index: 999;
    padding: 0.5rem 0 !important;
  }

  .nav-menu-desktop li:hover>.sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-menu-desktop .sub-menu li {
    width: 100%;
  }

  .nav-menu-desktop .sub-menu a {
    padding: 0.65rem 1.25rem;
    color: #cbd5e1;
    font-weight: 500;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: normal;
  }

  .nav-menu-desktop .sub-menu a:hover {
    background-color: var(--color-dark);
    color: var(--color-secondary);
    padding-left: 1.5rem;
  }

  #mobile-menu {
    display: none !important;
  }
}

/* --- Mobile Navigation (Up to 767px) --- */
@media (max-width: 767px) {
  .nav-menu-desktop {
    display: none !important;
  }

  #menu-toggle {
    display: block !important;
  }

  #mobile-menu {
    display: none;
    background-color: var(--color-dark);
    padding: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-menu-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .nav-menu-mobile a {
    color: #ffffff;
    font-weight: 600;
    font-size: 1rem;
    display: inline-block;
    padding: 0.35rem 0;
  }

  .mobile-parent-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .submenu-toggle-btn {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--color-secondary);
    color: var(--color-secondary);
    width: 36px;
    height: 36px;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
  }

  .submenu-toggle-btn:hover {
    background: var(--color-secondary);
    color: var(--color-primary);
  }

  /* Collapsed Mobile Sub-menu */
  .nav-menu-mobile .sub-menu {
    display: none;
    padding-left: 1rem !important;
    margin-top: 0.5rem !important;
    border-left: 2px solid var(--color-secondary);
  }

  /* Expanded Mobile Sub-menu */
  .nav-menu-mobile .menu-item-has-children.sub-open>.sub-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .nav-menu-mobile .sub-menu a {
    font-size: 0.9rem;
    color: #cbd5e1;
    font-weight: 400;
  }
}

/* ==========================================================================
   6. RESPONSIVE BREAKPOINTS (Medium Screens - 768px+)
   ========================================================================== */
@media (min-width: 768px) {
  .container {
    max-width: 720px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .grid-layout {
    grid-template-columns: repeat(2, 1fr);
  }

  .contact-email {
    display: inline-flex !important;
  }
}

/* ==========================================================================
   7. RESPONSIVE BREAKPOINTS (Large Screens - 1024px+)
   ========================================================================== */
@media (min-width: 1024px) {
  .container {
    max-width: 1140px;
  }

  .grid-layout {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-layout.grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: 1240px;
  }
}

/* ==========================================================================
   FLOATING WHATSAPP CALLER WITH BUBBLING ANIMATION
   ========================================================================== */
.whatsapp-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background-color: #25d366;
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  transition: transform 0.3s ease, background-color 0.3s ease;
  animation: whatsapp-pulse 2s infinite ease-in-out;
}

/* Scalable Vector Icon Styling */
.whatsapp-icon {
  width: 34px;
  height: 34px;
  fill: #ffffff;
}

/* Hover effect */
.whatsapp-float:hover {
  background-color: #20ba5a;
  transform: scale(1.12);
  animation-play-state: paused;
  /* Pause pulsation on hover */
}

/* Bubbling & Radar Ripple Keyframe Animation */
@keyframes whatsapp-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7), 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  50% {
    transform: scale(1.08);
    /* Zoom-in bubble stretch */
    box-shadow: 0 0 0 15px rgba(37, 211, 102, 0), 0 8px 20px rgba(0, 0, 0, 0.4);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0), 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

/* Mobile responsive positioning */
@media (max-width: 767px) {
  .whatsapp-float {
    bottom: 18px;
    right: 18px;
    width: 52px;
    height: 52px;
  }

  .whatsapp-icon {
    width: 28px;
    height: 28px;
  }
}