/* ── 0. SELF-HOSTED FONTS ──────────────────────────────────────────
   Previously loaded from fonts.googleapis.com. Edge Tracking Prevention
   (and most ad blockers) classify fonts.gstatic.com as a tracker and abort
   the request, which dropped every page to the system fallback. These are
   the variable builds — one file per family covers all weights.

   Manrope tops out at 800, so the font-weight:900 declarations scattered
   through the pages clamp to 800. That was already true with the CDN copy;
   nothing changes visually.
------------------------------------------------------------------ */
@font-face {
  font-family: 'Manrope';
  src: url('/fonts/Manrope/Manrope-VariableFont_wght.ttf') format('truetype');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrains%20Mono/JetBrainsMono-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------------
   avtoyoxla.az — shared stylesheet
   ------------------------------------------------------------------
   One cached request instead of the same nav/footer/token rules being
   inlined into all 17 pages. Everything here is additive: it introduces
   new classes, it does not override existing page CSS.

   Contains:
     1. Canonical design tokens (single source of truth)
     2. Bilingual static-content helpers  (.l-az / .l-en)
     3. Skip link + focus-visible (accessibility)
     4. "Alətlər" nav dropdown
     5. Trust bar + footer legal line
     6. Reduced-motion + print
------------------------------------------------------------------ */

/* ── 1. CANONICAL TOKENS ───────────────────────────────────────────
   Pages still declare their own :root; these are the agreed values.
   Anything new should use var(--av-*) so there is one place to change.
------------------------------------------------------------------ */
:root {
  --av-bg:      #080808;
  --av-bg2:     #101010;
  --av-bg3:     #181818;
  --av-bg4:     #202020;
  --av-accent:  #e8ff47;
  --av-accent2: #c8e000;
  --av-white:   #ffffff;
  --av-border:  rgba(255,255,255,.08);
  --av-border2: rgba(255,255,255,.12);
  --av-muted:   rgba(255,255,255,.45);
  --av-font:    'Manrope', system-ui, -apple-system, sans-serif;
  --av-mono:    'JetBrains Mono', ui-monospace, monospace;
}

/* ── 2. BILINGUAL STATIC CONTENT ───────────────────────────────────
   The site's content used to exist only inside JavaScript objects, so
   crawlers that don't execute JS saw an empty page. Static content is
   now emitted in BOTH languages and the inactive one is hidden by CSS,
   keyed off <html lang> — which lang-seo.js already maintains.

   This is not cloaking: both versions are real, visible content and
   the switch is a user-facing control.
------------------------------------------------------------------ */
html[lang="en"] .l-az { display: none !important; }
html:not([lang="en"]) .l-en { display: none !important; }

/* Inline variants so a language span inside a sentence doesn't break flow. */
html[lang="en"] span.l-az,
html[lang="en"] a.l-az { display: none !important; }
html:not([lang="en"]) span.l-en,
html:not([lang="en"]) a.l-en { display: none !important; }

/* ── 3. ACCESSIBILITY ──────────────────────────────────────────────*/
.av-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  background: var(--av-accent);
  color: #000;
  padding: 10px 18px;
  border-radius: 0 0 8px 0;
  font: 700 14px/1 var(--av-font);
  text-decoration: none;
}
.av-skip:focus {
  left: 0;
  outline: 3px solid #fff;
}

/* Visible keyboard focus. The site had none at all — keyboard users
   could not tell where they were. */
