/*
 * ECAR global layer: reset, base type, the shell container, and the one
 * shared button component. Section-specific rules stay in their own files.
 */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

/* Native smooth scrolling replaces the hand-rolled JS scroller that used to
   live in main.js — same behaviour, no scroll listeners, and it respects the
   user's motion preference instead of ignoring it. */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  background-color: var(--ecar-bg);
  color: var(--ecar-text-secondary);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition), opacity var(--transition);
}

/* The accent is the only color in the system that survives as a 1-2px ring
   on a near-black background — the previous navy ring was invisible. */
:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--ecar-accent);
  outline-offset: 3px;
  border-radius: 1px;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--ecar-text-primary);
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

/* Anchored sections clear the sticky header on their own, so no JS has to
   measure it per click. --header-h is defined per breakpoint in variables.css. */
:target,
[id]:where(section, main, form, div, li) {
  scroll-margin-top: calc(var(--header-h) + 20px);
}

/* --- Shell ---
   Every section used to repeat `max-width:1440px; margin:0 auto; padding:0 32px`
   plus three media queries to walk the gutter down. One class, one place. */
.ecar-shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Legacy container, still used by index.php */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Accessibility helpers --- */
.ecar-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.ecar-skip-link {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 2000;
  padding: 12px 20px;
  transform: translate(-50%, -120%);
  background-color: var(--ecar-accent);
  color: var(--ecar-bg);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  transition: transform var(--dur) var(--ease);
}

.ecar-skip-link:focus-visible {
  transform: translate(-50%, 0);
  outline-offset: -4px;
}

/* --- Button ---
   Lives here rather than in header.css: it is used by the header, hero,
   why-choose-us, pricing promise and the request form.

   --primary is a light bone fill on dark, not navy. A mid-navy fill sits at
   roughly 2:1 against a #0A0A0A page, so the site's single most important
   element used to read as a dark rectangle among dark rectangles. Reversing
   it to the accent gives the CTA the strongest contrast on the page while
   keeping navy as the brand's surface color everywhere else. */
.ecar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 15px 26px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), transform var(--dur-fast) ease;
}

.ecar-btn:active {
  transform: translateY(1px);
}

.ecar-btn__icon {
  display: inline-flex;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
}

.ecar-btn__icon svg {
  width: 100%;
  height: 100%;
  transition: transform var(--dur-slow) var(--ease);
}

.ecar-btn--primary {
  background-color: var(--ecar-accent);
  color: var(--ecar-bg);
  border-color: var(--ecar-accent);
}

.ecar-btn--primary:hover,
.ecar-btn--primary:focus-visible {
  background-color: var(--ecar-accent-strong);
  border-color: var(--ecar-accent-strong);
}

.ecar-btn--secondary {
  background-color: transparent;
  color: var(--ecar-text-primary);
  border-color: var(--ecar-border-strong);
}

.ecar-btn--secondary:hover,
.ecar-btn--secondary:focus-visible {
  border-color: var(--ecar-text-secondary);
  background-color: rgba(245, 245, 245, 0.04);
}

/* Navy fill: a second, brand-colored solid alongside --primary's accent
   fill — used where two actions need to read as equally weighted but
   visually distinct (e.g. the mobile header's Call / Book pair). */
.ecar-btn--navy {
  background-color: var(--ecar-navy);
  color: var(--ecar-text-primary);
  border-color: var(--ecar-navy-line);
}

.ecar-btn--navy:hover,
.ecar-btn--navy:focus-visible {
  background-color: var(--ecar-navy-hover);
  border-color: var(--ecar-navy-hover);
}

.ecar-btn--sm {
  height: 46px;
  padding: 0 22px;
}

/* --- Two-line button ---
   For actions that carry their own detail: "CALL NOW / 980-880-7788",
   "BOOK ONLINE / Same-day appointments". The detail is the reason the
   button converts — a phone number the visitor can read before deciding
   to tap it — so it belongs inside the control rather than in a caption
   underneath. The label keeps the base button's uppercase tracking; the
   sub-line drops to sentence case at 80% opacity so the two never compete. */
.ecar-btn--stack {
  gap: 12px;
  padding: 12px 24px;
  text-align: left;
}

.ecar-btn__stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.ecar-btn__label {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.3;
}

.ecar-btn__sub {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: none;
  opacity: 0.78;
}

.ecar-btn--stack .ecar-btn__icon {
  width: 19px;
  height: 19px;
}

/* Icon motion is tied to what the icon depicts: the arrow travels along its
   own diagonal, the wrench turns. Both are ~200ms one-shots on intent, not
   ambient animation. */
.ecar-btn--primary:hover .ecar-btn__icon svg,
.ecar-btn--primary:focus-visible .ecar-btn__icon svg {
  transform: translate(2px, -2px);
}

.ecar-btn--secondary:hover .ecar-btn__icon svg,
.ecar-btn--secondary:focus-visible .ecar-btn__icon svg {
  transform: rotate(-18deg);
}

/* A phone handset or a calendar has no direction to travel in, so the
   two-line buttons opt out of the icon motion above entirely. */
.ecar-btn--stack:hover .ecar-btn__icon svg,
.ecar-btn--stack:focus-visible .ecar-btn__icon svg {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .ecar-btn,
  .ecar-btn__icon svg {
    transition: none;
  }

  .ecar-btn:active {
    transform: none;
  }

  .ecar-btn--primary:hover .ecar-btn__icon svg,
  .ecar-btn--primary:focus-visible .ecar-btn__icon svg,
  .ecar-btn--secondary:hover .ecar-btn__icon svg,
  .ecar-btn--secondary:focus-visible .ecar-btn__icon svg {
    transform: none;
  }
}

/* --- Breadcrumbs ---
   Lives here rather than in a section-specific stylesheet since it's a
   sitewide wayfinding component (template-parts/breadcrumbs.php), the
   same reasoning as .ecar-btn above — currently used on service pages,
   but not tied to that one template.

   A slim strip rather than anything folded into the hero: the hero's
   content column is vertically centered and full-bleed-photo-backed, so
   a top-anchored strip above it is the one placement that never fights
   that layout regardless of how tall a given hero's heading wraps to. */
.ecar-crumbs {
  background-color: var(--ecar-bg);
  border-bottom: 1px solid var(--ecar-hairline);
}

.ecar-crumbs__inner {
  padding-block: 14px;
}

.ecar-crumbs__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ecar-crumbs__item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ecar-crumbs__item a,
.ecar-crumbs__item span {
  display: inline-block;
  max-width: 32ch;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  color: var(--ecar-text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.ecar-crumbs__item a {
  transition: color var(--transition);
}

.ecar-crumbs__item a:hover,
.ecar-crumbs__item a:focus-visible {
  color: var(--ecar-accent);
}

/* The current page: not a link, and the one crumb allowed to run long
   (a service title) since nothing sits to its right to be crowded. */
.ecar-crumbs__item span[aria-current="page"] {
  max-width: 46ch;
  color: var(--ecar-text-secondary);
  font-weight: 600;
}

.ecar-crumbs__icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--ecar-text-muted);
}

.ecar-crumbs__sep {
  display: inline-flex;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--ecar-border-strong);
}

@media (max-width: 767px) {
  .ecar-crumbs__inner {
    padding-block: 12px;
  }

  .ecar-crumbs__item a,
  .ecar-crumbs__item span {
    max-width: 30vw;
  }

  .ecar-crumbs__item span[aria-current="page"] {
    max-width: 48vw;
  }
}

