/* ==========================================================================
   ER Auto Service — Riverview concept (web2)
   Tokens, nav, footer, buttons and base primitives.
   Page content lives in home.css.
   Palette sampled from the real badge logo: assets/img/logoerautoservice.png
   ========================================================================== */

:root {
  /* Palette — tire-tread black, brushed-chrome grey, the logo's own engine red. */
  --ink:        #0A0A0B;   /* page base, tire tread */
  --iron:       #18191D;   /* raised dark panels */
  --iron-hi:    #232429;   /* hairlines / borders on dark */
  --chrome:     #C9CCD2;   /* secondary text on dark, from the medallion silver */
  --chrome-dim: #83878E;
  --ember:      #D81F26;   /* the logo's red — primary action color */
  --ember-hi:   #F5322F;
  --ember-dark: #9E1319;
  --ember-text: #C11B21;   /* AA-safe ember for small text set on paper */
  --paper:      #EEF0F2;   /* cool steel-white, light sections */
  --paper-dim:  #DDE0E4;

  --font-display: 'Archivo', system-ui, sans-serif;
  --font-body:    'Barlow', system-ui, sans-serif;
  --font-mono:    'Martian Mono', ui-monospace, monospace;

  --section-y: clamp(1rem, 3vw, 7.5rem);
  --gutter:    clamp(1.25rem, 4vw, 3.5rem);
  --maxw:      1280px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  /* Real rendered navbar height: the 117px logo (.nav-brand img) plus
     .nav-inner's own padding-top:5px + padding-bottom:2px = 124px. Must
     match reality, not just look tall enough — the mobile .nav-menu panel
     positions itself with `inset: var(--nav-h) 0 auto 0`, so an
     under-measured value here made it start before the navbar actually
     ended, covering the bottom of the logo. */
  --nav-h:    124px;
  --radius-pill: 999px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.97rem + 0.15vw, 1.07rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a   { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--ember);
  outline-offset: 3px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Type & section utilities --------------------------------- */

.display {
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 118, 'wght' 800;
  text-transform: uppercase;
  line-height: 0.92;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
}
.display--lg { font-size: clamp(2.1rem, 1.6rem + 2.4vw, 3rem); }
.display--sm { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.8rem); }
.display-line { display: block; white-space: nowrap; }
@media (max-width: 600px) {
  /* Same fix as the hero title and reviews heading: a forced single line
     doesn't leave room to shrink further on a phone without clipping —
     let it wrap there instead. */
  .display-line { white-space: normal; }
}

/* The logo's italic lean — same device as ../web/, for headlines that want the accent. */
.display--lean { transform: skewX(-6deg); transform-origin: left bottom; }

@media (max-width: 600px) {
  /* skewX shifts a box's top edge sideways by height × tan(angle) — fine for
     a short one-line headline, but once a heading wraps to several lines on
     a phone (tall box, big mobile font) that shift alone pushes it past the
     screen edge. Verified: at the hero's mobile size this alone added 25px
     of real overflow with no text-wrapping involved. Off on phones, kept on
     larger screens where headings stay short enough for it to be safe. */
  .display--lean { transform: none; }
}

.lede {
  font-size: clamp(1rem, 0.97rem + 0.2vw, 1.15rem);
  color: #4B4F57;   /* passes AA on paper/paper-dim; the default context */
  max-width: 52ch;
  margin: 0 0 1.5rem;
}
.section--dark .lede { color: var(--chrome); }

.text-ember { color: var(--ember); }

.btn-row { display: flex; gap: 1rem; flex-wrap: wrap; }

.section { padding-block: var(--section-y); }
.section--dark  { background: var(--ink); color: var(--paper); }
.section--paper { background: var(--paper); }
.section--paper-dim { background: var(--paper-dim); }

.sec-head { margin-bottom: clamp(2rem, 4vw, 3rem); }
.sec-head--center { max-width: 100%; text-align: center; margin-inline: auto; }
.sec-head--center .display { margin-inline: auto; }

.sec-head--inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: clamp(1.5rem, 4vw, 3rem);
  row-gap: 0.5rem;
}
.sec-head--inline .display { margin: 0; flex: none; }
.sec-head--inline .lede { margin: 0; }

.section-kicker {
  font-weight: 700;
  color: var(--ember-text);
  margin: -0.6rem 0 1rem;
}
@media (max-width: 600px) {
  /* The -0.6rem pull-up was tuned for a predictable 2-line desktop heading
     sitting right above it. On a phone the heading can wrap to 3-4 lines
     instead, so the same pull-up crowds it against the last line — drop it
     and let the heading's own margin-bottom do the spacing. */
  .section-kicker { margin-top: 0; }
}

