/* =========================================================
   ISOLUTION — Charte graphique 1.0
   Système de style partagé (galerie + viewer)
   ========================================================= */

:root {
  /* --- Couleurs primaires (priorité absolue) --- */
  --ink:        #21282B;  /* Dark Grey — corps de texte sur fond blanc */
  --blue:       #1E2849;  /* Blue — titres, barres, fonds */
  --green:      #20A555;  /* Green — accents, CTA, liens */
  --white:      #ffffff;

  /* --- Nuanciers secondaires (usage doux) --- */
  --grey-mid:   #7A7E80;
  --grey-light: #E5E5E5;
  --blue-soft:  #787E92;
  --blue-bg:    #E7E8EB;
  --green-soft: #79C999;
  --green-bg:   #EDF8F1;

  /* --- Fonds --- */
  --page-bg:    #f6f7f8;
  --card-bg:    #ffffff;

  /* --- Typo : SF Pro d'abord, repli propre Windows/Android --- */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(33,40,43,.06), 0 8px 24px rgba(33,40,43,.06);
  --shadow-hover: 0 2px 4px rgba(33,40,43,.08), 0 16px 40px rgba(33,40,43,.12);
  --maxw: 1100px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* corps de texte : SF Pro Light, interligne aéré */
body { font-weight: 300; line-height: 1.6; }

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =========================================================
   Barre d'en-tête (fond Blue, texte White)
   ========================================================= */
.topbar {
  background: var(--blue);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(30,40,73,.18);
}
.topbar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar .logo { height: 30px; display: block; }
.topbar__title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--white);
  letter-spacing: 0;
  margin: 0;
}
.topbar__spacer { flex: 1; }

/* Boutons de la barre */
.btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: .9rem;
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, opacity .12s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

/* CTA vert : uniquement sur fond clair/blanc — jamais vert sur bleu */
.btn--cta { background: var(--green); color: var(--white); }
.btn--cta:hover { background: #1c9a4e; text-decoration: none; }

/* Bouton clair sur fond bleu (barre) : blanc, pas de vert sur bleu */
.btn--ghost {
  background: rgba(255,255,255,.12);
  color: var(--white);
  border: 1px solid rgba(255,255,255,.25);
}
.btn--ghost:hover { background: rgba(255,255,255,.22); text-decoration: none; }

/* =========================================================
   Galerie
   ========================================================= */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 32px 22px 80px; }

.hero { margin: 8px 0 26px; }
.hero h1 {
  font-weight: 700;
  color: var(--blue);
  font-size: 2rem;
  letter-spacing: 0;
  margin: 0 0 8px;
}
.hero p {
  color: var(--grey-mid);
  max-width: 640px;
  margin: 0;
  font-size: 1.02rem;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 22px 0 26px;
  flex-wrap: wrap;
}
.search {
  flex: 1;
  min-width: 220px;
  border: 1px solid var(--grey-light);
  background: var(--white);
  border-radius: 999px;
  padding: 11px 18px;
  font-family: var(--font);
  font-size: .95rem;
  color: var(--ink);
}
.search:focus { outline: 2px solid var(--blue-bg); border-color: var(--blue-soft); }
.count { color: var(--grey-mid); font-size: .9rem; }

/* Grille de cartes */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--grey-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: var(--blue-bg); }

.card__top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card h2 {
  font-weight: 700;
  color: var(--blue);
  font-size: 1.16rem;
  margin: 0;
  letter-spacing: 0;
  line-height: 1.25;
}
.card__date { color: var(--grey-mid); font-size: .8rem; white-space: nowrap; }
.card p { color: var(--ink); margin: 0; font-size: .95rem; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.tag {
  background: var(--green-bg);
  color: #17823f;
  font-size: .74rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.card__actions { display: flex; gap: 10px; margin-top: auto; padding-top: 6px; }
.card__actions .btn { flex: 0 0 auto; }
.link-open {
  background: var(--blue);
  color: var(--white);
}
.link-open:hover { background: #17203c; text-decoration: none; }
.btn--soft {
  background: var(--blue-bg);
  color: var(--blue);
}
.btn--soft:hover { background: #dcdee6; text-decoration: none; }

.empty {
  text-align: center;
  color: var(--grey-mid);
  padding: 60px 20px;
  border: 1px dashed var(--grey-light);
  border-radius: var(--radius);
  background: var(--white);
}

/* =========================================================
   Viewer (view.html)
   ========================================================= */
.viewer-frame-wrap {
  max-width: var(--maxw);
  margin: 22px auto 0;
  padding: 0 22px;
}
.viewer-frame {
  width: 100%;
  height: 78vh;
  border: 1px solid var(--grey-light);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.comments-section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 34px 22px 90px;
}
.comments-section h3 {
  color: var(--blue);
  font-weight: 700;
  font-size: 1.2rem;
  margin: 0 0 6px;
  letter-spacing: 0;
}
.comments-section .sub {
  color: var(--grey-mid);
  font-size: .92rem;
  margin: 0 0 18px;
}
.giscus { margin-top: 8px; }

.notice {
  background: var(--green-bg);
  border: 1px solid var(--green-soft);
  color: #17823f;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: .92rem;
}
.notice code { background: rgba(0,0,0,.05); padding: 1px 6px; border-radius: 5px; }

/* =========================================================
   Toast « lien copié »
   ========================================================= */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--blue);
  color: var(--white);
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .9rem;
  box-shadow: var(--shadow-hover);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 22px;
  color: var(--grey-mid);
  font-size: .82rem;
  border-top: 1px solid var(--grey-light);
}

@media (max-width: 560px) {
  .hero h1 { font-size: 1.5rem; }
  .viewer-frame { height: 68vh; }
}
