/* -----------------------------------------------------------
   style.css — Thème "Inflexions" (v2.3 — août 2025)
   - Mobile : vignettes & héros en 16:9, image plein cadre (object-fit: cover)
   - Nettoyage des anciens blocs 'contain' et règles cassées
----------------------------------------------------------- */

:root {
  --maxw: 980px;
  --gap: 24px;

  --bg: #ffffff;
  --muted: #666666;

  --home-thumb-w: 400px;
  --home-thumb-h: 200px;
  --article-hero-h: 280px;
  --radius: 8px;
}

/* Base ---------------------------------------------------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: #111;
  font-family: Georgia, 'Times New Roman', Times, serif;
  line-height: 1.6;
  overflow-x: hidden; /* bloque le scroll horizontal */
}

/* iOS : éviter les zooms auto de texte */
html { -webkit-text-size-adjust: 100%; }

a { color: inherit; }

/* Focus accessible */
a:focus-visible,
.btn:focus-visible {
  outline: 2px dashed #666;
  outline-offset: 2px;
}

/* Layout -------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px;
}

.site-header {
  max-width: var(--maxw);
  margin: 0 auto;
  text-align: center;
  padding: 28px 20px 10px;
}

.site-title {
  margin: 0;
  letter-spacing: 2px;
  font-weight: 700;
  font-size: 32px;
}

/* lien sur le titre (page article) */
.site-title-link {
  text-decoration: none;
  color: inherit;
}
.site-title-link:hover { text-decoration: underline; }

.site-subtitle {
  margin-top: 6px;
  font-size: 20px;
  color: var(--muted);
}

.hairline {
  margin-top: 14px;
  border: 0;
  border-top: 1px solid #ddd; /* ligne fine */
}

/* Accueil : liste des posts ------------------------------- */
.post-list {
  list-style: none;
  padding: 0;
  margin: 26px 0;
  display: grid;
  gap: 60px;
}

.post-item {
  display: grid;
  grid-template-columns: var(--home-thumb-w) 1fr;
  gap: 24px;
  align-items: start;
}
/* Empêcher la grille de pousser à droite */
.post-item > * { min-width: 0; }

/* Vignette (desktop) */
.post-thumb { width: 100%; }
.post-thumb img {
  display: block;
  width: 100%;
  height: var(--home-thumb-h);   /* hauteur fixe uniforme sur desktop */
  object-fit: cover;             /* recadrage propre */
  object-position: center;
  border: 1px solid #eee;
  border-radius: var(--radius);
}

.thumb-placeholder {
  width: 100%;
  height: var(--home-thumb-h);
  background: #f3f3f3;
  border: 1px dashed #ddd;
  border-radius: var(--radius);
}

/* Colonne texte */
.post-info {
  width: 520px;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  text-align: justify;
}

