/* --- /styles/hea_menu.css (clean layout, dark-mode ready) --- */

/* i18n no-flash gate on non-English static routes:
   hide by default, reveal only when translations are applied */
html[lang="fr"] .hea-header .hea-menu,
html[lang="nl"] .hea-header .hea-menu,
html[lang="es"] .hea-header .hea-menu,
html[lang="de"] .hea-header .hea-menu {
  opacity: 0;
  pointer-events: none;
}

/* Generic no-flash gate (covers query/localStorage locale before i18n init). */
html.hea-i18n-pending .hea-header .hea-menu {
  opacity: 0;
  pointer-events: none;
}

html[lang="fr"].hea-menu-i18n-ready .hea-header .hea-menu,
html[lang="nl"].hea-menu-i18n-ready .hea-header .hea-menu,
html[lang="es"].hea-menu-i18n-ready .hea-header .hea-menu,
html[lang="de"].hea-menu-i18n-ready .hea-header .hea-menu {
  opacity: 1;
  pointer-events: auto;
}

html.hea-i18n-ready .hea-header .hea-menu {
  opacity: 1;
  pointer-events: auto;
}

/* =========================
   Header (L1)
   ========================= */

.hea-header{
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
  border-top: 4px solid var(--brand-color-primary);
}

.hea-header-inner{
  max-width: var(--page-w);
  margin-inline: auto;
  padding: 10px var(--app-pad);
  box-sizing: border-box;

  display: flex;
  align-items: center;
  gap: 14px;
}

/* Logo */
.hea-logo-link{ display:flex; align-items:center; }
.hea-logo{ height: 52px; flex: 0 0 auto; }
@media (max-width: 600px){
  .hea-logo{ height: 40px; }
}

