/* Cần Thơ Ford V2 / P4.1D.1 — Bold Navigation Refinement (0.7.95)
 * Canonical header stylesheet (supersedes the P4.1D 0.7.94 version of this same file; no extra override layer).
 *
 * What this file owns
 *  - Header height tokens: --ctf-header-h (header only) and --ctf-header-offset (header + WP admin bar).
 *    Other sticky components (vehicle tabs, service nav, buy-tools summary) read --ctf-header-offset
 *    so they can never drift from the real header height again.
 *  - Navy header, white logo on the bar (no frame), navigation pills, gradient CTA, Ford mega menu.
 *
 * Cascade notes (root causes fixed here, not patched with !important)
 *  - typography-system-p35.css sets nav font-weight with `body .ctf-site-header :is(...)` (0,2,2). Nav typography
 *    below uses `body .ctf-site-header …` and loads after it, so weight/size are deterministic.
 *  - Desktop and mobile rules live in separate media queries, so pill/hover rules never fight the mobile panel.
 *
 * Unchanged by design: header.php contact routing (tel:/label), mega-menu data & links, header-navigation-p41.js.
 */

/* ------------------------------------------------------------------ tokens */
:root {
  --ctf-header-h: 66px;           /* total header height incl. 1px bottom border */
}
body {
  --ctf-admin-bar-h: 0px;
  --ctf-header-offset: calc(var(--ctf-header-h) + var(--ctf-admin-bar-h));
}
body.admin-bar { --ctf-admin-bar-h: 32px; }
@media (max-width: 1160px) { :root { --ctf-header-h: 64px; } }
@media (max-width: 782px)  { body.admin-bar { --ctf-admin-bar-h: 46px; } }
@media (max-width: 650px)  { :root { --ctf-header-h: 62px; } }
@media (max-width: 600px)  { body.admin-bar { --ctf-admin-bar-h: 0px; } } /* admin bar scrolls away on small screens */

/* ------------------------------------------------------------------ bar */
.ctf-site-header {
  --ctf-nav-pill-bg: rgba(255,255,255,.14);      /* approved light hover pill ("Tin tức") */
  --ctf-nav-pill-line: rgba(255,255,255,.09);
  position: sticky;
  top: 0;
  z-index: 700;
  background: linear-gradient(105deg,#061a42 0%,#072b6c 65%,#063986 100%);
  border-bottom: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 5px 16px rgba(5,29,71,.12);
}
/* Respect the WordPress admin bar in authenticated staging views. */
body.admin-bar .ctf-site-header { top: 32px; }
@media (max-width: 782px) { body.admin-bar .ctf-site-header { top: 46px; } }
@media (max-width: 600px) { body.admin-bar .ctf-site-header { top: 0; } }
.ctf-site-header::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,#2b7be9 0%,#78b1ff 50%,#2b7be9 100%);
  pointer-events: none;
}
.ctf-site-header .ctf-header-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(120px,1fr) auto minmax(120px,1fr);
  align-items: center;
  gap: clamp(12px,1.35vw,24px);
  height: calc(var(--ctf-header-h) - 1px);
}

/* Logo: the supplied white logo sits directly on navy. No frame, no fill, no recolouring. */
.ctf-site-header .ctf-brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 44px;
  flex: none;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 6px;
  box-shadow: none;
}
.ctf-site-header .ctf-logo-image,
.ctf-site-header .ctf-logo-image--default {
  display: block;
  width: auto;
  height: 46px;
  max-width: 120px;
  object-fit: contain;
}

