/* =====================================================================
   Sillon — feuille de style
   Inspiration : Psyche (psyche.co). Fond crème, encre brune, rouille,
   colonne étroite, page qui se déroule en longueur, tableaux en grand.
   ===================================================================== */

/* ---------- 1. Jetons ---------- */
:root {
  --papier: #f4f1ea;
  --papier-2: #ebe6da;
  --surface: #faf8f3;
  --encre: #443d3d;
  --encre-douce: #7a716a;
  --encre-pale: #a39a8f;
  --rouille: #9d4f06;
  --rouille-doux: rgb(157 79 6 / .1);
  --trait: #ddd5c6;
  --liturgie: #a3853f;
  --ombre-oeuvre: 0 30px 60px -30px rgb(60 40 20 / .45);

  --colonne: 36rem;
  --large: 72rem;
  --titre: "Fraunces", Georgia, serif;
  --texte: "Newsreader", Georgia, serif;
  --meta: "DM Mono", ui-monospace, "Cascadia Mono", monospace;
  --vitesse: 200ms;
  --courbe: cubic-bezier(.2, .7, .2, 1);

  color-scheme: light;
}

:root[data-theme="sombre"] {
  --papier: #1c1916;
  --papier-2: #26221e;
  --surface: #221f1b;
  --encre: #e9e2d6;
  --encre-douce: #a8a094;
  --encre-pale: #7d756b;
  --rouille: #d9925a;
  --rouille-doux: rgb(217 146 90 / .12);
  --trait: #3a342e;
  --ombre-oeuvre: 0 30px 60px -30px rgb(0 0 0 / .7);
  color-scheme: dark;
}

