/* Carte (graphe) */

/* Fix logo DGDDI : empêcher l'SVG de prendre toute la place */
.fr-header__operator .dgddi-logo {
  height: 3.25rem;
  width: auto;
  max-width: 100%;
}


.recode-graph-search {
  position: relative;
}

/* La search-bar DSFR peut avoir un max-width + centrage : ici on veut plein largeur */
.recode-graph-search .fr-search-bar {
  max-width: none;
  width: 100%;
}

.recode-suggestions {
  position: absolute;
  top: calc(100% + .25rem);
  left: 0;
  right: 0;
  z-index: 3000;
  /* Plus de lignes visibles (moins de scroll) */
  max-height: min(60vh, 44rem);
  overflow: auto;
  border: 1px solid var(--border-default-grey);
  background: var(--background-default-grey);
  border-radius: .5rem;
  padding: .25rem;
  text-align: left;
}

.recode-suggestions[hidden] {
  display: none !important;
}

.recode-suggestions__item {
  display: block;
  /* Lignes plus compactes pour afficher davantage d'articles */
  padding: .25rem .5rem;
  cursor: pointer;
  border-radius: .25rem;
  text-decoration: none;
  color: inherit;
  text-align: left;
  width: 100%;
  line-height: 1.25;
}

.recode-suggestions__item:hover,
.recode-suggestions__item:focus {
  background: var(--background-contrast-grey);
}

.recode-graph-layout {
  display: grid;
  grid-template-columns: 1fr minmax(22rem, 34rem);
  gap: 1rem;
  align-items: start;
}

.recode-graph-stage {
  position: relative;
  border: 1px solid var(--border-default-grey);
  overflow: hidden;
}

#recodeGraphCanvas {
  display: block;
  width: 100%;
  height: min(76vh, 820px);
  min-height: 620px;
}

.recode-graph-badge {
  position: absolute;
  top: .75rem;
  left: .75rem;
  z-index: 5;
  pointer-events: none;
}

.recode-graph-panel {
  display: flex;
  gap: .75rem;
  border: 1px solid var(--border-default-grey);
  overflow: hidden;
  position: sticky;
  top: 1rem;
  max-height: calc(min(70vh, 720px) + 2rem);
}

.recode-graph-panel__strip {
  width: .5rem;
  background: linear-gradient(
          180deg,
          var(--background-action-high-blue-france),
          var(--background-action-low-blue-france)
  );
  flex: 0 0 auto;
}

.recode-graph-panel__content {
  flex: 1 1 auto;
  min-width: 0;
}

#graphPanelExcerpt {
  text-align: justify;
  overflow-wrap: anywhere;
}

@media (max-width: 62em) {
  .recode-graph-layout {
    grid-template-columns: 1fr;
  }

  .recode-graph-panel {
    position: fixed;
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
    top: auto;
    max-height: min(55vh, 28rem);
    z-index: 4000;
    box-shadow: var(--shadow-lifted);
  }
}

@media (max-width: 62em) {
  #recodeGraphCanvas {
    height: min(58vh, 32rem);
    min-height: 22rem;
  }

  .recode-graph-panel {
    right: 0.75rem;
    left: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
    max-height: min(60vh, 24rem);
  }

  .recode-graph-panel .fr-btns-group {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.75rem;
  }

  .recode-graph-panel .fr-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 48em) {
  .recode-suggestions {
    max-height: min(45vh, 18rem);
  }

  .recode-graph-badge {
    position: static;
    margin: 0.75rem 0 0;
    pointer-events: auto;
  }
}