/* ------------------------------------------------------------------ navigation (shared) */
.ctf-site-header .ctf-nav {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.ctf-site-header .ctf-nav-vehicles { display: flex; align-items: center; }
.ctf-site-header .ctf-nav .ctf-nav-vehicles-toggle { gap: 8px; cursor: pointer; }
.ctf-site-header .ctf-nav .ctf-nav-vehicles-toggle svg { display: none; }
.ctf-site-header .ctf-nav > a::after { display: none; }
.ctf-site-header .ctf-nav .ctf-nav-vehicles-toggle::after {
  content: "";
  display: block;
  position: static;
  width: 7px; height: 7px;
  margin-left: 1px;
  border: solid currentColor;
  border-width: 0 1.7px 1.7px 0;
  border-radius: 0;
  background: none;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .16s ease;
}
.ctf-site-header .ctf-nav .ctf-nav-vehicles-toggle[aria-expanded="true"]::after {
  transform: translateY(2px) rotate(225deg);
}
body .ctf-site-header .ctf-nav > a,
body .ctf-site-header .ctf-nav .ctf-nav-vehicles-toggle {
  font-family: var(--ctf-font,"Source Sans 3","Segoe UI",Arial,sans-serif);
  font-size: var(--ctf-type-nav,.9375rem);
  font-weight: 600;                 /* one weight for every item and state: no width shift on hover/active */
  line-height: 1.3;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ call-to-action: Option C gradient */
.ctf-site-header .ctf-header-tools {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 12px;
  margin: 0;
  padding-left: clamp(12px,1.25vw,19px);
  border-left: 1px solid rgba(255,255,255,.22);
}
/* Every gradient stop keeps >= 4.5:1 with white text (lightest #1a6fe3 = 4.74:1). No glow, no neon. */
.ctf-site-header .ctf-header-contact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  background-color: #0b5bd3;
  background-image: linear-gradient(120deg,#1a6fe3 0%,#0b5bd3 55%,#0847a6 100%);
  background-size: 150% 100%;
  background-position: 100% 0;      /* resting: deeper end of the gradient */
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.26), 0 6px 14px rgba(2,12,40,.30);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  transition: background-position .28s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.ctf-site-header .ctf-header-contact:hover {
  color: #fff;
  background-position: 0 0;         /* hover: gradient slides to its brighter end */
  border-color: rgba(255,255,255,.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.34), 0 8px 18px rgba(2,12,40,.36);
  transform: translateY(-1px);
}
.ctf-site-header .ctf-header-contact:active { transform: translateY(0); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 3px 8px rgba(2,12,40,.3); }
.ctf-site-header .ctf-header-contact svg {
  width: 18px; height: 18px;
  flex: none;
  stroke-width: 2;                  /* crisper handset at 18px */
}

/* Focus: always visible. Light ring on navy; Ford-blue ring on the white mega panel. */
.ctf-site-header :is(.ctf-nav > a,.ctf-nav-vehicles-toggle,.ctf-header-contact,.ctf-menu-toggle,.ctf-brand):focus-visible,
.ctf-site-header .ctf-vehicle-mega__head a:focus-visible {
  outline: 3px solid #74abff;
  outline-offset: 3px;
}
.ctf-site-header .ctf-vehicle-mega__item:focus-visible {
  outline: 3px solid #0b5bd3;
  outline-offset: -3px;
}
.ctf-site-header .ctf-menu-toggle { font-size: 0; color: #fff; }
.ctf-site-header .ctf-menu-toggle svg { width: 23px; height: 23px; }
.ctf-site-header .ctf-menu-toggle__close { display: none; }
.ctf-site-header .ctf-menu-toggle.is-open .ctf-menu-toggle__open { display: none; }
.ctf-site-header .ctf-menu-toggle.is-open .ctf-menu-toggle__close { display: block; }

/* ------------------------------------------------------------------ desktop navigation */
@media (min-width: 1161px) {
  .ctf-site-header .ctf-nav {
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 2px;
    overflow: visible;
    max-height: none;
    white-space: nowrap;
  }
  .ctf-site-header .ctf-nav > a,
  .ctf-site-header .ctf-nav .ctf-nav-vehicles-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
    min-height: 44px;
    padding: 10px clamp(9px,.85vw,15px);
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: #fff;
    transition: color .16s ease, background-color .16s ease, border-color .16s ease;
  }
  /* hover = active = expanded: ONE light navy pill (the approved "Tin tức" hover). Never a solid white pill. */
  body .ctf-site-header .ctf-nav > a:hover,
  body .ctf-site-header .ctf-nav > a[aria-current="page"],
  body .ctf-site-header .ctf-nav .ctf-nav-vehicles-toggle:hover,
  body .ctf-site-header .ctf-nav .ctf-nav-vehicles.is-current .ctf-nav-vehicles-toggle,
  body .ctf-site-header .ctf-nav .ctf-nav-vehicles-toggle[aria-expanded="true"] {
    color: #fff;
    background-color: var(--ctf-nav-pill-bg);
    border-color: var(--ctf-nav-pill-line);
    box-shadow: none;
  }
  /* Product discovery panel (overlay: never pushes page content). */
  .ctf-site-header .ctf-vehicle-mega {
    position: absolute;
    top: calc(100% - 1px);
    left: 50%; right: auto;
    width: var(--ctf-menu-viewport-width,100vw);
    max-width: none;
    max-height: calc(100vh - var(--ctf-header-offset) - 12px);
    max-height: calc(100dvh - var(--ctf-header-offset) - 12px);
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-50%);
    padding: 0;
    border: 0;
    border-top: 1px solid #dce7f3;
    border-bottom: 1px solid #dce7f3;
    border-radius: 0;
    background: #fff;
    box-shadow: 0 24px 48px rgba(4,27,70,.17);
    white-space: normal;
    z-index: 760;
  }
}

/* ------------------------------------------------------------------ mega menu content (shared) */
.ctf-site-header .ctf-vehicle-mega__inner {
  display: grid;
  grid-template-columns: 218px minmax(0,1fr);
  gap: 23px;
  align-items: stretch;
  width: min(100%,1260px);
  min-width: 0;
  margin: 0 auto;
  padding: 20px 22px 22px;
}
.ctf-site-header .ctf-vehicle-mega__intro {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 20px 17px 18px 20px;
  background: linear-gradient(145deg,#07224c 0%,#0b438b 100%);
  border: 1px solid rgba(14,76,155,.25);
  border-radius: 12px;
  overflow: hidden;
}
.ctf-site-header .ctf-vehicle-mega__intro::after {
  content: "";
  position: absolute;
  right: -45px; bottom: -53px;
  width: 180px; height: 180px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 0 0 32px rgba(255,255,255,.025), 0 0 0 64px rgba(255,255,255,.022);
  pointer-events: none;
}
.ctf-site-header .ctf-vehicle-mega__intro > * { position: relative; z-index: 1; }
.ctf-site-header .ctf-vehicle-mega__eyebrow {
  color: #aad0ff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .095em;
}
.ctf-site-header .ctf-vehicle-mega__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0;
  margin: 0;
  width: 100%;
}
.ctf-site-header .ctf-vehicle-mega__head strong {
  color: #fff;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.08;
}
.ctf-site-header .ctf-vehicle-mega__head p {
  margin: 9px 0 7px;
  color: #e0eaff;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
}
.ctf-site-header #ctf-vehicle-mega .ctf-vehicle-mega__head a {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  min-height: 36px;
  padding: 3px 0;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  white-space: normal;
}
.ctf-site-header #ctf-vehicle-mega .ctf-vehicle-mega__head a::after,
.ctf-site-header #ctf-vehicle-mega .ctf-vehicle-mega__item::after { display: none; }
.ctf-site-header .ctf-vehicle-mega__list {
  display: grid;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 4px;
  align-items: stretch;
  min-width: 0;
}
.ctf-site-header #ctf-vehicle-mega .ctf-vehicle-mega__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 10px 5px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  transform: none;
  text-align: center;
  color: #151515;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.ctf-site-header #ctf-vehicle-mega .ctf-vehicle-mega__item:hover,
