/* ===========================================================
   montsdeflandre.fr — Design system "Flandre des Moulins"
   =========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,500&family=Karla:wght@400;500;600;700;800&display=swap');

/* Reset anti-distorsion obligatoire */
img { max-width: 100%; height: auto; display: block; }
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }

:root {
  /* Palette "Flandre des Moulins" */
  --brique: #A6432E;
  --brique-dark: #7E3021;
  --houblon: #6B7A3A;
  --houblon-dark: #4E5A29;
  --lin: #EFE6D3;
  --ardoise: #2B2622;
  --moutarde: #C68A2E;
  --lin-profond: #D8C9A3;

  /* Derives opacite */
  --brique-80: rgba(166, 67, 46, 0.8);
  --brique-40: rgba(166, 67, 46, 0.4);
  --brique-20: rgba(166, 67, 46, 0.2);
  --brique-10: rgba(166, 67, 46, 0.1);
  --brique-06: rgba(166, 67, 46, 0.06);
  --houblon-20: rgba(107, 122, 58, 0.2);
  --houblon-10: rgba(107, 122, 58, 0.1);
  --ardoise-70: rgba(43, 38, 34, 0.7);
  --ardoise-50: rgba(43, 38, 34, 0.5);
  --lin-95: rgba(239, 230, 211, 0.95);
  --lin-75: rgba(239, 230, 211, 0.75);
  --lin-40: rgba(239, 230, 211, 0.4);

  --bg: #FBF8F1;
  --bg-alt: var(--lin);
  --text: var(--ardoise);
  --text-light: #5C5347;

  /* Polices */
  --ff-display: 'Fraunces', Georgia, serif;
  --ff-body: 'Karla', system-ui, -apple-system, sans-serif;

  /* Mesures */
  --measure-article: 840px;
  --measure-wide: 1280px;
  --measure-hero: 1440px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-sm: 0 2px 10px rgba(43, 38, 34, 0.08);
  --shadow-md: 0 10px 28px rgba(43, 38, 34, 0.16);

  /* Transitions */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 300ms;
  --dur: 500ms;
  --dur-slow: 700ms;
}

body {
  font-family: var(--ff-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--ff-display);
  color: var(--ardoise);
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.005em;
}

h1 { font-size: clamp(2.2rem, 4.5vw, 3.5rem); font-weight: 500; }
h2 { font-size: clamp(1.5rem, 3vw, 2.05rem); margin-top: 2.6em; position: relative; }
h3 { font-size: clamp(1.2rem, 2.2vw, 1.45rem); }

/* Filet decoratif sous H2 — brique, pas moutarde (accent unique par composant) */
h2::after {
  content: '';
  display: block;
  width: 52px;
  height: 3px;
  margin-top: 0.5em;
  background: var(--brique);
  transform-origin: left;
  transform: scaleX(0);
  animation: growLine 700ms var(--ease) forwards;
  animation-delay: 100ms;
}
@keyframes growLine { to { transform: scaleX(1); } }

a { color: var(--brique); text-decoration-color: var(--brique-40); text-underline-offset: 3px; }
a:hover { color: var(--moutarde); }

.container { max-width: var(--measure-wide); margin: 0 auto; padding: 0 var(--gutter); }
.container--article { max-width: var(--measure-article); margin: 0 auto; padding: 0 var(--gutter); }

/* Kicker — petites capitales reelles, pas tout-majuscule tracke */
.kicker {
  font-family: var(--ff-body);
  font-size: 0.92rem;
  font-weight: 700;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  color: var(--houblon-dark);
}

/* ===== Wrappers anti-distorsion images ===== */
.img-hero     { aspect-ratio: 3/2; overflow: hidden; border-radius: var(--radius-lg); }
.img-card     { aspect-ratio: 3/2; overflow: hidden; border-radius: var(--radius-sm); }
.img-body     { aspect-ratio: 3/2; overflow: hidden; border-radius: var(--radius-md); }
.img-portrait { aspect-ratio: 1/1; overflow: hidden; 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;
}

/* ===== Figures + legendes obligatoires (regle reseau) ===== */
figure { margin: 2.2em 0; }
figure.body-figure img { border-radius: var(--radius-md); }
figcaption {
  font-family: var(--ff-body);
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.6em;
  padding-left: 0.7em;
  border-left: 2px solid var(--moutarde);
  line-height: 1.4;
}
.hero figcaption, .hero-home figcaption {
  color: var(--lin-95);
  border-left-color: var(--moutarde);
}

