initial commit
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
/* ============================================================
|
||||
Local Business Website — Base JavaScript Template
|
||||
Mobile nav toggle, header scroll shrink, active page detection.
|
||||
Copy as js/main.js — zero dependencies, vanilla JS.
|
||||
============================================================ */
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
/* ---- Elements ---- */
|
||||
var hamburger = document.querySelector('.hamburger');
|
||||
var mobileNav = document.querySelector('.mobile-nav');
|
||||
var header = document.querySelector('.site-header');
|
||||
|
||||
/* ---- Mobile Nav Toggle ---- */
|
||||
if (hamburger && mobileNav) {
|
||||
hamburger.addEventListener('click', function () {
|
||||
var isOpen = mobileNav.classList.toggle('open');
|
||||
hamburger.classList.toggle('active');
|
||||
hamburger.setAttribute('aria-expanded', isOpen);
|
||||
document.body.style.overflow = isOpen ? 'hidden' : '';
|
||||
});
|
||||
|
||||
/* Close nav when a link is tapped */
|
||||
var navLinks = mobileNav.querySelectorAll('a');
|
||||
navLinks.forEach(function (link) {
|
||||
link.addEventListener('click', function () {
|
||||
mobileNav.classList.remove('open');
|
||||
hamburger.classList.remove('active');
|
||||
hamburger.setAttribute('aria-expanded', 'false');
|
||||
document.body.style.overflow = '';
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/* ---- Header Shrink on Scroll ---- */
|
||||
if (header) {
|
||||
window.addEventListener('scroll', function () {
|
||||
if (window.scrollY > 80) {
|
||||
header.classList.add('scrolled');
|
||||
} else {
|
||||
header.classList.remove('scrolled');
|
||||
}
|
||||
}, { passive: true });
|
||||
}
|
||||
|
||||
/* ---- Active Nav Link Highlighting ---- */
|
||||
(function () {
|
||||
var currentPath = window.location.pathname.replace(/\/$/, '') || '/';
|
||||
var navLinks = document.querySelectorAll('.main-nav a, .footer-nav a');
|
||||
navLinks.forEach(function (link) {
|
||||
var href = link.getAttribute('href');
|
||||
if (!href) return;
|
||||
var linkPath = href.replace(/\/$/, '') || '/';
|
||||
if (linkPath === '/' && currentPath !== '/') return;
|
||||
if (currentPath.startsWith(linkPath) && linkPath !== '/') {
|
||||
link.classList.add('active');
|
||||
} else if (currentPath === '/' && linkPath === '/') {
|
||||
link.classList.add('active');
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
/* ---- Smooth Scroll for Anchor Links ---- */
|
||||
document.querySelectorAll('a[href^="#"]').forEach(function (anchor) {
|
||||
anchor.addEventListener('click', function (e) {
|
||||
var target = document.querySelector(this.getAttribute('href'));
|
||||
if (target) {
|
||||
e.preventDefault();
|
||||
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,304 @@
|
||||
/* ============================================================
|
||||
Local Business Website — Base CSS Template
|
||||
Mobile-first. No frameworks. No build step.
|
||||
Copy this, customize :root variables, build your pages.
|
||||
============================================================ */
|
||||
|
||||
/* ---- CSS Custom Properties ---- */
|
||||
:root {
|
||||
/* Colors — customize these per-client */
|
||||
--color-primary: #1E40AF; /* Blue — trust, main brand */
|
||||
--color-primary-light:#DBEAFE;
|
||||
--color-secondary: #15803D; /* Green — growth, second service line */
|
||||
--color-secondary-light:#DCFCE7;
|
||||
--color-emergency: #DC2626; /* Red — urgency CTAs only */
|
||||
--color-emergency-light:#FEE2E2;
|
||||
--color-dark: #111827; /* Near-black — body text */
|
||||
--color-dark-soft: #1F2937;
|
||||
--color-medium: #6B7280; /* Secondary text */
|
||||
--color-light: #F9FAFB; /* Page background */
|
||||
--color-white: #FFFFFF;
|
||||
--color-border: #E5E7EB;
|
||||
--color-accent: #D97706; /* Amber/gold — stars, subtle highlights */
|
||||
|
||||
/* Typography */
|
||||
--font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
||||
Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
||||
--line-height-body: 1.65;
|
||||
|
||||
/* Spacing scale */
|
||||
--space-xs: 0.25rem;
|
||||
--space-sm: 0.5rem;
|
||||
--space-md: 1rem;
|
||||
--space-lg: 1.5rem;
|
||||
--space-xl: 2rem;
|
||||
--space-2xl: 3rem;
|
||||
--space-3xl: 4rem;
|
||||
|
||||
/* Layout */
|
||||
--max-width: 72rem;
|
||||
--header-height: 64px;
|
||||
--callbar-height: 48px;
|
||||
|
||||
/* Shadows */
|
||||
--shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
|
||||
--shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
|
||||
|
||||
/* Transitions */
|
||||
--transition-fast: 150ms ease;
|
||||
}
|
||||
|
||||
/* ---- Reset ---- */
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 100%;
|
||||
scroll-behavior: smooth;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: var(--font-stack);
|
||||
font-size: 1rem;
|
||||
line-height: var(--line-height-body);
|
||||
color: var(--color-dark);
|
||||
background: var(--color-light);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
padding-top: calc(var(--header-height) + var(--callbar-height));
|
||||
}
|
||||
|
||||
img { max-width: 100%; height: auto; display: block; }
|
||||
a { color: inherit; text-decoration: none; }
|
||||
ul, ol { list-style: none; }
|
||||
button { font: inherit; cursor: pointer; border: none; background: none; }
|
||||
|
||||
/* ---- Utility Classes ---- */
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: var(--max-width);
|
||||
margin: 0 auto;
|
||||
padding: 0 var(--space-lg);
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
position: absolute; width: 1px; height: 1px;
|
||||
padding: 0; margin: -1px;
|
||||
overflow: hidden; clip: rect(0,0,0,0);
|
||||
white-space: nowrap; border: 0;
|
||||
}
|
||||
|
||||
/* ---- Buttons ---- */
|
||||
.btn {
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
gap: var(--space-sm); padding: 0.75rem 1.5rem;
|
||||
font-weight: 600; font-size: 1rem; line-height: 1;
|
||||
border-radius: 0.5rem; transition: all var(--transition-fast);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: var(--color-primary); color: var(--color-white);
|
||||
}
|
||||
.btn-primary:hover, .btn-primary:focus-visible { background: #1E3A8A; }
|
||||
|
||||
.btn-emergency {
|
||||
background: var(--color-emergency); color: var(--color-white);
|
||||
}
|
||||
.btn-emergency:hover, .btn-emergency:focus-visible { background: #B91C1C; }
|
||||
|
||||
.btn-secondary {
|
||||
background: var(--color-secondary); color: var(--color-white);
|
||||
}
|
||||
.btn-secondary:hover, .btn-secondary:focus-visible { background: #166534; }
|
||||
|
||||
.btn-outline {
|
||||
background: var(--color-white); color: var(--color-primary);
|
||||
border: 2px solid var(--color-primary);
|
||||
}
|
||||
.btn-outline:hover, .btn-outline:focus-visible {
|
||||
background: var(--color-primary-light);
|
||||
}
|
||||
|
||||
.btn-large { padding: 1rem 2rem; font-size: 1.125rem; }
|
||||
.btn-full { width: 100%; }
|
||||
|
||||
/* ---- Phone Link ---- */
|
||||
.phone-link {
|
||||
display: inline-flex; align-items: center; gap: var(--space-xs);
|
||||
font-weight: 700; color: var(--color-primary); font-size: 1.125rem;
|
||||
transition: color var(--transition-fast);
|
||||
}
|
||||
.phone-link:hover, .phone-link:focus-visible { color: var(--color-emergency); }
|
||||
.phone-link svg { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
|
||||
|
||||
/* ================================================================
|
||||
HEADER (sticky)
|
||||
================================================================ */
|
||||
.site-header {
|
||||
position: fixed; top: 0; left: 0; right: 0; z-index: 100;
|
||||
height: var(--header-height); background: var(--color-white);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
box-shadow: var(--shadow-sm);
|
||||
transition: height var(--transition-fast), padding var(--transition-fast);
|
||||
}
|
||||
.site-header.scrolled { --header-height: 56px; }
|
||||
|
||||
.header-inner {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* Logo */
|
||||
.logo {
|
||||
display: flex; align-items: center; gap: var(--space-sm);
|
||||
font-weight: 800; font-size: 1.25rem; color: var(--color-dark);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.logo-icon {
|
||||
width: 2rem; height: 2rem; background: var(--color-primary);
|
||||
color: var(--color-white); border-radius: 0.5rem;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
|
||||
/* Desktop nav */
|
||||
.main-nav {
|
||||
display: none; /* hidden on mobile */
|
||||
align-items: center; gap: var(--space-xl);
|
||||
}
|
||||
.main-nav a {
|
||||
font-weight: 500; color: var(--color-dark-soft);
|
||||
padding: var(--space-xs) 0; border-bottom: 2px solid transparent;
|
||||
transition: color var(--transition-fast), border-color var(--transition-fast);
|
||||
}
|
||||
.main-nav a:hover, .main-nav a.active {
|
||||
color: var(--color-primary); border-bottom-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.header-right { display: none; align-items: center; gap: var(--space-lg); }
|
||||
|
||||
/* Hamburger */
|
||||
.hamburger {
|
||||
display: flex; flex-direction: column; justify-content: center; gap: 5px;
|
||||
width: 44px; height: 44px; padding: 10px;
|
||||
}
|
||||
.hamburger span {
|
||||
display: block; width: 24px; height: 2px;
|
||||
background: var(--color-dark); border-radius: 2px;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
|
||||
.hamburger.active span:nth-child(2) { opacity: 0; }
|
||||
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
|
||||
|
||||
/* Mobile nav drawer */
|
||||
.mobile-nav {
|
||||
display: none; position: fixed; top: var(--header-height);
|
||||
left: 0; right: 0; bottom: 0; background: var(--color-white);
|
||||
z-index: 99; flex-direction: column; padding: var(--space-xl) var(--space-lg);
|
||||
gap: var(--space-sm); overflow-y: auto;
|
||||
}
|
||||
.mobile-nav.open { display: flex; }
|
||||
.mobile-nav a {
|
||||
display: block; padding: var(--space-md); font-size: 1.125rem;
|
||||
font-weight: 600; color: var(--color-dark); border-radius: 0.5rem;
|
||||
}
|
||||
.mobile-nav a:hover { background: var(--color-light); }
|
||||
.mobile-nav .btn { margin-top: var(--space-md); }
|
||||
|
||||
/* ================================================================
|
||||
TAP-TO-CALL BAR (mobile only)
|
||||
================================================================ */
|
||||
.callbar {
|
||||
position: fixed; top: var(--header-height); left: 0; right: 0; z-index: 98;
|
||||
height: var(--callbar-height); background: var(--color-primary);
|
||||
color: var(--color-white);
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
font-weight: 700; font-size: 1rem; gap: var(--space-sm);
|
||||
text-decoration: none;
|
||||
}
|
||||
.callbar:hover { background: #1E3A8A; }
|
||||
.callbar.emergency { background: var(--color-emergency); }
|
||||
.callbar.emergency:hover { background: #B91C1C; }
|
||||
.callbar svg { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
|
||||
|
||||
/* ================================================================
|
||||
PAGE SECTIONS
|
||||
================================================================ */
|
||||
.page-section { padding: var(--space-3xl) 0; }
|
||||
.page-section-alt { background: var(--color-white); }
|
||||
.page-section-dark { background: var(--color-dark); color: var(--color-white); }
|
||||
|
||||
.section-heading {
|
||||
font-size: 1.75rem; font-weight: 800; text-align: center;
|
||||
margin-bottom: var(--space-xs); color: var(--color-dark); line-height: 1.2;
|
||||
}
|
||||
.section-subheading {
|
||||
font-size: 1.125rem; color: var(--color-medium); text-align: center;
|
||||
margin-bottom: var(--space-2xl); max-width: 36rem;
|
||||
margin-left: auto; margin-right: auto;
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
FOOTER
|
||||
================================================================ */
|
||||
.site-footer {
|
||||
background: var(--color-dark-soft); color: var(--color-white);
|
||||
padding: var(--space-3xl) 0 var(--space-xl);
|
||||
}
|
||||
.footer-grid {
|
||||
display: grid; grid-template-columns: 1fr; gap: var(--space-2xl);
|
||||
}
|
||||
.footer-brand p { color: #D1D5DB; margin-top: var(--space-sm); line-height: 1.7; }
|
||||
.footer-brand .logo { color: var(--color-white); font-size: 1.375rem; }
|
||||
|
||||
.footer-nav h4 {
|
||||
font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em;
|
||||
color: #9CA3AF; margin-bottom: var(--space-md);
|
||||
}
|
||||
.footer-nav a { display: block; color: #D1D5DB; padding: var(--space-xs) 0; }
|
||||
.footer-nav a:hover { color: var(--color-white); }
|
||||
|
||||
.footer-contact p {
|
||||
display: flex; align-items: center; gap: var(--space-sm);
|
||||
color: #D1D5DB; margin-bottom: var(--space-sm);
|
||||
}
|
||||
.footer-contact .phone-link { color: var(--color-white); font-size: 1.25rem; }
|
||||
|
||||
.footer-service-areas {
|
||||
margin-top: var(--space-2xl); padding-top: var(--space-xl);
|
||||
border-top: 1px solid #374151; text-align: center;
|
||||
color: #9CA3AF; font-size: 0.9375rem;
|
||||
}
|
||||
.footer-service-areas span { color: #D1D5DB; }
|
||||
|
||||
.footer-bottom {
|
||||
margin-top: var(--space-xl); padding-top: var(--space-lg);
|
||||
border-top: 1px solid #374151; text-align: center;
|
||||
color: #6B7280; font-size: 0.875rem;
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
RESPONSIVE: Tablet+ (768px)
|
||||
================================================================ */
|
||||
@media (min-width: 768px) {
|
||||
body { padding-top: var(--header-height); }
|
||||
.hamburger { display: none; }
|
||||
.main-nav { display: flex; }
|
||||
.header-right { display: flex; }
|
||||
.callbar { display: none; }
|
||||
.mobile-nav { display: none !important; }
|
||||
.footer-grid { grid-template-columns: 2fr 1fr 1fr; }
|
||||
.section-heading { font-size: 2.25rem; }
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.section-heading { font-size: 2.75rem; }
|
||||
.section-subheading { font-size: 1.25rem; }
|
||||
}
|
||||
Reference in New Issue
Block a user