/* ================================================================
   EMPLACEMENT : assets/style.css
   (remplace l existant)
================================================================ */

/* ===============================================================
   THEME GLOBAL — variables CSS
   ---------------------------------------------------------------
   Ces valeurs servent de FALLBACK au cas où le moteur de thème PHP
   ne s'exécuterait pas. Le <style id="theme-vars"> injecté par
   render_theme_style() (dans <head>) écrase ces valeurs avec le
   thème actif sélectionné par l'admin.

   Le set par défaut ci-dessous correspond au thème "Terracotta &
   crème" (palette A).
=============================================================== */
:root {
  /* Surfaces */
  --bg:             #FAF6F0;
  --card:           #FFFFFF;
  --card-alt:       #F5EFE6;
  --card-hover:     #F2EBDF;
  --nav:            #43291C;
  --nav-text:       #FFFFFF;
  --nav-invert:     1;

  /* Couleurs d'action */
  --accent:         #C66B3D;
  --accent-hover:   #A8552E;
  --secondary:      #7A8B6F;
  --gold:           #B8954D;

  /* Texte */
  --text:           #2C2825;
  --muted:          #6B5F52;
  --text-on-accent: #FFFFFF;

  /* Bordures et effets */
  --border:         #E8DFD0;
  --shadow:         0 6px 24px rgba(58,40,25,.08);

  /* Dégradés */
  --page-gradient:  linear-gradient(180deg,#FAF6F0,#F5EFE6);
  --hero-gradient:  linear-gradient(180deg,#F5EFE6,#ECE3D0);

  /* Lecteur audio (0=clair sans inversion, 1=foncé avec inversion) */
  --audio-invert:   0;

  /* Typographies */
  --font-heading: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body:    "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
}


/* ===============================================================
   BASE
=============================================================== */
body {
  margin: 0;
  background: var(--page-gradient);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color .2s ease;
}

a:hover {
  color: var(--accent-hover);
}


/* ===============================================================
   TITRES — éditoriaux, en serif
=============================================================== */
h1, h2, h3, h4 {
  color: var(--text);
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.5px;
}

h1 {
  font-size: 42px;
  margin-bottom: 24px;
  font-weight: 600;
}

h2 {
  font-size: 30px;
  margin-bottom: 14px;
  font-weight: 500;
}

h3 {
  font-size: 22px;
  font-weight: 500;
}

h4 { font-size: 18px; }


/* ===============================================================
   NAVBAR
=============================================================== */
.navbar {
  background: var(--nav) !important;
  border-bottom: 1px solid var(--border);
  padding-top: 12px;
  padding-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.03);
}

.navbar-brand {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 600;
  color: var(--nav-text) !important;
}

.brand-logo {
  height: 64px;
  max-width: 280px;
  width: auto;
  margin-right: 10px;
  display: block;
}

.navbar .nav-link {
  color: var(--nav-text) !important;
  font-weight: 500;
  font-size: 15px;
  padding: 8px 14px !important;
  transition: color .2s ease;
}

.navbar .nav-link:hover {
  color: var(--gold) !important;
}

/* Bouton "Donner" en pilule, plus visible */
.nav-donate {
  background: var(--accent);
  color: var(--text-on-accent) !important;
  padding: 8px 18px !important;
  border-radius: 999px;
  margin-left: 6px;
  font-weight: 600 !important;
}

.nav-donate:hover {
  background: var(--accent-hover);
  color: var(--text-on-accent) !important;
}

/* Menu hamburger (mobile) — visible sur nav claire comme foncée */
.navbar-toggler {
  border-color: var(--nav-text);
}

.navbar-toggler-icon {
  filter: invert(var(--nav-invert));
}


/* ===============================================================
   LAYOUT
=============================================================== */
main.container {
  max-width: 1100px;
  padding: 30px 0;
}

.section-title {
  margin: 40px 0 20px;
  font-weight: 500;
}

/* Petit kicker discret avant les titres de section */
.section-title::before {
  content: "";
  display: inline-block;
  width: 36px;
  height: 2px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: 14px;
  margin-bottom: 6px;
}


/* ===============================================================
   CARDS — fond clair, bordure douce, ombre subtile
=============================================================== */
.card,
.card-light,
.blog-card,
.podcast-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  box-shadow: var(--shadow);
  color: var(--text);
  transition: transform .25s ease, box-shadow .25s ease;
}

