/* Structure commune du jardin.
   N'utilise que les variables définies par le thème du moment (themes/*.css). */

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--fond);
  color: var(--texte);
  font-family: "Literata", Georgia, serif;
  font-optical-sizing: auto;
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.75;
}

/* Bascule de moment : les couleurs glissent en 1,2 s (classe posée par moment.js). */
@media (prefers-reduced-motion: no-preference) {
  .bascule,
  .bascule *,
  .bascule *::before,
  .bascule *::after {
    transition: background-color 1.2s ease, color 1.2s ease, fill 1.2s ease,
      stroke 1.2s ease, border-color 1.2s ease, box-shadow 1.2s ease,
      text-decoration-color 1.2s ease !important;
  }
}

h1,
h2,
h3 {
  color: var(--titre);
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 400;
  line-height: 1.2;
  margin: 3rem 0 1rem;
}

h1 { font-size: 2.25rem; margin-top: 0; margin-bottom: 1.25rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }

p,
ul,
ol,
blockquote,
pre,
table {
  margin: 0 0 1.5rem;
}

strong,
b {
  font-weight: 500;
}

blockquote {
  margin-left: 0;
  padding-left: 1.1rem;
  border-left: 1px solid var(--vegetal);
  font-style: italic;
}

hr {
  border: 0;
  border-top: 1px solid var(--vegetal);
  margin: 3.5rem 0;
}

code,
pre {
  font-size: 0.9em;
  background-color: var(--surface);
  border-radius: 4px;
}

code { padding: 0.1em 0.3em; }
pre { padding: 0.9rem 1rem; overflow-x: auto; }
pre code { padding: 0; background: none; }

img,
svg {
  max-width: 100%;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  text-align: left;
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--vegetal);
}

::selection {
  background-color: var(--lien);
  color: var(--fond);
}

:focus-visible {
  outline: 2px solid var(--lien);
  outline-offset: 2px;
}

.visuellement-cache {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

/* ---------- Liens ---------- */

a {
  color: var(--lien);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* Chemins du jardin : liens vers une autre note. */
a.lien-interne,
.contenu a[href^="/"] {
  text-decoration-style: dotted;
}

/* Liens externes : soulignement plein et petite flèche. */
.contenu a[href^="http"]::after,
a.lien-externe::after {
  content: "\00a0↗";
  font-size: 0.85em;
  text-decoration: none;
  display: inline-block;
}

/* Note pas encore semée : non cliquable. */
.graine-absente {
  color: var(--texte);
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--vegetal);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: help;
}

.evitement {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.4rem 0.8rem;
  background-color: var(--lien);
  color: var(--fond);
  border-radius: 6px;
  z-index: 10;
}

.evitement:focus {
  top: 1rem;
}

/* ---------- Mise en page ---------- */

/* Largeur de la colonne de lecture (la charte prévoyait 38rem). */
.colonne {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.colonne-large {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- En-tête : nom, menu, ciel ---------- */

.entete {
  padding-top: 2.5rem;
}

.entete-haut {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.nom-site {
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: 1.35rem;
  color: var(--titre);
  text-decoration: none;
}

.menu ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
}

.menu a {
  text-decoration-style: dotted;
}

.menu a[aria-current="page"] {
  color: var(--titre);
  text-decoration-style: solid;
}

.ciel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-top: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--vegetal);
}

.ciel-textes {
  flex: 1 1 14rem;
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.5;
}

.ciel-textes p {
  margin: 0;
}

.heure {
  font-variant-numeric: tabular-nums;
}

.bouton-lien {
  font: inherit;
  text-align: left;
  color: var(--lien);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

/* ---------- Choix du moment : quatre pictos ---------- */

.moments {
  display: flex;
  flex: 0 0 auto;
  gap: 0.25rem;
}

/* Zone cliquable de 40px, picto de 22px, trait sous le moment affiché. */
.repere {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--vegetal);
  cursor: pointer;
}

.repere svg {
  width: 22px;
  height: 22px;
}

.repere::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 2px;
  height: 1.5px;
  border-radius: 1px;
}

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

.repere[aria-pressed="true"] {
  color: var(--astre);
}

.repere[aria-pressed="true"]::after {
  background-color: var(--lien);
}

.infobulle {
  position: absolute;
  left: 50%;
  top: calc(100% + 2px);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  background-color: var(--surface);
  color: var(--texte);
  font-size: 0.8rem;
  font-style: italic;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

.repere:last-child .infobulle { left: auto; right: 0; transform: none; }

.repere:hover .infobulle,
.repere:focus-visible .infobulle {
  opacity: 1;
}

/* ---------- Contenu ---------- */

main#contenu {
  padding-top: 3.5rem;
  padding-bottom: 5rem;
}