/* Couleur liturgique : seulement la petite pastille */
:root[data-liturgie="vert"]   { --liturgie: #4f7a5a; }
:root[data-liturgie="violet"] { --liturgie: #6d5591; }
:root[data-liturgie="rouge"]  { --liturgie: #a3443a; }
:root[data-liturgie="rose"]   { --liturgie: #c07a8c; }
:root[data-liturgie="blanc"]  { --liturgie: #d8c9a3; }
:root[data-liturgie="noir"]   { --liturgie: #5b5750; }

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 1.5rem; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font: 400 1.1875rem/1.7 var(--texte);
  font-variation-settings: "opsz" 16;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--vitesse), color var(--vitesse);
}
img, svg { display: block; }
img { max-width: 100%; height: auto; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
::selection { background: rgb(157 79 6 / .22); }
:focus-visible { outline: 2px solid var(--rouille); outline-offset: 3px; border-radius: 4px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.bouton-icone svg, .verrou-icone svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.colonne { max-width: var(--colonne); margin-inline: auto; padding-inline: 1.25rem; }
.meta { font: 400 .75rem/1.45 var(--meta); letter-spacing: .12em; text-transform: uppercase; color: var(--encre-douce); }
.discret { color: var(--encre-douce); font-size: .95rem; }
.visuellement-cache { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.lien-evitement { position: absolute; left: 1rem; top: -3rem; z-index: 100; padding: .5rem .9rem; border-radius: 6px; background: var(--encre); color: var(--papier); text-decoration: none; transition: top var(--vitesse); }
.lien-evitement:focus { top: 1rem; }

/* ---------- 3. En-tête ---------- */
.barre {
  max-width: var(--large); margin: 0 auto;
  padding: 1.3rem max(1rem, env(safe-area-inset-left)) .2rem;
  display: grid; grid-template-columns: 2.75rem 1fr 2.75rem; align-items: center;
}
.logo { justify-self: center; text-align: center; text-decoration: none; }
.logo strong { display: block; font: 400 2.4rem/1 var(--titre); font-variation-settings: "opsz" 144; color: var(--rouille); letter-spacing: -.02em; }
.logo span { display: block; margin-top: .25rem; font: italic 400 1rem/1 var(--titre); color: var(--rouille); opacity: .85; }
.bouton-icone { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border: 0; border-radius: 999px; background: none; color: var(--encre); transition: background var(--vitesse); }
.bouton-icone:hover { background: var(--papier-2); }
.bouton-icone svg { width: 1.3rem; height: 1.3rem; }
:root[data-theme="sombre"] .si-clair, :root:not([data-theme="sombre"]) .si-sombre { display: none; }

.jours { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: .4rem 1rem; padding: 1rem 1rem 1.5rem; }
.jours button { border: 0; background: none; font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--encre-douce); padding: .4rem .6rem; border-radius: 999px; transition: color var(--vitesse), background var(--vitesse); }
.jours button:hover { color: var(--encre); background: var(--papier-2); }
.date-courante { position: relative; color: var(--encre); font-weight: 500; padding: .4rem .5rem; border-radius: 999px; cursor: pointer; }
.date-courante:hover { background: var(--papier-2); }
.date-courante input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.date-courante:has(input:focus-visible) { outline: 2px solid var(--rouille); outline-offset: 2px; }
.jours .retour { color: var(--rouille); }

/* ---------- 4. Frontispice ---------- */
.frontispice { margin: 0 auto; max-width: var(--large); }
.frontispice img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: 50% 30%; }
figcaption { padding: .65rem 1.25rem 0; text-align: center; }

/* ---------- 5. Le jour ---------- */
main { outline: none; }
.jour { text-align: center; padding-top: 3.4rem; }
.jour > .meta { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; flex-wrap: wrap; margin: 0; }
.pastille-liturgique { width: .5rem; height: .5rem; border-radius: 50%; background: var(--liturgie); flex-shrink: 0; }
.fete { margin: .7rem 0 0; font: italic 400 1.05rem/1.4 var(--titre); color: var(--encre-douce); }
h1 { margin: 1.1rem 0 1.2rem; font: 400 clamp(2rem, 6vw, 2.9rem)/1.15 var(--titre); font-variation-settings: "opsz" 120; color: var(--rouille); letter-spacing: -.015em; text-wrap: balance; }
.reference { margin: 0; font-size: 1.05rem; color: var(--encre-douce); }
.reference strong { font-weight: 500; color: var(--encre); }

/* ---------- 6. Les trois temps ---------- */
.temps { padding-top: 4rem; }
.temps-titre { display: flex; align-items: center; gap: 1rem; margin: 0 0 1.6rem; font-weight: 400; }
.temps-titre::after { content: ""; flex: 1; height: 1px; background: var(--trait); }

.evangile p { margin: 0 0 1.1em; }
.evangile p.lettrine::first-line { font-variant-caps: all-small-caps; letter-spacing: .05em; color: var(--rouille); }
.acclamation { margin: 2rem 0 0; text-align: center; font-style: italic; color: var(--encre-douce); }

/* Méditer */
.pistes { margin: 0 0 1.2rem; font-style: italic; color: var(--encre-douce); }
#meditation {
  display: block; width: 100%; min-height: 9rem; resize: vertical;
  border: 0; border-bottom: 1px solid var(--encre-pale); background: transparent;
  font: italic 400 1.15rem/1.7 var(--texte); color: var(--encre);
  padding: .4rem 0; outline: none; transition: border-color var(--vitesse);
}
#meditation:focus { border-bottom-color: var(--rouille); }
#meditation::placeholder { color: var(--encre-pale); }
.sous-champ { display: flex; justify-content: space-between; gap: 1rem; margin: .6rem 0 0; color: var(--encre-pale); }
.consigne { margin: .8rem 0 0; font-size: .95rem; font-style: italic; color: var(--encre-douce); }
.consigne:empty { display: none; }

/* Boutons */
.actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.4rem; }
.bouton {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.9rem; padding: .85rem 1.3rem; border-radius: 999px;
  font: 500 .78rem/1 var(--meta); letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
  border: 1px solid var(--encre); background: var(--encre); color: var(--papier);
  transition: background var(--vitesse), color var(--vitesse), opacity var(--vitesse), transform var(--vitesse) var(--courbe);
}
.bouton:hover:not(:disabled) { background: var(--rouille); border-color: var(--rouille); color: #fff; }
.bouton:active:not(:disabled) { transform: scale(.98); }
.bouton:disabled { opacity: .35; cursor: not-allowed; }
.bouton-leger { background: transparent; color: var(--encre); }

/* ---------- 7. S'éclairer ---------- */
.verrou { padding: 2.6rem 1.5rem; text-align: center; border: 1px solid var(--trait); border-radius: 4px; }
.verrou-icone { display: inline-grid; place-items: center; width: 3rem; height: 3rem; margin: 0 auto 1rem; border-radius: 50%; background: var(--rouille-doux); color: var(--rouille); }
.verrou-icone svg { width: 1.3rem; height: 1.3rem; }
.verrou h3, .vide h3 { margin: 0 0 .4rem; font: 400 1.4rem/1.3 var(--titre); }
.verrou p, .vide p { margin: 0 auto; max-width: 26rem; color: var(--encre-douce); font-size: 1rem; }
.vide { padding: 2.2rem 1.5rem; text-align: center; border: 1px dashed var(--trait); border-radius: 4px; }
.erreur { padding: 1.4rem; border: 1px solid #c98a7f; border-radius: 4px; }
.erreur p { margin: 0 0 .8rem; }

.rappel-meditation { margin: 0 0 2.2rem; padding-left: 1.1rem; border-left: 2px solid var(--rouille); }
.rappel-meditation p { margin: 0 0 .3rem; }
.rappel-meditation blockquote { margin: 0; font-style: italic; color: var(--encre-douce); white-space: pre-line; }

.citation { margin: 0 0 2.4rem; font: 400 1.65rem/1.35 var(--titre); font-variation-settings: "opsz" 72; text-wrap: pretty; }
.citation::before { content: "« "; color: var(--rouille); }
.citation::after { content: " »"; color: var(--rouille); }

.partie { border-top: 1px solid var(--trait); }
.partie:last-of-type { border-bottom: 1px solid var(--trait); }
.partie summary { list-style: none; cursor: pointer; padding: 1.15rem 0; display: grid; grid-template-columns: 1fr auto; gap: .15rem 1rem; align-items: baseline; }
.partie summary::-webkit-details-marker { display: none; }
.partie-nom { font: 400 1.35rem/1.25 var(--titre); }
.partie-sous { grid-column: 1; font-style: italic; color: var(--encre-douce); font-size: 1rem; }
.partie-plus { grid-row: 1 / span 2; grid-column: 2; font: 300 1.6rem/1 var(--titre); color: var(--rouille); transition: transform var(--vitesse) var(--courbe); }
.partie[open] .partie-plus { transform: rotate(45deg); }
.partie-texte { padding: 0 0 1.4rem; font-size: 1.1rem; }
.partie-texte p { margin: 0 0 1em; }
.partie-texte ul, .partie-texte ol { margin: 0 0 1em; padding-left: 1.1rem; }
.partie-texte li { margin: .5em 0; }
.partie-texte li::marker { color: var(--rouille); }
.partie-texte strong { font-weight: 600; }
.partie-texte blockquote { margin: 1.3em 0; padding-left: 1.1rem; border-left: 2px solid var(--trait); font-style: italic; color: var(--encre-douce); }

.appel-note { font: 500 .62rem/1 var(--meta); color: var(--rouille); text-decoration: none; vertical-align: super; padding: 0 .12em; }
.appel-note:hover { text-decoration: underline; }

.question { margin: 3rem 0 0; padding: 2.2rem 1.5rem; text-align: center; background: var(--papier-2); border-radius: 4px; }
.question p { margin: 0; }
.question .question-texte { margin-top: .7rem; font: italic 400 1.4rem/1.4 var(--titre); text-wrap: balance; }

.cartes { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 2.4rem; }
.vide + .cartes { margin-top: 1.4rem; }
.carte { display: block; padding: 1.1rem 1.1rem 1.2rem; border: 1px solid var(--trait); border-radius: 4px; text-decoration: none; transition: border-color var(--vitesse), background var(--vitesse); }
.carte:hover { border-color: var(--rouille); background: var(--surface); }
.carte .meta { color: var(--rouille); }
.carte-titre { display: block; margin-top: .45rem; font: 400 1.1rem/1.3 var(--titre); }

.sources { margin-top: 2.4rem; border-top: 1px solid var(--trait); color: var(--encre-douce); font-size: .95rem; }
.sources summary { list-style: none; cursor: pointer; padding: .9rem 0; }
.sources summary::-webkit-details-marker { display: none; }
.sources summary::after { content: " +"; color: var(--rouille); }
.sources[open] summary::after { content: " −"; }
.sources ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.sources li { margin: .35rem 0; padding: .15rem .3rem; border-radius: 3px; transition: background .6s; }
.sources li.surlignee { background: var(--rouille-doux); }
.sources li::marker { font: 500 .75rem var(--meta); color: var(--rouille); }
.source-type { font: 400 .68rem/1 var(--meta); letter-spacing: .08em; text-transform: uppercase; color: var(--rouille); margin-right: .4rem; }
.source-auteur { color: var(--encre); }
.statut { margin: .2rem 0 1rem; font-size: .9rem; }
.statut a { color: var(--encre-douce); text-underline-offset: 3px; }

/* Squelettes & apparitions */
.squelette { display: block; height: .9em; margin: .5em 0; border-radius: 4px; background: linear-gradient(90deg, var(--papier-2) 0%, var(--trait) 50%, var(--papier-2) 100%); background-size: 200% 100%; animation: miroiter 1.4s linear infinite; }
.squelette.court { width: 60%; }
.squelette-titre { width: 70%; height: 1em; margin: .1em auto; }
@keyframes miroiter { to { background-position: -200% 0; } }
.apparait { animation: apparaitre 520ms var(--courbe) both; }
@keyframes apparaitre { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 8. Pied ---------- */
.pied { margin-top: 6rem; padding-bottom: calc(3rem + env(safe-area-inset-bottom)); }
.detail-millet { margin: 0 auto; max-width: 48rem; padding-inline: 1.25rem; }
.detail-millet img { width: 100%; aspect-ratio: 20 / 11; object-fit: cover; border-radius: 2px; }
.detail-millet figcaption { padding-inline: 0; }
.pied blockquote { margin-top: 2.6rem; margin-bottom: 0; font: italic 400 1.3rem/1.5 var(--titre); text-align: center; }
.pied cite { display: block; margin-top: .6rem; font-style: normal; }
.pied-liens { display: flex; justify-content: center; gap: 1.6rem; margin-top: 2.6rem; }
.pied-liens a { text-decoration: none; }
.pied-liens a:hover { color: var(--rouille); }
.pied-mention { max-width: var(--colonne); margin: 1.2rem auto 0; padding-inline: 1.25rem; text-align: center; font-size: .85rem; color: var(--encre-pale); }

/* ---------- 9. Panneaux ---------- */
.panneau {
  width: min(32rem, calc(100% - 2rem)); max-height: min(88vh, 46rem);
  margin: auto; padding: 0; border: 1px solid var(--trait); border-radius: 6px;
  background: var(--papier); color: var(--encre); box-shadow: 0 24px 64px -24px rgb(0 0 0 / .35); overflow: hidden;
}
.panneau[open] { display: flex; flex-direction: column; animation: apparaitre 260ms var(--courbe) both; }
.panneau::backdrop { background: rgb(28 22 16 / .4); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.panneau-entete { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem .9rem .9rem 1.4rem; border-bottom: 1px solid var(--trait); }
.panneau-entete h2 { margin: 0; font: 400 1.5rem/1.2 var(--titre); color: var(--rouille); }
.panneau-corps { padding: 1.2rem 1.4rem 1.6rem; overflow-y: auto; font-size: 1.05rem; }
.panneau-sous-titre { margin: 1.9rem 0 .7rem; font-weight: 400; }
.panneau textarea, .panneau input[type="text"], .panneau input[type="time"] {
  width: 100%; border: 1px solid var(--trait); border-radius: 4px; background: var(--surface);
  padding: .7rem .85rem; outline: none; transition: border-color var(--vitesse);
}
.panneau textarea { font: 400 .95rem/1.55 var(--texte); resize: vertical; }
.panneau input[type="time"] { width: auto; font-variant-numeric: tabular-nums; }
.panneau textarea:focus, .panneau input:focus { border-color: var(--rouille); }
.ligne-formulaire { display: flex; gap: .5rem; }
.ligne-formulaire input[type="text"] { flex: 1; min-width: 0; }

.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.chiffre { padding: .9rem .5rem; border-radius: 4px; background: var(--papier-2); text-align: center; }
.chiffre strong { display: block; font: 400 2rem/1.1 var(--titre); color: var(--rouille); }
.chiffre span { font: 400 .68rem/1.3 var(--meta); letter-spacing: .06em; text-transform: uppercase; color: var(--encre-douce); }
.calendrier { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; justify-content: start; }
.case { width: .8rem; height: .8rem; border-radius: 2px; background: var(--papier-2); }
.case.remplie { background: var(--rouille); }
.case.aujourdhui { outline: 1.5px solid var(--encre-douce); outline-offset: 1px; }
.case.futur { background: transparent; }
.liste-meditations { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.liste-meditations button { width: 100%; text-align: left; border: 1px solid var(--trait); border-radius: 4px; background: var(--surface); padding: .7rem .85rem; transition: border-color var(--vitesse); }
.liste-meditations button:hover { border-color: var(--rouille); }
.liste-meditations strong { display: block; font: 400 .72rem/1.4 var(--meta); letter-spacing: .08em; text-transform: uppercase; color: var(--encre-douce); }
.liste-meditations span { margin-top: .2rem; font-style: italic; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---------- 10. Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  padding: .7rem 1.1rem; border-radius: 999px; background: var(--encre); color: var(--papier);
  font: 400 .78rem/1.3 var(--meta); letter-spacing: .06em;
  transition: opacity var(--vitesse), transform var(--vitesse) var(--courbe);
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 11. Page « Méthode & sources » ---------- */
.prose h2 { margin: 3rem 0 1rem; }
.prose p, .prose li { font-size: 1.1rem; }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li { margin: .5em 0; }
.prose li::marker { color: var(--rouille); }
.prose blockquote { margin: 1.6rem 0; padding-left: 1.1rem; border-left: 2px solid var(--rouille); font-style: italic; color: var(--encre-douce); }

/* ---------- 12. Petits écrans ---------- */
@media (max-width: 34rem) {
  body { font-size: 1.125rem; }
  .logo strong { font-size: 2rem; }
  .cartes { grid-template-columns: 1fr; }
  .actions .bouton { flex: 1 1 auto; }
  .citation { font-size: 1.45rem; }
}

/* ---------- 13. Préférences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
@media print {
  .barre, .jours, .frontispice, #mediter .actions, .pied-liens, .toast { display: none !important; }
  body { background: #fff; color: #000; }
}
