/**
 * Core Metrics Consulting - Main Stylesheet
 * Authoritative Visual & Design System implementation from final Build Guide
 * Self-hosted Inter font, flat 6-color system, restrained typography, strict responsive scale
 */

/* ==========================================================================
   1. Typography (@font-face: Self-hosted Inter WOFF2)
   ========================================================================== */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter-v20-latin-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/inter-v20-latin-600.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/inter-v20-latin-700.woff2') format('woff2');
}

/* ==========================================================================
   2. Design Tokens (:root)
   ========================================================================== */
:root {
  /* Core Color System (Build Guide Page 51) */
  --cmc-teal: #135C68;        /* Primary teal: primary buttons, links, icons, active/focus states, accents */
  --cmc-navy: #0F2F3A;        /* Deep navy: headlines, footer background, button hover */
  --cmc-slate: #2F4858;       /* Body slate: body copy, supporting text, meta lines */
  --cmc-aqua: #EAF2F2;        /* Soft aqua: pricing callout, featured cards, chips, final contact band */
  --cmc-gray: #D8E3E5;        /* Border gray: card borders, dividers, form field outlines */
  --cmc-white: #FFFFFF;       /* White: page background and card surfaces */
  --cmc-error: #B42318;       /* Error red: form error text and error field border */
  --cmc-success: #067647;     /* Success green: form success message and icon */

  /* Legacy & Semantic Mappings */
  --navy: var(--cmc-navy);
  --teal: var(--cmc-teal);
  --teal-dark: var(--cmc-navy);
  --aqua: var(--cmc-aqua);
  --slate: var(--cmc-slate);
  --line: var(--cmc-gray);
  --white: var(--cmc-white);
  --cmc-ink: var(--cmc-navy);
  --cmc-text: var(--cmc-slate);
  --cmc-muted: var(--cmc-slate);
  --cmc-line: var(--cmc-gray);
  --cmc-bg: var(--cmc-white);
  --cmc-mist: var(--cmc-aqua);
  --cmc-cream: var(--cmc-white);

  /* Spacing Scale (4, 8, 12, 16, 24, 32, 48, 64, 96 px strictly - Page 52) */
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
  --space-48: 48px;
  --space-64: 64px;
  --space-96: 96px;

  /* Layout & Grid (12 cols, 1200px max, 24px gutters - Page 52) */
  --max-width: 1200px;
  --text-max-width: 760px;
  --gutter: 24px;
  --side-padding: 48px;       /* 48px desktop, 40px tablet, 24px mobile */
  --wrap: min(var(--max-width), calc(100% - (var(--side-padding) * 2)));

  /* Radii */
  --radius-sm: 8px;           /* Form fields */
  --radius-button: 10px;      /* Buttons */
  --radius-pricing: 12px;     /* Pricing callout & mega menu */
  --radius-card: 14px;        /* Task cards, featured cards, checklist card */
  --radius-pill: 999px;       /* Chips */

  /* Typography Fallbacks */
  --font-sans: 'Inter', Arial, Helvetica, sans-serif;
  --font-serif: 'Inter', Arial, Helvetica, sans-serif; /* Prohibit second typeface */

  /* Focus Indicator (Page 52) */
  --focus-outline: 3px solid var(--cmc-teal);
  --focus-offset: 2px;
}

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

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

body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-width: 320px;
  overflow-x: hidden;
  background-color: var(--cmc-white);
  color: var(--cmc-slate);
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.lock-scroll {
  overflow: hidden;
}

/* ==========================================================================
   4. Typography Hierarchy (Build Guide Page 52)
   ========================================================================== */
/* Headings in sentence case. No all-caps, no letter-spaced labels, no italics for emphasis */
h1, h2, h3, h4, h5, h6 {
  color: var(--cmc-navy);
  font-family: var(--font-sans);
  text-transform: none;
  font-style: normal;
  letter-spacing: normal;
  margin-top: 0;
  margin-bottom: var(--space-16);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* H1: 52px desktop, 40px tablet, 34px mobile; 700 weight; line height 1.1; Deep navy. One H1 per page */
h1 {
  font-size: 52px;
  font-weight: 700;
  line-height: 1.1;
}

/* H2: 36px desktop, 30px tablet, 26px mobile; 700 weight; line height 1.2; Deep navy */
h2 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
}

/* H3: 22px desktop, 20px mobile; 600 weight; line height 1.3; Deep navy */
h3 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}

h4 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

/* Body: 18px desktop, 17px mobile; 400 weight; line height 1.65; Body slate */
p {
  margin-top: 0;
  margin-bottom: var(--space-16);
  color: var(--cmc-slate);
  font-size: 18px;
  line-height: 1.65;
}

/* Lead paragraph (top section only): 20px desktop, 18px mobile */
p.lead, .lead {
  font-size: 20px;
  line-height: 1.65;
  color: var(--cmc-slate);
  margin-bottom: var(--space-24);
}

/* Small text: 14px, line height 1.5, Body slate */
small, .text-sm, .response-line, .chip-text, .footer-legal, .form-help {
  font-size: 14px;
  line-height: 1.5;
  color: var(--cmc-slate);
}

