/* CarrXpert Saint-Léonard — "precision atelier" theme.
   Dark graphite, CarrXpert red accent, condensed industrial display type.
   Fonts are self-hosted (assets/fonts/) — no third-party requests. */

/* ---------------------------------------------------------------- fonts */

/* latin-ext faces first, latin last: with overlapping unicode-ranges the
   last-declared face wins, and chars like œ live only in the latin files. */
@font-face {
  font-family: "Big Shoulders Display";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/big-shoulders-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  font-display: swap;
  src: url("/assets/fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Big Shoulders Display";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/big-shoulders-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  font-display: swap;
  src: url("/assets/fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------- tokens */

:root {
  /* Defaults — overridden at runtime from content/config.js (brand.colors). */
  --brand-primary: #d81e2c;
  --brand-ink: #f2f4f7;
  --brand-surface: #0b0d11;
  --brand-surface-raised: #151920;
  --brand-muted: #9aa2ae;
  --brand-line: rgba(255, 255, 255, 0.08);

  /* Brighter red for small text/marks on the dark ground (AA contrast). */
  --accent-bright: #f4374b;
  --open-green: #2bd576;
  --text-soft: #b9c0ca;

  --font-display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --font-body: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Helvetica, Arial, sans-serif;

  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");

  --maxw: 640px;
  --gap: 1.25rem;
  --radius: 16px;
}

/* Derive the bright accent from the owner-configurable primary when supported.
   (A plain re-declaration wouldn't fall back: custom properties accept any
   token stream, so the literal above must live behind @supports instead.) */
@supports (color: color-mix(in srgb, red 50%, white)) {
  :root { --accent-bright: color-mix(in srgb, var(--brand-primary) 68%, white); }
}

/* ----------------------------------------------------------------- base */

* { box-sizing: border-box; }

html { color-scheme: dark; overflow-x: hidden; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--brand-ink);
  background:
    radial-gradient(640px 340px at 50% -90px, rgba(216, 30, 44, 0.16), transparent 70%),
    radial-gradient(900px 520px at 88% 6%, rgba(62, 84, 122, 0.10), transparent 65%),
    var(--brand-surface);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  /* Leave room for the floating action dock (+ iOS safe area). */
  padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
}

/* Film-grain overlay — keeps the dark ground from looking flat. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: rgba(216, 30, 44, 0.55); color: #fff; }

main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gap); }

/* --------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 13, 17, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--brand-line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.6rem var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.topbar__brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.topbar__brand::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  background: var(--brand-primary);
  border-radius: 2px;
  transform: rotate(45deg);
}
.lang-toggle {
  min-height: 44px;
  min-width: 56px;
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--brand-ink);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.lang-toggle:hover { background: rgba(255, 255, 255, 0.09); }
.lang-toggle:focus-visible { outline: 3px solid var(--accent-bright); outline-offset: 2px; }

/* ----------------------------------------------------------------- hero */

.hero { position: relative; text-align: center; padding: 2.75rem 0 1rem; }

/* Faint diagonal panel lines, fading toward the edges. */
.hero::before {
  content: "";
  position: absolute;
  inset: -2.75rem 0 0; /* no side bleed — it would create horizontal scroll */
  z-index: -1;
  background: repeating-linear-gradient(
    115deg,
    rgba(255, 255, 255, 0.040) 0 1px,
    transparent 1px 26px
  );
  -webkit-mask-image: radial-gradient(85% 95% at 50% 18%, #000 25%, transparent 78%);
  mask-image: radial-gradient(85% 95% at 50% 18%, #000 25%, transparent 78%);
}

.hero__eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent-bright);
}
.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 750;
  font-size: clamp(2.9rem, 13vw, 4.6rem);
  line-height: 0.92;
  letter-spacing: 0.012em;
  text-transform: uppercase;
  text-wrap: balance;
}
.hero__subtitle {
  margin: 0.85rem 0 0;
  color: var(--brand-muted);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

/* Open/closed status pill (filled in by JS; stays hidden on failure). */
.status[hidden] { display: none; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 1.1rem 0 0;
  padding: 0.5rem 1rem;
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status__dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-muted);
}
.status--open .status__dot { background: var(--open-green); }
.status--closed .status__dot { background: var(--accent-bright); }

/* Certification chips */
.badges {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  padding: 0;
  margin: 1.4rem 0 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--brand-line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 0.45rem 0.85rem 0.45rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge::before {
  content: "";
  width: 13px;
  height: 13px;
  flex: none;
  background: var(--accent-bright);
  -webkit-mask: var(--icon-check) center / contain no-repeat;
  mask: var(--icon-check) center / contain no-repeat;
}

/* ---------------------------------------------------------------- cards */

.cards {
  counter-reset: card;
  display: grid;
  gap: 0.9rem;
  margin-top: 1.9rem;
}
.card {
  background: linear-gradient(180deg, var(--brand-surface-raised), #11141a);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius);
  padding: 1.35rem 1.3rem 1.45rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.card h2 {
  counter-increment: card;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.95rem;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.card h2::before {
  content: counter(card, decimal-leading-zero);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-bright);
}
.card h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--brand-line), transparent);
}
.card p { margin: 0; color: var(--text-soft); line-height: 1.65; }

/* Hours */
.hours { list-style: none; margin: 0; padding: 0; }
.hours__row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.5rem 0;
}
.hours__day { font-weight: 600; color: var(--text-soft); }
.hours__dots {
  flex: 1;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.16);
  transform: translateY(-4px);
}
.hours__time { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.hours__time.is-closed { color: var(--brand-muted); }
.hours__row.is-today .hours__day { color: #fff; }
.hours__row.is-today .hours__day::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.5rem;
  background: var(--accent-bright);
  border-radius: 1px;
  transform: rotate(45deg) translateY(-1px);
}
.hours__row.is-today .hours__time { color: #fff; font-weight: 700; }

/* Address + phone */
.address { color: var(--text-soft); }
.phone { margin: 0.85rem 0 0; }
.phone a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #fff;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-bottom: 2px solid var(--brand-primary);
  transition: color 0.18s ease, border-color 0.18s ease;
}
.phone a:hover { color: var(--accent-bright); border-color: var(--accent-bright); }
.phone a:focus-visible { outline: 3px solid var(--accent-bright); outline-offset: 3px; }

/* --------------------------------------------------------- action dock */

.actionbar {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  transform: translateX(-50%);
  z-index: 60;
  width: min(calc(100% - 24px), 560px);
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 20px;
  background: rgba(17, 20, 26, 0.80);
  border: 1px solid rgba(255, 255, 255, 0.10);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.action {
  flex: 1;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 14px;
  color: #c9cfd8;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}
.action svg { width: 21px; height: 21px; }
.action:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.action:active { transform: scale(0.96); }
.action:focus-visible { outline: 3px solid var(--accent-bright); outline-offset: -3px; }
.action--primary {
  background: linear-gradient(180deg, #e63143, var(--brand-primary));
  color: #fff;
  box-shadow: 0 6px 18px rgba(216, 30, 44, 0.35);
}
/* White ring on the red button — the red ring would be invisible there. */
.action--primary:focus-visible { outline-color: #fff; }
/* Darken (not lighten) on hover so the white label keeps 4.5:1 contrast. */
.action--primary:hover { background: linear-gradient(180deg, #e02232, #c8101e); color: #fff; }

/* --------------------------------------------------------------- footer */

.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.25rem var(--gap) 0.5rem;
  text-align: center;
  color: var(--brand-muted);
  font-size: 0.8rem;
}

/* --------------------------------------------------------------- motion */

@media (prefers-reduced-motion: no-preference) {
  @keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(43, 213, 118, 0.45); }
    70%, 100% { box-shadow: 0 0 0 9px rgba(43, 213, 118, 0); }
  }
  .status--open .status__dot { animation: pulse 2.4s ease-out infinite; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
  }
  @keyframes dock-rise {
    from { opacity: 0; transform: translate(-50%, 16px); }
    to { opacity: 1; transform: translate(-50%, 0); }
  }
  .hero__eyebrow, .hero__title, .hero__subtitle, .status, .badges, .card {
    animation: rise 0.65s cubic-bezier(0.16, 0.84, 0.3, 1) both;
  }
  .hero__title { animation-delay: 0.05s; }
  .hero__subtitle { animation-delay: 0.10s; }
  .status { animation-delay: 0.16s; }
  .badges { animation-delay: 0.22s; }
  .card:nth-child(1) { animation-delay: 0.30s; }
  .card:nth-child(2) { animation-delay: 0.38s; }
  .card:nth-child(3) { animation-delay: 0.46s; }
  .actionbar { animation: dock-rise 0.6s cubic-bezier(0.16, 0.84, 0.3, 1) 0.5s both; }
}

@media (min-width: 480px) {
  .hero { padding-top: 3.5rem; }
}