/* ===== Article body ===== */
.article-body { font-size: 1.08rem; }
.article-body p { margin: 1.3em 0; }
.article-body > p:first-of-type::first-letter {
  font-family: var(--ff-display);
  font-size: 3.3em;
  float: left;
  line-height: 0.85;
  padding: 0.05em 0.08em 0 0;
  color: var(--brique);
  font-weight: 600;
}
.article-body blockquote {
  border-left: 3px solid var(--moutarde);
  margin: 1.6em 0;
  padding: 0.4em 0 0.4em 1.2em;
  font-style: italic;
  color: var(--ardoise);
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.95rem;
}
.article-body th, .article-body td {
  border: 1px solid var(--brique-20);
  padding: 0.6em 0.8em;
  text-align: left;
}
.article-body th { background: var(--brique-06); font-weight: 700; font-size: 0.85rem; }

.saviez-vous, .highlight-box {
  background: var(--houblon-10);
  border: 1px solid var(--houblon-20);
  border-radius: var(--radius-md);
  padding: 1.3em 1.5em;
  margin: 2em 0;
}
.saviez-vous strong, .highlight-box strong { color: var(--houblon-dark); font-weight: 700; font-size: 0.85rem; }

/* ===== Hero — asymetrique, texte case en bas-gauche ===== */
.hero {
  position: relative;
  min-height: 60vh;
  display: flex;
  align-items: flex-end;
  color: var(--lin);
  overflow: hidden;
}
.hero-home { min-height: 86vh; }
.hero-compact { min-height: 44vh; }
.hero__img { position: absolute; inset: 0; z-index: 0; }
.hero__img img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.hero__overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(43,38,34,0.1) 0%, rgba(43,38,34,0.5) 58%, rgba(43,38,34,0.92) 100%);
}
/* Signature : silhouette de moulin a vent, filigrane discret, une seule fois par hero */
.hero__moulin {
  position: absolute; z-index: 2; right: 4%; bottom: 0;
  width: clamp(140px, 18vw, 260px); height: auto;
  opacity: 0.16; pointer-events: none;
}
.hero__content {
  position: relative; z-index: 3;
  padding: 3rem var(--gutter) 3rem;
  width: 100%; max-width: var(--measure-hero); margin: 0 auto;
  text-align: left;
}
/* Bandeau plein sous le texte, evoque un auvent d'estaminet */
.hero-home .hero__content, .hero-compact .hero__content {
  background: linear-gradient(90deg, rgba(43,38,34,0.72) 0%, rgba(43,38,34,0.35) 70%, transparent 100%);
  border-top: 3px solid var(--brique);
}
.hero__breadcrumb { font-size: 0.82rem; opacity: 0.85; margin-bottom: 1em; }
.hero__breadcrumb a { color: var(--lin); }
.hero h1 { color: #fff; margin: 0.2em 0 0.4em; max-width: 780px; }
.hero__desc { max-width: 620px; font-size: 1.08rem; color: var(--lin-95); }
.hero__meta { font-size: 0.85rem; color: var(--lin-75); margin-top: 1em; }

.hero-home__kicker { color: var(--moutarde); }
.hero-home__scroll {
  position: absolute; bottom: 1.2rem; left: var(--gutter);
  font-size: 0.72rem; letter-spacing: 0.08em;
  color: var(--lin-75); text-transform: uppercase;
}

/* ===== TOC ===== */
.article-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 3rem; max-width: var(--measure-wide); margin: 0 auto; padding: 0 var(--gutter); }
.article-container { max-width: var(--measure-article); }
.article-summary { font-family: var(--ff-display); font-style: italic; font-size: 1.15rem; color: var(--text-light); margin-bottom: 1.5em; }
.toc { align-self: start; position: sticky; top: 2rem; max-height: calc(100vh - 110px); overflow-y: auto; }
.toc-title { font-weight: 700; font-size: 0.82rem; color: var(--houblon-dark); margin-bottom: 0.8em; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--brique-10); }
.toc li { margin: 0.4em 0; }
.toc a { display: block; padding: 0.15em 0 0.15em 1em; font-size: 0.9rem; color: var(--text-light); }
.toc a:hover { color: var(--brique); }
@media (max-width: 900px) {
  .article-layout { grid-template-columns: 1fr; }
  .toc { position: static; margin-bottom: 2rem; }
}

