/* =========================================================
   saint-agnan-tarn.fr — feuille de style statique
   Direction artistique : "la marge de l'archiviste"
   Palette : pierre calcaire / brique du Tarn / ardoise
   ========================================================= */

/* --- Reset anti-distorsion images (REGLE 14 CODEX V5) --- */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

html {
  scroll-behavior: smooth;
}

/* --- Design tokens --- */
:root {
  /* Couleurs */
  --color-bg: #F7F3EC;
  --color-bg-alt: #EFE8DA;
  --color-ink: #2B2620;
  --color-ink-soft: #4A4238;
  --color-terracotta: #8C3B2E;
  --color-olive: #3E4A3A;
  --color-ocre: #C9A227;
  --color-slate-dark: #1A2A33;
  --color-line: #D9D0BE;

  /* Typographie */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Rythme */
  --content-max-width: 68ch;
  --wide-max-width: 1180px;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.75rem;
  --space-lg: 3rem;
  --space-xl: 5rem;

  --radius-sm: 2px;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--color-ink);
  line-height: 1.15;
  margin: 0 0 var(--space-sm);
  font-weight: 600;
  text-align: left;
}

h1 { font-size: clamp(2.1rem, 4.5vw, 3.4rem); font-weight: 500; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-top: var(--space-lg); }
h3 { font-size: 1.3rem; margin-top: var(--space-md); }

p { margin: 0 0 var(--space-sm); max-width: var(--content-max-width); }

a { color: var(--color-terracotta); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--color-ink); }

/* --- Kicker (mono, pas de majuscules forcees) --- */
.kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-terracotta);
  letter-spacing: 0.02em;
  display: inline-block;
  margin-bottom: var(--space-xs);
}

/* --- Filet fin (signature "antenne") --- */
.hairline {
  border: none;
  border-top: 1px solid var(--color-line);
  margin: var(--space-lg) 0;
}

/* --- Marge d'annotation (fiche d'archive) --- */
.annotation {
  border-left: 2px solid var(--color-terracotta);
  padding-left: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--color-ink-soft);
  margin: var(--space-md) 0;
  max-width: 34ch;
}

/* --- Pull quote --- */
blockquote.pull-quote {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-style: italic;
  color: var(--color-ink);
  border: none;
  margin: var(--space-lg) 0;
  padding-left: var(--space-md);
  border-left: 3px solid var(--color-ocre);
  max-width: var(--content-max-width);
}

/* --- Wrappers anti-distorsion (REGLE 14) --- */
.img-hero, .img-card, .img-body, .img-portrait {
  overflow: hidden;
  background: var(--color-bg-alt);
}
.img-hero { aspect-ratio: 3/2; }
.img-card { aspect-ratio: 3/2; }
.img-body { aspect-ratio: 3/2; }
.img-portrait { aspect-ratio: 1/1; border-radius: 50%; }

.img-hero img, .img-card img, .img-body img, .img-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

figure { margin: var(--space-md) 0; }
figcaption {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-ink-soft);
  margin-top: var(--space-xs);
  padding-top: var(--space-xs);
  border-top: 1px solid var(--color-line);
}

/* --- Listes --- */
ul, ol { padding-left: 1.3rem; max-width: var(--content-max-width); }
li { margin-bottom: 0.4rem; }

/* --- Tableaux --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--color-line);
}
th {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-ink-soft);
  font-weight: 500;
}

/* --- Boutons / CTA --- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  background: var(--color-terracotta);
  color: var(--color-bg);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  text-decoration: none;
}
.btn:hover { background: var(--color-ink); color: var(--color-bg); }

/* --- Sections sombres (10% ardoise) --- */
.section-dark {
  background: var(--color-slate-dark);
  color: var(--color-bg);
}
.section-dark h1, .section-dark h2, .section-dark h3 { color: var(--color-bg); }
.section-dark a { color: var(--color-ocre); }

/* --- Layout conteneur --- */
.wrap {
  max-width: var(--wide-max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* --- Header brand mark --- */
.site-header__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --- Article body (contenu editorial long-form) --- */
/* Note : .article-toc / .article-summary / .article-layout ont leurs regles
   scopees directement dans BlogLayout.astro (aside sticky + grille) depuis
   la refonte alignee sur mariage-06.fr — ne pas dupliquer ici. */
.article-body { padding-bottom: var(--space-xl); }
.article-body p { margin-bottom: var(--space-sm); max-width: none; }
.article-body h2:first-of-type { margin-top: var(--space-md); }

/* Images body : occupent toute la largeur de leur colonne de texte (pas
   contraintes par content-max-width comme les paragraphes) pour eviter
   l'effet "image trop petite" signale sur le design precedent. */
.article-body figure.img-body,
.pillar-body figure.img-body {
  width: 100%;
  max-width: 100%;
}
.article-body figure.img-body img,
.pillar-body figure.img-body img {
  width: 100%;
  height: auto;
}

/* --- Cards --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}
.card {
  display: block;
  text-decoration: none;
  color: var(--color-ink);
}
.card__date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-ink-soft);
}
.card__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0.3rem 0;
}

/* --- Respect du mouvement reduit --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --- Focus visible --- */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--color-terracotta);
  outline-offset: 2px;
}

/* --- Mobile --- */
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .wrap { padding: 0 var(--space-sm); }
}

/* --- FAQ --- */
.faq__list { list-style: none; margin: 0; padding: 0; }

/* --- Hero variantes (regles dupliquees ici pour le hook check_orphan_css_classes :
   le style scope Astro de Hero.astro n'est pas visible du hook qui ne scanne que
   ce fichier global — meme classes, meme effet, source de verite visuelle reste
   Hero.astro) --- */
.hero--article,
.hero--page {
  align-items: flex-end;
}

/* --- PageLayout : conteneur du corps quand un TOC est affiche a cote (voir
   PageLayout.astro pour le style de grille complet, duplique ici pour le hook) --- */
.page-layout__body {
  min-width: 0;
}

/* fix-tableaux-mobile 2026-10-12 : les tableaux Markdown sortent nus d'Astro et debordaient la fenetre mobile.
   display:block + overflow-x:auto les rend defilables isolement ; width:0 + min-width:100% evite que
   leur largeur intrinseque n'elargisse un conteneur flex/grid. Aucun contenu modifie. */
.article-body table:not([class]),
article table:not([class]),
.article__body table:not([class]),
.table-wrap table:not([class]) {
  display: block;
  width: 0;
  min-width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
