/* ════════════════════════════════════════════════════════════════════════
   Carnet — rendu éditorial « almanach relié »
   Tronc commun + peau par type (--accent). Charte « herbier vivant ».
   ════════════════════════════════════════════════════════════════════════ */

html { scroll-behavior: smooth; }

.astro-carnet {
  --c-ivoire:#faf6ee; --c-papier:#f3ecdf; --c-encre:#4a3f35;
  --c-terracotta:#b5704f; --c-sauge:#97a883; --c-bleu:#93a4b5;
  --c-or:#ab8a4e; --c-rose:#dcb8b0; --c-border:#e3d8c5;

  --accent:   var(--c-terracotta);
  --accent-2: var(--c-or);

  max-width: 44rem;
  margin: 0 auto;
  color: var(--c-encre);
}

.astro-carnet--arbre_sacre        { --accent: var(--c-sauge);  --accent-2: var(--c-terracotta); }
.astro-carnet--portrait_ame       { --accent: var(--c-bleu);   --accent-2: var(--c-or); }
.astro-carnet--revolution_solaire { --accent: var(--c-or);     --accent-2: var(--c-sauge); }
.astro-carnet--trilogie           { --accent: var(--c-or);     --accent-2: var(--c-rose); }

.astro-orn { width: 1.25rem; height: 1.25rem; display: inline-block; vertical-align: middle; }

/* ── Frontispice : 2 colonnes (identité | carte) ──────────────────────── */
.astro-frontispice {
  display: grid;
  grid-template-columns: 1fr minmax(0, 14rem);
  gap: 2.5rem;
  align-items: center;
  padding: 1rem 0 0.5rem;
}
.astro-front-identite { min-width: 0; }
.astro-type {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin: 0 0 1rem;
  padding-left: 0.3em;
}
.astro-type-orn { color: var(--accent); line-height: 0; }
.astro-type-orn .astro-orn { width: 1rem; height: 1rem; }

.astro-nom {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1.05;
  font-weight: 500;
  color: var(--c-terracotta);
  margin: 0;
  letter-spacing: 0.01em;
}
.astro-naissance {
  margin: 1.1rem 0 0;
  font-style: italic;
  font-size: 0.98rem;
  color: var(--c-bleu);
  letter-spacing: 0.02em;
  line-height: 1.7;
}
.astro-naissance span { display: block; }

/* ── Carte oracle (frontispice + lightbox) ────────────────────────────── */
.astro-carte { margin: 0; }
.astro-carte-zoom { background: none; border: none; padding: 0; cursor: zoom-in; display: block; width: 100%; }
.astro-carte img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(74, 63, 53, 0.32), 0 3px 8px rgba(74, 63, 53, 0.2);
  transform: rotate(-2.5deg);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.astro-carte-zoom:hover img { transform: rotate(0deg) scale(1.02); }
.astro-carte figcaption {
  margin-top: 1rem;
  text-align: center;
  font-style: italic;
  font-size: 0.92rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.astro-lightbox[hidden] { display: none; }
.astro-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(35, 28, 22, 0.92);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out; padding: 4vh 4vw;
}
.astro-lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* ── Bouton PDF ───────────────────────────────────────────────────────── */
.astro-carnet-actions { text-align: right; margin: 1.6rem 0 0.5rem; }
.astro-pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: none;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--c-border));
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.astro-pdf-btn:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: var(--accent);
}

/* ── Sommaire ancré ───────────────────────────────────────────────────── */
.astro-toc {
  margin: 2.4rem 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
}
.astro-toc-titre {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--accent);
  margin: 0 0 0.8rem;
}
.astro-toc-liste { list-style: none; margin: 0; padding: 0; }
.astro-toc-liste a {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  color: var(--c-encre);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}
.astro-toc-liste a:hover { background: color-mix(in srgb, var(--c-papier) 70%, transparent); color: var(--accent); }
.astro-toc-liste a.is-current { color: var(--accent); }
.astro-toc-num { color: var(--accent); font-style: italic; min-width: 2.2ch; }
.astro-toc-label { line-height: 1.4; }

/* ── Divider ornemental ───────────────────────────────────────────────── */
.astro-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  color: var(--accent);
  margin: 3.2rem auto;
  max-width: 22rem;
}
.astro-divider-line {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 55%, transparent));
}
.astro-divider-line:last-child { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent), transparent); }
.astro-divider .astro-orn { width: 1.15rem; height: 1.15rem; }

