/* ===========================================================
   Soirée LZM - palette "missel / livret ancien"
   Encre nuit · parchemin ivoire · or mat · rubriques bordeaux
   =========================================================== */

:root {
  --encre: #1c2f4a;
  --encre-clair: #33507a;
  --parchemin: #f8f3e6;
  --parchemin-ombre: #efe4cd;
  --or: #a67c3d;
  --or-clair: #c9a463;
  --bordeaux: #7a2e2e;
  --texte: #26221b;
  --bordure: #d9c9a3;

  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "EB Garamond", Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.05rem;
  background: var(--parchemin);
  color: var(--texte);
  line-height: 1.5;
}

/* ---- Masthead ---- */

header {
  background: var(--encre);
  color: var(--parchemin);
  padding: 2.25rem 2rem 0;
  border-bottom: 3px double var(--or-clair);
}

header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.1rem;
  letter-spacing: 0.02em;
}

.masthead-subtitle {
  margin: 0.25rem 0 1.5rem;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.95rem;
  color: rgba(248, 243, 230, 0.72);
}

nav {
  display: flex;
  gap: 0.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(248, 243, 230, 0.68);
  padding: 0.7rem 1.1rem;
  font-family: var(--font-body);
  font-variant: small-caps;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
  cursor: pointer;
}

.tab-btn.active {
  color: var(--parchemin);
  border-bottom-color: var(--or-clair);
}

.tab-btn:hover { color: var(--parchemin); }

/* ---- Layout ---- */

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.panel {
  background: var(--parchemin-ombre);
  border-top: 2px solid var(--or);
  border-radius: 0;
  padding: 1.75rem 1.75rem 2rem;
  margin-bottom: 2rem;
}

.panel h2 {
  margin: 0 0 1.1rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--encre);
}

.panel h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--encre);
  margin: 1.5rem 0 0.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--bordure);
}

.panel h3:first-of-type { border-top: none; padding-top: 0; }

.rubrique {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--bordeaux);
  font-size: 0.92rem;
  margin: 0 0 0.75rem;
}

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

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  align-items: end;
}

.form-row label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  font-style: italic;
  gap: 0.3rem;
  color: var(--encre);
}

input, select, textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--bordure);
  border-radius: 2px;
  background: var(--parchemin);
  color: var(--texte);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--or-clair);
  outline-offset: 1px;
}

textarea { width: 100%; resize: vertical; font-size: 0.98rem; }

button {
  font-family: var(--font-body);
  font-variant: small-caps;
  letter-spacing: 0.02em;
  font-size: 1rem;
  background: var(--encre);
  color: var(--parchemin);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  padding: 0.55rem 1.1rem;
}

button:hover { background: var(--encre-clair); }

/* ---- Évangile du jour ---- */

.evangile-box {
  background: var(--parchemin);
  border-left: 3px solid var(--bordeaux);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  white-space: pre-wrap;
  font-size: 0.98rem;
}

/* ---- Tirage aléatoire des chants ---- */

#btn-nouvelle-seance { margin-top: 1rem; }

#btn-tirer-tout {
  background: var(--bordeaux);
  margin-bottom: 1rem;
}

#btn-tirer-tout:hover { background: #632424; }

.categorie-bloc { margin-bottom: 1.4rem; }

.categorie-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--bordure);
}

.categorie-header h4 {
  color: var(--or);
  margin: 0;
  font-family: var(--font-display);
  font-variant: small-caps;
  letter-spacing: 0.05em;
  font-size: 1.15rem;
  font-weight: 600;
}

.btn-choix-aleatoire {
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
}

.chant-checkbox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px dotted var(--bordure);
}

.chant-checkbox label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1rem;
}

.usage-badge {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--or);
  background: var(--parchemin);
  border: 1px solid var(--bordure);
  padding: 0.05rem 0.4rem;
  border-radius: 8px;
}

.export-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ---- Listes (référentiel, historique) ---- */

.chant-item {
  border-bottom: 1px solid var(--bordure);
  padding: 0.7rem 0;
}

.chant-item h4 {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--texte);
}

