:root {
  --rouge: #E22C07;
  --orange: #FFAE1C;
  --steel: #F3F0EC;
  --paper: #FFFFFF;
  --ink: #2A211C;
  --soft: #7A6C63;
  --line: #D9D0C8;
  --ok: #2E7D5B;
  --warn: #E09000;
  --off: #E22C07;
  --gap: 26px;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--steel);
  color: var(--ink);
  font-family: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px
}

.top {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 10px
}

.entete {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  border-bottom: 3px solid var(--rouge);
  padding-bottom: 16px
}

.logo {
  width: 190px;
  height: auto;
  flex: 0 0 auto
}

h1 {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: clamp(26px, 4.4vw, 40px);
  line-height: .95;
  margin: 0
}

h1 span {
  display: block;
  font-size: .4em;
  font-weight: 500;
  color: var(--soft);
  margin-top: 7px
}

.bandeau {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 18px 0 8px
}

button {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 9px 13px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  border-radius: 2px;
  cursor: pointer
}

button:hover {
  background: var(--rouge);
  border-color: var(--rouge);
  color: #fff
}

button:focus-visible {
  outline: 3px solid var(--rouge);
  outline-offset: 2px
}

input {
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  font: inherit;
  border-radius: 2px;
  color: var(--ink)
}

input:focus {
  outline: none;
  border-color: var(--rouge);
  box-shadow: 0 0 0 3px rgba(226, 44, 7, .18)
}

#q {
  flex: 1 1 220px
}

.legende {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--soft);
  margin-bottom: 10px
}

.puce {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px
}

.p-ok {
  background: var(--ok)
}

.p-warn {
  background: var(--warn)
}

.p-off {
  background: var(--off)
}

/* Synchronisation */
.sync {
  display: none;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: #FDF7EC;
  border: 1.5px solid var(--line);
  border-left: 4px solid var(--orange);
  padding: 12px;
  margin-bottom: 14px
}

.sync.on {
  display: flex
}

.sync input {
  flex: 1 1 340px;
  font-size: 13.5px
}

.sync p {
  margin: 0;
  flex-basis: 100%;
  font-size: 13px;
  color: var(--soft);
  line-height: 1.45
}

.sync p b {
  color: var(--ink)
}

#etatSync {
  font-size: 13px;
  color: var(--soft)
}

/* Plan */
/* `justify-content: safe center` centre l'arbre quand il tient dans la
   fenêtre, mais bascule sur un alignement à gauche quand il déborde :
   sans le mot-clé `safe`, le début du plan deviendrait inatteignable. */
.plan {
  overflow: auto;
  display: flex;
  justify-content: safe center;
  background: var(--steel);
  border-top: 2px solid var(--orange);
  border-bottom: 2px solid var(--orange);
  padding: 34px 20px 44px;
  cursor: grab;
  overscroll-behavior-x: contain
}

.plan.drag {
  cursor: grabbing
}

.zoom {
  flex: 0 0 auto;
  margin: 0 auto
}

.arbre {
  display: flex;
  justify-content: center
}

ul.br {
  display: flex;
  justify-content: center;
  padding: var(--gap) 0 0;
  margin: 0;
  list-style: none;
  position: relative
}

ul.br::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: var(--gap);
  border-left: 1.5px solid var(--line)
}

li.br {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--gap) 9px 0;
  margin: 0;
  position: relative;
  list-style: none
}

li.br::before,
li.br::after {
  content: "";
  position: absolute;
  top: 0;
  height: var(--gap);
  width: 50%;
  border-top: 1.5px solid var(--line)
}

li.br::before {
  right: 50%
}

li.br::after {
  left: 50%
}

li.br:only-child::before,
li.br:only-child::after {
  display: none
}

li.br:first-child::before,
li.br:last-child::after {
  border-top-color: transparent
}

li.br:first-child::after {
  border-left: 1.5px solid var(--line)
}

li.br:last-child::before {
  border-right: 1.5px solid var(--line)
}

li.br.racine {
  padding-top: 0
}

li.br.racine::before,
li.br.racine::after {
  display: none
}

li.br.ferme>ul.br {
  display: none
}

/* Cases */
.boite {
  position: relative;
  width: 186px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-top-width: 4px;
  padding: 9px 10px 10px;
  border-radius: 2px;
  text-align: center;
  box-shadow: 2px 2px 0 rgba(42, 33, 28, .12);
  cursor: default
}

.b-ok {
  border-top-color: var(--ok)
}

.b-warn {
  border-top-color: var(--warn)
}

.b-off {
  border-top-color: var(--off)
}

.boite .nom {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.1;
  display: block
}

.boite .pre {
  font-weight: 500
}

.boite .poste {
  display: block;
  font-size: 12.5px;
  color: var(--soft);
  line-height: 1.25;
  margin-top: 4px
}

.boite .tel {
  display: block;
  font-size: 11.5px;
  color: #A3968D;
  margin-top: 3px;
  font-variant-numeric: tabular-nums
}

.rang0 {
  width: 240px;
  border: 2px solid var(--rouge);
  border-top-width: 6px;
  background: var(--rouge)
}

.rang0 .nom {
  color: #fff;
  font-size: 22px
}

.rang0 .poste {
  color: #FFE0C9
}

.rang1 {
  width: 220px;
  border-color: var(--rouge)
}

.rang1 .nom {
  font-size: 19px
}

.boite.trouve {
  outline: 3px solid var(--orange);
  outline-offset: 2px
}

.boite.eteint {
  opacity: .28
}

