/*
  Theme CSS pour site d'auteur
  - Design simple et épuré
  - Mode dark/light
  - Responsive
*/

/* ==================== VARIABLES CSS ==================== */
:root {
  /* Couleurs mode clair */
  --bg-color: #ffffff;
  --text-color: #333333;
  --text-muted: #666666;
  --accent-color: #2563eb;
  --accent-hover: #1d4ed8;
  --border-color: #e5e7eb;
  --section-bg: #f9fafb;

  /* Espacements */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 2rem;
  --spacing-lg: 4rem;
  --spacing-xl: 6rem;

  /* Tailles */
  --max-width: 1200px;
  --header-height: 80px;
  --border-radius: 8px;
}

/* Mode sombre */
body.dark {
  --bg-color: #1a1a1a;
  --text-color: #e5e7eb;
  --text-muted: #9ca3af;
  --accent-color: #3b82f6;
  --accent-hover: #60a5fa;
  --border-color: #374151;
  --section-bg: #111111;
}

/* ==================== RESET & BASE ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

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

/* Container global */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* ==================== HEADER ==================== */
.site-header {
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-sm) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.3s ease;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Logo */
.logo-link img {
  height: 50px;
  width: auto;
  max-width: 200px;
}

/* Navigation */
.main-nav ul {
  display: flex;
  list-style: none;
  gap: var(--spacing-md);
  align-items: center;
}

.main-nav a {
  color: var(--text-color);
  font-weight: 500;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--border-radius);
  transition: background-color 0.2s ease;
}

.main-nav a:hover {
  background-color: var(--section-bg);
}

/* Bouton thème */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  padding: var(--spacing-xs);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

/* Menu mobile */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
}