/* ── Section narrative : marqueur sticky | contenu ────────────────────── */
.astro-recit {
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 1.6rem;
  align-items: start;
  scroll-margin-top: calc(2.75rem + 1.6rem); /* barre astro + souffle */
}
.astro-section-marker {
  position: sticky;
  top: calc(2.75rem + 1.6rem); /* affixe sous la barre astro, avec souffle */
  align-self: start;
  display: flex;
  justify-content: center;
}
/* Affix : decaler sous la barre admin/astro pour laisser respirer */
body.admin-bar .astro-recit { scroll-margin-top: calc(32px + 2.75rem + 1.6rem); }
body.admin-bar .astro-section-marker { top: calc(32px + 2.75rem + 1.6rem); }
@media screen and (max-width: 782px) {
  body.admin-bar .astro-recit { scroll-margin-top: calc(46px + 2.75rem + 1.4rem); }
  body.admin-bar .astro-section-marker { top: calc(46px + 2.75rem + 1.4rem); }
}

.astro-marker-rond {
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--c-border));
  background: color-mix(in srgb, var(--c-papier) 65%, var(--c-ivoire));
  color: var(--accent);
  box-shadow: 0 6px 16px rgba(74, 63, 53, 0.08);
  transition: background .35s ease, color .35s ease, border-color .35s ease, box-shadow .35s ease;
}
.astro-marker-rond .astro-orn { width: 1.5rem; height: 1.5rem; }

/* Marqueur affixe (colle au scroll) -> theme sombre */
.astro-section-marker.is-affixe .astro-marker-rond {
  background: var(--c-encre);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--c-encre));
  color: color-mix(in srgb, var(--accent) 40%, var(--c-ivoire));
  box-shadow: 0 10px 24px rgba(74, 63, 53, 0.30);
}

/* -- Bas de carnet : bouton « Tu as une question ? » -- */
.astro-question {
  margin-top: 3rem;
  padding-top: 2.2rem;
  border-top: 1px solid var(--c-border);
  text-align: center;
}
.astro-question-btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.72rem 1.6rem;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--c-border));
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--c-papier) 55%, var(--c-ivoire));
  text-decoration: none;
  font-size: 1.04rem;
  transition: background .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.astro-question-btn:hover {
  background: var(--accent);
  color: var(--c-ivoire);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(74, 63, 53, 0.18);
}
.astro-question-orn { line-height: 0; display: inline-flex; }
.astro-question-orn svg, .astro-question-orn .astro-orn { width: 1.15rem; height: 1.15rem; }

.astro-section-main { min-width: 0; }
.astro-section-tete { margin-bottom: 1.3rem; }
.astro-section-eyebrow { display: flex; align-items: baseline; gap: 0.7rem; margin: 0 0 0.45rem; }
.astro-section-num {
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.astro-section-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  color: color-mix(in srgb, var(--accent) 78%, var(--c-encre));
  transform: translateY(-0.15em);
}
.astro-section-titre {
  font-size: clamp(1.5rem, 3.4vw, 2.05rem);
  line-height: 1.22;
  font-weight: 500;
  color: var(--c-encre);
  margin: 0;
  text-wrap: balance;
}

/* ── Corps de texte ───────────────────────────────────────────────────── */
.astro-corps { font-size: 1.06rem; line-height: 1.85; color: var(--c-encre); }
.astro-corps > * { margin: 0 0 1.1rem; }
.astro-corps > *:last-child { margin-bottom: 0; }
.astro-corps > p:first-of-type {
  font-size: 1.16rem; line-height: 1.75;
  color: color-mix(in srgb, var(--c-encre) 92%, black);
}
.astro-recit--first .astro-section-main .astro-corps > p:first-of-type::first-letter {
  float: left;
  font-size: 3.5em;
  line-height: 0.74;
  margin: 0.06em 0.12em 0 0;
  color: var(--accent);
  font-weight: 500;
}
.astro-corps h3 { font-size: 1.16rem; font-weight: 500; color: var(--accent); letter-spacing: 0.02em; margin: 1.9rem 0 0.75rem; }
.astro-corps h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.2em; color: color-mix(in srgb, var(--accent) 80%, var(--c-encre)); margin: 1.7rem 0 0.55rem; }
.astro-corps em { color: color-mix(in srgb, var(--c-encre) 85%, var(--accent)); }
.astro-corps strong { color: var(--c-terracotta); font-weight: 600; }
.astro-corps a { color: var(--accent); text-underline-offset: 0.18em; }
.astro-corps blockquote { margin: 1.7rem 0; text-align: center; font-size: 1.28rem; line-height: 1.6; font-style: italic; color: var(--c-terracotta); }
.astro-corps blockquote p { margin: 0; }
.astro-corps ul, .astro-corps ol { padding-left: 1.4rem; }
.astro-corps li { margin: 0 0 0.5rem; padding-left: 0.3rem; }
.astro-corps ul li::marker { color: var(--accent); content: '› '; }
.astro-corps ol li::marker { color: var(--accent); font-style: italic; }