/* ===== Cards — radius quasi-droit, registre carte postale ===== */
.card-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  background: #fff; border-radius: var(--radius-sm); overflow: hidden;
  box-shadow: var(--shadow-sm); border: 1px solid var(--lin-profond);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  display: flex; flex-direction: column; height: 100%;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card__body { padding: 1.2rem 1.3rem 1.4rem; display: flex; flex-direction: column; gap: 0.5em; flex: 1; }
.card__kicker { font-weight: 700; font-size: 0.78rem; font-variant: small-caps; color: var(--houblon-dark); }
.card__title { font-family: var(--ff-display); font-size: 1.2rem; margin: 0; color: var(--ardoise); }
.card__date { font-size: 0.8rem; color: var(--text-light); }
.card__desc { font-size: 0.92rem; color: var(--text-light); }
.card a.card__link { text-decoration: none; color: inherit; display: block; }

/* ===== Header / Footer ===== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--lin-95); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--brique-10);
  transition: box-shadow var(--dur-fast) var(--ease);
}
.site-header.scrolled { box-shadow: var(--shadow-sm); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem var(--gutter); max-width: var(--measure-wide); margin: 0 auto; }
.site-logo { font-family: var(--ff-display); font-weight: 600; font-size: 1.25rem; color: var(--ardoise); text-decoration: none; }
.site-logo span { color: var(--brique); }
.main-nav { display: flex; gap: 1.6rem; align-items: center; }
.main-nav a { font-size: 0.94rem; color: var(--text); text-decoration: none; }
.main-nav a:hover { color: var(--brique); }
.nav-toggle { display: none; }

.site-footer { background: var(--ardoise); color: var(--lin-75); padding: 3.5rem 0 2rem; margin-top: 4rem; }
.site-footer .container { display: grid; gap: 2.5rem; grid-template-columns: 1.3fr 1fr 1fr 1fr; }
.site-footer h4 { color: var(--lin); font-size: 0.95rem; font-weight: 700; }
.site-footer a { color: var(--lin-75); text-decoration: none; font-size: 0.92rem; }
.site-footer a:hover { color: var(--moutarde); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5em; }
.site-footer__bottom { max-width: var(--measure-wide); margin: 2.5rem auto 0; padding: 1.5rem var(--gutter) 0; border-top: 1px solid rgba(239,230,211,0.12); font-size: 0.82rem; }
@media (max-width: 800px) { .site-footer .container { grid-template-columns: 1fr 1fr; } }

/* ===== FAQ accordion ===== */
.faq-section { margin: 3rem 0; }
.faq-item { border-bottom: 1px solid var(--brique-10); }
.faq-item__q { display: flex; justify-content: space-between; align-items: center; padding: 1.1em 0; cursor: pointer; font-family: var(--ff-display); font-weight: 500; color: var(--ardoise); background: none; border: none; width: 100%; text-align: left; font-size: 1.05rem; }
.faq-item__icon { font-size: 1.4rem; color: var(--moutarde); transition: transform var(--dur-fast) var(--ease); flex-shrink: 0; margin-left: 1em; }
.faq-item.open .faq-item__icon { transform: rotate(45deg); }
.faq-item__a { max-height: 0; overflow: hidden; transition: max-height var(--dur) var(--ease); font-size: 0.96rem; color: var(--text-light); }
.faq-item.open .faq-item__a { max-height: 600px; padding-bottom: 1.2em; }

/* ===== Reveal animation ===== */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease); }
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  h2::after { animation: none; transform: scaleX(1); }
  html { scroll-behavior: auto; }
}

/* Focus visible obligatoire */
a:focus-visible, button:focus-visible, .faq-item__q:focus-visible {
  outline: 2px solid var(--moutarde);
  outline-offset: 2px;
}

@media (max-width: 700px) {
  .main-nav { display: none; }
  .site-header__inner { padding: 0.8rem var(--gutter); }
}

/* ===== Nav "Aller plus loin / Pour creuser" ===== */
.article-nav-related ul { list-style: none; }
.article-nav-related a { font-weight: 600; }

/* ===== Filtres blog ===== */
.filter-btn {
  font-family: var(--ff-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5em 1.1em;
  border-radius: 999px;
  border: 1px solid var(--brique-20);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.filter-btn.active, .filter-btn:hover {
  background: var(--brique);
  color: #fff;
  border-color: var(--brique);
}
