/* =================================================================
   RITES.PRO — La Boussole des passages
   Feuille de style de l'outil de découverte (page boussole.html).
   Tout est encapsulé dans #boussole pour ne rien changer ailleurs.
   ================================================================= */

#boussole {
  --bsl-ivoire:      var(--color-ivory, #FAF7F2);
  --bsl-creux:       #F3EEE6;
  --bsl-encre:       var(--color-charcoal, #2B2F33);
  --bsl-encre-doux:  var(--color-brown-text, #5D544B);
  --bsl-or:          var(--color-gold, #B08D4F);
  --bsl-or-clair:    #D9C49B;
  --bsl-trait:       var(--color-sand, #E7DED3);
  --bsl-serif:       var(--font-display, "Cormorant Garamond", Georgia, serif);
  --bsl-sans:        var(--font-body, "Inter", Arial, sans-serif);

  max-width: 50rem;
  margin: 0 auto;
  scroll-margin-top: 6rem;
  padding: 0 1.25rem 4rem;
  font-family: var(--bsl-sans);
  color: var(--bsl-encre);
}

/* ---------- Progression ---------- */
#boussole .bsl-progression {
  display: flex; gap: .5rem; justify-content: center; align-items: center;
  margin: 1.75rem 0 .25rem; min-height: 10px;
}
#boussole .bsl-progression span {
  width: 34px; height: 2px; background: var(--bsl-trait); border-radius: 2px;
  transition: background .4s ease;
}
#boussole .bsl-progression span.faite  { background: var(--bsl-or-clair); }
#boussole .bsl-progression span.active { background: var(--bsl-or); }

/* ---------- Écrans ---------- */
#boussole .bsl-ecran { display: none; padding: 1.5rem 0 2rem; }
#boussole .bsl-ecran.visible { display: block; animation: bsl-apparait .5s ease both; }
@keyframes bsl-apparait { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #boussole .bsl-ecran.visible { animation: none; } }

#boussole h1 {
  font-family: var(--bsl-serif); font-weight: 500;
  font-size: clamp(2rem, 5.2vw, 2.9rem); line-height: 1.15;
  margin: 0 0 1rem; text-wrap: balance;
}
#boussole h2 {
  font-family: var(--bsl-serif); font-weight: 500;
  font-size: clamp(1.5rem, 4vw, 2.05rem); line-height: 1.25;
  margin: 0 0 .6rem; text-wrap: balance;
}
#boussole h3 { font-family: var(--bsl-serif); font-weight: 500; font-size: 1.3rem; margin: 0 0 .5rem; }
#boussole .bsl-chapeau { color: var(--bsl-encre-doux); margin: 0 0 1.6rem; max-width: 56ch; }
#boussole .bsl-filet { width: 52px; height: 1px; background: var(--bsl-or); border: 0; margin: 0 0 1.6rem; }
#boussole .bsl-mention { font-size: .85rem; color: var(--bsl-encre-doux); }

/* ---------- Choix ---------- */
#boussole .bsl-choix {
  display: grid; gap: .75rem; margin: 0 0 1.6rem; padding: 0; border: 0;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
#boussole .bsl-choix legend { padding: 0; }
#boussole .bsl-opt { position: relative; }
#boussole .bsl-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
#boussole .bsl-opt label {
  display: block; cursor: pointer;
  border: 1px solid var(--bsl-trait); border-radius: 3px;
  background: #fff; padding: .95rem 1.1rem;
  font-size: 1.02rem; line-height: 1.45;
  transition: border-color .2s, box-shadow .2s;
}
#boussole .bsl-opt label:hover { border-color: var(--bsl-or-clair); }
#boussole .bsl-opt input:focus-visible + label { outline: 2px solid var(--bsl-or); outline-offset: 2px; }
#boussole .bsl-opt input:checked + label {
  border-color: var(--bsl-or); box-shadow: inset 3px 0 0 var(--bsl-or);
}

/* ---------- Galerie d'images ---------- */
#boussole .bsl-galerie { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
#boussole .bsl-galerie .bsl-opt label { padding: 0; overflow: hidden; text-align: center; }
#boussole .bsl-galerie figure { margin: 0; }
#boussole .bsl-galerie .bsl-cadre {
  background: var(--bsl-creux); display: block; width: 100%; aspect-ratio: 4 / 3; max-width: 100%;
}
#boussole .bsl-galerie .bsl-cadre img { display: block; width: 100%; height: 100%; object-fit: cover; }
#boussole .bsl-galerie figcaption { padding: .75rem .6rem; font-family: var(--bsl-serif); font-size: 1.18rem; }