.post-date {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.post-title {
  margin: 0 0 6px 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* titres non soulignés par défaut */
.post-title a {
  color: inherit;
  text-decoration: none;
}
.post-title a:hover { text-decoration: underline; }

.post-excerpt { margin: 0; text-align: justify; }

/* Page article ------------------------------------------- */
.article .post-date {
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 4px;
}

.article .article-title {
  margin: 8px 0 10px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-align: left;
}

/* Héros d'article (desktop) : bandeau recadré */
.article .article-image img {
  width: 100%;
  height: var(--article-hero-h);
  object-fit: cover;
  object-position: center;
  display: block;
  margin: 6px 0 16px;
  border: 1px solid #eee;
  border-radius: var(--radius);
}

/* Texte de l’article */
.article .article-text {
  text-align: justify;
 font-size: 18px;
  margin: 0 auto;
  max-width: 900px;
}

/* Admin --------------------------------------------------- */
.admin-login h1,
.admin h1 { margin-top: 0; }

.admin .admin-form,
.admin .admin-list { margin-top: 24px; }

label { display: block; margin: 10px 0 6px; }

input[type="text"],
input[type="password"],
input[type="file"],
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 15px;
}

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid #eee; padding: 8px; text-align: left; }
.table .actions .btn { margin-right: 6px; }

.btn {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid #222;
  text-decoration: none;
  color: #111;
  background: #fff;
  cursor: pointer;
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 14px;
}
.btn:hover { background: #f7f7f7; }
.btn.small { padding: 4px 8px; font-size: 13px; }
.btn.danger { border-color: #a00; color: #a00; }

/* Pagination --------------------------------------------- */
.pagination {
  margin: 22px 0 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pagination > * { min-width: 0; }
.page-indicator { color: var(--muted); }

/* Robustesse typographique ------------------------------- */
.post-info,
.post-excerpt,
.article .article-text,
.site-title,
.site-subtitle,
.page-indicator,
.post-title,
a {
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}
/* Désactiver la césure dans les titres */
.site-title,
.post-title { hyphens: none; }

/* Médias 100% responsives */
img, video { max-width: 100%; height: auto; display: block; }

/* Fallbacks (variables CSS) ------------------------------ */
html, body { background: var(--bg, #ffffff); }
.site-subtitle, .post-date { color: var(--muted, #666666); }

/* Responsive --------------------------------------------- */

/* Tablette : réduire un peu la colonne image pour l’équilibre */
@media (max-width: 900px) {
  :root { --home-thumb-w: 320px; }
}

/* Mobile (iPhone & co.) ---------------------------------- */
@media (max-width: 680px) {

  /* 0) Typo confortable */
  body { font-size: 16px; }
  .post-title { font-size: 20px; }
  .site-title { font-size: 30px; }
  .article .article-title { font-size: 20px; }

  /* 1) Empilement : image puis texte (une colonne) */
  .post-item {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .post-thumb { grid-column: 1; }
  .post-info  { grid-column: 1; }

  /* 2) Accueil : cadre 16:9, image qui REMPLIT le cadre */
  .post-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid #eee;
    border-radius: var(--radius);
    background: #fff;
  }
  .post-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100% !important;
    object-fit: cover !important;   /* plein cadre horizontal */
    object-position: center;
    border: none;                   /* évite la double bordure */
    border-radius: 0;
  }

  /* 3) Article : héros 16:9, image qui REMPLIT le cadre */
  .article .article-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid #eee;
    border-radius: var(--radius);
    margin: 6px 0 16px;
    background: #fff;
  }
  .article .article-image a {
    position: absolute;
    inset: 0;
    display: block;
  }
  .article .article-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100% !important;
    object-fit: cover !important;   /* plein cadre */
    object-position: center;
    border: none;                   /* évite la double bordure */
    border-radius: 0;
  }

  /* 4) Texte confortable et contenu */
  .article .article-text { max-width: 65ch; margin: 0 auto; }

  /* 5) Container et header : mêmes marges gauche/droite */
  .container { max-width: 100%; padding: 0 28px; }
  .site-header { padding: 28px 28px 10px; }

  /* 6) Pagination centrée uniquement sur mobile */
  .pagination { justify-content: center; row-gap: 8px; }
  .pagination .page-indicator { flex: 1 1 100%; text-align: center; }
}

/* Très petits écrans (≤360px) : moins de marge latérale */
@media (max-width: 360px) {
  .container { padding: 0 16px; }
  .site-header { padding: 24px 16px 10px; }
}

																								  /* === Filet anti-débordement (mobile) ===================== */
@media (max-width: 820px) and (hover: none) and (pointer: coarse) {
  /* 1) Jamais de scroll horizontal */
  html, body { width: 100%; overflow-x: hidden; }

  /* 2) Rien ne dépasse la largeur d'écran */
  .container,
  .post-list,
  .post-item,
  .post-info { max-width: 100%; width: 100%; }

  /* 3) Sécurité : une seule colonne pour les cartes */
  .post-item { grid-template-columns: 1fr !important; }

  /* 4) Si un contenu exagère (URL, mot très long), on casse proprement */
  .post-info,
  .post-excerpt,
  .post-title,
  .page-indicator,
  a { overflow-wrap: anywhere; word-break: break-word; }
}
