/* ==========================================================================
   MATEK SITE HEADER — single source of truth (index, tarifs, videos, apropos)
   Uses design tokens from capps.css :root where loaded.
   ========================================================================== */

:root {
  --matek-header-h: 75px;
  --matek-header-pad-x: 40px;
  --matek-nav-gap: 28px;
  --matek-actions-gap: 16px;
  /* Alias: tokens defined in capps.css :root; fallback keeps header sane if capps omitted */
  --matek-font-nav: var(--nav-font-size, 16px);
  --matek-logo-h: 50px;
  --header-h: var(--matek-header-h);
}

/*
 * index.html loads Bootstrap 5; inner pages use Bootstrap 4. Their reboot / html rules
 * can yield different root rem + text-size behavior so the same px header looks smaller
 * on the home page. Lock the document root here (this file loads last on all routes).
 */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Fixed header: anchor scroll targets show below the bar (tune to match --matek-header-h). */
section {
  scroll-margin-top: 100px;
}

/* Offres menu: keep extra links in DOM but hidden (see navbar HTML). */
.hidden-item {
  display: none !important;
}

/* index (CAPPS) : hero already offsets fixed header — avoid double spacing */
body.matek-page:not(.matek-page--index) {
  padding-top: var(--matek-header-h);
}

body.matek-drawer-open {
  overflow: hidden;
}

/* ----- shell ----- */
.matek-site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  width: 100%;
  height: var(--matek-header-h);
  min-height: var(--matek-header-h);
  margin: 0;
  padding: 0;
  background: var(--accent-lighter-color);
  border-bottom: 1px solid var(--primary-lighter-color);
  box-shadow: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease,
    backdrop-filter 0.2s ease;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  font-size: var(--nav-font-size, 16px);
  font-weight: var(--nav-font-weight, 500);
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
}

/*
 * Lock all header descendants to the same px + weight so Bootstrap 4/5, body, and
 * portages/site.css (e.g. global `li { font-size: … }`) cannot diverge — especially index vs videos.
 */
.matek-site-header *,
.matek-site-header *::before,
.matek-site-header *::after {
  font-size: var(--nav-font-size, 16px) !important;
  font-weight: var(--nav-font-weight, 500) !important;
  line-height: 1.2 !important;
}

.matek-site-header .matek-brand__text,
.matek-site-header .matek-brand__accent,
.matek-site-header .matek-brand__text b {
  font-weight: 800 !important;
}

.matek-site-header .matek-brand__text {
  letter-spacing: -0.01em;
  line-height: 1 !important;
}

.matek-site-header i {
  line-height: 1 !important;
  font-weight: 400 !important;
}

.matek-site-header .matek-dropdown__icon i {
  font-size: 17px !important;
}

.matek-site-header nav a {
  text-decoration: none;
}

.matek-site-header.is-scrolled {
  box-shadow: 0 10px 28px
    color-mix(in srgb, var(--text-primary-darker-color) 10%, transparent);
  border-bottom-color: color-mix(
    in srgb,
    var(--primary-lighter-color) 88%,
    transparent
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.matek-site-header__inner {
  box-sizing: border-box;
  max-width: 1280px;
  width: 100%;
  height: 100%;
  min-height: var(--matek-header-h);
  margin: 0 auto;
  padding: 0 var(--matek-header-pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  overflow: visible;
}

/* ----- brand ----- */
.matek-brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary-darker-color);
}

.matek-brand__logo,
img.matek-brand__logo {
  display: block;
  flex-shrink: 0;
  height: var(--matek-logo-h) !important;
  width: auto !important;
  max-width: none !important;
  object-fit: contain;
  object-position: left center;
}

.matek-brand__text {
  white-space: nowrap;
}

.matek-brand__accent {
  color: var(--primary-darker-color);
}

/* ----- main nav ----- */
.matek-nav {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: visible;
}

/* Legacy portages/site.css defines global `li { list-style-type: disc; padding-bottom: 16px; }`
   which would otherwise show bullets and break vertical alignment in the header. */
.matek-site-header nav.matek-nav ul,
.matek-site-header .matek-dropdown__list {
  list-style: none;
  list-style-type: none;
  margin: 0;
  padding: 0;
  padding-left: 0;
  padding-inline-start: 0;
}

.matek-site-header li {
  list-style: none;
  list-style-type: none;
  margin: 0;
  padding-bottom: 0;
  padding-left: 0;
}

.matek-site-header li::marker {
  content: none;
  font-size: 0;
}

/* Restore dropdown row spacing (overrides margin reset above) */
.matek-site-header .matek-dropdown__item {
  margin: 2px 0;
}

.matek-nav__list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--matek-nav-gap);
  margin: 0;
  padding: 0;
  list-style: none;
  list-style-type: none;
  overflow: visible;
}

