/* =========================================================
   géoduc — blog (liste des articles et article)
   Couleurs réseaux reprises de la charte graphique (tokens net-*)
   ========================================================= */

:root,
:root[data-theme="light"] {
  --gd-elec: #D7263D;      --gd-elec-ink: #B01C30;      --gd-elec-soft: #FBE3E6;
  --gd-gaz: #F2B705;       --gd-gaz-ink: #7F5A00;       --gd-gaz-soft: #FDF1CC;
  --gd-eau: #1F6FB2;       --gd-eau-ink: #1A5E98;       --gd-eau-soft: #DDEBF7;
  --gd-telecom: #2E9E5B;   --gd-telecom-ink: #1F7342;   --gd-telecom-soft: #DCF1E4;
  --gd-line: #D9D9D2;
  --gd-line-strong: #7A808A;
  --gd-sunken: #ECECE7;
  --gd-grid: rgba(22, 24, 29, 0.06);
}

:root[data-theme="dark"] {
  --gd-elec: #E8424F;      --gd-elec-ink: #FF7A84;      --gd-elec-soft: #3A1419;
  --gd-gaz: #F2B705;       --gd-gaz-ink: #F5C842;       --gd-gaz-soft: #3A2E08;
  --gd-eau: #3E8BD0;       --gd-eau-ink: #7DB4E8;       --gd-eau-soft: #10273B;
  --gd-telecom: #3BB36E;   --gd-telecom-ink: #6FD195;   --gd-telecom-soft: #10301D;
  --gd-line: #2E333B;
  --gd-line-strong: #6E7580;
  --gd-sunken: #0C0E11;
  --gd-grid: rgba(241, 241, 236, 0.05);
}

/* Couleur dominante d'un article, selon son réseau */
.tone-elec    { --tone: var(--gd-elec);    --tone-ink: var(--gd-elec-ink);    --tone-soft: var(--gd-elec-soft); }
.tone-gaz     { --tone: var(--gd-gaz);     --tone-ink: var(--gd-gaz-ink);     --tone-soft: var(--gd-gaz-soft); }
.tone-eau     { --tone: var(--gd-eau);     --tone-ink: var(--gd-eau-ink);     --tone-soft: var(--gd-eau-soft); }
.tone-telecom { --tone: var(--gd-telecom); --tone-ink: var(--gd-telecom-ink); --tone-soft: var(--gd-telecom-soft); }

/* Pastilles réseau : texte foncé (ink) sur fond doux (soft) */
.pill {
  display: inline-block;
  padding: 0.1875rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
}
.net-elec    { color: var(--gd-elec-ink);    background: var(--gd-elec-soft); }
.net-gaz     { color: var(--gd-gaz-ink);     background: var(--gd-gaz-soft); }
.net-eau     { color: var(--gd-eau-ink);     background: var(--gd-eau-soft); }
.net-telecom { color: var(--gd-telecom-ink); background: var(--gd-telecom-soft); }

/* ---------- Structure commune ---------- */
.blog-geoduc {
  max-width: var(--gd-page-width, 1040px);
  margin-inline: auto;
}

.gd-wires {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.gd-wires span { display: block; height: 4px; }
.gd-wires .wire-elec    { background: var(--gd-elec);    width: 100%; }
.gd-wires .wire-gaz     { background: var(--gd-gaz);     width: 88%; }
.gd-wires .wire-eau     { background: var(--gd-eau);     width: 76%; }
.gd-wires .wire-telecom { background: var(--gd-telecom); width: 64%; }

.gd-overline {
  margin: 0 0 0.5rem;
  font-family: var(--pico-font-family-display);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--q2-text-muted);
}

.post-meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  font-family: var(--pico-font-family-monospace);
  font-size: 0.8125rem;
  color: var(--q2-text-muted);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.875rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.post-tags li {
  list-style: none;
  margin: 0;
}
.post-tags li::before { content: none; }
.post-tags a {
  position: relative;
  z-index: 1;   /* reste cliquable au-dessus du lien qui couvre la carte */
  font-family: var(--pico-font-family-monospace);
  font-size: 0.8125rem;
  color: var(--q2-text-muted);
  text-decoration: none;
}
.post-tags a:hover {
  color: var(--q2-text-strong);
  text-decoration: underline;
}