.plier {
  position: absolute;
  left: 50%;
  transform: translate(-50%, 50%);
  bottom: -2px;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: 12.5px;
  line-height: 1;
  padding: 3px 7px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  border-radius: 11px;
  cursor: pointer;
  white-space: nowrap;
  z-index: 2
}

.plier:hover {
  background: var(--rouge);
  border-color: var(--rouge);
  color: #fff
}

/* Grappes */
.grappe {
  width: 200px;
  background: #FDF7EC;
  border: 1.5px solid var(--line);
  border-top: 4px solid var(--orange);
  cursor: default
}

.grappe .nom {
  font-size: 16px
}

.grappe .eff {
  display: block;
  font-size: 12.5px;
  color: var(--soft);
  margin-top: 3px
}

.grappe .liste {
  display: none;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  text-align: left;
  max-height: 290px;
  overflow: auto
}

.grappe.ouverte .liste {
  display: block
}

.grappe .liste button {
  display: flex;
  gap: 6px;
  align-items: baseline;
  width: 100%;
  text-align: left;
  font-family: "Barlow", sans-serif;
  font-weight: 400;
  font-size: 12.5px;
  line-height: 1.4;
  border: 0;
  background: none;
  padding: 2px 3px;
  color: var(--ink);
  border-radius: 2px
}

.grappe .liste button:hover {
  background: var(--orange);
  color: var(--ink)
}

.grappe .liste i {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 1px
}

.voir {
  margin-top: 8px;
  font-size: 12px;
  padding: 4px 8px
}

/* Fiche */
.voile {
  position: fixed;
  inset: 0;
  background: rgba(42, 33, 28, .35);
  display: none;
  z-index: 40
}

.voile.on {
  display: block
}

.fiche {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(430px, 100%);
  background: var(--paper);
  border-left: 3px solid var(--rouge);
  z-index: 50;
  transform: translateX(100%);
  transition: transform .22s ease;
  display: flex;
  flex-direction: column
}

.fiche.on {
  transform: none
}

@media (prefers-reduced-motion:reduce) {
  .fiche {
    transition: none
  }
}

.fiche header {
  padding: 18px 20px 14px;
  border-bottom: 1.5px solid var(--line);
  position: relative
}

.fiche h2 {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  line-height: 1.05;
  padding-right: 34px
}

.fiche h2 small {
  display: block;
  font-size: .55em;
  font-weight: 500;
  color: var(--soft);
  margin-top: 5px
}

.fermer {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 2px 9px;
  font-size: 18px;
  line-height: 1.2
}

.corps {
  overflow: auto;
  padding: 4px 20px 34px
}

.corps h3 {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--rouge);
  margin: 20px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line)
}

dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 14px;
  margin: 0;
  font-size: 13.5px
}

dt {
  color: var(--soft)
}

dd {
  margin: 0;
  text-align: right;
  font-weight: 500
}

dd.num {
  font-variant-numeric: tabular-nums
}

.etiq {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 2px;
  font-size: 12.5px;
  font-weight: 600
}

.e-ok {
  background: #E4F1EA;
  color: var(--ok)
}

.e-warn {
  background: #FCF0D9;
  color: #8A5A00
}

.e-off {
  background: #FBE3DF;
  color: var(--off)
}

.chaine {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13.5px
}

.chaine li {
  position: relative;
  padding: 3px 0 3px 20px
}

.chaine li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--line)
}

.chaine li:last-child::before {
  bottom: 50%
}

.chaine li::after {
  content: "";
  position: absolute;
  left: 2.5px;
  top: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line)
}

.chaine li:last-child::after {
  background: var(--rouge)
}

.lien {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--rouge);
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px
}

.lien:hover {
  background: none;
  color: var(--ink)
}

.equipe {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13.5px;
  max-height: 230px;
  overflow: auto
}

.equipe li {
  display: flex;
  gap: 7px;
  align-items: baseline;
  padding: 2px 0
}

.equipe i {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 1px
}

.equipe span {
  color: var(--soft);
  font-size: 12.5px;
  margin-left: auto;
  text-align: right
}

footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 20px 60px;
  font-size: 13px;
  color: var(--soft)
}

@media print {

  .bandeau,
  .sync,
  .plier,
  .voir,
  .fiche,
  .voile {
    display: none
  }

  .plan {
    overflow: visible;
    border: 0
  }
}

/* État de la recherche */
#etatQ {
  font-size: 13px;
  color: var(--soft);
  flex: 0 0 auto
}

/* Écrans étroits */
@media (max-width: 720px) {
  :root {
    --gap: 20px
  }

  .top {
    padding: 16px 14px 8px
  }

  .entete {
    gap: 14px
  }

  .logo {
    width: 130px
  }

  .plan {
    padding: 24px 12px 34px
  }

  #q {
    flex: 1 1 100%
  }

  .bandeau button {
    flex: 1 1 auto
  }

  .boite {
    width: 158px
  }

  .rang0 {
    width: 200px
  }

  .rang0 .nom {
    font-size: 19px
  }

  .rang1 {
    width: 180px
  }

  .grappe {
    width: 172px
  }

  .fiche {
    border-left: 0;
    border-top: 3px solid var(--rouge)
  }

  footer {
    padding: 14px 14px 40px
  }
}

/* Le navigateur peut ne pas gérer `safe center` : on retombe alors sur
   un alignement à gauche, jamais sur un plan tronqué. */
@supports not (justify-content: safe center) {
  .plan {
    justify-content: flex-start
  }
}

/* Signature */
.signature {
  display: block;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--soft)
}

.signature b {
  font-weight: 700;
  color: var(--ink)
}

@media print {
  .signature {
    color: var(--ink)
  }
}
