:root {
  --nuit: #14132B;
  --ground: #14132B;
  --voile: rgba(242, 237, 227, 0.07);
  --trait: rgba(242, 237, 227, 0.14);
  --parchemin: #F2EDE3;
  --estompe: #A9A192;
  --lueur: #E9B96B;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --voix: "EB Garamond", Georgia, "Times New Roman", serif;
  --sur-lueur: #14132B;
  --echelle: 1;
  --barre-h: 62px;
}

[data-taille="moyenne"] { --echelle: 1.15; }
[data-taille="grande"]  { --echelle: 1.34; }

[data-theme="clair"] {
  --nuit: #F6F1E6;
  --ground: #F6F1E6;
  --voile: rgba(43, 39, 64, 0.05);
  --trait: rgba(43, 39, 64, 0.16);
  --parchemin: #2B2740;
  --estompe: #726B5E;
  --lueur: #9C6B1B;
  --sur-lueur: #FCF8F0;
}

[data-moment="matin"] { --lueur: #E9B96B; --ground: #1A1631; }
[data-moment="midi"]  { --lueur: #EFDFB4; --ground: #1C1A33; }
[data-moment="soir"]  { --lueur: #CE7F5E; --ground: #221829; }
[data-moment="nuit"]  { --lueur: #8C99C0; --ground: #101026; }

[data-theme="clair"][data-moment="matin"] { --lueur: #9C6B1B; --ground: #F8F2E4; }
[data-theme="clair"][data-moment="midi"]  { --lueur: #7A6A2E; --ground: #F7F3E8; }
[data-theme="clair"][data-moment="soir"]  { --lueur: #9B4526; --ground: #F7EFE7; }
[data-theme="clair"][data-moment="nuit"]  { --lueur: #414D7C; --ground: #F2F1EC; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--ground);
  color: var(--parchemin);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
  transition: background-color 700ms ease;
}

body {
  padding-bottom: calc(var(--barre-h) + env(safe-area-inset-bottom));
}

body.lecture { padding-bottom: 0; }
body.lecture #barre { display: none; }

#vue {
  max-width: 34rem;
  margin: 0 auto;
  padding: calc(1.5rem + env(safe-area-inset-top)) 1.25rem 1.5rem;
}

h1, h2, h3 { font-weight: 500; margin: 0; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

:focus-visible { outline: 2px solid var(--lueur); outline-offset: 3px; border-radius: 4px; }

/* ---------- barre de navigation ---------- */

#barre {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--barre-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: var(--ground);
  border-top: 1px solid var(--trait);
}

#barre button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--estompe);
  font-size: 0.6875rem;
  letter-spacing: 0.01em;
}

#barre button[aria-current="page"] { color: var(--parchemin); }

#barre svg {
  width: 21px; height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- accueil : le chemin du jour ---------- */

.entete-jour { margin-bottom: 2.25rem; }
.entete-jour .date { font-size: 0.8125rem; color: var(--estompe); letter-spacing: 0.02em; }
.entete-jour .fiat {
  font-family: var(--voix);
  font-size: 2.75rem;
  line-height: 1.1;
  margin-top: 0.15rem;
  color: var(--lueur);
}
.entete-jour .verbe {
  font-family: var(--voix);
  font-style: italic;
  font-size: calc(1.0625rem * var(--echelle));
  color: var(--parchemin);
  margin-top: 0.4rem;
  opacity: 0.85;
}

.chemin { position: relative; padding-left: 1.75rem; }

.chemin::before {
  content: "";
  position: absolute;
  left: 5px; top: 1.4rem; bottom: 1.4rem;
  width: 1px;
  background: var(--trait);
}

.station {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--trait);
}
.chemin .station:last-of-type { border-bottom: none; }

.station::before {
  content: "";
  position: absolute;
  left: -1.75rem; top: 1.65rem;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 1px solid var(--trait);
  background: var(--ground);
}

.station[data-actif="oui"]::before {
  border-color: var(--lueur);
  background: var(--lueur);
  box-shadow: 0 0 0 5px var(--voile);
}

.station .nom { font-size: 1.125rem; }
.station[data-actif="oui"] .nom { color: var(--lueur); }
.station .duree { font-size: 0.75rem; color: var(--estompe); margin-left: auto; white-space: nowrap; }
.station .intro {
  display: block;
  font-family: var(--voix);
  font-size: calc(0.9375rem * var(--echelle));
  color: var(--estompe);
  margin-top: 0.2rem;
}

.station .titre-ligne { display: flex; align-items: baseline; gap: 0.6rem; width: 100%; }

.note-bas {
  margin-top: 2rem;
  font-family: var(--voix);
  font-style: italic;
  font-size: calc(0.9375rem * var(--echelle));
  line-height: 1.6;
  color: var(--estompe);
  border-left: 1px solid var(--trait);
  padding-left: 0.9rem;
}
.note-bas .ref { display: block; font-style: normal; font-size: 0.75rem; margin-top: 0.4rem; opacity: 0.7; }

/* ---------- lecteur de session ---------- */

.lecteur {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.lecteur-haut {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem 0.6rem;
}

.lecteur-haut .quitter {
  color: var(--estompe);
  font-size: 0.8125rem;
  padding: 0.35rem 0;
}

.jauge { flex: 1; display: flex; gap: 4px; }
.jauge span {
  flex: 1; height: 2px;
  background: var(--trait);
  border-radius: 1px;
}
.jauge span.faite { background: var(--lueur); }

.bloc {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1.5rem 1.5rem;
  max-width: 34rem;
  width: 100%;
  margin: 0 auto;
  animation: monte 400ms ease both;
}

@keyframes monte {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.bloc .etiquette {
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lueur);
  opacity: 0.8;
}

.bloc h2 {
  font-family: var(--voix);
  font-size: calc(1.75rem * var(--echelle));
  line-height: 1.25;
  margin: 0.5rem 0 1.25rem;
}

.bloc .texte {
  font-family: var(--voix);
  font-size: calc(1.1875rem * var(--echelle));
  line-height: 1.75;
}

.bloc .texte p { margin: 0 0 1rem; }

.bloc .silence {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 2.5rem 0;
}

.souffle {
  width: 84px; height: 84px;
  border-radius: 50%;
  border: 1px solid var(--lueur);
  animation: souffle 8s ease-in-out infinite;
}

@keyframes souffle {
  0%, 100% { transform: scale(0.72); opacity: 0.35; }
  50%      { transform: scale(1);    opacity: 0.9; }
}

.lecteur-bas {
  padding: 0.75rem 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 34rem;
  width: 100%;
  margin: 0 auto;
}

.lecteur-bas .precedent { color: var(--estompe); font-size: 0.875rem; }

.suivant {
  margin-left: auto;
  background: var(--lueur);
  color: var(--sur-lueur);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.8rem 1.9rem;
  border-radius: 999px;
}

/* ---------- explorer ---------- */

.titre-page { font-size: 1.5rem; font-family: var(--voix); margin-bottom: 0.35rem; }
.sous-titre-page { font-size: 0.9375rem; color: var(--estompe); margin: 0 0 1.75rem; }

.carte {
  display: block;
  width: 100%;
  text-align: left;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--trait);
}
.carte .nom { font-size: 1.0625rem; }
.carte .sous { display: block; font-family: var(--voix); font-size: calc(0.9375rem * var(--echelle)); color: var(--estompe); margin-top: 0.2rem; }
.carte .compte { font-size: 0.75rem; color: var(--estompe); margin-top: 0.35rem; display: block; }

.retour { color: var(--estompe); font-size: 0.875rem; margin-bottom: 1.25rem; display: inline-block; }

/* ---------- réglages ---------- */

.reglage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--trait);
}
.reglage .libelle { font-size: 1rem; }
.reglage .aide { display: block; font-size: 0.8125rem; color: var(--estompe); margin-top: 0.2rem; }

.segment { display: flex; border: 1px solid var(--trait); border-radius: 999px; overflow: hidden; flex: none; }
.segment button { padding: 0.45rem 0.8rem; font-size: 0.8125rem; color: var(--estompe); }
.segment button[aria-pressed="true"] { background: var(--voile); color: var(--parchemin); }

.vide { font-family: var(--voix); font-size: 1.0625rem; color: var(--estompe); line-height: 1.7; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
