/* ==========================================================================
   RAPID RESPONSE PLUMBING & HEATING — BASE RESET & TYPOGRAPHY
   Mobile-First Approach
   ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--color-neutral-800);
  background-color: var(--color-background);
  line-height: 1.6;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
}

/* Heading Typography — Mobile-First Base Scale */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-primary);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Mobile Typographic Sizes (320px–639px) */
h1 { font-size: clamp(1.85rem, 7vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 5vw, 2rem); }
h3 { font-size: clamp(1.25rem, 4vw, 1.5rem); }
h4 { font-size: 1.15rem; }
h5 { font-size: 1.05rem; }
h6 { font-size: 1rem; }

/* Desktop Typographic Scale Overrides (1024px+) */
@media (min-width: 1024px) {
  h1 { font-size: 3.25rem; }
  h2 { font-size: 2.375rem; }
  h3 { font-size: 1.75rem; }
  h4 { font-size: 1.25rem; }
}

p {
  margin-bottom: var(--space-4);
  word-wrap: break-word;
}
p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover {
  color: var(--color-primary);
}

img, picture, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Touch Targets: Guaranteed Minimum 44x44px for All Interactive Elements */
button, 
input, 
select, 
textarea,
.btn-accent,
.btn-secondary,
.phone-cta-link,
.nav-link,
.option-card,
.faq-button,
.before-after-handle-btn {
  min-height: 44px;
  touch-action: manipulation;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Accessibility Focus Ring (WCAG 2.1 AA Compliance) */
:focus-visible {
  outline: none !important;
  box-shadow: var(--focus-ring) !important;
  border-radius: var(--radius-sm);
}

/* Form Reset & Controls */
input[type="text"],
input[type="tel"],
input[type="email"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  background-color: var(--color-surface);
  border: 1.5px solid var(--color-neutral-300);
  border-radius: var(--radius-md);
  color: var(--color-neutral-900);
  font-size: 1rem;
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(30, 91, 140, 0.2);
}

/* Utility Layout Containers — Mobile First */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 640px) {
  .container {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

.container-narrow {
  max-width: var(--container-narrow);
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.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;
}

.text-muted { color: var(--color-neutral-600); }
.text-accent { color: var(--color-accent); }
.text-navy { color: var(--color-primary); }

.bg-navy { background-color: var(--color-primary); color: var(--color-surface); }
.bg-light { background-color: var(--color-neutral-100); }
.bg-white { background-color: var(--color-surface); }

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