/* ==========================================================================
   EMG UNIVERSAL AUTO — Dakar
   Composition: receipt/listing layout · section-rotating palette ·
   stacked offset headline · fade+rise on scroll · drag band · grain overlay
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --ink: #0a0a0a;
  --paper: #f2f0ea;
  --red: #e10600;
  --blue: #003c8a;
  --acid: #f4ff33;

  --fg: var(--ink);
  --bg: var(--paper);
  --rule: rgba(10, 10, 10, 0.35);

  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --display: "Archivo Black", "Arial Black", Impact, sans-serif;

  --col: 42ch;
  --pad: clamp(1.25rem, 5vw, 3.5rem);
}

/* dark mode: paper becomes near-black, ink becomes bone */
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #ece9e2;
    --bg: #0d0d0d;
    --rule: rgba(236, 233, 226, 0.35);
  }
}

html[data-theme="light"] {
  --fg: var(--ink);
  --bg: var(--paper);
  --rule: rgba(10, 10, 10, 0.35);
}

html[data-theme="dark"] {
  --fg: #ece9e2;
  --bg: #0d0d0d;
  --rule: rgba(236, 233, 226, 0.35);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: clamp(0.9rem, 0.55vw + 0.78rem, 1.02rem);
  line-height: 1.65;
  font-variant-ligatures: none;
  overflow-x: hidden;
}

/* grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='180' height='180' filter='url(%23n)'/></svg>");
  background-size: 180px 180px;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

/* ---------- layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--col);
  margin-inline: auto;
  padding-inline: var(--pad);
}

section {
  padding-block: clamp(3rem, 9vw, 6rem);
  position: relative;
}

/* ---------- fade + rise on scroll ---------- */
@keyframes fadeRise {
  from { opacity: 0; translate: 0 14px; }
  to   { opacity: 1; translate: 0 0; }
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    section > .wrap,
    .band-wrap {
      animation: fadeRise 420ms cubic-bezier(.2, .7, .1, 1) both;
      animation-timeline: view();
      animation-range: entry 0% cover 22%;
    }
  }
}

