/*
  Rôles texte:
  - hero:        titre + lead sur bandeau (blanc si .has-hero)
  - normal:      corps, list-titre, nav, titre site
  - small 0.8rem: dates, tags, list-date, list-sous-titre, n° page, footer

  Familles hover:
  - nav:        titre site, menu, langues
  - content:    liens corps, tags
  - chrome:     prev/next, pagination, « tous les articles »
*/

:root {
  --bg: #f7f5f1;
  --fg: #1a1a1a;
  --muted: #5c5c5c;
  --border: #e0dbd3;
  --hero-fg: #fff;
  --accent: #c0392b;
  --link-underline: #ccc;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --measure: calc(min(100% - 10mm, 50% + 30mm));
  --lh: 1.3;
  --size-hero: clamp(1.75rem, 4vw, 2.4rem);
  --size: 1rem;
  --size-small: 0.8rem;
  --weight-bold: 650;
  --post-thumb-size: 5.5rem;
  --post-thumb-gap: 1rem;
}

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

html { font-size: 18px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--size);
  line-height: var(--lh);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 10;
  padding: .5rem 1rem;
  background: var(--fg);
  color: var(--bg);
}
.skip-link:focus { left: 0; }

.wrap {
  width: min(100% - 2rem, 58rem);
  margin-inline: auto;
}

/* ——— Header / nav (hors hero) ——— */
.site-header {
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  padding: 1rem 0;
}

.site-title {
  font-weight: var(--weight-bold);
  font-size: var(--size);
  text-decoration: none;
  color: var(--fg);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.25rem;
}

.nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: .15rem .9rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: var(--size);
}

.nav a:hover,
.nav a[aria-current],
.site-title:hover {
  color: var(--accent);
}

.nav .lang a {
  text-transform: uppercase;
  font-size: var(--size-small);
  letter-spacing: .04em;
}

/* ——— Hero : fond clair + image + voile sombre → texte blanc ——— */
.site-header.has-hero {
  border-bottom: none;
  background-color: #fff;
  background-image: var(--hero-image);
  background-size: cover;
  background-position: center;
}

.site-header.has-hero .hero-overlay {
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, .6),
    rgba(0, 0, 0, .3)
  );
  padding-bottom: 2.5rem;
}

.site-header.has-hero .site-title,
.site-header.has-hero .nav a {
  color: var(--hero-fg);
}

.site-header.has-hero .site-title:hover,
.site-header.has-hero .nav a:hover,
.site-header.has-hero .nav a[aria-current] {
  color: var(--hero-fg);
  opacity: .85;
}

.hero-title {
  padding: 2.5rem 0 .5rem;
  text-align: center;
}

.hero-title h1 {
  margin: 0 0 .4rem;
  font-size: var(--size-hero);
  font-weight: var(--weight-bold);
  line-height: var(--lh);
  color: var(--fg);
}

.hero-title .lead {
  margin: 0 auto;
  max-width: 36rem;
  font-size: var(--size);
  font-weight: 400;
  color: var(--muted);
}

.site-header.has-hero .hero-title h1,
.site-header.has-hero .hero-title .lead {
  color: var(--hero-fg);
}

/* ——— Colonne de lecture ——— */
.main {
  flex: 1;
  padding: 2rem 0 3rem;
}

.main .wrap.page {
  width: var(--measure);
  max-width: none;
  margin-inline: auto;
}

/* ——— Meta : date + tags ——— */
.meta {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: var(--size); /* date + tags article = taille texte */
}

/* ——— Corps ——— */
.content {
  width: 100%;
}

.content > :first-child { margin-top: 0; }

.content img {
  max-width: 100%;
  height: auto;
  background: #fff;
}

.content blockquote {
  margin: 1.25rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.content pre,
.content code {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", monospace;
  font-size: .9em;
}

.content pre {
  overflow-x: auto;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Liens contenu + tags (famille content) */
.content a,
.meta a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 2px;
}

.content a:hover,
.meta a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ——— Liste d’articles ——— */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.post-item {
  display: flex;
  align-items: center;
  gap: var(--post-thumb-gap);
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}

.post-thumb {
  flex: 0 0 var(--post-thumb-size);
  width: var(--post-thumb-size);
  height: var(--post-thumb-size);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
}

.post-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: #fff;
}

.post-body {
  flex: 1 1 auto;
  min-width: 0;
}

.post-title {
  display: block;
  font-weight: var(--weight-bold);
  font-size: var(--size);
  line-height: var(--lh);
  color: var(--fg);
  text-decoration: none;
}

.post-title:hover {
  color: var(--accent);
}

.post-body time {
  display: block;
  margin: .2rem 0;
  font-size: var(--size-small);
  color: var(--muted);
}

.summary {
  margin: .25rem 0 0;
  font-size: var(--size);
  font-weight: 400;
  color: var(--muted);
}

/* ——— Chrome : prev/next, pagination, « tous les articles » ——— */
.post-nav,
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 30px;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: var(--size);
}

.post-nav a,
.pagination a,
.more a {
  color: var(--accent);
  text-decoration: none;
}

.post-nav a:hover,
.pagination a:hover,
.more a:hover {
  text-decoration: underline;
}

/* Chaque côté ~ moitié de la colonne, moins la place du centre / gap */
.post-nav .prev,
.post-nav .next,
.pagination > :first-child,
.pagination > :last-child {
  flex: 1 1 calc(50% - 30px);
  min-width: calc(50% - 30px);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.post-nav .prev,
.pagination > :first-child {
  text-align: left;
}

.post-nav .next,
.pagination > :last-child {
  text-align: right;
  margin-left: auto;
}

.pagination > .pages {
  flex: 0 0 auto;
  font-size: var(--size-small);
  color: var(--muted);
  align-self: center;
}

.pagination .disabled {
  color: #aaa;
}

.more {
  margin-top: 1.25rem;
}

/* ——— Contact ——— */
.contact-form {
  display: grid;
  gap: 1rem;
  max-width: 28rem;
  margin-top: 1.5rem;
}

.contact-form label {
  display: grid;
  gap: .35rem;
  font-size: var(--size-small);
}

.contact-form input,
.contact-form textarea {
  font: inherit;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--fg);
}

.contact-form button {
  justify-self: start;
  font: inherit;
  padding: .55rem 1.1rem;
  border: 0;
  border-radius: 4px;
  background: var(--fg);
  color: #fff;
  cursor: pointer;
}

.contact-form button:hover {
  background: #333;
}

/* ——— Footer ——— */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  font-size: var(--size-small);
  color: var(--muted);
}

.site-footer p { margin: 0; }

.embed { margin: 1.5rem 0; }
.embed iframe { max-width: 100%; }

@media (max-width: 520px) {
  html { font-size: 17px; }
  /* prev/next : min-width 50%-30px + flex-wrap → empilement naturel */
  .post-nav .next,
  .pagination > :last-child {
    text-align: left;
    margin-left: 0;
  }
}