.chant-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.chant-item-header h4 { margin: 0; }

.btn-modifier-chant {
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  flex-shrink: 0;
}

.chant-item .meta {
  font-size: 0.85rem;
  font-style: italic;
  color: #7a7263;
}

.chant-liens {
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

.chant-liens a {
  color: var(--bordeaux);
  text-decoration: none;
  margin-right: 0.5rem;
}

.chant-liens a:hover { text-decoration: underline; }

.chant-paroles {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.chant-paroles summary {
  cursor: pointer;
  color: var(--encre-clair);
  font-style: italic;
}

.chant-paroles pre {
  font-family: var(--font-body);
  white-space: pre-wrap;
  background: var(--parchemin);
  border-left: 2px solid var(--bordure);
  padding: 0.6rem 0.9rem;
  margin: 0.5rem 0 0;
  max-width: 68ch;
}

#export-liens a {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--bordeaux);
  font-style: italic;
}

/* ---- Accessibilité : mouvement réduit ---- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- Livret de prière (lecture à l'écran) ---- */

.livret-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--bordure);
}

.livret-section:last-child { border-bottom: none; }

.livret-section h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--encre);
  margin: 0 0 0.6rem;
}

.livret-texte {
  margin: 0 0 0.9rem;
  max-width: 68ch;
}

.livret-section .rubrique { max-width: 68ch; }

.deroule-insert {
  margin: 0 0 1.75rem;
}

.deroule-chant {
  background: var(--parchemin);
  border-left: 3px solid var(--or);
  padding: 0.9rem 1.1rem;
}

.deroule-chant h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--encre);
  margin: 0 0 0.4rem;
}

.deroule-chant pre {
  font-family: var(--font-body);
  white-space: pre-wrap;
  margin: 0.5rem 0 0;
  max-width: 68ch;
}

/* ---- En-tête de panneau avec action ---- */

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.panel-header-row h2 { margin: 0; }

.panel-header-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.format-exemple {
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--parchemin);
  border: 1px solid var(--bordure);
  padding: 0.75rem 1rem;
  white-space: pre-wrap;
  margin: 0 0 0.9rem;
}

/* ---- Fenêtre modale d'ajout de chant ---- */

dialog {
  font-family: var(--font-body);
  color: var(--texte);
  background: var(--parchemin);
  border: none;
  border-top: 3px solid var(--or);
  border-radius: 0;
  padding: 1.75rem;
  width: min(560px, 92vw);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

dialog::backdrop {
  background: rgba(28, 47, 74, 0.55);
}

dialog h2 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--encre);
  margin: 0 0 1.1rem;
  font-size: 1.4rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

.btn-secondaire {
  background: transparent;
  color: var(--encre);
  border: 1px solid var(--bordure);
}

.btn-secondaire:hover { background: var(--parchemin-ombre); }

/* ===========================================================
   Responsive - mobile
   =========================================================== */

@media (max-width: 640px) {
  header {
    padding: 1.5rem 1.25rem 0;
  }

  header h1 {
    font-size: 1.7rem;
  }

  .masthead-subtitle {
    font-size: 0.85rem;
    margin-bottom: 1rem;
  }

  nav {
    flex-wrap: wrap;
    gap: 0.15rem;
  }

  .tab-btn {
    padding: 0.6rem 0.7rem;
    font-size: 0.95rem;
    flex: 1 1 auto;
    text-align: center;
  }

  main {
    padding: 1.5rem 1rem 3rem;
  }

  .panel {
    padding: 1.25rem 1.1rem 1.5rem;
    margin-bottom: 1.25rem;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .form-row label { width: 100%; }

  .form-row input, .form-row select, .form-row button {
    width: 100%;
  }

  .categorie-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .categorie-header .btn-choix-aleatoire { width: 100%; }

  .chant-checkbox {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }

  .export-buttons {
    flex-direction: column;
  }

  .export-buttons button { width: 100%; }

  .panel-header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-header-row button { width: 100%; }

  .chant-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .btn-modifier-chant { align-self: flex-start; }

  dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    padding: 1.5rem 1.1rem;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions button { width: 100%; }
}