/* Links in body text are Primary teal and underlined (Page 52) */
p a, .body-link {
  color: var(--cmc-teal);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 200ms ease;
}

p a:hover, .body-link:hover {
  color: var(--cmc-navy);
}

a {
  color: var(--cmc-teal);
  text-decoration: none;
  transition: color 200ms ease;
}

a:hover {
  color: var(--cmc-navy);
}

/* Text columns 680-760 px wide (Page 52) */
.prose, .text-column, .content-column {
  max-width: var(--text-max-width);
}

/* Images & Media (Page 55) */
img, video, iframe, svg, canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==========================================================================
   5. Layout & Spacing (Build Guide Page 52)
   ========================================================================== */
.wrap {
  width: var(--wrap);
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 0;
  padding-right: 0;
}

.wrap-narrow {
  width: min(var(--text-max-width), calc(100% - (var(--side-padding) * 2)));
  max-width: var(--text-max-width);
  margin-left: auto;
  margin-right: auto;
}

/* Section padding (top and bottom): 96px desktop, 72px tablet, 56px mobile */
.section {
  padding-top: var(--space-96);
  padding-bottom: var(--space-96);
  background-color: var(--cmc-white);
}

.section-soft {
  background-color: var(--cmc-aqua);
}

.section-top {
  padding-top: 80px;
  padding-bottom: 72px;
  background-color: var(--cmc-white);
}

.sectionhead {
  margin-bottom: 40px; /* Heading block to cards: 40px */
}

.sectionhead.centered {
  text-align: center;
  max-width: var(--text-max-width);
  margin-left: auto;
  margin-right: auto;
}

/* Prohibit decorative uppercase eyebrow labels (Page 51) */
.eyebrow {
  display: none !important;
}

/* ==========================================================================
   6. Buttons & Interactive Links (Build Guide Page 53)
   ========================================================================== */
/* Primary button: Primary teal background, white 16px 600-weight label,
   52px tall, 24px side padding, 10px radius. Hover: Deep navy (200ms).
   Focus: teal ring. Full width below 640px. */
.button, a.button, button.button, input[type="submit"].button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  height: 52px;
  min-height: 52px;
  box-sizing: border-box;
  padding: 0 var(--space-24);
  border-radius: var(--radius-button);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  background-color: var(--cmc-teal);
  color: var(--cmc-white) !important;
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease;
  box-shadow: none !important;
  transform: none !important; /* No card lift or scale effects */
}

.button:hover, a.button:hover, button.button:hover, input[type="submit"].button:hover {
  background-color: var(--cmc-navy);
  color: var(--cmc-white) !important;
  transform: none !important;
  box-shadow: none !important;
}

.button.primary, .button-primary {
  background-color: var(--cmc-teal);
  color: var(--cmc-white) !important;
}

.button.primary:hover, .button-primary:hover {
  background-color: var(--cmc-navy);
  color: var(--cmc-white) !important;
}

/* Secondary button: white background, Primary teal label, 1px teal border.
   Hover: Soft aqua background. (Page 53) */
.button.secondary, .button-secondary, .button.outline, .button-outline {
  background-color: var(--cmc-white);
  color: var(--cmc-teal) !important;
  border: 1px solid var(--cmc-teal);
}

.button.secondary:hover, .button-secondary:hover, .button.outline:hover, .button-outline:hover {
  background-color: var(--cmc-aqua);
  color: var(--cmc-teal) !important;
  border-color: var(--cmc-teal);
}

/* Text link with arrow (e.g. "All services →", "See Who We Help"):
   Primary teal, 600 weight; arrow moves 2 px right on hover. (Page 53) */
.link-arrow, .text-link-arrow, a.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  color: var(--cmc-teal);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: color 200ms ease;
}

.link-arrow .arrow, .link-arrow svg {
  display: inline-block;
  transition: transform 200ms ease;
}

.link-arrow:hover, a.link-arrow:hover {
  color: var(--cmc-navy);
  text-decoration: underline;
}

.link-arrow:hover .arrow, .link-arrow:hover svg {
  transform: translateX(2px);
}

/* Response line under every top-section button:
   14 px Body slate, 12 px below the button: "We respond within 1 business day · (302) 551-6591"
   with the phone number as a tap-to-call link. (Page 53) */
.response-line {
  display: block;
  font-size: 14px;
  line-height: 1.5;
  color: var(--cmc-slate);
  margin-top: var(--space-12);
}

.response-line a {
  color: var(--cmc-slate);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.response-line a:hover {
  color: var(--cmc-teal);
}

/* Disabled & Loading States (Page 52) */
.button:disabled, .button[aria-disabled="true"], button:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  transform: none !important;
  box-shadow: none !important;
}

.button.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.button.is-loading::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: var(--space-8);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: cmc-spin 0.6s linear infinite;
}

@keyframes cmc-spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   7. Keyboard Focus Ring & Accessibility (WCAG 2.2 AA)
   ========================================================================== */