.ctf-site-header #ctf-vehicle-mega .ctf-vehicle-mega__item:focus-visible {
  border-color: #e8eff8;
  background: #f0f5fc;
  box-shadow: none;
  transform: translateY(-2px);
}
.ctf-site-header .ctf-vehicle-mega__art {
  display: grid;
  place-items: center;
  width: 100%;
  height: 132px;
  min-width: 0;
  margin: 0 0 8px;
  padding: 6px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
}
.ctf-site-header .ctf-vehicle-mega__art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transform: scale(calc(var(--ctf-home-car-scale,1) * .88));
  transition: transform .22s ease;
}
.ctf-site-header #ctf-vehicle-mega .ctf-vehicle-mega__item:hover .ctf-vehicle-mega__art img,
.ctf-site-header #ctf-vehicle-mega .ctf-vehicle-mega__item:focus-visible .ctf-vehicle-mega__art img {
  transform: scale(calc(var(--ctf-home-car-scale,1) * .93));
}
/* Transit is a taller silhouette. Dedicated full-car cut-out (menu-transit-full.webp) + optical fit: NEVER crop. */
.ctf-site-header #ctf-vehicle-mega [data-vehicle="transit"] .ctf-vehicle-mega__art { padding: 7px 5px; }
.ctf-site-header #ctf-vehicle-mega [data-vehicle="transit"] .ctf-vehicle-mega__art img,
.ctf-site-header #ctf-vehicle-mega [data-vehicle="transit"]:hover .ctf-vehicle-mega__art img,
.ctf-site-header #ctf-vehicle-mega [data-vehicle="transit"]:focus-visible .ctf-vehicle-mega__art img {
  transform: scale(.91);
}
.ctf-site-header .ctf-vehicle-mega__name {
  width: 100%;
  padding: 0;
  color: #151515;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.26;
}
.ctf-site-header .ctf-vehicle-mega__detail {
  width: 100%;
  padding: 4px 0 0;
  color: #595959;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

/* ------------------------------------------------------------------ tablet + mobile (<= 1160px) */
@media (max-width: 1160px) {
  .ctf-site-header .ctf-header-inner { display: flex; gap: 10px; }
  .ctf-site-header .ctf-logo-image,
  .ctf-site-header .ctf-logo-image--default { height: 44px; max-width: 110px; }
  .ctf-site-header .ctf-header-tools { margin-left: auto; gap: 9px; padding-left: 0; border-left: 0; }
  .ctf-site-header .ctf-header-contact { display: inline-flex; padding: 0 16px; }
  .ctf-site-header .ctf-menu-toggle {
    display: inline-grid;
    place-items: center;
    width: 44px; height: 44px;
    margin: 0;
    border: 1px solid rgba(255,255,255,.38);
    border-radius: 11px;
    background: rgba(255,255,255,.10);
    color: #fff;
  }
  .ctf-site-header .ctf-nav {
    display: none;
    position: absolute;
    top: calc(100% - 1px);
    left: 0; right: 0;
    z-index: 750;
    width: auto;
    max-height: calc(100vh - var(--ctf-header-offset) - 8px);
    max-height: calc(100dvh - var(--ctf-header-offset) - 8px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 11px 13px 17px;
    border: 1px solid #e1eaf3;
    border-radius: 0 0 15px 15px;
    background: #fff;
    box-shadow: 0 22px 38px rgba(10,31,60,.12);
    white-space: normal;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .ctf-site-header .ctf-nav.is-open { display: flex; }
  .ctf-site-header .ctf-nav > a,
  .ctf-site-header .ctf-nav .ctf-nav-vehicles-toggle {
    display: flex;
    justify-content: space-between;
    width: 100%;
    min-height: 52px;
    padding: 13px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #151515;
    text-align: left;
  }
  /* The panel is white, so the same "light pill" idea is a soft Ford-blue tint here. */
  body .ctf-site-header .ctf-nav > a:hover,
  body .ctf-site-header .ctf-nav > a[aria-current="page"],
  body .ctf-site-header .ctf-nav .ctf-nav-vehicles-toggle:hover,
  body .ctf-site-header .ctf-nav .ctf-nav-vehicles.is-current .ctf-nav-vehicles-toggle,
  body .ctf-site-header .ctf-nav .ctf-nav-vehicles-toggle[aria-expanded="true"] {
    background-color: #edf4ff;
    border-color: transparent;
    box-shadow: none;
    color: #0b5bd3;
  }
  .ctf-site-header .ctf-nav :is(a,button):focus-visible { outline-color: #0b5bd3; outline-offset: -3px; }
  .ctf-site-header .ctf-nav-vehicles { display: block; }
  .ctf-site-header .ctf-vehicle-mega {
    position: static;
    left: auto; right: auto; top: auto;
    width: auto;
    transform: none;
    margin: 2px 0 8px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    box-shadow: none;
    background: #f6f9fd;
    overflow: visible;
  }
  .ctf-site-header .ctf-vehicle-mega__inner { display: block; width: auto; padding: 13px 10px; }
  .ctf-site-header .ctf-vehicle-mega__intro {
    display: block;
    padding: 0 8px 9px;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
  }
  .ctf-site-header .ctf-vehicle-mega__intro::after { display: none; }
  .ctf-site-header .ctf-vehicle-mega__eyebrow { display: none; }
  .ctf-site-header .ctf-vehicle-mega__head { display: flex; flex-direction: row; justify-content: space-between; align-items: center; gap: 10px; }
  .ctf-site-header .ctf-vehicle-mega__head strong { font-size: 17px; line-height: 1.3; color: #151515; }
  .ctf-site-header .ctf-vehicle-mega__head p { display: none; }
  .ctf-site-header #ctf-vehicle-mega .ctf-vehicle-mega__head a { font-size: 14px; white-space: nowrap; min-height: 44px; padding: 0; color: #0b5bd3; }
  .ctf-site-header .ctf-vehicle-mega__head a:focus-visible { outline-color: #0b5bd3; }
  .ctf-site-header .ctf-vehicle-mega__list { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
  .ctf-site-header .ctf-vehicle-mega__art { height: 108px; }
  .ctf-site-header .ctf-vehicle-mega__name { font-size: 16px; }
  .ctf-site-header .ctf-vehicle-mega__detail { font-size: 14px; }
}
@media (max-width: 650px) {
  .ctf-site-header .ctf-logo-image,
  .ctf-site-header .ctf-logo-image--default { height: 42px; max-width: 100px; }
  .ctf-site-header .ctf-header-contact {
    width: 44px; min-width: 44px; height: 44px; min-height: 44px;
    padding: 0;
  }
  .ctf-site-header .ctf-header-contact span { display: none; }
  .ctf-site-header .ctf-header-contact svg { width: 19px; height: 19px; }
  .ctf-site-header .ctf-nav { padding: 9px 10px 16px; }
  .ctf-site-header .ctf-vehicle-mega__head { flex-wrap: wrap; gap: 5px 10px; }
  .ctf-site-header .ctf-vehicle-mega__list { display: flex; flex-direction: column; gap: 0; }
  .ctf-site-header #ctf-vehicle-mega .ctf-vehicle-mega__item {
    display: grid;
    grid-template-columns: 102px minmax(0,1fr);
    grid-template-rows: auto auto;
    align-content: center;
    justify-items: start;
    gap: 0 12px;
    min-height: 92px;
    padding: 8px 6px;
    border-radius: 9px;
    text-align: left;
  }
  .ctf-site-header #ctf-vehicle-mega .ctf-vehicle-mega__item + .ctf-vehicle-mega__item {
    border-top: 1px solid #e4edf6;
    border-radius: 0;
  }
  .ctf-site-header .ctf-vehicle-mega__art { grid-row: 1/span 2; width: 102px; height: 75px; padding: 2px; margin: 0; }
  .ctf-site-header .ctf-vehicle-mega__name { align-self: end; font-size: 16px; }
  .ctf-site-header .ctf-vehicle-mega__detail { align-self: start; font-size: 14px; padding: 3px 0 0; }
}

/* ------------------------------------------------------------------ preferences */
@media (prefers-reduced-motion: reduce) {
  .ctf-site-header .ctf-vehicle-mega__item,
  .ctf-site-header .ctf-vehicle-mega__art img,
  .ctf-site-header .ctf-header-contact,
  .ctf-site-header .ctf-nav > a,
  .ctf-site-header .ctf-nav .ctf-nav-vehicles-toggle::after { transition: none !important; }
  .ctf-site-header .ctf-header-contact:hover { transform: none; }
}
/* Windows High Contrast / forced colours: backgrounds are dropped, so the state must be a visible border. */
@media (forced-colors: active) {
  .ctf-site-header .ctf-nav > a[aria-current="page"],
  .ctf-site-header .ctf-nav .ctf-nav-vehicles.is-current .ctf-nav-vehicles-toggle,
  .ctf-site-header .ctf-nav .ctf-nav-vehicles-toggle[aria-expanded="true"] { border-color: Highlight; }
  .ctf-site-header .ctf-header-contact { border-color: ButtonText; }
}