:focus-visible {
  outline: 2px solid var(--av-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Screen-reader-only text (used for icon-only button labels). */
.av-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── 4. "ALƏTLƏR" NAV DROPDOWN ─────────────────────────────────────
   customs.html and decode.html previously had two internal links each,
   both from footers, despite being the strongest organic-traffic pages
   on the site. This exposes them (plus FAQ and the referral programme)
   from the nav on every page.

   The trigger keeps its original id (nl1 / nav-faydali) so each page's
   own setLang() still writes its label. The menu is a sibling element,
   so textContent on the trigger cannot wipe it.
------------------------------------------------------------------ */
.av-dd { position: relative; }

/* NOTE ON SPECIFICITY
   Every page inlines its own <style> AFTER this file loads, and those
   sheets carry rules like `.nav-links a { display:block; text-align:right;
   border-bottom:… }` for the mobile panel. At equal specificity the later
   sheet wins, which flattened these menu rows into a mess inside the
   hamburger. Selectors here are therefore written as
   `.av-dd .av-dd-menu a` (two classes) so they outrank `.nav-links a`. */

.av-dd .av-dd-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: -14px;
  min-width: 232px;
  background: var(--av-bg2);
  border: 1px solid var(--av-border2);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 18px 44px rgba(0,0,0,.6);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
  z-index: 200;
  list-style: none;
  margin: 0;
  text-align: left;
}
.av-dd:hover .av-dd-menu,
.av-dd:focus-within .av-dd-menu,
.av-dd .av-dd-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
/* Invisible bridge so the menu doesn't close in the gap under the trigger. */
.av-dd .av-dd-menu::before {
  content: "";
  position: absolute;
  top: -12px; left: 0; right: 0;
  height: 12px;
}
.av-dd .av-dd-menu li {
  list-style: none;
  margin: 0;
  width: auto;
}
.av-dd .av-dd-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 0;
  border-radius: 8px;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  text-align: left;
  font: 500 13.5px/1.35 var(--av-font);
  transition: background .14s, color .14s;
}
.av-dd .av-dd-menu a:hover,
.av-dd .av-dd-menu a:focus-visible {
  background: var(--av-bg3);
  color: var(--av-white);
}
.av-dd .av-dd-ic {
  flex: none;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: rgba(232,255,71,.09);
  border: 1px solid rgba(232,255,71,.16);
  font-size: 13px;
  line-height: 1;
}
.av-dd .av-dd-sub {
  display: block;
  font: 400 11px/1.3 var(--av-font);
  color: rgba(255,255,255,.34);
  margin-top: 2px;
}

/* Caret so it reads as a menu rather than a link. */
/* No href any more, so restore the affordance a link gave for free. */
.av-dd-trigger {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.av-dd-trigger::after {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  margin-left: 6px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .2s ease;
  opacity: .55;
}
.av-dd:hover .av-dd-trigger::after,
.av-dd-trigger[aria-expanded="true"]::after {
  transform: translateY(0) rotate(-135deg);
  opacity: 1;
}

/* ── MOBILE PANEL MODE ───────────────────────────────────────────────
   Driven by a class, NOT a media query.

   Each page collapses its nav at a different width — 720px on faq,
   768px on reports, 820px on decode, 860px on sample, 900px on index,
   about, contact, referral, blog and customs. A single hard-coded
   breakpoint here was wrong on every page except one: between the two
   thresholds the nav was already a hamburger while the dropdown still
   positioned itself as a desktop popover.

   av-shared.js now reads the computed style of the nav list and adds
   .av-dd-mobile when it has actually switched to panel layout, so this
   tracks each page's own breakpoint automatically.
─────────────────────────────────────────────────────────────────────── */
.av-dd.av-dd-mobile .av-dd-menu {
  position: static;
  opacity: 1;
  visibility: visible;
  transform: none;
  box-shadow: none;
  background: transparent;
  border: none;
  border-right: 1px solid var(--av-border2);
  border-radius: 0;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 0 10px 0 0;

  /* Height is what hides it here — opacity alone left it taking up space
     and every item stayed on screen. */
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease, margin .3s ease, padding .3s ease;
}
.av-dd.av-dd-mobile .av-dd-menu.open {
  max-height: 460px;
  margin: 4px 0 8px;
  padding: 2px 10px 2px 0;
}
/* Hover must not open it on touch — that fires on first tap and makes the
   menu flash open then navigate away. */
.av-dd.av-dd-mobile:hover .av-dd-menu:not(.open),
.av-dd.av-dd-mobile:focus-within .av-dd-menu:not(.open) {
  max-height: 0;
}
.av-dd.av-dd-mobile .av-dd-menu::before { display: none; }
.av-dd.av-dd-mobile .av-dd-menu a {
  display: flex;
  flex-direction: row-reverse;      /* matches the right-aligned mobile nav */
  justify-content: flex-start;
  text-align: right;
  padding: 9px 0;
  font-size: 14px;
  border-bottom: 0;
}
.av-dd.av-dd-mobile .av-dd-sub { display: none; }
.av-dd.av-dd-mobile .av-dd-ic {
  width: 22px; height: 22px;
  font-size: 11px;
}


/* ── MOBILE NAV PANEL: let it scroll ─────────────────────────────────
   index.html caps the open hamburger at `max-height: 60vh` with
   `overflow: hidden`. That was fine for five links; adding the Alətlər
   submenu pushed Qiymət, Nümunə and Blog past the cap and they were
   silently clipped off the bottom — the panel gave no indication there
   was anything below.

   `nav .nav-links.open` is one element + two classes, so it outranks the
   page's own `.nav-links.open` (two classes) regardless of load order.
   Closed state keeps overflow:hidden so the slide-down still animates.
──────────────────────────────────────────────────────────────────────── */
nav .nav-links.open {
  max-height: calc(100vh - 64px);
  max-height: calc(100dvh - 64px);   /* dvh accounts for mobile browser chrome */
  overflow-y: auto;
  overscroll-behavior: contain;      /* stops the page scrolling behind it */
  -webkit-overflow-scrolling: touch;
}

/* A thin scrollbar so it's visibly scrollable on desktop. */
nav .nav-links.open::-webkit-scrollbar { width: 3px; }
nav .nav-links.open::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.18);
  border-radius: 3px;
}