/* L1 nav */
.hea-menu{
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

/* Main links centered */
.hea-nav-main{
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  min-width: 0;
}

/* Utilities on the right */
.hea-nav-util{
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Links */
.hea-menu a{
  text-decoration: none;
  font-weight: 500;
  color: var(--ink);
  padding: 6px 2px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .2s ease, border-color .2s ease, background .15s ease;
}

.hea-menu a:hover{
  color: var(--brand-color-primary);
}

.hea-menu a.active{
  color: var(--brand-color-primary);
  font-weight: 700;
  border-bottom-color: var(--brand-color-primary);
}

/* Icon links */
.icon-link{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.icon-link:hover{
  background: color-mix(in oklab, var(--surface-2) 70%, transparent);
  border-color: var(--line);
}

.ico{
  filter: grayscale(100%) brightness(.9);
  opacity: .85;
}
.icon-link:hover .ico{
  filter: none;
  opacity: 1;
}

/* Utility icon active state (notif/account) */
.icon-link.active,
.icon-link[aria-current="page"]{
  border-color: color-mix(in oklab, var(--brand-color-primary) 55%, var(--line));
  background: color-mix(in oklab, var(--brand-color-primary) 10%, var(--surface));
}

.icon-link.active .ico,
.icon-link[aria-current="page"] .ico{
  filter: none;
  opacity: 1;
}

/* Optional: small underline accent (matches your screenshot vibe) */
.icon-link.active::after,
.icon-link[aria-current="page"]::after{
  content:"";
  position:absolute;
  inset-inline: 10px;
  inset-block-end: -6px;
  height: 2px;
  border-radius: 999px;
  background: var(--brand-color-primary);
}

/* Ensure icon-link can host ::after */
.icon-link{
  position: relative;
}

/* Admin pill */
.util-link{
  padding: 6px 10px !important;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.util-link:hover{
  border-color: color-mix(in oklab, var(--brand-color-primary) 55%, var(--line));
}

/* Public language switcher: compact globe + dropdown */
.hea-lang-switch{
  display: inline-flex;
  align-items: center;
}
.hea-lang-picker{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--surface);
}
.hea-lang-picker-icon{
  font-size: 14px;
  line-height: 1;
}
.hea-lang-picker select{
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  max-width: 112px;
  cursor: pointer;
}

/* Responsive: allow wrap, but keep utilities aligned */
@media (max-width: 980px){
  .hea-header-inner{ flex-wrap: wrap; }
  .hea-menu{ width: 100%; }
  .hea-nav-main{ justify-content: flex-start; gap: 14px; }
}

/* Public: keep center truly centered even with right util */
.hea-public-nav .hea-nav-main{
  flex: 1 1 auto;
  justify-content: center;
}
.hea-public-nav .hea-nav-util{
  flex: 0 0 auto;
  margin-left: auto;
}

/* Public mobile: keep nav on one line and scroll horizontally */
@media (max-width: 520px){
  .hea-public-nav .hea-nav-main{
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    gap: 14px;
    padding-bottom: 4px;
  }
  .hea-public-nav .hea-nav-main > a{
    flex: 0 0 auto;
  }
}


/* =========================
   Sub menu placeholder (L2 container)
   ========================= */

#sub-menu-placeholder{ width: 100%; }


/* =========================
   L2 tabs (your existing style)
   ========================= */

.hea-menu-l2{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding-block:8px;
  padding-inline:12px;
  background:var(--card, #fff);
  border-block-end:1px solid var(--line, #eee);
}

@media (min-width:768px){
  .hea-menu-l2{ padding-inline:24px; }
}

.hea-menu-l2-left{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  min-height:40px;
}

.hea-menu-l2-right{
  margin-inline-start:auto;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  min-height:40px;
}

.hea-menu-l2-tab{
  background: var(--surface);
  padding: 0.4rem 0.75rem;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.hea-menu-l2-tab:hover{
  background-color: var(--surface-2);
}

.hea-menu-l2-tab.active{
  background-color: var(--brand-color-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}

@media (max-width: 980px){
  .hea-nav-util{
    margin-left: auto; /* keeps icons pushed right even when wrapped */
  }
}

/* ==========================================================
   IN-APP MOBILE COMPACT MODE
   Reduces header vertical footprint on iPhone
   ========================================================== */

body.hea-compact-nav .hea-header-inner{
  padding-block: 8px !important;
}
body.hea-compact-nav .hea-logo{
  height: 38px !important;
}
body.hea-compact-nav .hea-menu a{
  padding-block: 4px !important;
  padding-inline: 2px !important;
  font-size: .98rem;
}

/* ==========================================================
   APP MOBILE: reduce L2 height
   ========================================================== */
@media (max-width: 520px){
  /* shrink L2 paddings */
  .hea-menu-l2{
    padding-block: 6px;
  }

  /* ✅ hide the user badge on very small screens to save space */
  .hea-menu-l2-right{
    display: none !important;
  }

  /* (optional) tighter L2 tabs */
  .hea-menu-l2-left{
    gap: 8px;
  }
  .hea-menu-l2-tab{
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    font-size: 0.92rem;
  }
}

/* Make Admin smaller (so L1 is more likely to stay on one line)*/
@media (max-width: 520px){
  .hea-nav-util .util-link{
    padding: 5px 8px !important;
    font-size: 12px;
  }
  .hea-nav-util .icon-link{
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }
}

/* In compact mode: prefer horizontal scroll for the main nav instead of wrapping */
@media (max-width: 520px){
  body.hea-compact-nav .hea-menu{
    width: 100%;
  }
  body.hea-compact-nav .hea-nav-main{
    justify-content:flex-start !important;
    flex-wrap:nowrap !important;
    overflow:auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 4px;
    gap: 14px !important;
  }
  body.hea-compact-nav .hea-nav-main > a{
    flex: 0 0 auto;
  }
}

/* ==========================================================
   PUBLIC NAV (new structure)
   - .hea-logo-link left
   - .hea-nav-main centered
   - .hea-nav-util right
   ========================================================== */

/* Ensure true centering even with util block on the right */
.hea-public-nav .hea-nav-main{
  justify-content: center;
}

.hea-public-nav .hea-nav-util{
  margin-left: auto;
}

/* Public mobile: nav-main becomes horizontal scroll */
@media (max-width: 520px){
  .hea-public-nav .hea-nav-main{
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    gap: 14px;
    padding-bottom: 4px;
  }
  .hea-public-nav .hea-nav-main > a{
    flex: 0 0 auto;
  }

  /* Optional: active tab pill on tiny screens */
  .hea-public-nav .hea-nav-main a.active{
    background: color-mix(in oklab, var(--brand-color-primary) 10%, transparent);
    border-radius: 999px;
    padding-inline: 10px;
    border-bottom-color: transparent;
  }

  /* Optional subtle fades */
  .hea-public-nav .hea-header-inner{
    position: relative;
  }
  .hea-public-nav .hea-header-inner::before,
  .hea-public-nav .hea-header-inner::after{
    content:"";
    position:absolute;
    top: 0;
    bottom: 0;
    width: 22px;
    pointer-events:none;
    z-index: 2;
  }
  .hea-public-nav .hea-header-inner::before{
    left: 0;
    background: linear-gradient(90deg, var(--surface), transparent);
    opacity: .9;
  }
  .hea-public-nav .hea-header-inner::after{
    right: 0;
    background: linear-gradient(270deg, var(--surface), transparent);
    opacity: .9;
  }
}