.menu-toggle span {
  width: 25px;
  height: 3px;
  background-color: var(--text-color);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* ==================== SECTION 1 : HERO BOOK ==================== */
.hero-book {
  padding: var(--spacing-xl) 0;
  background-color: var(--section-bg);
}

.book-layout {
  display: grid;
  grid-template-columns: 2fr 1fr; /* 2/3 - 1/3 */
  gap: var(--spacing-lg);
  align-items: center;
}

.book-description h1 {
  font-size: 3rem;
  margin-bottom: var(--spacing-sm);
  font-weight: 700;
  line-height: 1.6;
}

.book-description .subtitle {
  font-size: 1.5rem;
  color: var(--text-muted);
  margin-bottom: var(--spacing-md);
}

.book-description .description {
  font-size: 1.1rem;
  margin-bottom: var(--spacing-md);
  line-height: 1.6;
}

.book-cover img {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  border-radius: var(--border-radius);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ==================== SECTION 2 : À PROPOS ==================== */
.about-section {
  padding: var(--spacing-xl) 0;
}

.about-layout {
  display: grid;
  grid-template-columns: 1fr 2fr; /* 1/3 - 2/3 */
  gap: var(--spacing-lg);
  align-items: start;
}

.about-image img {
  width: 100%;
  max-width: 350px;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.about-text h2 {
  font-size: 2.5rem;
  margin-bottom: var(--spacing-md);
  font-weight: 700;
}

.about-text .bio {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ==================== SECTION 3 : NEWSLETTER ==================== */
.newsletter-section {
  padding: var(--spacing-xl) 0;
  background-color: var(--bg-color);
}

.newsletter-section h2 {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: var(--spacing-md);
  font-weight: 700;
}

.newsletter-content {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.newsletter-description {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: var(--spacing-lg);
}

.newsletter-form {
  margin-top: var(--spacing-lg);
}

/* Formulaire personnalisé Substack */
.newsletter-form-custom {
  display: flex;
  gap: var(--spacing-sm);
  max-width: 500px;
  margin: 0 auto;
  flex-wrap: wrap;
  justify-content: center;
}

/* Formulaire générique (fallback) */
.newsletter-form-fallback {
  display: flex;
  gap: var(--spacing-sm);
  max-width: 500px;
  margin: 0 auto;
  flex-wrap: wrap;
  justify-content: center;
}

.newsletter-input {
  flex: 1;
  min-width: 250px;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.newsletter-input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.newsletter-note {
  margin-top: var(--spacing-md);
  color: var(--text-muted);
  font-style: italic;
}

/* ==================== SECTION 4 : GRILLE DE LIVRES ==================== */
.books-grid-section {
  padding: var(--spacing-xl) 0;
  background-color: var(--section-bg);
}

.books-grid-section h2 {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: var(--spacing-lg);
  font-weight: 700;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 colonnes */
  gap: var(--spacing-md);
}

.book-item {
  text-align: center;
  transition: transform 0.2s ease;
}

.book-item:hover {
  transform: translateY(-5px);
}

.book-item img {
  width: 100%;
  max-width: 250px;
  margin: 0 auto;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.book-item .book-title {
  margin-top: var(--spacing-sm);
  font-weight: 600;
  color: var(--text-color);
}

/* ==================== SECTION 5 : ÉVÉNEMENTS ==================== */
.events-section {
  padding: var(--spacing-xl) 0;
}

.events-section h2 {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: var(--spacing-lg);
  font-weight: 700;
}

.events-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 colonnes */
  gap: var(--spacing-md);
}

.event-card {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: var(--bg-color);
  transition: box-shadow 0.2s ease;
  overflow: hidden;
}

.event-card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.event-thumbnail {
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.event-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.event-card:hover .event-thumbnail img {
  transform: scale(1.05);
}

.event-content {
  padding: var(--spacing-md);
}

.event-card h3 {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-xs);
}

.event-card h3 a {
  color: var(--text-color);
}

.event-card time {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: var(--spacing-sm);
}

.event-card p {
  color: var(--text-muted);
  margin-bottom: var(--spacing-sm);
}

.event-card .read-more {
  color: var(--accent-color);
  font-weight: 600;
}

/* ==================== FOOTER ==================== */
.site-footer {
  background-color: var(--section-bg);
  border-top: 1px solid var(--border-color);
  padding: var(--spacing-lg) 0;
  margin-top: var(--spacing-xl);
  text-align: center;
}

.footer-content {
  color: var(--text-muted);
}

.footer-menu {
  margin-bottom: var(--spacing-sm);
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  font-size: 0.85rem;
}

.footer-menu a {
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.footer-menu a:hover {
  opacity: 1;
  text-decoration: underline;
}

.social-links {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  margin-top: var(--spacing-md);
}

/* ==================== BOUTONS ==================== */
.btn-primary {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--accent-color);
  color: white;
  border-radius: var(--border-radius);
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  color: white;
  transform: translateY(-2px);
}

/* ==================== RESPONSIVE ==================== */

/* Tablettes */
@media (max-width: 768px) {
  /* Header mobile */
  .menu-toggle {
    display: flex;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md);
  }

  .main-nav.active {
    display: block;
  }

  .main-nav ul {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  /* Section 1 : Hero book */
  .book-layout {
    grid-template-columns: 1fr; /* Empilé */
  }

  .book-description h1 {
    font-size: 2rem;
  }

  /* Section 2 : À propos */
  .about-layout {
    grid-template-columns: 1fr; /* Empilé */
  }

  /* Section 3 : Grille de livres */
  .books-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 colonnes sur tablette */
  }

  /* Section 4 : Événements */
  .events-grid {
    grid-template-columns: 1fr; /* 1 colonne sur tablette */
  }
}

/* Mobile */
@media (max-width: 480px) {
  .book-description h1 {
    font-size: 1.75rem;
  }

  .about-text h2,
  .books-grid-section h2,
  .events-section h2 {
    font-size: 2rem;
  }

  /* Section 3 : 1 livre par ligne sur mobile */
  .books-grid {
    grid-template-columns: 1fr;
  }
}
