/* Footer Modern Three-Column Layout - Enhanced Design */
/* Mobile-first responsive design with Netlify compatibility */
/* Bug prevention: Memory leak protection and performance optimization */

/* Base footer styling with improved gradient - Original tight spacing */
.footer {
  background: linear-gradient(135deg, var(--graphite-navy) 0%, #1a2530 100%);
  color: #ffffff;
  padding: 20px 0 10px 0;
  position: relative;
  overflow: hidden;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
}

/* Modern three-column layout - Enhanced for CTA support */
.footer-content {
  display: grid;
  grid-template-columns: 1fr 200px 220px;
  gap: 1rem;
  margin-bottom: 15px;
  align-items: start;
}

/* CTA support - Allow company column to expand naturally */
@media (min-width: 769px) {
  .footer-content {
    grid-template-columns: minmax(300px, 1fr) 200px 220px;
  }
}

/* Ensure contact section aligns with Quick Links */
.footer-section:nth-child(2),
.footer-section:nth-child(3) {
  align-self: start;
}

/* Company Section (Left Column) - Clean typography */
.footer-company h3 {
  color: var(--soft-cream);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  font-family: 'Playfair Display', serif;
  line-height: 1.3;
}

.footer-tagline {
  color: rgba(243, 241, 238, 0.95) !important;
  font-size: 1rem !important;
  line-height: 1.5 !important;
  margin-bottom: 0.5rem !important;
  font-weight: 400;
}

/* Service Areas - Original tight spacing */
.footer-service-areas {
  margin-top: 0.5rem;
}

.footer-service-areas p {
  color: rgba(243, 241, 238, 0.9);
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

.footer-service-areas p:first-child {
  font-weight: 600;
  color: var(--soft-cream);
  margin-bottom: 0.25rem;
}

.footer-specialties {
  font-size: 0.85rem !important;
  color: rgba(243, 241, 238, 0.8) !important;
  line-height: 1.3 !important;
  margin-top: 0.25rem !important;
  margin-bottom: 0.25rem !important;
}

/* Navigation Section (Center Column) */
.footer-links h4 {
  color: var(--soft-cream);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  border-bottom: none;
  padding-bottom: 0;
  line-height: 1.3;
  margin-top: 0;
  position: relative;
}

/* Accent line under Quick Links heading - Exact CTA button color */
.footer-links h4::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #CC6B5C !important;
  opacity: 0.8 !important;
  border-radius: 1px;
  transition: opacity 0.3s ease;
  will-change: opacity;
  backface-visibility: hidden;
  z-index: 1;
  display: block !important;
}

.footer-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.links-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.links-column ul li {
  margin-bottom: 0.25rem;
  margin-top: 0;
  padding: 0;
  line-height: 1.5;
}

.links-column ul li a {
  color: rgba(243, 241, 238, 0.9);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.5;
  margin: 0;
  padding: 0;
  transition: color 0.3s ease, transform 0.2s ease;
  display: inline-block;
}

.links-column ul li a:hover {
  color: var(--color-accent);
  transform: translateX(4px);
}

/* Contact Section (Right Column) - Bug prevention for white box */
.footer-contact {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.footer-contact h4 {
  color: var(--soft-cream);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  border-bottom: none;
  padding-bottom: 0;
  line-height: 1.3;
  margin-top: 0;
  background: transparent !important;
  position: relative;
}

/* Accent line under Contact Us heading - Exact CTA button color */
.footer-contact h4::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #CC6B5C !important;
  opacity: 0.8 !important;
  border-radius: 1px;
  transition: opacity 0.3s ease;
  will-change: opacity;
  backface-visibility: hidden;
  z-index: 1;
  display: block !important;
}

.contact-info {
  margin-bottom: 0;
  margin-top: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  margin-top: 0;
  padding: 0;
  line-height: 1.5;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: 100%;
}

.contact-item:first-child {
  margin-top: 0;
}

.contact-item:last-child {
  margin-bottom: 0;
}

.contact-item svg {
  color: var(--color-accent);
  flex-shrink: 0;
  opacity: 0.9;
}

.contact-item a {
  color: rgba(243, 241, 238, 0.95);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.5;
  margin: 0;
  padding: 0;
  transition: color 0.3s ease;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.contact-item a:hover {
  color: var(--soft-cream);
  background: transparent !important;
}

/* CTA Section - Moved higher with tighter spacing */
.footer-cta {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-cta h4 {
  color: var(--soft-cream);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.footer-cta .btn {
  background: var(--color-accent);
  color: var(--soft-cream);
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-block;
  transition: all 0.3s ease;
  border: 2px solid var(--color-accent);
  box-shadow: 0 2px 8px rgba(204, 107, 92, 0.2);
}

.footer-cta .btn:hover {
  background: transparent;
  color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(204, 107, 92, 0.3);
}

/* Footer Bottom - Original tight layout */
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-bottom p {
  color: rgba(243, 241, 238, 0.7);
  font-size: 0.85rem;
  margin: 0;
}

.footer-legal {
  display: flex;
  gap: 1.5rem;
}

.footer-legal a {
  color: rgba(243, 241, 238, 0.8);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.3s ease;
}

.footer-legal a:hover {
  color: var(--color-accent);
}

/* Mobile optimizations - Bug prevention for layout shifts */
@media (max-width: 768px) {
  .footer {
    padding: 15px 0 8px 0;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    gap: 1rem;
    text-align: center;
  }
  
  .footer-company h3 {
    font-size: 1.4rem;
    text-align: center;
  }
  
  .footer-tagline {
    text-align: center !important;
    font-size: 1rem !important;
  }
  
  .footer-service-areas {
    text-align: center;
  }
  
  /* Center company section elements on mobile */
  .footer-company {
    text-align: center !important;
  }
  
  .footer-company p {
    text-align: center !important;
  }
  
  .footer-company h4 {
    text-align: center !important;
  }
  
  .footer-links h4,
  .footer-contact h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    text-align: center;
  }
  
  /* Center Quick Links navigation items on mobile */
  .footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: center;
  }
  
  .footer-links li {
    text-align: center;
    margin-bottom: 0.5rem;
  }
  
  .footer-links a {
    display: inline-block;
    text-align: center;
  }
  
  /* Mobile optimization for accent lines - Enhanced visibility */
  .footer-links h4::after,
  .footer-contact h4::after {
    height: 1.5px !important;
    bottom: -3px !important;
    opacity: 0.7 !important;
    background-color: #CC6B5C !important;
    display: block !important;
  }
  
  .footer-links-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .contact-item {
    justify-content: center;
    text-align: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    margin-bottom: 0.25rem;
  }
  
  /* Center contact information on mobile */
  .footer-contact p {
    text-align: center;
    margin: 0.5rem 0;
  }
  
  .footer-contact a {
    text-align: center;
    display: inline-block;
  }
  
  .contact-info {
    align-items: center;
    text-align: center;
    margin-bottom: 0;
    margin-top: 0;
  }
  
  .footer-cta {
    text-align: center;
    margin-top: 0.25rem;
    padding-top: 0.25rem;
  }
  
  /* Force CTA button centering on mobile - Higher specificity */
  .footer .footer-cta .footer-cta-btn {
    display: block !important;
    margin: 0 auto !important;
    text-align: center !important;
    width: fit-content !important;
  }
  
  /* Override any parent text-align on mobile */
  .footer-cta {
    text-align: center !important;
  }
  
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    padding-top: 8px;
    gap: 0.25rem;
  }
  
  .footer-legal {
    justify-content: center;
  }
}

/* Tablet optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
  .footer-content {
    grid-template-columns: 1fr 180px 200px;
    gap: 0.75rem;
  }
  
  .footer-links-grid {
    grid-template-columns: 1fr;
  }
}

/* Large screen enhancements */
@media (min-width: 1025px) {
  .footer-content {
    grid-template-columns: 1fr 220px 240px;
  }
  
  .footer-links-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Performance and memory leak prevention */
@media (prefers-reduced-motion: reduce) {
  .links-column ul li a,
  .footer-cta .btn,
  .contact-item a {
    transition: none;
  }
  
  .links-column ul li a:hover {
    transform: none;
  }
  
  .footer-cta .btn:hover {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .footer {
    background: #000000;
  }
  
  .footer-company h3,
  .footer-links h4,
  .footer-contact h4 {
    color: #ffffff;
  }
  
  .footer-tagline,
  .footer-service-areas p,
  .contact-item a,
  .links-column ul li a {
    color: #ffffff !important;
  }
  
  .footer-cta .btn {
    border: 3px solid var(--color-accent);
  }
}

/* Bug prevention: Text overflow and font loading */
.footer-section {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.footer-company h3 {
  font-display: swap;
}

/* Ensure proper spacing on very small screens */
@media (max-width: 480px) {
  .footer {
    padding: 12px 0 6px 0;
  }
  
  .footer-content {
    gap: 0.75rem;
  }
  
  .contact-item {
    font-size: 0.9rem;
    justify-content: center;
    margin-bottom: 0.25rem;
  }
  
  .contact-info {
    align-items: center;
    margin-bottom: 0;
    margin-top: 0;
  }
  
  .footer-legal {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Ultimate bug prevention: Force transparent backgrounds on all footer elements */
.footer *,
.footer *:before,
.footer *:after {
  background-color: transparent !important;
  box-shadow: none !important;
}

/* Exception: Allow CTA button with solid background - Header match */
.footer-cta-btn {
  color: #FFFFFF !important;
  background-color: var(--color-accent) !important;
  border: none !important;
}

/* Restore intended backgrounds only where needed */
.footer {
  background: linear-gradient(135deg, var(--graphite-navy) 0%, #1a2530 100%) !important;
}

.footer .btn,
.footer .btn-primary {
  background: var(--color-accent) !important;
}

.footer .btn:hover,
.footer .btn-primary:hover {
  background: transparent !important;
}

/* Override for new CTA button - Perfect header match */
.footer-cta-btn {
  background: var(--color-accent) !important;
  color: #FFFFFF !important;
  border: none !important;
}

.footer-cta-btn:hover {
  background: rgba(204, 107, 92, 0.9) !important;
  color: #FFFFFF !important;
  border: none !important;
}

/* Ultimate alignment enforcement - Force identical baselines */
.footer-links ul,
.contact-info {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: 1.5 !important;
}

.footer-links ul li:first-child,
.contact-item:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Comprehensive bug prevention for perfect alignment */
.contact-info {
  min-height: auto !important;
  overflow: visible !important;
  width: 100% !important;
  max-width: none !important;
}

.contact-item {
  position: relative !important;
  z-index: 1 !important;
  width: 100% !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.5 !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Mobile responsiveness for contact items */
@media (max-width: 768px) {
  .contact-item {
    white-space: normal !important;
    word-break: break-word !important;
  }
  
  .footer-links-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Netlify compatibility - prevent font loading issues */
.contact-item a,
.footer-links a {
  font-display: swap !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

/* Footer CTA Section - Mobile-first with comprehensive bug prevention */
.footer-cta {
  margin-top: 1rem;
  text-align: left;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0;
  width: 100%;
}

.footer-cta h4 {
  color: var(--soft-cream);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
  padding-top: 0;
  line-height: 1.3;
  background: transparent !important;
}

.footer-cta-btn {
  background: var(--color-accent) !important;
  border: none !important;
  color: #FFFFFF !important;
  padding: 12px 24px !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  border-radius: 20px !important;
  text-decoration: none !important;
  display: inline-block !important;
  transition: all 0.3s ease !important;
  box-shadow: none !important;
  margin: 0 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  line-height: 1.4 !important;
  font-family: 'Open Sans', sans-serif !important;
  text-align: center !important;
}

.footer-cta-btn:hover,
.footer-cta-btn:focus {
  background: rgba(204, 107, 92, 0.9) !important;
  color: #FFFFFF !important;
  border: none !important;
  text-decoration: none !important;
  transform: translateY(-1px) !important;
}

.footer-cta-btn:active {
  transform: translateY(0) !important;
}

/* Mobile-specific CTA optimizations */
@media (max-width: 768px) {
  .footer-cta {
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
  }
  
  .footer-cta-btn {
    padding: 14px 28px !important;
    font-size: 1rem !important;
    width: auto !important;
    min-width: 160px !important;
    background: var(--color-accent) !important;
    color: #FFFFFF !important;
    border: none !important;
    border-radius: 20px !important;
    font-weight: 600 !important;
  }
  
  /* Prevent CTA button from breaking layout */
  .footer-company {
    overflow: visible !important;
    word-wrap: break-word !important;
  }
}

/* Bug prevention - Layout stability and accessibility */
.footer-cta,
.footer-cta * {
  box-sizing: border-box !important;
  position: relative !important;
}

/* Prevent CTA from affecting column alignment */
.footer-company {
  min-height: auto !important;
  height: auto !important;
  overflow: visible !important;
}

/* Mobile accessibility and touch optimization */
@media (hover: none) and (pointer: coarse) {
  .footer-cta-btn {
    min-height: 48px !important;
    padding: 16px 32px !important;
    background: var(--color-accent) !important;
    color: #FFFFFF !important;
    border: none !important;
    border-radius: 20px !important;
    font-size: 1rem !important;
  }
  
  .footer-cta-btn:active {
    background: rgba(204, 107, 92, 0.8) !important;
    transform: translateY(0) !important;
    color: #FFFFFF !important;
  }
}

/* Bug prevention for accent lines - Enhanced visibility and performance */
.footer-links h4::after,
.footer-contact h4::after {
  transform: translateZ(0) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  pointer-events: none;
  content: '' !important;
  background-color: #CC6B5C !important;
}

/* High contrast mode accessibility for accent lines */
@media (prefers-contrast: high) {
  .footer-links h4::after,
  .footer-contact h4::after {
    opacity: 1 !important;
    height: 3px !important;
    background-color: #CC6B5C !important;
  }
}

/* Force accent lines visibility - Override any conflicting styles */
html .footer .footer-links h4::after,
html .footer .footer-contact h4::after {
  content: '' !important;
  position: absolute !important;
  background-color: #CC6B5C !important;
  display: block !important;
  width: 100% !important;
  height: 2px !important;
  bottom: -4px !important;
  left: 0 !important;
  opacity: 0.8 !important;
}

/* Prevent layout shifts and ensure Netlify compatibility */
.footer-cta-btn {
  will-change: transform !important;
  backface-visibility: hidden !important;
  -webkit-tap-highlight-color: rgba(204, 107, 92, 0.3) !important;
  background: var(--color-accent) !important;
  color: #FFFFFF !important;
  border: none !important;
}

/* Additional bug prevention for edge cases */
.footer-cta h4,
.footer-cta-btn {
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  font-display: swap !important;
}

/* Ensure consistent button appearance across all contexts */
.footer-cta-btn {
  background-color: var(--color-accent) !important;
  border: none !important;
  color: #FFFFFF !important;
  border-radius: 20px !important;
}

/* Ensure CTA doesn't break on very long text */
.footer-cta-btn {
  max-width: 100% !important;
  word-break: keep-all !important;
  hyphens: none !important;
}