/* Belt and braces: if av-shared.js fails to load, .av-dd-mobile never
   gets applied and the submenu would render permanently expanded — the
   exact failure this file has already caused once. On a touch device
   there is no hover, so an expanded popover is never correct there. */
@media (hover: none) {
  /* Only when it is rendering inline inside a panel — a tablet in
     landscape still gets the normal absolutely-positioned popover, which
     must not be height-clamped. */
  .av-dd.av-dd-mobile .av-dd-menu:not(.open) {
    max-height: 0;
    overflow: hidden;
  }
  /* And if the JS never ran at all, nothing has .av-dd-mobile — so also
     collapse any menu that is in normal flow rather than positioned. */
  .av-dd .av-dd-menu:not(.open):not([style*="position"]) {
    max-height: 0;
  }
}

/* ── 5. TRUST BAR + FOOTER LEGAL ───────────────────────────────────*/
.av-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 26px;
  padding: 18px 20px;
  border-top: 1px solid var(--av-border);
  border-bottom: 1px solid var(--av-border);
  background: rgba(255,255,255,.012);
}
.av-trust-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 600 12.5px/1.3 var(--av-font);
  color: rgba(255,255,255,.55);
}
.av-trust-item b {
  color: var(--av-accent);
  font-weight: 800;
}
.av-trust-ic {
  width: 17px; height: 17px;
  flex: none;
  stroke: var(--av-accent);
  fill: none;
  stroke-width: 2.2;
}
.av-legal {
  font: 400 11.5px/1.6 var(--av-font);
  color: rgba(255,255,255,.24);
  text-align: center;
  padding: 14px 20px 26px;
}
.av-legal b { color: rgba(255,255,255,.4); font-weight: 700; }

@media (max-width: 620px) {
  .av-trust { gap: 9px 16px; padding: 14px 14px; }
  .av-trust-item { font-size: 11.5px; }
}

/* ── 6. MOTION + PRINT ─────────────────────────────────────────────*/
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  nav, footer, .av-skip, .av-trust, .lang-sw { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
}

/* ── Avatar ─────────────────────────────────────────────────────────
   Applies to every avatar element regardless of which class a page
   happens to use (.u-avatar, .u-av, .user-avatar, .nav-user .avatar) —
   they were defined separately per page and had already drifted apart.
   Only the image state lives here; the letter-fallback styling stays
   with each page's own rule. */
.u-avatar.has-img, .u-av.has-img, .user-avatar.has-img,
.nav-user .avatar.has-img, .user-info-avatar.has-img{
  background:rgba(255,255,255,.08)!important;
  padding:0;
  overflow:hidden;              /* without this a square PNG pokes out of the circle */
}
.u-avatar img, .u-av img, .user-avatar img,
.nav-user .avatar img, .user-info-avatar img{
  width:100%;height:100%;object-fit:cover;border-radius:50%;display:block;
}