/* ---------- En-tête du blog ---------- */
.blog-head {
  margin-bottom: 2.5rem;
}
.blog-head .gd-wires {
  max-width: 240px;
  margin-bottom: 1.75rem;
}
.blog-head .gd-wires span { border-radius: 2px; }

h1.blog-title {
  margin: 0 0 0.75rem;
  font-size: clamp(2.25rem, 4vw + 1rem, 3.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.blog-subtitle,
.blog-intro p {
  max-width: 60ch;
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--q2-text-muted);
}
.blog-intro { margin-top: 0.75rem; }

.blog-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1.75rem;
  padding: 0.875rem 1.125rem;
  border-radius: 8px;
  background: var(--q2-bg-muted);
}

.blog-filter a {
  font-weight: 500;
  color: var(--q2-text-strong);
}

.blog-empty {
  color: var(--q2-text-muted);
}

/* ---------- Grille des articles ---------- */
.post-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}
@media (min-width: 640px) {
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 980px) {
  .post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Carte d'article ---------- */
.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--q2-bg-elev);
  border-radius: 14px;
  box-shadow: var(--q2-shadow-card);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--q2-shadow-raised);
}
/* Trait de couleur réseau sous l'image */
.post-card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  border-bottom: 4px solid var(--tone);
  background: var(--gd-sunken);
}
.post-card-media img,
.post-card-media .post-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  padding: 1.25rem 1.375rem 1.375rem;
}

.post-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.post-card-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.post-card-title::before { display: none; }
.post-card-title a {
  color: var(--q2-text-strong);
  text-decoration: none;
}
/* Toute la carte est cliquable, via le lien du titre */
.post-card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}
.post-card-title a:focus-visible {
  outline: none;
}
.post-card:has(.post-card-title a:focus-visible) {
  outline: 2px solid var(--q2-focus-ring);
  outline-offset: 3px;
}

.post-card-summary {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--q2-text-muted);
}

.post-card .post-tags { margin-top: auto; padding-top: 0.25rem; }

/* Article à la une : pleine largeur, image à gauche */
.post-card-featured {
  grid-column: 1 / -1;
}
@media (min-width: 760px) {
  .post-card-featured {
    flex-direction: row;
  }
  .post-card-featured .post-card-media {
    flex: 0 0 55%;
    aspect-ratio: auto;
    min-height: 340px;
    border-bottom: 0;
    border-right: 4px solid var(--tone);
  }
  .post-card-featured .post-card-body {
    justify-content: center;
    padding: 2rem 2.25rem;
  }
  .post-card-featured .post-card-title {
    font-size: clamp(1.5rem, 1.5vw + 1rem, 2rem);
    letter-spacing: -0.02em;
  }
  .post-card-featured .post-card-summary {
    font-size: 1rem;
  }
}

/* ---------- Illustration par défaut ---------- */
.post-art-bg { fill: var(--gd-sunken); }
.post-art-grid line {
  stroke: var(--gd-grid);
  stroke-width: 1;
}
.post-art-line {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.35;
}
.post-art-line.is-tone {
  stroke-width: 10;
  opacity: 1;
}
.line-elec    { stroke: var(--gd-elec); }
.line-gaz     { stroke: var(--gd-gaz); }
.line-eau     { stroke: var(--gd-eau); }
.line-telecom { stroke: var(--gd-telecom); }

/* ---------- Recherche ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.blog-search {
  position: relative;
  display: flex;
  gap: 0.5rem;
  max-width: 560px;
  margin: 1.75rem 0 0;
}
.blog-search > i {
  position: absolute;
  z-index: 1;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--q2-text-muted);
  pointer-events: none;
}
/* L'identifiant renforce la priorité face aux styles de champ du thème */
.blog-search input#blog-search-input {
  flex: 1;
  min-width: 0;
  height: 48px;
  margin: 0;
  padding: 0 0.875rem 0 2.5rem;
  border: 1.5px solid var(--gd-line-strong);
  border-radius: 8px;
  background: var(--q2-bg-elev);
  font-size: 1rem;
}
.blog-search input#blog-search-input:focus {
  border-color: var(--gd-eau);
  box-shadow: 0 0 0 3px var(--gd-eau-soft);
}
.blog-search .btn {
  flex: 0 0 auto;
  width: auto;
  height: 48px;
  margin: 0;
}
@media (max-width: 480px) {
  .blog-search .btn { padding-inline: 0.875rem; }
}