.card:hover,
.blog-card:hover,
.podcast-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(58,40,25,.12);
}

.card *,
.card-light *,
.blog-card *,
.podcast-card * {
  color: var(--text);
}

.card p,
.card-light p,
.blog-card p {
  color: var(--muted);
}

.card-link {
  text-decoration: none;
  display: block;
}


/* ===============================================================
   HERO — page d'accueil
=============================================================== */
.hero {
  padding: 70px 0 50px;
  background: var(--hero-gradient);
  border-radius: 14px;
  margin-bottom: 30px;
}

.hero h1 {
  font-size: 48px;
  font-weight: 600;
}

.hero p {
  font-size: 19px;
  color: var(--muted);
  margin-bottom: 30px;
}

.hero-landing {
  padding: 10px 0 0;
}

.hero-landing .card,
.hero-landing .card-light {
  background: var(--card);
  border: 1px solid var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: center;
}

.hero-text h1 {
  font-size: 44px;
  font-weight: 600;
}

.hero-text p {
  font-size: 19px;
  color: var(--muted);
  margin: 16px 0 28px;
}

.hero-image img,
.hero-img {
  width: 100%;
  border-radius: 14px;
  box-shadow: var(--shadow);
  object-fit: cover;
}


/* ===============================================================
   PODCAST GRID — 3 colonnes responsive
=============================================================== */
.podcasts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

.podcast-card {
  display: flex;
  flex-direction: column;
}

/* Titre toujours sur 2 lignes : alignement garanti des éléments dessous */
.podcast-card h3 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
  margin-bottom: 6px;
}

.podcast-card .podcast-date {
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 16px;
}

.podcast-card .btn-download {
  margin-top: auto;
  width: 100%;
  text-align: center;
}

@media(max-width: 1024px) {
  .podcasts-grid { grid-template-columns: repeat(2, 1fr); }
}

@media(max-width: 640px) {
  .podcasts-grid { grid-template-columns: 1fr; }
}


/* ===============================================================
   BLOG
=============================================================== */
.blog-grid {
  margin: 30px 0 70px;
}

.blog-card {
  background: var(--card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.blog-card h3 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 12px;
}

.blog-read {
  margin-top: 18px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  display: inline-block;
}

.blog-read:hover {
  color: var(--accent-hover);
}


/* ===============================================================
   BUTTONS
=============================================================== */
.btn-success,
.btn-download,
.btn-hero,
.btn-hero-link {
  display: inline-block;
  background: var(--accent);
  color: var(--text-on-accent) !important;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 8px;
  text-decoration: none;
  border: none;
  transition: background .2s ease, transform .2s ease;
  cursor: pointer;
}

.btn-success:hover,
.btn-download:hover,
.btn-hero:hover,
.btn-hero-link:hover {
  background: var(--accent-hover);
  color: var(--text-on-accent) !important;
  transform: translateY(-1px);
}

/* Variante "outline" pour bouton secondaire (livre, etc.) */
.btn-hero-link {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 14px;
}

/* Bouton retour discret */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card-alt);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  border: 1px solid var(--border);
  transition: all .2s ease;
}

.btn-back:hover {
  background: var(--card-hover);
  color: var(--accent);
  transform: translateX(-2px);
}

/* Override Bootstrap btn-primary / btn-secondary pour cohérence */
.btn-primary {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: var(--text-on-accent) !important;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}

.btn-secondary {
  background: var(--card-alt) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  font-weight: 500;
}

.btn-secondary:hover {
  background: var(--card-hover) !important;
  color: var(--accent) !important;
}


/* ===============================================================
   CUSTOM AUDIO PLAYER
   ---------------------------------------------------------------
   Le <audio> natif est caché par JS, ce bloc style l'UI custom.
   Si JS échoue, on retombe sur le natif (donc on garde un style
   minimal pour audio aussi).
=============================================================== */

audio {
  width: 100%;
  margin: 16px 0;
  border-radius: 10px;
  filter: invert(var(--audio-invert));
}

.audio-player {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 16px 0;
}

.ap-play {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease, transform .15s ease;
}

.ap-play:hover {
  background: var(--accent-hover);
}

.ap-play:active {
  transform: scale(0.95);
}

