:root {
  color-scheme: light dark;

  --fond: #fafbfd;
  --surface: #ffffff;
  --surface-douce: #f1f3f8;
  --trait: #e4e7ee;
  --trait-fort: #ccd2de;
  --texte: #12151c;
  --texte-doux: #5f677a;
  --accent: #0b57d0;
  --accent-doux: #e8effd;
  --pere: #2f7de1;
  --mere: #c2609a;
  --produit: #1f9d76;
  --inconnu: #9aa3b4;
  --alerte: #b3261e;
  --ok: #146c43;
  --graphe-trait: #b9c0cf;
  --graphe-fond: #f7f8fc;

  --rayon: 16px;
  --rayon-petit: 10px;
  --ombre: 0 1px 2px rgb(16 22 38 / 5%), 0 10px 30px rgb(16 22 38 / 7%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0c0e13;
    --surface: #14171f;
    --surface-douce: #1b1f2a;
    --trait: #242936;
    --trait-fort: #343c4c;
    --texte: #edeff5;
    --texte-doux: #98a1b4;
    --accent: #8fb4fb;
    --accent-doux: #1a2740;
    --pere: #6ea8fe;
    --mere: #e08cbb;
    --produit: #5bd0a6;
    --inconnu: #7d8698;
    --alerte: #f2b8b5;
    --ok: #7ddba6;
    --graphe-trait: #3a4254;
    --graphe-fond: #10131a;
    --ombre: 0 1px 2px rgb(0 0 0 / 35%), 0 14px 36px rgb(0 0 0 / 30%);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.entete {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 3vw, 2rem);
  padding: 0.85rem clamp(1rem, 4vw, 2rem);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--trait);
}

.marque {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: none;
}

.marque strong {
  display: block;
  font-size: 0.95rem;
}

.pastille {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: var(--rayon-petit);
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

@media (prefers-color-scheme: dark) {
  .pastille {
    color: #0c0e13;
  }
}

.sous-titre,
.lien-doc {
  font-size: 0.8rem;
  color: var(--texte-doux);
}

.lien-doc {
  flex: none;
  text-decoration: none;
}

.lien-doc:hover {
  color: var(--accent);
}

.champ {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  max-width: 34rem;
  margin: 0 auto;
  padding: 0 0.85rem;
  background: var(--surface-douce);
  border: 1px solid transparent;
  border-radius: 999px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.champ:focus-within {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-doux);
}

.loupe {
  flex: none;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--texte-doux);
  stroke-width: 2;
  stroke-linecap: round;
}

.champ input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
}

.champ input:focus {
  outline: none;
}

.raccourci {
  flex: none;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--trait-fort);
  border-radius: 6px;
  color: var(--texte-doux);
  font-size: 0.7rem;
  font-family: inherit;
}

#suggestions {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  z-index: 20;
  width: 100%;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  max-height: 24rem;
  overflow-y: auto;
}

#suggestions:empty {
  display: none;
}

#suggestions li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--rayon-petit);
  cursor: pointer;
}

#suggestions li[aria-selected="true"] {
  background: var(--accent-doux);
}

#suggestions .nom {
  font-weight: 550;
}

#suggestions mark {
  background: none;
  color: var(--accent);
  font-weight: 700;
}

#suggestions .meta {
  margin-left: auto;
  color: var(--texte-doux);
  font-size: 0.78rem;
  white-space: nowrap;
}

main {
  max-width: 78rem;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 1.75rem) clamp(1rem, 4vw, 2rem) 3rem;
}

.scene {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 64rem) {
  .scene {
    grid-template-columns: minmax(0, 1fr) 20rem;
    align-items: start;
  }
}

.carte {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
}

.graphe-carte {
  padding: 0.75rem 0.75rem 0.5rem;
}

.graphe-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.15rem 0.35rem 0.6rem;
}

.legende {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--texte-doux);
  font-size: 0.78rem;
}

.puce {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  margin-left: 0.5rem;
}

.puce:first-child {
  margin-left: 0;
}

.puce.sujet {
  background: var(--accent);
}

.puce.male {
  background: var(--pere);
}

.puce.femelle {
  background: var(--mere);
}

.puce.inconnu {
  background: var(--inconnu);
}

.puce.creuse {
  background: none;
  border: 2px solid var(--texte-doux);
}

.reglages {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--texte-doux);
  font-size: 0.78rem;
}

.reglages label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.reglages select,
.reglages button {
  padding: 0.2rem 0.4rem;
  background: var(--surface-douce);
  color: inherit;
  border: 1px solid var(--trait);
  border-radius: 7px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.reglages button {
  width: 1.9rem;
  height: 1.7rem;
  line-height: 1;
}

.reglages button:hover,
.reglages select:hover {
  border-color: var(--trait-fort);
}

.toile-cadre {
  position: relative;
  height: clamp(24rem, 62vh, 40rem);
  background: var(--graphe-fond);
  border-radius: var(--rayon-petit);
  overflow: hidden;
}

#toile {
  display: block;
  touch-action: none;
  cursor: grab;
}