/* ---------- Pagination ---------- */
.blog-pagination {
  margin-top: 3rem;
}
.blog-pagination .pagination {
  gap: 0.5rem;
}
.blog-pagination .pagination li a,
.blog-pagination .pagination li span {
  min-width: 44px;
  height: 44px;
  border-radius: 8px;
  font-family: var(--pico-font-family-monospace);
  font-size: 0.9375rem;
  transition: background 0.15s ease, transform 0.15s ease;
}
.blog-pagination .pagination li a:hover {
  background: var(--q2-bg-muted);
  transform: translateY(-1px);
}
.blog-pagination .pagination li.active span {
  background: var(--q2-text-strong);
  color: var(--q2-bg-elev);
  box-shadow: inset 0 -3px 0 var(--gd-eau);
}
.blog-pagination .pagination li.disabled span {
  opacity: 0.4;
  box-shadow: none;
  background: transparent;
}

/* ---------- Article ---------- */
.post {
  background: var(--q2-bg-elev);
  border-radius: 14px;
  box-shadow: var(--q2-shadow-card);
  overflow: hidden;
}

.post-header {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  max-width: 760px;
  margin-inline: auto;
  padding: clamp(1.75rem, 4vw, 3rem) clamp(1.25rem, 4vw, 2.5rem) 1.75rem;
}

.post-back {
  align-self: flex-start;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--q2-text-muted);
  text-decoration: none;
}
.post-back:hover { color: var(--q2-text-strong); }
.post-back i { margin-right: 0.25rem; }

h1.post-title {
  margin: 0;
  font-size: clamp(2rem, 3vw + 1rem, 2.75rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.post-subtitle {
  margin: 0;
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--q2-text-muted);
}

.post-cover {
  margin: 0 0 2rem;
  border-top: 4px solid var(--tone);
  border-bottom: 4px solid var(--tone);
}
.post-cover img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: cover;
}

/* Colonne de lecture : environ 70 caractères par ligne */
.post-content {
  max-width: 760px;
  margin-inline: auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem) clamp(2rem, 4vw, 3rem);
}
.post-content > :first-child { margin-top: 0; }
.post-content p,
.post-content li {
  font-size: 1.0625rem;
  line-height: 1.75;
}
.post-content h2::before {
  background: var(--tone);   /* le petit trait des intertitres prend la couleur du réseau */
  opacity: 1;
}
.post-content a {
  text-decoration-color: var(--tone);
  text-decoration-thickness: 2px;
}
.post-content blockquote {
  border-left: 4px solid var(--tone);
  background: var(--tone-soft);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.25rem;
}
.post-content img {
  border-radius: 8px;
}
.post-content figure {
  margin: 2rem 0;
}
.post-content figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--q2-text-muted);
}
.post-content table {
  font-size: 0.9375rem;
}
.post-content td,
.post-content th {
  font-variant-numeric: tabular-nums;
}

/* ---------- Navigation entre articles ---------- */
.post-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}
@media (min-width: 640px) {
  .post-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.125rem 1.375rem;
  border-radius: 14px;
  background: var(--q2-bg-elev);
  box-shadow: var(--q2-shadow-card);
  text-decoration: none;
  transition: transform 0.2s ease;
}
.post-nav-link:hover {
  transform: translateY(-2px);
  text-decoration: none;
}
.post-nav-next {
  grid-column: -2;
  text-align: right;
}
.post-nav-label {
  font-family: var(--pico-font-family-monospace);
  font-size: 0.8125rem;
  color: var(--q2-text-muted);
}
.post-nav-title {
  font-family: var(--pico-font-family-display);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--q2-text-strong);
}
