/* Shared: personal agent + language + avatar (include via link) */
.top-nav .top-nav__inner {
  box-sizing: border-box;
  /* Reserve space so tray (agent + lang) never sits under the fixed avatar */
  padding-right: 46px;
}
.top-nav__avatar-fixed {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 101;
}
.top-nav__tray {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 16px;
  flex-shrink: 0;
  min-width: 0;
}
/* Nav is only the three links — same visual centering as before */
.top-nav__links {
  grid-column: 2;
  justify-self: center;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 5;
}
.top-nav__link-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(32px, 8vw, 72px);
}
.personal-agent {
  position: relative;
  flex-shrink: 1;
  min-width: 0;
}
.personal-agent__trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(220px, 38vw);
  padding: 8px 6px;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-muted, #5c5c5c);
  border-radius: 8px;
  text-align: left;
  transition: color 0.15s ease, background 0.15s ease;
}
.personal-agent__trigger:hover {
  color: var(--ink, #0d0d0d);
  background: rgba(0, 0, 0, 0.04);
}
.personal-agent__trigger[aria-expanded="true"] {
  color: var(--ink, #0d0d0d);
}
.personal-agent__trigger > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.personal-agent__caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  flex-shrink: 0;
  opacity: 0.85;
  margin-top: 1px;
}
.personal-agent__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(380px, calc(100vw - 40px));
  padding: 16px 16px 14px;
  background: var(--surface, #fff);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14);
  z-index: 210;
  box-sizing: border-box;
}
.personal-agent__input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 12px;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink, #0d0d0d);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  resize: vertical;
  min-height: 88px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.02);
}
.personal-agent__input::placeholder {
  color: var(--ink-faint, #8e8e8e);
}
.personal-agent__input:focus {
  outline: none;
  border-color: rgba(138, 112, 56, 0.45);
  background: var(--surface, #fff);
}
.personal-agent__rule {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin: 14px 0 12px;
}
.personal-agent__soon {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold, #8a7038);
}
.personal-agent__hint {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink-muted, #5c5c5c);
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted, #5c5c5c);
  flex-shrink: 0;
}
.user-avatar svg {
  width: 20px;
  height: 20px;
  display: block;
}
.lang-switcher {
  position: relative;
  flex-shrink: 0;
}
.lang-switcher__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  border: none;
  border-radius: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: opacity 0.15s ease;
}
.lang-switcher__btn:hover {
  opacity: 0.85;
}
.lang-switcher__btn[aria-expanded="true"] {
  opacity: 1;
}
.lang-switcher__flag {
  width: 22px;
  height: 16px;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  flex-shrink: 0;
}
.lang-switcher__flag svg {
  width: 100%;
  height: 100%;
  display: block;
}
.lang-switcher__caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--ink-muted, #5c5c5c);
  flex-shrink: 0;
  margin-top: 1px;
}
.lang-switcher__menu[hidden] {
  display: none !important;
  pointer-events: none !important;
}
.lang-switcher__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 148px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
  z-index: 200;
}
.lang-switcher__menu li {
  margin: 0;
}
.lang-switcher__menu button {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
}
.lang-switcher__menu button:hover {
  background: var(--gold-soft);
}
.lang-switcher__menu button.is-active {
  font-weight: 600;
  background: rgba(0, 0, 0, 0.04);
}
.lang-switcher__menu button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: var(--ink-muted, #888);
}
.lang-switcher__menu button:disabled:hover {
  background: transparent;
}
/* Wordmark + train mark (transparent PNG, no backdrop blur) */
.top-nav__brand {
  overflow: visible;
  min-width: max-content;
}
.top-nav__brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.02em;
  color: inherit;
  text-decoration: none;
  line-height: 1;
  overflow: visible;
}
.top-nav__brand-train {
  display: block;
  height: clamp(46px, 10vw, 58px);
  width: auto;
  flex-shrink: 0;
  margin-left: 0.06em;
  margin-right: -0.12em;
  transform: translate(10px, -8px);
  object-fit: contain;
  object-position: left center;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  box-shadow: none;
  border: none;
  outline: none;
  background: transparent;
}

@media (max-width: 720px) {
  .top-nav .top-nav__inner {
    padding-right: 40px;
  }
  .top-nav__avatar-fixed {
    right: 5px;
  }
  .top-nav__tray {
    gap: 8px 10px;
  }
  .personal-agent__trigger {
    max-width: min(160px, 34vw);
    font-size: 0.8rem;
    padding: 6px 4px;
  }
  .user-avatar {
    width: 32px;
    height: 32px;
  }
  .user-avatar svg {
    width: 18px;
    height: 18px;
  }
}

/* Pas d’ombre sur le panneau du haut (Dashboard) — séparation = border des pages si besoin */
.top-nav {
  box-shadow: none;
}
.top-nav.top-nav--scrolled {
  box-shadow: none;
}

