/* ═══════════════════════════════════════════════════════════════════
   GAZETTE IMPÉRIALE — Styles globaux
   Palette : bleu marine impérial, or, ivoire parchemin
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=Source+Serif+4:ital,wght@0,400;0,600;1,400&family=Montserrat:wght@400;500;600;700&display=swap');

:root {
  --navy:    #1a2744;
  --navy2:   #243356;
  --gold:    #c8922a;
  --gold-lt: #e8c96a;
  --ivory:   #f8f4ec;
  --ivory2:  #f2ece0;
  --red:     #b03020;
  --green:   #2e7d4f;
  --text:    #1e2535;
  --muted:   #6b7280;
  --border:  #d8d0c0;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Source Serif 4', Georgia, serif;
  background: var(--ivory);
  color: var(--text);
  min-height: 100vh;
  -webkit-user-select: none;
  user-select: none;
}

/* ── Typographie ── */
h1, h2, h3, h4 { font-family: 'Playfair Display', Georgia, serif; }
.montserrat { font-family: 'Montserrat', sans-serif; }

/* ── Header ── */
#site-header {
  background: var(--navy);
  color: white;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
#site-header .brand {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold-lt);
  letter-spacing: 0.08em;
  text-decoration: none;
}
#site-header nav { display: flex; gap: 0.15rem; flex-wrap: wrap; }
#site-header nav a {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 0.2rem;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
#site-header nav a:hover,
#site-header nav a.active {
  background: rgba(255,255,255,0.12);
  color: white;
}

/* ── Layout ── */
.page-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ── Règle décorative ── */
.gazette-rule {
  border: none;
  border-top: 2px solid var(--gold);
  margin: 1.25rem 0;
  opacity: 0.5;
}

/* ── Badge social ── */
.social-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--navy);
  color: white;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.75rem;
  border-radius: 0.2rem;
  margin-bottom: 0.75rem;
}

/* ── Boutons ── */
.btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.55rem 1.25rem;
  border-radius: 0.25rem;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-navy  { background: var(--navy);  color: white; }
.btn-green { background: var(--green); color: white; }
.btn-red   { background: var(--red);   color: white; }
.btn-gold  { background: var(--gold);  color: white; }

