/* ==========================================================================
   Gafas Raysol — pages/blog.css
   Journal : index (/blog/) et articles (/blog/<slug>/). Chargé après site.css,
   sur ces pages seulement. Réutilise les jetons, la prose (.prose), le sommaire
   (.toc), les cartes d'article (.post-card) et l'encadré (.help-box) de site.css :
   ce fichier ne fait que la mise en page propre au Journal.
   --------------------------------------------------------------------------
   01  Index : en-tête éditorial
   02  Index : article à la une
   03  Index : autres articles
   04  Article : en-tête, méta, couverture
   05  Article : colonne de lecture et tableaux
   06  Encadré tienda / guía de medidas
   07  Sigue leyendo
   08  Focus des cartes
   ========================================================================== */


/* 01 — Index : en-tête éditorial
   ========================================================================== */
.blog-hero { border-bottom: 1px solid var(--line); }
.blog-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: end;
  padding-bottom: clamp(36px, 4.5vw, 64px);
}
.blog-hero__title { margin-top: 16px; max-width: 13em; font-size: var(--fs-1); }
.blog-hero__intro { max-width: 44ch; font-size: var(--fs-lead); line-height: 1.55; color: var(--ink-2); }
@media (min-width: 1024px) {
  .blog-hero__inner { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(40px, 6vw, 112px); }
  .blog-hero__intro { padding-bottom: .35em; }
}


/* 02 — Index : article à la une
   ========================================================================== */
.blog-feature {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  margin-top: clamp(32px, 4.5vw, 72px);
}
.blog-feature__media { aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--radius); background: var(--sand); }
.blog-feature__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: var(--focal, 50% 50%);
  transition: transform 1.4s var(--ease-out);
}
.blog-feature:hover .blog-feature__media img { transform: scale(1.03); }
.blog-feature__body { display: grid; align-content: center; justify-items: start; }
.blog-feature__title { margin-top: 16px; max-width: 14em; font-size: var(--fs-2); line-height: 1.04; }
.blog-feature__link { text-decoration: none; }
.blog-feature__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.blog-feature:hover .blog-feature__link { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.blog-feature__excerpt { margin-top: 18px; max-width: 46ch; color: var(--ink-2); }
.blog-feature__meta { margin-top: 22px; }
.blog-feature__cta { margin-top: 10px; }
.blog-feature:hover .blog-feature__cta { text-decoration-color: currentColor; }
.blog-feature:hover .blog-feature__cta .icon { transform: translateX(4px); }
@media (min-width: 1024px) {
  .blog-feature { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(40px, 5vw, 96px); align-items: center; }
  .blog-feature__excerpt { font-size: var(--fs-lead); line-height: 1.55; }
}


/* 03 — Index : autres articles
   ========================================================================== */
.blog-more__head .section-head__title { font-size: var(--fs-3); }
.blog-more .section-head { margin-bottom: clamp(24px, 2.6vw, 40px); padding-bottom: 18px; border-bottom: 1px solid var(--line); }


/* 04 — Article : en-tête, méta, couverture
   ========================================================================== */
.post-hero__title { margin-top: 16px; max-width: 15em; font-size: var(--fs-1); }
/* titres longs (> 60 signes) : un cran plus petits pour rester sur 2 à 3 lignes */
.post-hero__title--long { max-width: 17em; font-size: var(--fs-2); line-height: 1.04; }

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 24px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.post-meta li { display: inline-flex; align-items: center; gap: 8px; }
.post-meta .icon { width: 16px; height: 16px; }

.post-cover {
  margin: clamp(28px, 3.5vw, 48px) 0 0;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--sand);
}
.post-cover img { width: 100%; height: 100%; object-fit: cover; object-position: var(--focal, 50% 50%); }
/* 16/9 dès la tablette, plus de 2/1 (M7) : un bandeau trop étiré ne laissait voir que du ciel */
@media (min-width: 768px) { .post-cover { aspect-ratio: 16 / 9; } }


/* 05 — Article : colonne de lecture et tableaux
   ========================================================================== */
.post-layout { padding-bottom: clamp(56px, 6vw, 96px); }

/* Chapô aligné sur la colonne de texte : 70ch du corps ≈ 57ch à la taille du chapô */
.post-body > .lead:first-child { max-width: 57ch; }

/* Tableaux de 1 à 3 colonnes : alignés sur la colonne de texte ; à partir de 4, ils s'élargissent */
.post-body > .table-wrap:not(:has(tr > :nth-child(4))) { max-width: 70ch; }