.ap-track {
  flex: 1;
  min-width: 0;
}

.ap-bar {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: height .15s ease;
}

.ap-bar:hover {
  height: 7px;
}

.ap-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width .1s linear;
}

.ap-times {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media(max-width: 480px) {
  .audio-player {
    gap: 10px;
    padding: 10px 12px;
  }
  .ap-play {
    width: 38px;
    height: 38px;
  }
}


/* ===============================================================
   LISTES & LIST GROUP
=============================================================== */
.list-group-item {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  padding: 14px 18px;
  font-size: 16px;
  transition: background .2s ease, color .2s ease;
}

.list-group-item:hover,
.list-group-item-action:hover {
  background: var(--card-hover) !important;
  color: var(--accent) !important;
}


/* ===============================================================
   CMS CONTENT — articles, pages riches
=============================================================== */
.cms-content,
.cms-content *,
.post-content,
.post-content * {
  color: var(--text);
}

.post-content {
  font-size: 18px;
  line-height: 1.75;
}

.post-content p {
  margin-bottom: 1.2em;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.cms-content img,
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 16px 0;
}


/* ===============================================================
   FORMS & FILTRES
=============================================================== */
.form-control {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  padding: 10px 14px;
  border-radius: 8px;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.form-control:focus {
  background: var(--card) !important;
  border-color: var(--accent) !important;
  color: var(--text) !important;
  box-shadow: 0 0 0 3px rgba(198,107,61,.15);
  outline: none;
}

.form-control::placeholder {
  color: var(--muted);
  opacity: .7;
}

/* Filtre archive (utilisé sur podcasts.php) */
.archive-filter {
  background: var(--card-alt);
  padding: 22px;
  border-radius: 12px;
  margin-bottom: 30px;
  border: 1px solid var(--border);
}

.filter-title {
  color: var(--text);
  font-weight: 600;
  margin-bottom: 14px;
  font-size: 16px;
}

.filter-group {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.date-input {
  flex: 1;
  min-width: 180px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.date-input::-webkit-calendar-picker-indicator {
  filter: invert(var(--audio-invert)) opacity(.6);
  cursor: pointer;
}

.btn-filter {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease;
}

.btn-filter:hover {
  background: var(--accent-hover);
}

.btn-reset {
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: all .2s ease;
}

.btn-reset:hover {
  background: var(--card-hover);
  color: var(--accent);
}

/* Boutons de période prédéfinie (podcasts.php / documents.php) */
.period-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.btn-period {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  transition: all .2s ease;
}

.btn-period:hover {
  background: var(--card-hover);
  color: var(--accent);
}

.btn-period.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
}

.btn-period.active:hover {
  background: var(--accent-hover);
  color: var(--text-on-accent);
}


/* ===============================================================
   ALERTS — overrides Bootstrap pour cohérence
=============================================================== */
.alert {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 14px 18px;
}

.alert-secondary {
  background: var(--card-alt);
  color: var(--muted);
  border-color: var(--border);
}

.alert-warning {
  background: #FFF8E5;
  color: #7A5A0F;
  border-color: #F0DCA8;
}

.alert-danger {
  background: #FEEDED;
  color: #8B2929;
  border-color: #F5C8C8;
}

.alert-success {
  background: #E8F0E2;
  color: #3E5C2D;
  border-color: #C8DCB8;
}


/* ===============================================================
   HIGHLIGHTS — recherche fulltext
=============================================================== */
mark {
  background: var(--gold);
  color: #fff;
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: 600;
}

.search-excerpt {
  margin: 8px 0;
  padding: 8px 12px;
  background: var(--card-alt);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 15px;
}


/* ===============================================================
   SÉPARATEURS
=============================================================== */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}


/* ===============================================================
   RESPONSIVE
=============================================================== */
@media(max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .hero-image {
    order: -1;
  }
}

@media(max-width: 768px) {
  body { font-size: 17px; }
  h1 { font-size: 32px; }
  h2 { font-size: 24px; }
  .hero h1 { font-size: 36px; }
  .hero-text h1 { font-size: 32px; }
  .brand-logo { height: 44px; max-width: 200px; }
  main.container { padding: 20px 0; }
}

/* Date sous chaque document (page Documents) — lisible sur fond clair */
.doc-date {
  color: var(--muted);
  font-size: 13px;
}