.matek-nav__item {
  position: relative;
  margin: 0;
  padding: 0;
  overflow: visible;
}

.matek-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--text-primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
  position: relative;
}

.matek-nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--primary-color);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.2s ease;
}

.matek-nav__link:hover,
.matek-nav__link:focus-visible {
  color: var(--primary-color);
  outline: none;
}

.matek-nav__link:hover::after,
.matek-nav__link:focus-visible::after {
  transform: scaleX(1);
}

.matek-nav__chevron {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  opacity: 0.72;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 111.08 1.04l-4.25 4.39a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 111.08 1.04l-4.25 4.39a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E")
    center / contain no-repeat;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.matek-nav__item--has-dropdown:hover .matek-nav__chevron,
.matek-nav__item--has-dropdown:focus-within .matek-nav__chevron,
.matek-nav__item--has-dropdown.is-open .matek-nav__chevron {
  opacity: 1;
  transform: rotate(-180deg);
}

/* ----- dropdown ----- */
.matek-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin: 0;
  padding: 10px 0 0;
  min-width: 280px;
  max-width: min(520px, calc(100vw - 32px));
  width: max-content;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 10001;
}

.matek-nav__item--dropdown-wide .matek-dropdown {
  min-width: 440px;
}

.matek-nav__item--dropdown-narrow .matek-dropdown {
  min-width: 300px;
  max-width: 360px;
}

.matek-nav__item--has-dropdown:hover .matek-dropdown,
.matek-nav__item--has-dropdown:focus-within .matek-dropdown,
.matek-nav__item--has-dropdown.is-open .matek-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.matek-dropdown__panel {
  margin: 0;
  padding: 12px;
  list-style: none;
  background: var(--accent-lighter-color);
  border: 1px solid color-mix(in srgb, var(--primary-lighter-color) 88%, transparent);
  border-radius: 12px;
  box-shadow: 0 18px 40px
    color-mix(in srgb, var(--text-primary-darker-color) 14%, transparent);
  max-height: min(72vh, 620px);
  overflow-y: auto;
}

.matek-dropdown__heading {
  margin: 0 0 8px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid
    color-mix(in srgb, var(--primary-lighter-color) 92%, transparent);
}

.matek-dropdown__heading span {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-color);
  font-weight: 700 !important;
}

.matek-dropdown__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.matek-dropdown__item {
  margin: 2px 0;
  padding: 0;
  border-radius: 10px;
  transition: background 0.2s ease;
}

.matek-dropdown__item:hover {
  background: var(--primary-lighter-color);
}

.matek-dropdown__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-primary-color);
  line-height: 1.25 !important;
  transition: color 0.2s ease;
}

.matek-dropdown__item:hover .matek-dropdown__link {
  color: var(--primary-darker-color);
}

.matek-dropdown__icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary-color) 12%, transparent);
  transition: background 0.2s ease;
}

.matek-dropdown__icon i {
  color: var(--primary-color);
  transition: color 0.2s ease;
}

.matek-dropdown__item:hover .matek-dropdown__icon {
  background: var(--primary-color);
}