/* Intitulés de colonne sur plusieurs lignes si besoin : la largeur se répartit selon le contenu
   des cellules (sinon un long intitulé écrase la colonne voisine) */
.post-body thead th { white-space: normal; vertical-align: bottom; }

/* Indice de défilement horizontal : une ombre n'apparaît que du côté où il reste du contenu caché */
.post-body .table-wrap {
  background:
    linear-gradient(to right, var(--paper) 40%, rgb(var(--paper-rgb) / 0)) left center / 40px 100% no-repeat local,
    linear-gradient(to left, var(--paper) 40%, rgb(var(--paper-rgb) / 0)) right center / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgb(var(--ink-rgb) / .14), rgb(var(--ink-rgb) / 0)) left center / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgb(var(--ink-rgb) / .14), rgb(var(--ink-rgb) / 0)) right center / 14px 100% no-repeat scroll,
    var(--paper);
}

@media (max-width: 639.98px) {
  /* 2 colonnes : le tableau tient dans la largeur, sans défilement */
  .post-body table { min-width: 0; }
  .post-body th, .post-body td { padding: 12px 14px; }
  .post-body caption { padding: 12px 14px; }

  /* 3 colonnes ou plus : une fiche par ligne (intitulés de colonne posés par blog.js en data-label).
     Sans JavaScript, le tableau garde son défilement horizontal. */
  .post-body .table-wrap.is-stackable { overflow: visible; background: var(--paper); }
  .post-body .is-stackable table,
  .post-body .is-stackable tbody,
  .post-body .is-stackable tr { display: block; min-width: 0; }
  .post-body .is-stackable caption { display: block; }
  .post-body .is-stackable thead {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .post-body .is-stackable tbody tr { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
  .post-body .is-stackable tbody tr:last-child { border-bottom: 0; }
  .post-body .is-stackable tbody th,
  .post-body .is-stackable tbody td { display: block; padding: 5px 0; border: 0; }
  .post-body .is-stackable tbody [data-label] {
    display: grid;
    grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr);
    gap: 14px;
  }
  .post-body .is-stackable [data-label]::before {
    content: attr(data-label);
    content: attr(data-label) / "";
    padding-top: 3px;
    font-family: var(--font-sans);
    font-size: var(--fs-micro);
    font-weight: 500;
    font-style: normal;
    line-height: 1.35;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .post-body .is-stackable tbody th { padding-bottom: 8px; font-family: var(--font-serif); font-size: 1.375rem; font-weight: 400; line-height: 1.15; }
}


/* 06 — Encadré tienda / guía de medidas (sur la base de .help-box)
   ========================================================================== */
.post-shop { padding-bottom: 0; }
.post-shop--index { padding-top: clamp(8px, 1vw, 16px); padding-bottom: var(--section); }
.post-shop .help-box__inner { align-items: start; }
.post-shop__cta { margin-top: 26px; }
/* liste sans pictogrammes (m20) : les intitulés des collections suffisent */
.post-shop .help-box__list li { grid-template-columns: minmax(0, 1fr); }
.post-shop .help-box__list a { text-decoration: none; }
.post-shop .help-box__list a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
@media (min-width: 1024px) {
  .post-shop .help-box__inner { align-items: center; }
}


/* 07 — Sigue leyendo
   ========================================================================== */
/* < 768 px : liste compacte (vignette + date + titre) plutôt que trois grandes cartes */
@media (max-width: 767.98px) {
  .post-related .posts { gap: 0; border-top: 1px solid var(--line); }
  .post-related .post-card {
    grid-template-columns: 104px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 16px;
    row-gap: 6px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
  }
  .post-related .post-card__media { grid-row: 1 / span 2; aspect-ratio: 1; }
  .post-related .post-card__meta,
  .post-related .post-card__title { grid-column: 2; }
  .post-related .post-card__title { font-size: 1.25rem; line-height: 1.2; }
  .post-related .post-card__excerpt { display: none; }
}


/* 08 — Focus des cartes : tout le bloc est entouré quand son lien a le focus
   ========================================================================== */
@supports selector(:has(*)) {
  .post-card__link:focus-visible,
  .blog-feature__link:focus-visible { outline: none; }
  .post-card:has(.post-card__link:focus-visible),
  .blog-feature:has(.blog-feature__link:focus-visible) { outline: 2px solid var(--ink); outline-offset: 6px; }
}


/* 09 — Impression : l'article seul (sans encadré tienda ni suggestions de lecture)
   ========================================================================== */
@media print {
  .post-shop, .post-related { display: none !important; }
  .post-layout { display: block; padding-bottom: 0; }
  .post-body .table-wrap { overflow: visible; background: none; }
}