/* ── Section technique : accordéon ────────────────────────────────────── */
details.astro-technique { border: 1px solid var(--c-border); border-radius: 10px; background: color-mix(in srgb, var(--c-papier) 70%, transparent); }
details.astro-technique summary { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; cursor: pointer; padding: 1.1rem 1.4rem; list-style: none; }
details.astro-technique summary::-webkit-details-marker { display: none; }
.astro-technique-titre { font-size: 1.08rem; color: var(--c-encre); }
details.astro-technique summary em { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--accent); white-space: nowrap; }
details.astro-technique summary em::after { content: ' ▾'; }
details.astro-technique[open] summary em::after { content: ' ▴'; }
.astro-technique-body { padding: 0 1.4rem 1.3rem; font-size: 1.02rem; }

/* ── Haïku de clôture ─────────────────────────────────────────────────── */
.astro-final { text-align: center; padding: 1rem 1rem 0.5rem; }
.astro-final-orn { color: var(--accent); display: block; margin-bottom: 1.1rem; }
.astro-final-orn .astro-orn { width: 1.5rem; height: 1.5rem; }
.astro-haiku { font-size: 1.2rem; line-height: 2.2; font-style: italic; color: var(--c-encre); }

/* ── Notes du lecteur — écrin mis en évidence ─────────────────────────── */
.astro-notes-lecteur {
  margin-top: 3.4rem;
  padding: 1.8rem 2rem 1.2rem;
  background: color-mix(in srgb, var(--c-papier) 55%, var(--c-ivoire));
  border: 1px solid color-mix(in srgb, var(--c-sauge) 50%, var(--c-border));
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(74, 63, 53, 0.08);
  position: relative;
}
.astro-notes-lecteur::before {
  content: '';
  position: absolute; top: -1px; left: 1.4rem; right: 1.4rem; height: 2px;
  background: linear-gradient(90deg, transparent, var(--c-sauge), transparent);
  border-radius: 2px;
}
.astro-notes-lecteur h2 {
  margin-top: 0;
  font-size: 1.2rem; font-weight: 500; color: var(--c-sauge); letter-spacing: 0.02em;
}
.astro-notes-lecteur h2::before { content: '❧\2002'; color: color-mix(in srgb, var(--c-sauge) 70%, var(--c-or)); }
.astro-notes-hint { font-size: 0.9rem; font-style: italic; color: var(--c-bleu); }
#astro-reader-notes {
  width: 100%; border: 1px solid var(--c-border); border-radius: 10px;
  background: color-mix(in srgb, var(--c-ivoire) 80%, transparent);
  padding: 1rem; font-family: inherit; font-size: 1rem; line-height: 1.7; color: var(--c-encre); resize: vertical;
}
#astro-reader-notes:focus { outline: 2px solid var(--c-sauge); border-color: transparent; }
.astro-notes-status { font-size: 0.85rem; color: var(--c-sauge); min-height: 1.2em; text-align: right; }

/* ── Toggle lecture jour / pénombre (frontispice) ─────────────────────── */
.astro-lumiere {
  display: flex; width: max-content; align-items: center; gap: 0.5rem;
  margin: 0 0 1.35rem; padding: 0.4rem 1.05rem;
  font: inherit; font-size: 0.82rem; font-style: italic; letter-spacing: 0.04em;
  color: var(--c-bleu);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--c-bleu) 45%, var(--c-border));
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}
.astro-lumiere:hover {
  color: var(--c-encre);
  border-color: var(--c-bleu);
  background: color-mix(in srgb, var(--c-bleu) 12%, transparent);
}
.astro-lumiere-ico { display: inline-flex; line-height: 0; }
.astro-lumiere .astro-ico-soleil { display: none; }
html.astro-dark .astro-lumiere .astro-ico-soleil { display: block; }
html.astro-dark .astro-lumiere .astro-ico-lune { display: none; }
.astro-lumiere-txt--jour { display: none; }
html.astro-dark .astro-lumiere-txt--nuit { display: none; }
html.astro-dark .astro-lumiere-txt--jour { display: inline; }

