/* ==========================================================================
   Template System V2 - Compiled Static CSS & Semantic Design Tokens
   WCAG 2.2 AA Compliant - Zero Tailwind Runtime in Browser
   VR03 Shared Visual Primitives
   ========================================================================== */

:root {
  --theme-primary: #2563eb;
  --theme-accent: #1d4ed8;
  --theme-bg: #ffffff;
  --theme-surface: #f8fafc;
  --theme-text: #0f172a;
  --theme-text-muted: #64748b;
  --theme-border: #e2e8f0;
  --font-heading: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px 0 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);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --container-max: 80rem;
  --section-spacing: clamp(3.5rem, 6vw, 5.5rem);
}

/* Modern CSS Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-body);
  color: var(--theme-text);
  background-color: var(--theme-bg);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Global Text Overflow Prevention & Word Wrap */
h1, h2, h3, h4, h5, h6,
p, span, a, li, blockquote, dt, dd, td, th, label, figcaption {
  overflow-wrap: break-word;
}

/* Typography & Responsive Scale */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--theme-text);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h4 { font-size: 1.125rem; font-weight: 700; }
h5 { font-size: 1rem; font-weight: 700; }
h6 { font-size: 0.875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

p {
  margin-bottom: 1rem;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--theme-primary);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
  text-decoration: underline;
}

/* Media & Layout Shift Prevention (CLS) */
img, picture, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: cover;
}

img[width][height] {
  height: auto;
}

/* Accessibility (WCAG 2.2 AA) Skip Link & Focus */
.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;
}

.skip-link:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 9999;
  width: auto;
  height: auto;
  padding: 0.75rem 1.5rem;
  background-color: #0f172a;
  color: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  clip: auto;
  text-decoration: none;
  font-weight: 700;
}

:focus-visible {
  outline: 3px solid var(--theme-primary);
  outline-offset: 3px;
}

/* Semantic Layout Containers */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1rem, 4vw, 2rem);
  padding-right: clamp(1rem, 4vw, 2rem);
}

main {
  flex: 1 0 auto;
}

/* Shared Section Spacing */
.hero-section,
.services-section,
.catalog-section,
.gallery-section,
.testimonials-section,
.hours-section,
.locations-section,
.social-section,
.lead-form-section,
.cta-section,
.rich-text-section {
  padding-top: var(--section-spacing);
  padding-bottom: var(--section-spacing);
}

/* Buttons and Interactive Controls (Touch Target >= 44px) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none !important;
  transition: all 0.2s ease;
  line-height: 1.25;
  white-space: normal;
  text-align: center;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--theme-primary);
  color: #ffffff !important;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--theme-border);
  color: var(--theme-text) !important;
}

.btn-outline:hover {
  background-color: var(--theme-surface);
  border-color: var(--theme-text-muted);
}

/* Announcement Bar Contrast & Accessibility */
.announcement-bar {
  background-color: var(--theme-primary);
  color: #ffffff;
  padding: 0.625rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.announcement-badge {
  background-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 0.15rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Cards, Grid Items and Elevation */
.service-card,
.catalog-item-card,
.testimonial-card,
.location-card {
  min-width: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.service-card:hover,
.catalog-item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Form Controls */
input, textarea, select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  background-color: var(--theme-bg);
  color: var(--theme-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-width: 1rem;
  min-height: 1rem;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--theme-primary);
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--theme-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.btn:disabled, .btn.is-loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

/* Accessible Lead Form Feedback (WCAG Live Region) */
.lead-form-feedback {
  transition: all 0.25s ease;
  line-height: 1.5;
}

.lead-form-feedback.success {
  display: block !important;
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.lead-form-feedback.error {
  display: block !important;
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.lead-form-feedback.rate-limited {
  display: block !important;
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Header & Mobile Navigation */
.site-header {
  background-color: var(--theme-bg);
  border-bottom: 1px solid var(--theme-border);
  z-index: 50;
  backdrop-filter: blur(8px);
}

.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--theme-border);
  border-radius: var(--radius-md);
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 1.25rem;
  color: var(--theme-text);
  cursor: pointer;
  line-height: 1;
}

.mobile-menu-toggle:focus-visible {
  outline: 2px solid var(--theme-primary);
}

.mobile-nav-drawer {
  background-color: var(--theme-bg);
  border-bottom: 1px solid var(--theme-border);
  padding: 1rem 1.5rem 1.5rem;
  box-shadow: var(--shadow-md);
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mobile-nav-item {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--theme-text);
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--theme-border);
  text-decoration: none;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
}

.mobile-nav-item:last-child {
  border-bottom: none;
}

@media (max-width: 767px) {
  .desktop-nav {
    display: none !important;
  }
  .mobile-menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
  .header-phone-btn .phone-text {
    display: none;
  }
}

/* Typography Prose */
.prose {
  line-height: 1.8;
  color: var(--theme-text);
}

.prose p {
  margin-bottom: 1.25rem;
}

/* Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