/* ---------- header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px dotted var(--rule);
  backdrop-filter: blur(6px);
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.7rem;
}

.brand {
  font-family: var(--display);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1.1;
}

.brand small {
  display: block;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  opacity: 0.7;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.topbar nav a {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.7rem 0.55rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
}

.topbar nav a:hover { border-bottom-color: currentColor; }

.theme-btn {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: none;
  color: inherit;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.6rem 0.8rem;
  min-height: 44px;
  cursor: pointer;
}

.theme-btn:hover { background: var(--fg); color: var(--bg); }

@media (max-width: 640px) {
  .topbar nav a:not(.nav-tel) { display: none; }
}

/* ---------- section colour rotation ---------- */
.s-black { background: #0a0a0a; color: #f2f0ea; --rule: rgba(242, 240, 234, 0.32); }
.s-red   { background: var(--red); color: #fff; --rule: rgba(255, 255, 255, 0.4); }
.s-blue  { background: var(--blue); color: #fff; --rule: rgba(255, 255, 255, 0.4); }
.s-acid  { background: var(--acid); color: #0a0a0a; --rule: rgba(10, 10, 10, 0.35); }

.s-black .theme-btn,
.s-red .theme-btn,
.s-blue .theme-btn,
.s-acid .theme-btn { border-color: currentColor; }

/* ---------- stacked headline ---------- */
h1 {
  font-family: var(--display);
  font-size: clamp(2.1rem, 9.5vw, 4.1rem);
  line-height: 0.94;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 0 0 1.4rem;
  text-wrap: balance;
}

h1 span { display: block; }
h1 span:nth-child(2) { margin-left: 1.6em; }
h1 span:nth-child(3) { margin-left: -0.35em; }

@media (max-width: 480px) {
  h1 span:nth-child(2) { margin-left: 0.9em; }
  h1 span:nth-child(3) { margin-left: 0; }
}

h2 {
  font-family: var(--display);
  font-size: clamp(1.25rem, 4.2vw, 1.9rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin: 0 0 0.4rem;
}

h3 {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 0.15rem;
}

p { margin: 0 0 1rem; }

.eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.75;
  margin: 0 0 1.1rem;
}

.lede { font-size: 1.02em; }

/* ---------- receipt rules ---------- */
hr,
.rule {
  border: 0;
  border-top: 1px dotted var(--rule);
  margin: 1.5rem 0;
}

.rule-double {
  border: 0;
  border-top: 3px double var(--rule);
  margin: 1.75rem 0;
}

/* ---------- receipt rows ---------- */
.row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding-block: 0.42rem;
}

.row .lead { flex: 0 0 auto; }

.row .dots {
  flex: 1 1 auto;
  border-bottom: 1px dotted var(--rule);
  translate: 0 -0.28em;
  min-width: 1.5rem;
}

.row .meta {
  flex: 0 0 auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row .meta em {
  display: block;
  font-style: normal;
  font-size: 0.76rem;
  opacity: 0.72;
}

/* service block */
.svc { padding-block: 1.15rem; }
.svc p { margin: 0.35rem 0 0; font-size: 0.88rem; opacity: 0.88; }

/* ---------- hours ---------- */
.hours .row .meta { min-width: 8.5rem; }
.today {
  background: currentColor;
  border-radius: 2px;
}
.today > * { color: var(--bg); }
.today .dots { border-bottom-color: transparent; }

/* ---------- call button ---------- */
.tel {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-size: clamp(1rem, 3.6vw, 1.35rem);
  letter-spacing: 0.01em;
  text-decoration: none;
  padding: 0.95rem 1.3rem;
  min-height: 52px;
  border: 2px solid currentColor;
  background: transparent;
  color: inherit;
  transition: background 180ms ease, color 180ms ease;
}

.tel:hover { background: currentColor; }
.tel:hover span { color: var(--bg); }
.tel span { transition: color 180ms ease; }

.tel-solid {
  background: currentColor;
  border-color: currentColor;
}
.tel-solid span { color: var(--bg); }
.tel-solid:hover { background: transparent; }
.tel-solid:hover span { color: inherit; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

/* ---------- drag band ---------- */
.band-wrap {
  padding-block: clamp(2.5rem, 7vw, 4rem);
  overflow: hidden;
}

.band-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.band-head .hint {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.7;
  white-space: nowrap;
}

.band {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: grab;
  padding: 0.25rem var(--pad) 1.25rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: pan-x pan-y;
}

.band::-webkit-scrollbar { display: none; }
.band.is-dragging { cursor: grabbing; scroll-behavior: auto; }
.band.is-dragging * { user-select: none; pointer-events: none; }

.card {
  flex: 0 0 auto;
  width: min(74vw, 300px);
  scroll-snap-align: start;
}

.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
  transition: filter 260ms ease;
}

.card:hover img { filter: grayscale(0) contrast(1); }

.card figcaption {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding-top: 0.5rem;
  opacity: 0.85;
}

.card figcaption b {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- quote ---------- */
blockquote {
  margin: 0;
  font-size: 1.05em;
  line-height: 1.5;
}

blockquote footer {
  margin-top: 0.9rem;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.78;
}

/* ---------- footer ---------- */
footer.site {
  padding-block: clamp(2.5rem, 7vw, 4rem);
  border-top: 1px dotted var(--rule);
}

.claim-banner {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  padding: 0.7rem 0.85rem;
  margin-bottom: 1.25rem;
  border: 1px dotted var(--rule);
  background: color-mix(in srgb, currentColor 7%, transparent);
  opacity: 0.85;
}

.claim-banner:hover { opacity: 1; text-decoration: underline; }

.attribution {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  opacity: 0.7;
  margin: 0;
}

.attribution a { text-decoration: none; }
.attribution a:hover { text-decoration: underline; }

.foot-meta {
  font-size: 0.72rem;
  opacity: 0.75;
  margin: 0 0 1.25rem;
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .card img { filter: grayscale(0); }
}