.accueil {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 1rem;
  color: var(--texte-doux);
  text-align: center;
  pointer-events: none;
}

.accueil span {
  font-size: 0.8rem;
  opacity: 0.75;
}

.accueil[hidden] {
  display: none;
}

.couverture {
  margin: 0.55rem 0.35rem 0.25rem;
  color: var(--texte-doux);
  font-size: 0.8rem;
  min-height: 1.2rem;
}

.fiche {
  padding: 1.15rem;
  position: sticky;
  top: 5rem;
}

.fiche-tete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.fiche-tete h1 {
  font-size: 1.15rem;
}

.lien-source {
  flex: none;
  font-size: 0.78rem;
  text-decoration: none;
  white-space: nowrap;
}

.etiquettes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.etiquette {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-douce);
  color: var(--texte-doux);
  font-size: 0.76rem;
}

.etiquette.indice {
  background: var(--accent-doux);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.attributs {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.35rem 0.9rem;
  margin: 0;
  font-size: 0.87rem;
}

.attributs dt {
  color: var(--texte-doux);
}

.attributs dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.fiche {
  max-height: calc(100vh - 6.5rem);
  overflow-y: auto;
}

.bloc {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--trait);
}

.bloc h2 {
  margin-bottom: 0.5rem;
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--texte-doux);
}

.parents {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.parents li {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.85rem;
}

.parents .role {
  flex: none;
  width: 5.5rem;
  color: var(--texte-doux);
  font-size: 0.78rem;
}

.parents .parent {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}

.parents .parent:hover {
  text-decoration: underline;
}

.parents span.parent {
  color: var(--texte);
  cursor: default;
}

.parents .detail {
  margin-left: auto;
  color: var(--texte-doux);
  font-size: 0.74rem;
  text-align: right;
}

.filiation {
  margin: 0.6rem 0 0;
  color: var(--texte-doux);
  font-size: 0.8rem;
}

.filiation:empty {
  display: none;
}

.discipline + .discipline {
  margin-top: 0.85rem;
}

.discipline h3 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.texte-source {
  margin: 0.15rem 0 0.4rem;
  color: var(--texte-doux);
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

table.indices {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

table.indices th {
  padding: 0.15rem 0.3rem;
  border-bottom: 1px solid var(--trait);
  color: var(--texte-doux);
  font-weight: 500;
  text-align: left;
}

table.indices td {
  padding: 0.2rem 0.3rem;
  border-bottom: 1px solid var(--trait);
}

table.indices tr:last-child td {
  border-bottom: 0;
}

.brut {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--trait);
}

.brut summary {
  color: var(--texte-doux);
  font-size: 0.78rem;
  cursor: pointer;
}

.brut summary:hover {
  color: var(--accent);
}

.brut pre {
  max-height: 22rem;
  margin: 0.6rem 0 0;
  padding: 0.7rem;
  overflow: auto;
  background: var(--graphe-fond);
  border-radius: var(--rayon-petit);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  line-height: 1.45;
}

.message {
  margin: 0.8rem 0 0;
  color: var(--texte-doux);
  font-size: 0.85rem;
}

.message:empty {
  display: none;
}

.message[data-erreur] {
  color: var(--alerte);
}

.journal {
  margin-top: 1.75rem;
}

.journal-tete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.journal-tete h2 {
  font-size: 0.78rem;
  color: var(--texte-doux);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.indice-journal {
  color: var(--texte-doux);
  font-size: 0.76rem;
}

.appels {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
}

.appels li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.85rem;
  background: var(--surface);
  border-top: 1px solid var(--trait);
}

.appels li:first-child {
  border-top: 0;
}

.appels li.vide {
  color: var(--texte-doux);
  font-family: inherit;
}

.appels .statut {
  flex: none;
  color: var(--ok);
  font-variant-numeric: tabular-nums;
}

.appels .statut[data-echec] {
  color: var(--alerte);
}

.appels .chemin {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--texte-doux);
}

.appels .duree {
  flex: none;
  font-variant-numeric: tabular-nums;
}

.pied {
  padding: 1.5rem clamp(1rem, 4vw, 2rem) 2.5rem;
  border-top: 1px solid var(--trait);
  color: var(--texte-doux);
  font-size: 0.78rem;
  text-align: center;
}

@media (max-width: 46rem) {
  .entete {
    flex-wrap: wrap;
  }

  .champ {
    order: 3;
    max-width: none;
    flex-basis: 100%;
  }

  .lien-doc {
    margin-left: auto;
  }
}
