/* ============================================
   Mister Sparky of Jacksonville NC
   Classic & Elegant Electrical Services Site
   ============================================ */

/* Base Reset & Typography */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden;
}

/* Selection Color */
::selection {
    background-color: #d97706;
    color: #270f14;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #faf5f7;
}

::-webkit-scrollbar-thumb {
    background: #dbadae;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a35360;
}

/* ============================================
   Scroll Reveal Animations
   Progressive enhancement - content visible
   even if JS fails (default state is visible).
   JS adds the .revealed class.
   ============================================ */
[data-reveal] {
    opacity: 1;
    transform: none;
    transition: opacity 0.7s ease, transform 0.7s ease;
}

@media (prefers-reduced-motion: no-preference) {
    [data-reveal] {
        opacity: 0;
        transform: translateY(30px);
    }

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

    /* Stagger delays for grid items */
    .service-card[data-reveal] {
        transition-delay: calc(var(--index, 0) * 0.1s);
    }

    [data-reveal]:nth-child(1) { transition-delay: 0s; }
    [data-reveal]:nth-child(2) { transition-delay: 0.1s; }
    [data-reveal]:nth-child(3) { transition-delay: 0.2s; }
    [data-reveal]:nth-child(4) { transition-delay: 0.3s; }
}

/* ============================================
   Scroll Indicator Animation
   ============================================ */
@keyframes scrollIndicator {
    0% {
        top: -16px;
        opacity: 1;
    }
    100% {
        top: 40px;
        opacity: 0;
    }
}

.animate-scroll-indicator {
    animation: scrollIndicator 1.5s ease-in-out infinite;
}

/* ============================================
   Navbar Transitions
   ============================================ */
#navbar {
    background: transparent;
}

#navbar.scrolled {
    background: rgba(250, 245, 247, 0.97);
    backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(114, 49, 60, 0.08);
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: #d97706;
    transition: width 0.3s ease;
}

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

/* ============================================
   Mobile Menu
   ============================================ */
.mobile-menu.open {
    opacity: 1;
    pointer-events: all;
}

.mobile-menu-link {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.mobile-menu.open .mobile-menu-link {
    opacity: 1;
    transform: translateY(0);
}

.mobile-menu.open .mobile-menu-link:nth-child(1) { transition-delay: 0.05s; }
.mobile-menu.open .mobile-menu-link:nth-child(2) { transition-delay: 0.1s; }
.mobile-menu.open .mobile-menu-link:nth-child(3) { transition-delay: 0.15s; }
.mobile-menu.open .mobile-menu-link:nth-child(4) { transition-delay: 0.2s; }
.mobile-menu.open .mobile-menu-link:nth-child(5) { transition-delay: 0.25s; }

/* Hamburger Animation */
#mobile-menu-btn.active .mobile-menu-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

#mobile-menu-btn.active .mobile-menu-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

#mobile-menu-btn.active .mobile-menu-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
    width: 24px;
}

/* ============================================
   Service Card Hover Effects
   ============================================ */
.service-card {
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 0;
    background: #d97706;
    transition: height 0.4s ease;
}

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

/* ============================================
   Form Styles
   ============================================ */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2372313c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

select:focus {
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

/* ============================================
   Focus Styles for Accessibility
   ============================================ */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #d97706;
    outline-offset: 2px;
}

/* ============================================
   Subtle Pattern Background
   ============================================ */
.bg-pattern {
    background-image: radial-gradient(circle, rgba(114, 49, 60, 0.03) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* ============================================
   Image Placeholder Fallback
   ============================================ */
img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 767px) {
    .font-serif {
        line-height: 1.1;
    }
}

@media (min-width: 1024px) {
    /* Subtle parallax-like effect for hero image on scroll */
    #hero img {
        transition: transform 0.1s linear;
    }
}