/* ---------- Buttons — square corners, no radius ------------------------ */

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.95rem 1.9rem;
  border-radius: 0;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background 0.22s var(--ease-out), color 0.22s var(--ease-out),
              border-color 0.22s var(--ease-out), transform 0.22s var(--ease-out);
}
.btn:hover { transform: translateY(-2px); }

.btn-face { display: inline-flex; align-items: center; gap: 0.6rem; }

/* Diagonal-cut variant — reserved for the hero's two CTAs only. The box is
   skewed; .btn-face skews back the other way so the label stays upright. */
.btn--slant { transform: skewX(-12deg); }
.btn--slant:hover { transform: skewX(-12deg) translateY(-2px); }
.btn--slant .btn-face { transform: skewX(12deg); }

.btn--ember { background: var(--ember); color: #fff; }
.btn--ember:hover { background: var(--ember-hi); }

.btn--outline { border-color: #fff; color: #fff; }
.btn--outline:hover { border-color: var(--ember); color: var(--ember); }

.btn--outline-light { border-color: #fff; color: #fff; }
.btn--outline-light:hover { background: #fff; color: var(--ink); }

.section--paper .btn--outline,
.section--paper-dim .btn--outline { border-color: rgba(10,10,11,0.25); color: var(--ink); }
.section--paper .btn--outline:hover,
.section--paper-dim .btn--outline:hover { border-color: var(--ember); color: var(--ember); }

/* Solid-filled variants — reserved for a red or photo band where an outline
   button wouldn't have enough contrast (the Tires and Financing pages' CTA
   bands). */
.btn--white { background: #fff; color: var(--ember-text); }
.btn--white:hover { background: var(--ink); color: #fff; }
.btn--ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--ink:hover { background: #000; border-color: #000; }

/* ---------- Eyebrow / hero-split / hero-features ------------------------
   Small components first built for the Tires page's hero, then needed again
   verbatim on Financing — promoted here so both (and whatever page comes
   next) share one definition. */

.eyebrow {
  display: flex; align-items: center; gap: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 0.9rem;
}
.eyebrow::before { content: ''; width: 26px; height: 3px; background: var(--ember); flex: none; }
.eyebrow--light { color: #fff; }
.eyebrow--ember { color: var(--ember-text); }
.eyebrow--ember::before { background: var(--ember-text); }
.sec-head--center .eyebrow { justify-content: center; }

/* Splits a hero-inner into the usual copy column plus a secondary column
   (a feature list, a logo row, …) pinned to the far edge. */
.hero-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(2rem, 5vw, 4rem);
}
@media (max-width: 900px) {
  .hero-split { flex-direction: column; align-items: flex-start; }
}

.hero-features { display: grid; gap: 1.5rem; flex: none; }
.hero-feature { display: flex; align-items: center; gap: 0.9rem; }
.hero-feature i {
  flex: none; width: 2.1rem; text-align: center;
  font-size: 1.6rem; color: #fff;
}
.hero-feature span {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1.4;
  color: #fff;
  max-width: 15ch;
}
@media (max-width: 900px) {
  .hero-features { grid-auto-flow: column; gap: clamp(1rem, 3vw, 2rem); }
  .hero-feature span { max-width: none; }
}
@media (max-width: 600px) {
  .hero-split { align-items: center; }
  .hero-features { grid-auto-flow: row; justify-items: center; }
  .hero-feature { flex-direction: column; text-align: center; gap: 0.4rem; }
}

/* Compact hero variant — a shorter closing-CTA band that reuses .hero's own
   media/scrim/copy machinery instead of building a new banner mechanism.
   First used on Financing's "Ready to Get Started", now About's closing CTA
   too; each page still supplies its own .hero--cta .hero-media background. */
.hero--cta { min-height: auto; }
.hero--cta .hero-inner { padding-block: clamp(3rem, 6vw, 4.5rem); }

/* Hand-drawn marker stroke — a wavy SVG line in the brand red, sitting just
   under the baseline like it was underlined by hand. First used under
   "Quality" on the Tires page's used-tires quote, now shared since Auto
   Repair's hero quote needs it too. */
.quote-highlight {
  position: relative;
  display: inline-block;
}
.quote-highlight::after {
  content: '';
  position: absolute;
  left: -3%; right: -3%; bottom: -0.22em;
  height: 0.3em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M2 14 Q 20 4 40 14 T 80 14 T 120 14 T 160 14 T 198 14' stroke='%23D81F26' stroke-width='6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat;
  background-size: 100% 100%;
}

/* ---------- Navbar ------------------------------------------------------ */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ink);
  border-bottom: 1px solid var(--iron-hi);
}

.nav-inner {
  width: 100%;
  max-width: none;
  margin-inline: auto;
  padding-inline: var(--gutter);
  padding-top: 5px;
  padding-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: var(--nav-h);
}

.nav-brand { flex: none; line-height: 0; }
.nav-brand img { width: 117px; height: auto; transition: transform 0.4s var(--ease-out); }
.nav-brand:hover img { transform: rotate(-10deg); }

.nav-menu {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.4vw, 2rem);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.85rem, 1.6vw, 1.5rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--chrome);
  padding: 0.4rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.nav-link:hover { color: #fff; border-color: var(--ember); }
.nav-link.is-active { color: #fff; border-color: var(--ember); }

.nav-call {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--ember);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.65rem 1.25rem;
  border-radius: 0;
  white-space: nowrap;
  transition: background 0.22s var(--ease-out), transform 0.22s var(--ease-out);
}
.nav-call:hover { background: var(--ember-hi); transform: translateY(-2px); }

/* Mobile toggle */
.nav-toggle {
  display: none;
  margin-left: auto;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  margin-inline: auto;
  background: var(--paper);
  transition: transform 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 980px) {
  .nav-toggle { display: flex; }

  .nav-menu {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 1.1rem var(--gutter) 1.75rem;
    background: var(--iron);
    border-top: 1px solid var(--iron-hi);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    clip-path: inset(0 0 100% 0);
    pointer-events: none;
    transition: clip-path 0.4s var(--ease-out);
  }
  .nav-menu.is-open { clip-path: inset(0 0 0 0); pointer-events: auto; }

  .nav-links { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-links li + li { border-top: 1px solid var(--iron-hi); }
  .nav-link { display: block; padding: 0.9rem 0; font-size: 0.78rem; border-bottom: 0; }

  .nav-call { justify-content: center; margin-top: 1.25rem; padding-block: 0.9rem; }
}

/* ---------- Footer ------------------------------------------------------ */

.site-footer {
  background: var(--ink);
  color: var(--chrome);
  border-top: 1px solid var(--iron-hi);
  padding-top: clamp(3rem, 6vw, 4.5rem);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: clamp(2rem, 4vw, 3.5rem);
}
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 1.1rem;
}
.footer-brand img { width: 156px; height: auto; }

.footer-desc { color: var(--chrome-dim); max-width: 30ch; margin: 0; font-size: 0.92rem; }

.footer-social {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem;
  margin-top: 1.1rem;
  border-radius: 50%;
  border: 1px solid var(--iron-hi);
  color: var(--chrome);
  font-size: 1.1rem;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.footer-social:hover { color: var(--ember); border-color: var(--ember); }

@media (max-width: 560px) {
  .footer-brand { justify-content: center; }
  .footer-desc { max-width: none; width: 100%; }
  .footer-social { margin-inline: auto; }
}

.footer-heading {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ember-hi);
  margin: 0 0 1rem;
}

.footer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.footer-list a, .footer-list span { color: var(--chrome); font-size: 0.94rem; }
.footer-list a { transition: color 0.2s var(--ease-out); }
.footer-list a:hover { color: var(--ember); }

.footer-contact { font-style: normal; display: grid; gap: 0.85rem; }
.footer-contact p { margin: 0; display: flex; gap: 0.65rem; color: var(--chrome); font-size: 0.94rem; }
.footer-contact i { color: var(--ember); flex: none; margin-top: 0.2rem; }
.footer-contact a:hover { color: var(--ember); }

.footer-bottom {
  margin-top: clamp(2rem, 5vw, 3.5rem);
  border-top: 1px solid var(--iron-hi);
  padding-block: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--chrome-dim);
}
.footer-copy { margin: 0; }

.footer-bottom-right { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.5rem; }
.footer-legal { display: flex; flex-wrap: wrap; gap: 0.6rem 1.25rem; }
.footer-legal a { color: var(--chrome-dim); transition: color 0.2s var(--ease-out); }
.footer-legal a:hover { color: var(--ember); }

/* ---------- Back to top -------------------------------------------------- */

.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: var(--ember);
  color: #fff;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out), background 0.2s var(--ease-out);
  z-index: 90;
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--ember-hi); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .nav-brand:hover img { transform: none; }
  .btn:hover { transform: none; }
  .btn--slant:hover { transform: skewX(-12deg); }
}
