/* =========================================================================
   SHARED STYLES — MaltaMotors mockups
   Source of truth for: design tokens (:root vars), base resets, .container,
   header (.header / .logo / .header-btn / .btn-primary), footer.
   Edit HERE, never in inline <style> of a specific page.
   Every page (homepage.html, search.html, listing pages…) <link>s this file.
   ========================================================================= */

/* FE-Schrift — the regulatory typeface for Maltese (and German) registration
   plates. "fälschungserschwerende Schrift" = forgery-impeding script. Its
   asymmetric / open glyphs are designed to resist tampering on physical
   plates. Self-hosted at fonts/FE-FONT.woff. */
@font-face {
  font-family: 'FE-Schrift';
  font-style: normal;
  font-weight: normal;
  src: local('FE-Schrift'), local('FE-Font'), url('fonts/FE-FONT.woff') format('woff');
  font-display: swap;
}

:root {
  --red: #D32F2F;
  --red-dark: #B71C1C;
  --red-soft: #FEF2F2;

  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;
  --line: #E2E8F0;
  --line-2: #F1F5F9;
  --bg: #F8FAFC;
  --bg-2: #FFFFFF;

  --shadow-xs: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.06);
  --shadow-lg: 0 20px 40px -12px rgba(15,23,42,0.12);

  --radius: 12px;
  --radius-sm: 8px;
}

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

html, body {
  /* `overflow-x: clip` instead of `hidden` — `hidden` creates a scroll container
     which breaks `position: sticky` on all descendants (header, toolbar, sidebar).
     `clip` just visually clips overflow without touching scroll behaviour. */
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
}
body {
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Sticky footer: body is a flex column so a short <main> (e.g. /auth.html
     when the form fits in one screen) doesn't leave the footer floating in
     the middle of the viewport. On content-heavy pages this is a no-op
     because <main> already exceeds the available height. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* <main> takes all the leftover vertical space and pushes the footer down. */
body > main { flex: 1 0 auto; }
body > .footer { flex-shrink: 0; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img, svg { display: block; max-width: 100%; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }

/* ====== HEADER ====== */
.header {
  background: white;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 38px; height: 38px;
  background: var(--ink);
  border-radius: 9px;
  display: flex; align-items: flex-start; justify-content: center;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: -1.5px;
  padding-top: 6px;
  position: relative;
  overflow: hidden;
}
.logo-icon .m1 { color: #FFFFFF; }
.logo-icon .m2 { color: var(--red); }
.logo-icon::before,
.logo-icon::after {
  content: '';
  position: absolute;
  bottom: 6px;
  height: 2px;
}
.logo-icon::before { left: 5px;  right: 50%;  background: var(--red); border-radius: 1px 0 0 1px; }
.logo-icon::after  { left: 50%;  right: 5px;  background: #FFFFFF;    border-radius: 0 1px 1px 0; }
.logo-text {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--ink);
}
/* Brand mark — the period after "MaltaMotors" is always red (matches the
   logo). Class is global so it works in headers, footers, body copy. */
.dot { color: var(--red); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  transition: background 0.15s;
}
.header-btn:hover { background: var(--bg); }
.header-btn svg { width: 20px; height: 20px; display: block; }
.header-btn__icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.header-btn__badge {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  border-radius: 10px;
  box-shadow: 0 0 0 2px white;
}
.header-btn__badge[hidden] { display: none; }

.btn-primary {
  background: var(--ink);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}
.btn-primary:hover { background: #1E293B; }
.btn-primary svg { width: 14px; height: 14px; }

/* ====== FOOTER ====== */
.footer {
  background: white;
  border-top: 1px solid var(--line);
  padding: 48px 0 24px;
  margin-top: 48px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}
.footer-brand p { margin-top: 14px; font-size: 14px; max-width: 340px; color: var(--muted); line-height: 1.6; }
.footer h3,
.footer h4 /* legacy: any page that still ships h4 keeps the same look */
{ color: var(--ink); font-size: 13px; font-weight: 700; margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.8px; }
.footer ul { list-style: none; }
.footer li { margin-bottom: 10px; font-size: 14px; }
.footer a { color: var(--ink-2); }
.footer a:hover { color: var(--red); }
.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

/* ====== RESPONSIVE — shared header/footer collapse ====== */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .header-btn__label { display: none; }
  .header-btn { padding: 7px; min-width: 36px; min-height: 36px; justify-content: center; }
  .header-btn__badge { top: -5px; right: -7px; min-width: 14px; height: 14px; font-size: 9px; line-height: 14px; }
  .header-actions { gap: 4px; }
  .btn-primary { padding: 9px 14px; font-size: 13px; white-space: nowrap; }
  .btn-primary .btn-long { display: none; }
}
/* Below 480px the row is too tight for the wordmark + 3 icon-buttons +
   the Sell CTA. Drop the "MaltaMotors." text and keep only the MM tile —
   the brand mark on its own is recognisable and the row fits cleanly. */
@media (max-width: 480px) {
  .logo-text { display: none; }
}
@media (max-width: 400px) {
  .btn-primary { padding: 8px 12px; font-size: 12px; }
}

/* ====== COLOUR-SWATCH UTILITY MAP (shared by search + homepage filter modals) ====== */
/* Used as <span class="mf-swatch swatch-white"></span> next to the colour name. */
.swatch-white       { background: #ffffff; }
.swatch-black       { background: #0a0a0a; }
.swatch-grey        { background: #9ca3af; }
.swatch-blue        { background: #3b82f6; }
.swatch-red         { background: #b91c1c; }
.swatch-beige       { background: #d7c8a3; }
.swatch-brown       { background: #6b4423; }
.swatch-green       { background: #16a34a; }
.swatch-orange      { background: #f97316; }
.swatch-pink        { background: #f9a8d4; }
.swatch-purple      { background: #7c3aed; }
.swatch-yellow      { background: #eab308; }
.swatch-dark-grey   { background: #3f3f46; }
.swatch-light-grey  { background: #d4d4d8; }
.swatch-cream-ivory { background: #f5ecd7; }
.swatch-tan-cognac  { background: #c69b6d; }
.swatch-dark-brown  { background: #3e2410; }
.swatch-burgundy    { background: #6b1a2d; }
.swatch-blue-1e40af   { background: #1e40af; }
.swatch-green-166534  { background: #166534; }
.swatch-orange-ea580c { background: #ea580c; }

/* Utility helpers — replaces inline style="" attributes */
.u-mt-12     { margin-top: 12px; }
.u-icon-34   { width: 34px; height: 34px; }
.ff-count__inline { margin-left: auto; color: var(--muted); font-size: 13px; }
.ff-hint-row { padding: 8px 6px; color: var(--muted); font-size: 13px; }

/* ====== A11Y: SKIP LINK ======
   Hidden off-screen until focused via keyboard Tab. Lives in shared.css so
   every page using <a class="skip-link"> hides it correctly without each
   page redefining the rule. */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 9999;
  padding: 12px 20px;
  background: var(--ink);
  color: white;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 8px 0;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; outline: 2px solid var(--red); outline-offset: -4px; }
.sel-chip__swatch { background: var(--swatch, var(--line)); }