/*
 * Integrated Tools — tiroir aligné sur le libellé (bord gauche ≈ début du texte du lien).
 * --nav-dropdown-after-links : pont sous le header jusqu’au tiroir blanc.
 * --nav-dropdown-tongue-nudge : décalage suppl. vers la gauche (max ~10px), ex. -4px.
 */
.top-nav__dropdown {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
}
.top-nav__link.top-nav__link--integrated {
  color: #756742;
}
.top-nav__link.top-nav__link--integrated:hover {
  color: var(--ink, #0d0d0d);
}
.top-nav__link.top-nav__link--integrated.is-active {
  color: var(--ink, #0d0d0d);
}
.top-nav__dropdown-panel {
  position: absolute;
  /* 6px ≈ padding horizontal du .top-nav__link : bord du tiroir = début de l’écriture */
  left: calc(6px + var(--nav-dropdown-tongue-nudge, 0px));
  right: auto;
  z-index: 120;
  top: 100%;
  margin: 0;
  padding: 0;
  padding-top: var(--nav-dropdown-after-links, 26px);
  /* Même blanc que le panneau du haut (pont sous le lien inclus) */
  background-color: var(--surface, #ffffff);
  border: none;
  box-shadow: none;
  transform: translateY(10px);
  width: max-content;
  max-width: calc(100vw - 24px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.22s;
}
.top-nav__dropdown:hover .top-nav__dropdown-panel,
.top-nav__dropdown:focus-within .top-nav__dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition-delay: 0s, 0s, 0s;
}
.top-nav__dropdown-tongue {
  position: relative;
  margin: 0;
  padding: 14px 22px 16px 16px;
  min-width: min(300px, calc(100vw - 48px));
  box-sizing: border-box;
  /* Strictement la même couleur que .top-nav (var --surface) */
  background-color: var(--surface, #ffffff);
  border: 1px solid var(--gold-line, rgba(138, 112, 56, 0.28));
  border-top: 1px solid var(--gold-line, rgba(138, 112, 56, 0.28));
  border-radius: 0 0 14px 14px;
  /*
   * Ombre uniquement sous la languette (spread négatif = presque pas de fuite vers le haut / le panneau).
   * L’effet « ombre du bandeau » sur le haut du tiroir = ::before uniquement.
   */
  box-shadow:
    0 14px 28px -14px rgba(0, 0, 0, 0.12),
    0 22px 40px -18px rgba(0, 0, 0, 0.07);
}
/* Ombrage portée du bandeau Dashboard : assombrit légèrement le haut de la languette */
.top-nav__dropdown-tongue::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 24px;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.06) 0%,
    rgba(0, 0, 0, 0.022) 48%,
    transparent 100%
  );
  pointer-events: none;
}
/* Même typo que les liens Dashboard / Projects, teinte légèrement dorée */
.top-nav__dropdown-item {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  padding: 10px 4px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--gold, #8a7038);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  text-decoration: none;
  text-align: center;
  line-height: 1.35;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}
.top-nav__dropdown-item:hover {
  color: var(--ink, #0d0d0d);
  background: var(--gold-soft, rgba(138, 112, 56, 0.12));
}
.top-nav__dropdown-item:focus-visible {
  outline: 2px solid var(--gold-line, rgba(138, 112, 56, 0.28));
  outline-offset: 2px;
}
.top-nav__dropdown-item + .top-nav__dropdown-item {
  margin-top: 2px;
}
/* Tutoriel : texte noir uniquement, même hover que les autres entrées */
.top-nav__dropdown-item--tutorial {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: transparent !important;
  color: var(--ink, #0d0d0d) !important;
}
.top-nav__dropdown-item--tutorial:hover,
.top-nav__dropdown-item--tutorial:focus-visible {
  background: var(--gold-soft, rgba(138, 112, 56, 0.12)) !important;
  color: var(--ink, #0d0d0d) !important;
}
.top-nav__dropdown-tutorial-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.top-nav__dropdown-tutorial-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.top-nav__dropdown-tutorial-info svg {
  width: 16px;
  height: 16px;
  display: block;
  stroke: currentColor;
  fill: none;
  opacity: 0.85;
}
.top-nav__dropdown-item--tutorial:hover .top-nav__dropdown-tutorial-info,
.top-nav__dropdown-item--tutorial:focus-visible .top-nav__dropdown-tutorial-info {
  opacity: 1;
  transform: translateX(0);
}
@media (max-width: 720px) {
  .top-nav__dropdown-tongue {
    min-width: min(260px, calc(100vw - 24px));
    padding: 12px 14px 14px;
  }
  .top-nav__dropdown-item {
    font-size: 0.94rem;
    padding: 9px 4px;
  }
}