/* Flottaison douce, comme les pépites de l'accueil */
@keyframes astro-flotte {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
.astro-lumiere {
  animation: astro-flotte 6s ease-in-out infinite;
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  .astro-lumiere { animation: none; }
}

/* ── Échange avec Isabelle (commentaires du carnet) ───────────────────── */
.astro-echange {
  margin-top: 3rem;
  padding-top: 2.2rem;
  border-top: 1px solid var(--c-border);
}
.astro-echange h2 {
  font-size: 1.2rem; font-weight: 500; color: var(--accent); letter-spacing: 0.02em;
}
.astro-echange-hint { font-size: 0.9rem; font-style: italic; color: var(--c-bleu); }
.astro-echange-fil { list-style: none; margin: 1.4rem 0; padding: 0; display: grid; gap: 0.9rem; }
.astro-echange-msg {
  padding: 0.9rem 1.2rem;
  background: color-mix(in srgb, var(--c-papier) 60%, var(--c-ivoire));
  border: 1px solid var(--c-border);
  border-radius: 12px 12px 12px 4px;
  max-width: 85%;
}
.astro-echange-msg--isabelle {
  margin-left: auto;
  border-radius: 12px 12px 4px 12px;
  background: color-mix(in srgb, var(--accent) 10%, var(--c-ivoire));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--c-border));
}
.astro-echange-meta { margin: 0 0 0.35rem; font-size: 0.8rem; color: var(--c-bleu); }
.astro-echange-meta strong { color: var(--accent); font-weight: 600; }
.astro-echange-texte { font-size: 0.98rem; }
.astro-echange-texte p { margin: 0 0 0.5em; }
.astro-echange-texte p:last-child { margin-bottom: 0; }
.astro-echange-form textarea {
  width: 100%; border: 1px solid var(--c-border); border-radius: 10px;
  background: color-mix(in srgb, var(--c-ivoire) 80%, transparent);
  padding: 0.9rem 1rem; font-family: inherit; font-size: 1rem; line-height: 1.7;
  color: var(--c-encre); resize: vertical;
}
.astro-echange-form textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.astro-echange-form { text-align: center; }
.astro-echange-form .astro-question-btn { margin-top: 0.9rem; border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--c-border)); font-family: inherit; cursor: pointer; }

/* ── Mobile ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .astro-frontispice { grid-template-columns: 1fr; gap: 1.8rem; text-align: center; }
  .astro-lumiere { margin: 0 auto 1.35rem; }
  .astro-type { padding-left: 0; }
  .astro-naissance span { display: inline; }
  .astro-naissance span + span::before { content: ' · '; }
  .astro-front-carte { max-width: 13rem; margin: 0 auto; }
  .astro-recit { grid-template-columns: 1fr; gap: 1rem; }
  .astro-section-marker { position: static; justify-content: flex-start; }
  .astro-corps { font-size: 1.02rem; }
}

/* ════════════════════════════════════════════════════════════════════════
   Impression / Export PDF — pages A4, charte conservée
   ════════════════════════════════════════════════════════════════════════ */
@media print {
  @page { size: A4; margin: 16mm 15mm; }

  body { background: #faf6ee !important; }
  body * { visibility: hidden; }
  #astro-carnet, #astro-carnet * { visibility: visible; }
  #astro-carnet {
    position: absolute; top: 0; left: 0;
    width: 100%; max-width: none; margin: 0; padding: 0;
  }
  #astro-carnet, #astro-carnet * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .astro-carnet-actions, .astro-toc, .astro-divider, .astro-notes-lecteur, .astro-lightbox, .astro-lumiere, .astro-question, .astro-echange { display: none !important; }

  .astro-carte img { box-shadow: none; transform: none; }
  .astro-section-marker { position: static; }
  .astro-marker-rond { box-shadow: none; }

  .astro-recit { break-before: page; }
  .astro-final { break-before: page; }
  .astro-section-tete, .astro-section-eyebrow, .astro-section-titre { break-after: avoid; }
  .astro-front-carte, .astro-haiku { break-inside: avoid; }
}