/* ── Inputs exercices ── */
.ex-input {
  border: 2px solid #b0b8c8;
  border-radius: 0.2rem;
  padding: 2px 7px;
  font-family: 'Source Serif 4', serif;
  font-size: 0.9rem;
  background: white;
  display: inline-block;
  vertical-align: middle;
  transition: border-color 0.2s, background 0.2s;
  width: 180px;
}
.ex-input:focus { outline: 2px solid var(--navy); }
.ex-input.correct { border-color: var(--green); background: #edf7f1; }
.ex-input.incorrect { border-color: var(--red); background: #fdf2f0; }
.ex-input.solution { border-color: var(--navy); background: #eef0f8; }

/* ── Encadré info / consigne ── */
.info-box {
  background: #fdf8ee;
  border: 1px solid var(--gold);
  border-radius: 0.25rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
  line-height: 1.6;
}
.info-box.blue {
  background: #eef0f8;
  border-color: var(--navy);
}
.info-box.green {
  background: #edf7f1;
  border-color: var(--green);
}

/* ── Score ── */
.score-box {
  border-radius: 0.25rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
}
.score-box.good  { background: #edf7f1; border: 2px solid var(--green); color: #1a5c35; }
.score-box.bad   { background: #fdf2f0; border: 2px solid var(--red);   color: #7a1a10; }

/* ── Onglets chapitres ── */
.tabs-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #d8d0c0;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.tab-btn {
  background: white;
  color: #555;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.65rem 1.1rem;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  margin-bottom: -2px;
}
.tab-btn .sublabel {
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tab-btn.active { color: white; }
.tab-btn.active .sublabel { opacity: 0.9; }

/* ── Exercice texte ── */
.ex-text {
  font-family: 'Source Serif 4', serif;
  font-size: 0.95rem;
  line-height: 2.3;
  color: var(--text);
  margin-bottom: 1.25rem;
}
.ex-text p { margin-bottom: 0.5rem; }

/* ── Discussion box ── */
.discussion-box {
  background: #f5f7fd;
  border: 1px solid #b0b8d8;
  border-radius: 0.25rem;
  padding: 0.75rem 1rem;
  margin-top: 1.25rem;
  font-size: 0.88rem;
  line-height: 1.6;
}

/* ── Textarea production écrite ── */
.prod-textarea {
  width: 100%;
  font-family: 'Source Serif 4', serif;
  font-size: 0.95rem;
  line-height: 1.8;
  padding: 1rem;
  border: 2px solid #b0b8c8;
  border-radius: 0.25rem;
  resize: vertical;
  color: var(--text);
  background: white;
  transition: border-color 0.2s;
}
.prod-textarea.enough { border-color: var(--green); }
.prod-textarea:focus { outline: none; border-color: var(--navy); }

.word-count {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: right;
  margin-top: 0.25rem;
  color: var(--muted);
}
.word-count.enough { color: var(--green); }

/* ── Correction LanguageTool ── */
.lt-result {
  margin-top: 2rem;
  background: #eef0f8;
  border: 2px solid var(--navy);
  border-radius: 0.25rem;
  padding: 1.5rem;
}
.lt-result h4 {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--navy);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #c8cce0;
}
.lt-match {
  background: white;
  border: 1px solid #d0d4e8;
  border-radius: 0.2rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.lt-match .lt-context {
  font-family: 'Source Serif 4', serif;
  font-size: 0.9rem;
  color: #333;
  margin-bottom: 0.4rem;
}
.lt-match .lt-context mark {
  background: #fde8e0;
  color: var(--red);
  padding: 0 2px;
  border-radius: 2px;
}
.lt-match .lt-message {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 0.3rem;
}
.lt-match .lt-suggestions {
  font-size: 0.82rem;
  color: var(--green);
  font-weight: 600;
}
.lt-match .lt-rule {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: 'Montserrat', sans-serif;
  margin-top: 0.3rem;
}
.lt-no-errors {
  background: #edf7f1;
  border: 2px solid var(--green);
  border-radius: 0.25rem;
  padding: 1rem 1.25rem;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  color: #1a5c35;
  margin-top: 1.5rem;
}

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Vidéo YouTube ── */
.yt-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 0.25rem;
  margin-bottom: 1.5rem;
}
.yt-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* ── Audio player ── */
.audio-player-box {
  background: var(--navy);
  border-radius: 0.25rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
}
.audio-player-box .audio-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.audio-player-box audio { width: 100%; accent-color: var(--gold); }

/* ── Accordéon ── */
.accordion-btn {
  width: 100%;
  background: var(--gold);
  color: white;
  padding: 0.9rem 1.25rem;
  text-align: left;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 0.25rem 0.25rem 0 0;
}
.accordion-content {
  display: none;
  padding: 1.5rem;
  font-family: 'Source Serif 4', serif;
  font-size: 0.95rem;
  line-height: 1.9;
  background: white;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 0.25rem 0.25rem;
}
.accordion-content.open { display: block; }

/* ── Quiz Vrai/Faux ── */
.quiz-question {
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.quiz-question p { font-size: 0.9rem; margin-bottom: 0.5rem; line-height: 1.5; }
.quiz-btns { display: flex; gap: 0.5rem; }
.quiz-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  border-radius: 0.2rem;
  border: 2px solid var(--border);
  background: white;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.quiz-btn.selected-true  { background: #edf7f1; border-color: var(--green); color: var(--green); }
.quiz-btn.selected-false { background: #fdf2f0; border-color: var(--red);   color: var(--red); }
.quiz-feedback { font-size: 0.8rem; margin-top: 0.4rem; font-weight: 600; }
.quiz-feedback.ok  { color: var(--green); }
.quiz-feedback.err { color: var(--red); }

/* ── QCM ── */
.qcm-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 0.2rem;
  cursor: pointer;
  font-size: 0.88rem;
  margin-bottom: 0.3rem;
  border: 1px solid transparent;
  transition: background 0.1s;
}
.qcm-option:hover { background: #f0f2f8; }
.qcm-option.correct   { background: #edf7f1; border-color: var(--green); }
.qcm-option.incorrect { background: #fdf2f0; border-color: var(--red); }
.qcm-option.missed    { background: #fff8e0; border-color: var(--gold); }

/* ── PDF viewer ── */
.pdf-viewer-box {
  border: 2px solid var(--navy);
  border-radius: 0.25rem;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.pdf-nav {
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  color: white;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.78rem;
}
.pdf-nav button {
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  padding: 0.3rem 0.75rem;
  border-radius: 0.2rem;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
}
.pdf-nav button:disabled { opacity: 0.3; cursor: default; }
#pdf-canvas { display: block; width: 100%; }

/* ── Infographie lightbox ── */
.infographic-img {
  width: 100%;
  border-radius: 0.25rem;
  cursor: zoom-in;
  border: 2px solid var(--gold);
  transition: opacity 0.2s;
}
.infographic-img:hover { opacity: 0.9; }
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 95vw; max-height: 95vh; border-radius: 0.25rem; }

/* ── Timeline ── */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: 0.6rem;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--gold);
  opacity: 0.4;
}
.timeline-item { position: relative; margin-bottom: 1.5rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.55rem;
  top: 0.3rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--gold);
}
.timeline-item .tl-date {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 0.2rem;
}
.timeline-item .tl-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.3rem;
}
.timeline-item .tl-text {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #444;
}

/* ── Hero ── */
.hero-section {
  position: relative;
  border-radius: 0.25rem;
  overflow: hidden;
  margin-bottom: 2.5rem;
  box-shadow: 0 8px 32px rgba(26,39,68,0.35);
}
.hero-section img {
  width: 100%;
  height: clamp(220px, 40vw, 480px);
  object-fit: cover;
  display: block;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(26,39,68,0.15) 0%, rgba(26,39,68,0.7) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem 2rem;
}
.hero-overlay h1 {
  color: white;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  margin-bottom: 0.4rem;
}
.hero-overlay .hero-sub {
  color: var(--gold-lt);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Nav cards ── */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.nav-card {
  background: var(--navy);
  color: white;
  border-radius: 0.25rem;
  padding: 1.1rem;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.nav-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(26,39,68,0.3); }
.nav-card .card-icon { font-size: 1.5rem; }
.nav-card .card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
}
.nav-card .card-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-lt);
}
.nav-card .card-desc {
  font-size: 0.8rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.75);
  margin-top: 0.2rem;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  #site-header { flex-direction: column; gap: 0.5rem; text-align: center; }
  .hero-overlay { padding: 1rem; }
  .nav-cards { grid-template-columns: 1fr 1fr; }
  .tabs-bar { flex-wrap: nowrap; }
}