.meta,
.statut,
.tags {
  font-size: 0.875rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.4rem;
  margin: 0 0 2.5rem;
  list-style: none;
  padding: 0;
}

.statut {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  color: var(--texte);
  white-space: nowrap;
}

.statut svg {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

/* Icône de statut juste après le titre d'une note. */
.titre-fin {
  white-space: nowrap;
}

.titre-statut {
  display: inline-block;
  vertical-align: -0.12em;
  white-space: nowrap;
  cursor: help;
}

.titre-statut svg {
  width: 0.85em;
  height: 0.85em;
}

.statut-graine svg { color: var(--lien); }
.statut-pousse svg { color: var(--vegetal); }
.statut-arbre svg  { color: var(--titre); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.8rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.tags a {
  text-decoration-style: dotted;
}

.tags a::before {
  content: "#";
}

.source {
  margin: -1.25rem 0 2.5rem;
  font-style: italic;
}

/* Rétroliens : les chemins qui mènent ici. */
.encart {
  background-color: var(--surface);
  border-radius: 6px;
  padding: 1.75rem 2rem 2rem;
  margin: 4rem 0 0;
}

.encart h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.encart > :last-child {
  margin-bottom: 0;
}

.chemins {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chemins li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.45rem 0;
}

.chemins .statut-icone {
  display: inline-flex;
  padding: 0.15rem;
  border-radius: 4px;
  background-color: var(--fond);
}

.chemins .statut-icone svg {
  width: 1.1em;
  height: 1.1em;
}

.chemins a {
  text-decoration-style: dotted;
}

/* Chemins d'une note : en bas sur petit et moyen écran, en marge droite sur grand écran. */
.chemins-note section + section {
  margin-top: 2rem;
}

/* La marge droite doit contenir l'aside (2.5rem d'écart + 13rem) : 44rem + 2 × 16.75rem ≈ 78rem. */
@media (min-width: 78rem) {
  .note {
    position: relative;
  }

  .chemins-note {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(100% + 2.5rem);
    width: 13rem;
    margin: 0;
    padding: 0;
    background: none;
    border-radius: 0;
  }

  .chemins-contenu {
    position: sticky;
    top: 2rem;
    padding-left: 1.25rem;
    border-left: 1px solid var(--vegetal);
  }

  .chemins-note h2 {
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
  }

  .chemins-note .chemins {
    font-size: 0.95rem;
    line-height: 1.4;
  }

  .chemins-note .chemins li {
    align-items: flex-start;
    margin: 0.6rem 0;
  }

  .chemins-note .vide {
    font-size: 0.95rem;
  }
}

.vide {
  font-style: italic;
}

/* ---------- Photos ---------- */

.photo {
  margin: 0 0 2.5rem;
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 6px;
  background-color: var(--surface);
}

.photo figcaption {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  font-style: italic;
}

.photo figcaption a {
  color: inherit;
}

.photo-accueil {
  margin-bottom: 3rem;
}

/* ---------- Listes de notes ---------- */

.liste-notes {
  list-style: none;
  margin: 0;
  padding: 0;
}

.liste-notes > li {
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--vegetal);
}

.liste-notes > li:first-child {
  border-top: 1px solid var(--vegetal);
}

/* Chaque note : grande icône de statut à gauche, texte, vignette éventuelle à droite. */
.liste-notes > li {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  column-gap: 1.25rem;
  align-items: center;
}

.liste-notes > li.avec-vignette {
  grid-template-columns: 2.5rem 1fr 6.5rem;
}

.carte-icone {
  display: flex;
}

.carte-icone svg {
  width: 2.5rem;
  height: 2.5rem;
}

.liste-notes .vignette {
  width: 6.5rem;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
}

@media (max-width: 34rem) {
  .liste-notes > li { grid-template-columns: 2rem 1fr; column-gap: 0.9rem; }
  .liste-notes > li.avec-vignette { grid-template-columns: 2rem 1fr 4.5rem; }
  .carte-icone svg { width: 2rem; height: 2rem; }
  .liste-notes .vignette { width: 4.5rem; }
}

.liste-notes h3 {
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
}

.liste-notes h3 a {
  color: var(--titre);
  text-decoration: none;
}

.liste-notes h3 a:hover {
  text-decoration: underline dotted;
}

.liste-notes .meta {
  margin: 0;
}

.filtres {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.75rem;
  margin: 0 0 2rem;
  padding: 0;
  border: 0;
}

.filtres label {
  display: block;
  font-size: 0.95rem;
}

.compte {
  font-size: 0.875rem;
  font-style: italic;
}

/* ---------- Formulaires ---------- */

.formulaire label {
  display: block;
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  color: var(--texte);
}

.formulaire .champ {
  margin: 0 0 1.5rem;
}

.facultatif {
  font-style: italic;
}

input,
textarea,
select {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--texte);
  background-color: var(--surface);
  border: 1px solid var(--vegetal);
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
}