/* States: focus ring 3 px Primary teal outline with 2 px offset on every link,
   button, field and menu item. (Page 52) */
:focus-visible {
  outline: var(--focus-outline) !important;
  outline-offset: var(--focus-offset) !important;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: var(--focus-outline) !important;
  outline-offset: var(--focus-offset) !important;
}

/* Skip to content link (Page 53) */
.skip-link, .skip-to-content {
  position: absolute;
  top: -120px;
  left: var(--space-16);
  background-color: var(--cmc-navy);
  color: var(--cmc-white) !important;
  padding: var(--space-12) var(--space-24);
  font-size: 15px;
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 100000;
  text-decoration: none;
  transition: top 150ms ease;
}

.skip-link:focus, .skip-to-content:focus {
  top: 0;
  outline: var(--focus-outline) !important;
  outline-offset: var(--focus-offset) !important;
}

/* Screen reader utility */
.screen-reader-text, .sr-only {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

/* Touch targets at least 44x44px (Page 57) */
.touch-target, button, input[type="button"], input[type="submit"], a.button {
  min-height: 44px;
  min-width: 44px;
}

/* ==========================================================================
   8. Form Fields (Build Guide Page 53)
   ========================================================================== */
.form-group {
  margin-bottom: var(--space-24);
}

/* Label above the field (15 px, 600 weight) */
label, .form-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--cmc-navy);
  margin-bottom: var(--space-8);
}

/* 48 px tall fields, 1 px Border gray outline, 8 px radius, 16 px text (prevents zoom on iPhone) */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="search"],
select,
textarea,
.form-control {
  width: 100%;
  height: 48px;
  box-sizing: border-box;
  padding: 0 var(--space-16);
  border: 1px solid var(--cmc-gray);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--cmc-navy);
  background-color: var(--cmc-white);
  transition: border-color 200ms ease;
}

textarea, textarea.form-control {
  height: auto;
  min-height: 120px;
  padding: var(--space-12) var(--space-16);
  line-height: 1.6;
}

/* Focus: teal border plus teal ring (Page 53) */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus,
.form-control:focus {
  border-color: var(--cmc-teal);
  outline: var(--focus-outline) !important;
  outline-offset: var(--focus-offset) !important;
}

/* Errors: shown under the field in 14 px Error red with an alert-circle icon; field border turns red */
.form-control.is-invalid,
.has-error input,
.has-error select,
.has-error textarea {
  border-color: var(--cmc-error) !important;
}

.error-message, .form-error {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  font-size: 14px;
  color: var(--cmc-error);
  margin-top: var(--space-8);
}

.error-message svg, .form-error svg {
  width: 16px;
  height: 16px;
  flex: none;
  stroke: var(--cmc-error);
}

/* No-patient-information checkbox: 24 px box, label to the right, sits directly above submit button */
.no-phi-container, .checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: var(--space-12);
  margin-bottom: var(--space-24);
}

.no-phi-container input[type="checkbox"],
.checkbox-container input[type="checkbox"] {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  margin-top: 2px;
  border: 1px solid var(--cmc-gray);
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--cmc-teal);
}

.no-phi-container label,
.checkbox-container label {
  font-size: 15px;
  font-weight: 400;
  color: var(--cmc-slate);
  margin-bottom: 0;
  line-height: 1.5;
  cursor: pointer;
}

/* ==========================================================================
   9. Motion & Reduced-Motion Handling (Build Guide Page 57)
   ========================================================================== */
/* Button and link hover: color change, 200 ms ease */
/* Menus and dropdowns: fade, 150 ms */
/* Mobile drawer: slide in from the right, 250 ms */
/* Sticky header shrink: 200 ms */

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

/* ==========================================================================
   10. Responsive Breakpoints (Build Guide Page 52)
   Breakpoints: 640 / 768 / 1024 / 1280 px
   Tested at: 320, 375, 768, 1024, 1280, 1440 px
   ========================================================================== */
@media (max-width: 1279px) {
  :root {
    --side-padding: 40px;
  }
}

@media (max-width: 1023px) {
  :root {
    --side-padding: 40px;
  }
  .section {
    padding-top: 72px;
    padding-bottom: 72px;
  }
  h1 {
    font-size: 40px;
  }
  h2 {
    font-size: 30px;
  }
}

@media (max-width: 767px) {
  :root {
    --side-padding: 24px;
  }
  .section {
    padding-top: 56px;
    padding-bottom: 56px;
  }
  .section-top {
    padding-top: 56px;
    padding-bottom: 56px;
  }
  h1 {
    font-size: 34px;
  }
  h2 {
    font-size: 26px;
  }
  h3 {
    font-size: 20px;
  }
  body {
    font-size: 17px;
  }
  p {
    font-size: 17px;
  }
  p.lead, .lead {
    font-size: 18px;
  }
}

@media (max-width: 639px) {
  /* Full width button below 640px (Page 53) */
  .button, a.button, button.button, input[type="submit"].button {
    width: 100%;
  }
  .button-group, .hero-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
}