/* ---------- Champs ---------- */
#boussole .bsl-champ { margin: 0 0 1.5rem; }
#boussole .bsl-champ .bsl-intitule {
  display: block; font-family: var(--bsl-serif); font-size: 1.25rem; margin-bottom: .5rem; font-weight: 500;
}
#boussole input[type=text],
#boussole textarea,
#boussole input[type=date] {
  width: 100%; max-width: 100%;
  font-family: var(--bsl-sans); font-size: 1rem; color: var(--bsl-encre);
  background: #fff; border: 1px solid var(--bsl-trait); border-radius: 3px;
  padding: .8rem .95rem; line-height: 1.6; resize: vertical;
}
#boussole input[type=date] { width: auto; }
#boussole input:focus, #boussole textarea:focus { outline: none; border-color: var(--bsl-or); }
#boussole textarea { min-height: 6.5rem; }

/* ---------- Rangée compacte ---------- */
#boussole .bsl-rangee { display: flex; flex-wrap: wrap; gap: .55rem; margin: 0 0 .4rem; padding: 0; border: 0; }
#boussole .bsl-rangee .bsl-opt label { padding: .55rem .95rem; border-radius: 999px; font-size: .95rem; }
#boussole .bsl-rangee .bsl-opt input:checked + label {
  box-shadow: none; background: var(--bsl-or); border-color: var(--bsl-or); color: #fff;
}

/* ---------- Actions ---------- */
#boussole .bsl-actions { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; margin-top: .4rem; }
#boussole .bsl-lien {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-family: var(--bsl-sans); font-size: .9rem; color: var(--bsl-encre-doux);
  text-decoration: underline; text-underline-offset: 3px;
}
#boussole .bsl-lien:hover { color: var(--bsl-or); }
#boussole .btn[disabled] { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* ---------- Carnet ---------- */
#boussole .bsl-carnet {
  background: #fff; border: 1px solid var(--bsl-trait); border-radius: 3px;
  padding: clamp(1.6rem, 5vw, 3rem); margin: 0 0 1.9rem;
}
#boussole .bsl-carnet-tete { display: flex; gap: 1.6rem; align-items: center; margin-bottom: 1.6rem; flex-wrap: wrap; }
#boussole .bsl-carnet-image {
  flex: 0 0 180px; max-width: 180px; background: var(--bsl-creux);
  aspect-ratio: 4 / 3; border-radius: 2px; overflow: hidden;
}
#boussole .bsl-carnet-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
#boussole .bsl-carnet-titre { flex: 1 1 240px; }
#boussole .bsl-surtitre {
  font-size: .74rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--bsl-or); margin: 0 0 .4rem;
}
#boussole .bsl-recit { font-size: 1.06rem; margin: 0 0 1.6rem; max-width: 58ch; }
#boussole .bsl-citation {
  border-left: 2px solid var(--bsl-or-clair); padding: .25rem 0 .25rem 1.35rem; margin: 0 0 1.6rem;
  font-family: var(--bsl-serif); font-size: 1.32rem; line-height: 1.5; font-style: italic;
}
#boussole .bsl-bloc { border-top: 1px solid var(--bsl-trait); padding-top: 1.35rem; margin-top: 1.35rem; }
#boussole .bsl-bloc p { margin: 0 0 .6rem; }
#boussole #bsl-intention {
  font-family: var(--bsl-serif); font-size: 1.22rem; line-height: 1.5;
  background: var(--bsl-ivoire); border: 1px dashed var(--bsl-trait); min-height: 4.75rem;
}
#boussole #bsl-intention:focus { border-style: solid; border-color: var(--bsl-or); background: #fff; }
#boussole #bsl-geste {
  background: var(--bsl-ivoire); border: 1px dashed var(--bsl-trait); min-height: 5.5rem;
}
#boussole #bsl-geste:focus { border-style: solid; border-color: var(--bsl-or); background: #fff; }

#boussole .bsl-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
#boussole .bsl-duo .bsl-champ { margin: 0; }
#boussole .bsl-duo .bsl-intitule { font-size: 1.1rem; }
#boussole .bsl-duo textarea { min-height: 5.5rem; }

#boussole input[type=text].bsl-nom {
  font-family: var(--bsl-serif); font-size: clamp(1.5rem, 4vw, 2.05rem); font-weight: 500;
  line-height: 1.25; border: 0; border-bottom: 1px dashed var(--bsl-trait); border-radius: 0;
  padding: 2px 0 6px; background: transparent;
}
#boussole input[type=text].bsl-nom:focus { border-bottom-color: var(--bsl-or); border-bottom-style: solid; }
#boussole input[type=text].bsl-nom::placeholder { color: #b9b0a2; font-style: italic; }

/* ---------- Échelle 0 à 10 ---------- */
#boussole .bsl-echelle { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .85rem; padding: 0; border: 0; }
#boussole .bsl-echelle .bsl-opt label {
  padding: 0; width: 38px; height: 38px; line-height: 36px; text-align: center;
  border-radius: 50%; font-size: .95rem; font-variant-numeric: tabular-nums;
}
#boussole .bsl-echelle .bsl-opt input:checked + label {
  box-shadow: none; background: var(--bsl-or); border-color: var(--bsl-or); color: #fff;
}
#boussole .bsl-reperes { display: flex; justify-content: space-between; max-width: 508px; margin: -.35rem 0 1rem; }
#boussole .bsl-reperes span { font-size: .78rem; color: var(--bsl-encre-doux); }