.encart input,
.encart textarea {
  background-color: var(--fond);
}

select {
  width: auto;
  min-width: 9rem;
  padding: 0.35rem 0.5rem;
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--lien);
}

button.bouton,
.bouton {
  display: inline-block;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--fond);
  background-color: var(--lien);
  border: 0;
  border-radius: 6px;
  padding: 0.55rem 1.2rem;
  cursor: pointer;
  text-decoration: none;
}

.bouton:hover {
  background-color: var(--titre);
}

.bouton[disabled] {
  cursor: wait;
}

.piege {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.message-formulaire {
  font-style: italic;
  margin: 1rem 0 0;
}

.message-formulaire:empty {
  display: none;
}

/* ---------- Vue du ciel ---------- */

.graphe {
  position: relative;
  width: 100%;
  /* Hauteur maximale ; graphe.js la resserre quand il y a peu de notes. */
  height: var(--hauteur-graphe, min(75vh, 44rem));
  background-color: var(--fond);
  touch-action: none;
}

/* Au doigt, glisser sur le graphe déplace les disques : on laisse toujours une bande de page pour défiler. */
@media (max-width: 34rem) {
  .graphe {
    height: var(--hauteur-graphe, 58vh);
    height: var(--hauteur-graphe, 58svh);
  }
}

.graphe svg {
  display: block;
  width: 100%;
  height: 100%;
}

.graphe .arete {
  stroke: var(--vegetal);
  stroke-opacity: 0.5;
  stroke-width: 1;
}

.graphe .noeud {
  cursor: pointer;
  text-decoration: none;
}

.graphe .noeud circle {
  stroke: var(--fond);
  stroke-width: 1.5;
}

.graphe .noeud-graine circle { fill: var(--lien); }
.graphe .noeud-pousse circle { fill: var(--vegetal); }
.graphe .noeud-arbre circle  { fill: var(--titre); }

/* Graine pas encore semée : cercle vide en pointillés, relié par un trait pointillé. */
.graphe .noeud-absente circle {
  fill: var(--fond);
  stroke: var(--vegetal);
  stroke-width: 1.25;
  stroke-dasharray: 2 2;
}

.graphe .arete-absente {
  stroke-dasharray: 3 3;
}

.graphe .noeud-absente text {
  font-size: 0.75rem;
  font-style: italic;
  fill-opacity: 0.8;
}

.graphe .noeud:focus-visible circle {
  stroke: var(--lien);
  stroke-width: 3;
}

.graphe .noeud:focus {
  outline: none;
}

.graphe text {
  fill: var(--texte);
  font-family: "Literata", Georgia, serif;
  font-size: 0.8rem;
  paint-order: stroke;
  stroke: var(--fond);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
}

.graphe .noeud.relie text,
.graphe .noeud:hover text,
.graphe .noeud:focus-visible text {
  opacity: 1;
}

.legende {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.legende-absente svg {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  color: var(--vegetal);
}

/* Sous le graphe, comme la légende d'une photo. */
.graphe-legende {
  margin-top: 1.25rem;
}

.graphe-legende .legende {
  margin: 0 0 0.75rem;
}

/* ---------- Graines à semer ---------- */

.liste-graines {
  list-style: none;
  padding: 0;
}

.liste-graines > li {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--vegetal);
  scroll-margin-top: 2rem;
}

.liste-graines > li:first-child {
  border-top: 1px solid var(--vegetal);
}

.liste-graines h2 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
}

.liste-graines > li:target h2 {
  color: var(--lien);
}

.liste-graines .cite-par {
  margin: 0 0 0.25rem;
  padding: 0;
  font-size: 0.875rem;
}

/* ---------- Pied de page ---------- */

.pied {
  border-top: 1px solid var(--vegetal);
  padding-top: 2.5rem;
  padding-bottom: 4rem;
  font-size: 0.95rem;
}

.pied ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.pied a {
  text-decoration-style: dotted;
}

.pied p {
  margin: 0;
  font-style: italic;
}
