:root {
  --white-fill: white;
  --background-color: floralwhite;
  --primary-color: mediumpurple;
  --secondary-color: burlywood;
  --hover-primary-color: darkslateblue;
  --hover-secondary-color: floralwhite;
  --text-color: #2d3748;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --focus-outline: #2b6cb0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Quicksand", cursive;
  font-weight: 400;
  font-style: normal;
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.5;
  padding: 2rem;
}

h1 {
  font-weight: bold;
}

.btn-return {
  background: var(--white-fill);
  border: 1px solid var(--primary-color);
  display: inline-block;
  padding: 0.75rem;
  border-radius: 9999px;
  color: var(--primary-color);
  font-size: 0.7rem;
  font-weight: normal;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.3s;
}

.btn-return:hover {
  color: var(--primary-color);
  background-color: var(--hover-secondary-color);
  border: 2px solid var(--primary-color);
  font-weight: bold;
}

.btn-return:hover i {
  transform: translateX(-8px);
  font-weight: bold;
}

.btn-return i {
  display: inline-block;
  font-style: normal;
  font-size: 1rem;
  line-height: 0.75;
  transition: transform 0.2s ease;
}

.btn-return:focus-visible {
  outline: 3px solid #2b6cb0;
  outline-offset: 2px;
}

.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.story-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.story-card:nth-child(odd) {
  background: linear-gradient(180deg, var(--white-fill), var(--primary-color));
  border: 1px solid #e2d6ff;

  .btn-read {
    background: var(--secondary-color);
  }
}

.story-card:nth-child(even) {
  background: linear-gradient(180deg, var(--white-fill), var(--secondary-color));
  border: 1px solid #c3f7e7;

  .btn-read {
    background: var(--primary-color);
  }
}

.story-title {
  font-size: 1.25rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.story-meta {
  display: flex;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #718096;
  margin-bottom: 1rem;
}

.story-badge {
  background: #edf2f7;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.story-resume {
  margin-bottom: 1.5rem;
  color: #4a5568;
}

.btn-read {
  display: inline-block;
  padding: 0.75rem;
  border: none;
  border-radius: 9999px;
  color: white;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.3s;
}

.btn-read:hover {
  transform: scale(115%);
  transition: ease;
}

/* Accessibilité : Focus visible pour la navigation au clavier */
.btn-read:focus-visible {
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
}

.hidden {
  display: none;
}

#stories-error {
  color: #c53030;
  background-color: #fff5f5;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #fed7d7;
}

/* Style de l'arrière-plan de la modale */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem;
  box-sizing: border-box;
}

/* Boîte de contenu */
.modal-content {
  background: var(--bg-card);
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #718096;
  padding: 0.5rem;
}

.btn-close:hover {
  color: var(--text-color);
}

/* Zone de texte scrollable pour l'histoire */
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  font-size: 1.15rem; /* Légèrement plus grand pour le confort de lecture */
  line-height: 1.7;
}

.story-full-text p {
  margin-bottom: 1.25rem;
}

/* Footer avec le CTA de conversion */
.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  background-color: #f7fafc;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.cta-text {
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.btn-cta {
  display: inline-block;
  background-color: var(--primary-color); /* À adapter à ta charte graphique */
  color: white;
  text-decoration: none;
  padding: 0.75rem 2rem;
  border-radius: 6px;
  font-weight: bold;
  transition: background-color 0.2s;
}

.btn-cta:hover {
  background-color: var(--hover-primary-color);
}

/* Animation d'ouverture */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Classe utilitaire pour masquer */
.hidden {
  display: none !important;
}