/* ---------- Date ---------- */
#boussole .bsl-ligne-date { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }

/* ---------- Extrait du livre ---------- */
#boussole .bsl-extrait {
  background: var(--bsl-ivoire); border-left: 2px solid var(--bsl-or-clair);
  padding: 1.35rem 1.6rem; margin: 1.35rem 0 0;
}
#boussole .bsl-extrait p { font-family: var(--bsl-serif); font-size: 1.16rem; line-height: 1.6; margin: 0 0 .6rem; }
#boussole .bsl-extrait .bsl-source { font-family: var(--bsl-sans); font-size: .82rem; color: var(--bsl-encre-doux); margin: 0; }

/* ---------- Le carnet en deux temps ---------- */
#boussole .bsl-plus { border-top: 1px solid var(--bsl-trait); margin-top: 1.35rem; }
#boussole .bsl-plus > summary {
  list-style: none; cursor: pointer; padding: 1.1rem 0 .2rem;
  font-family: var(--bsl-serif); font-size: 1.3rem; font-weight: 500; color: var(--bsl-or);
  display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap;
}
#boussole .bsl-plus > summary::-webkit-details-marker { display: none; }
#boussole .bsl-plus > summary::before {
  content: "+"; font-family: var(--bsl-sans); font-size: 1.05rem; line-height: 1;
  color: var(--bsl-or); flex: 0 0 auto;
}
#boussole .bsl-plus[open] > summary::before { content: "\2013"; }
#boussole .bsl-plus > summary:hover { color: var(--bsl-encre); }
#boussole .bsl-plus > summary:focus-visible { outline: 2px solid var(--bsl-or); outline-offset: 3px; }
#boussole .bsl-plus > summary .bsl-mention { font-family: var(--bsl-sans); font-size: .85rem; }
#boussole .bsl-plus-contenu > .bsl-bloc:first-child { border-top: 0; margin-top: .6rem; padding-top: 0; }

/* ---------- Suite ---------- */
#boussole .bsl-suite { background: var(--bsl-creux); border-radius: 3px; padding: clamp(1.5rem, 4vw, 2.25rem); margin: 0 0 1.6rem; }
#boussole .bsl-suite h3 { margin-top: 0; }
#boussole .bsl-suite p { max-width: 56ch; }
#boussole .bsl-outils { display: flex; gap: 1.1rem; flex-wrap: wrap; align-items: center; }

/* ---------- Reprise des saisies à l'impression ---------- */
#boussole .bsl-impression { display: none; }

/* ---------- Impression ---------- */
@media print {
  .site-header, .site-footer, .skip-link,
  #boussole .bsl-progression,
  #boussole .bsl-ecran:not(.visible),
  #boussole .bsl-outils,
  #boussole .bsl-no-print,
  #boussole .bsl-echelle, #boussole .bsl-reperes, #boussole .bsl-ligne-date,
  #boussole input, #boussole textarea { display: none !important; }
  body { background: #fff; }
  #boussole { max-width: none; padding: 0; font-size: 12pt; }
  #boussole .bsl-carnet { border: 0; padding: 0; }
  #boussole .bsl-suite { background: #fff; border-top: 1px solid #ccc; border-radius: 0; padding: .9rem 0 0; }
  #boussole .bsl-extrait { background: #fff; padding: .9rem 0 0 1.1rem; }
  #boussole .bsl-impression { display: block; margin: 0 0 .4rem; }
  #boussole .bsl-impression:empty { display: none; }
  #boussole .bsl-impression.titre { font-family: var(--bsl-serif); font-size: 20pt; line-height: 1.2; margin: 0 0 .25rem; }
  #boussole .bsl-impression.intention { font-family: var(--bsl-serif); font-size: 14pt; line-height: 1.45; }
  #boussole .bsl-duo { gap: .6rem; }
  #boussole .bsl-bloc { break-inside: avoid; }
  #boussole .bsl-plus > summary { display: none !important; }
  #boussole .bsl-plus { border-top: 0; margin-top: 0; }
  #boussole a[href]::after { content: ""; }
}

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  #boussole .bsl-choix { grid-template-columns: 1fr; }
  #boussole .bsl-galerie { grid-template-columns: 1fr 1fr; }
  #boussole .bsl-galerie figcaption { font-size: 1.04rem; padding: .6rem .35rem; }
  #boussole .bsl-carnet-image { flex-basis: 130px; max-width: 130px; }
  #boussole .bsl-duo { grid-template-columns: 1fr; }
  #boussole .bsl-echelle .bsl-opt label { width: 34px; height: 34px; line-height: 32px; font-size: .88rem; }
  #boussole .bsl-actions { gap: .9rem; }
}