.matek-dropdown__item:hover .matek-dropdown__icon i {
  color: var(--accent-lighter-color);
}

.matek-dropdown__label {
  flex: 1 1 auto;
  white-space: normal;
}

/* ----- actions ----- */
.matek-header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--matek-actions-gap);
  overflow: visible;
}

.matek-btn--primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 18px;
  border-radius: 9px;
  background: var(--primary-color);
  border: 1px solid var(--primary-color);
  color: var(--accent-lighter-color);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.matek-btn--primary:hover {
  background: var(--primary-darker-color);
  border-color: var(--primary-darker-color);
  color: var(--accent-lighter-color);
}

.matek-phone {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--primary-lighter-color) 70%, transparent);
  background: var(--accent-lighter-color);
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.matek-phone::before {
  content: "";
  width: 15px;
  height: 15px;
  background: var(--primary-color);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M6.62 10.79a15.05 15.05 0 006.59 6.59l2.2-2.2a1 1 0 011.01-.24 11.36 11.36 0 003.58.57 1 1 0 011 1v3.5a1 1 0 01-1 1A17 17 0 013 5a1 1 0 011-1h3.5a1 1 0 011 1 11.36 11.36 0 00.57 3.58 1 1 0 01-.24 1.01l-2.21 2.2z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M6.62 10.79a15.05 15.05 0 006.59 6.59l2.2-2.2a1 1 0 011.01-.24 11.36 11.36 0 003.58.57 1 1 0 011 1v3.5a1 1 0 01-1 1A17 17 0 013 5a1 1 0 011-1h3.5a1 1 0 011 1 11.36 11.36 0 00.57 3.58 1 1 0 01-.24 1.01l-2.21 2.2z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.matek-phone span {
  color: var(--text-primary-color);
  white-space: nowrap;
}

.matek-phone:hover {
  border-color: var(--primary-color);
  background: var(--primary-lighter-color);
}

/* Language flags: flex row, fixed cells — overrides portages .portages_index_bloc_390 margins */
.matek-lang,
.matek-lang.flags-container {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
  line-height: 0;
}

.matek-lang .portages_index_bloc_lang_choice,
.matek-lang .flag-item {
  position: relative;
  z-index: 20;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: #f3f6fb;
  cursor: pointer;
  box-sizing: border-box;
  flex-shrink: 0;
  line-height: 0;
  pointer-events: auto;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.matek-lang .portages_index_bloc_lang_choice:hover,
.matek-lang .flag-item:hover {
  background: #e6f2ff;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.matek-lang .portages_index_bloc_lang_choice:focus-visible,
.matek-lang .flag-item:focus-visible {
  outline: 2px solid var(--primary-color, #3a9bdc);
  outline-offset: 2px;
}

.matek-lang .portages_index_bloc_lang_choice img.portages_index_bloc_390,
.matek-lang .flag-item img {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  min-height: 18px;
  object-fit: cover;
  object-position: center;
  display: block;
  margin: 0 !important;
  padding: 0;
  border: 0;
  vertical-align: middle;
  border-radius: 2px;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .matek-lang .portages_index_bloc_lang_choice:hover,
  .matek-lang .flag-item:hover {
    transform: none;
  }
}



/* responsive */
@media (max-width: 1200px) {
  :root {
    --matek-header-pad-x: 24px;
    --matek-nav-gap: 22px;
  }
}

@media (max-width: 980px) {
  .matek-nav {
    display: none;
  }

  .matek-header-actions .matek-phone,
  .matek-header-actions .matek-lang {
    display: none;
  }

  .matek-btn--primary {
    height: 38px;
    padding: 0 14px;
  }

}

@media (max-width: 640px) {
  :root {
    --matek-header-h: 64px;
    --matek-header-pad-x: 16px;
    --matek-logo-h: 44px;
    --header-h: var(--matek-header-h);
  }

  .matek-header-actions .matek-btn--primary {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .matek-site-header,
  .matek-site-header *,
    transition-duration: 0.01ms !important;
  }
}
