/* ============================================================
   TechMedias Blog — Phase 2 (revB)
   Canvas sombre + hero pleine largeur (style Joy Juice) + carte de lecture.
   Proportions : nombre d'or (φ ≈ 1.618) + espacements Fibonacci (8/13/21/34/55/89).
   ============================================================ */

:root {
  --tm-ink: #0B0D1A;
  --tm-card: #ffffff;
  --tm-card-2: #F5F5FA;
  --tm-text: #1F2433;
  --tm-muted: #5B6273;
  --tm-border: #E8E8F0;
  --tm-violet: #8B5CF6;
  --tm-pink: #EC4899;
  --tm-cyan: #22A6E8;
  --tm-grad: linear-gradient(135deg, #22A6E8 0%, #8B5CF6 52%, #EC4899 100%);
  /* échelle Fibonacci */
  --f1:8px; --f2:13px; --f3:21px; --f4:34px; --f5:55px; --f6:89px;
}

.tm-canvas { background: transparent; }

/* ============================================================
   BARRE DE PROGRESSION
   ============================================================ */
.tm-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 9999; background: var(--tm-grad); box-shadow: 0 0 10px rgba(139,92,246,.5); transition: width .08s linear; pointer-events: none; }
.admin-bar .tm-progress { top: 32px; }
@media screen and (max-width: 782px){ .admin-bar .tm-progress { top: 46px; } }

/* ============================================================
   HERO PLEINE LARGEUR (cover + image mise en avant)
   ============================================================ */
.tm-hero.wp-block-cover { min-height: 58vh; align-items: center; padding: var(--f5) var(--f4); }
.tm-hero .wp-block-cover__background {
  opacity: 1 !important;
  background: linear-gradient(180deg, rgba(11,13,26,.30) 0%, rgba(11,13,26,.50) 42%, rgba(11,13,26,.92) 100%) !important;
}
.tm-hero .wp-block-cover__inner-container { max-width: 880px; text-align: center; }
.tm-hero-cat { font-family: var(--wp--preset--font-family--display); font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; margin: 0 0 var(--f2); }
.tm-hero-cat a { color: #C9B7FF; text-decoration: none; font-weight: 600; }
.tm-hero .wp-block-post-title.tm-hero-title {
  color: #fff !important; -webkit-text-fill-color: #fff !important; background: none !important;
  font-family: var(--wp--preset--font-family--display);
  font-size: clamp(2.1rem, 4.8vw, 3.5rem); line-height: 1.08; letter-spacing: -.02em;
  margin: 0 auto var(--f3); max-width: 20ch; text-shadow: 0 2px 40px rgba(0,0,0,.45);
}
.tm-hero-sub { color: #D8DBE3; font-size: clamp(1rem, 1.6vw, 1.18rem); line-height: 1.55; max-width: 60ch; margin: 0 auto; }

/* ============================================================
   CARTE ARTICLE (remonte sur le hero) + marges généreuses
   ============================================================ */
/* spécificité doublée + !important : bat la mise en page "constrained" de WP
   (qui force has-global-padding=0 et max-width=contentSize sur la carte). */
.tm-article-card.tm-article-card {
  position: relative; z-index: 2;
  background: var(--tm-card); color: var(--tm-text);
  max-width: 800px !important;
  margin: -89px auto var(--f6) !important;
  padding: clamp(2rem, 5vw, 64px) clamp(1.5rem, 6vw, 72px) !important;
  border-radius: 24px;
  box-shadow: 0 40px 90px -40px rgba(0,0,0,.8), 0 2px 0 rgba(255,255,255,.04);
}

/* Barre du haut : fil d'ariane (gauche) + méta (droite) */
.tm-article-topbar { gap: var(--f2) var(--f4) !important; margin-bottom: var(--f4); padding-bottom: var(--f3); border-bottom: 1px solid var(--tm-border); }
.tm-breadcrumb { font-size: .8rem; color: var(--tm-muted); gap: .4rem !important; align-items: center; font-family: var(--wp--preset--font-family--display); margin: 0; }
.tm-breadcrumb a { color: var(--tm-muted); text-decoration: none; transition: color .2s; }
.tm-breadcrumb a:hover { color: var(--tm-violet); }
.tm-breadcrumb .tm-bc-sep { color: #C3C7D2; }
.tm-breadcrumb .wp-block-post-terms a { color: var(--tm-violet); font-weight: 600; }
.tm-article-meta { gap: 0 !important; align-items: center; font-size: .82rem; color: var(--tm-muted); font-family: var(--wp--preset--font-family--display); margin: 0; }
.tm-article-meta > * { margin: 0; }
.tm-article-meta > * + *::before { content: "·"; margin: 0 .5rem; color: #C3C7D2; }
.tm-article-meta .wp-block-post-author-name { font-weight: 600; color: var(--tm-text); }

/* Partage social (LinkedIn en tête) */
.tm-share { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; margin: 0 auto var(--f5) !important; }
.tm-share-label { font-size: .8rem; color: var(--tm-muted); font-family: var(--wp--preset--font-family--display); margin-right: .25rem; }
.tm-share-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--tm-border); color: #5B6273; background: #fff; transition: background .2s, color .2s, transform .2s, border-color .2s; cursor: pointer; }
.tm-share-btn:hover { color: #fff; border-color: transparent; transform: translateY(-2px); }
.tm-share-linkedin:hover { background: #0A66C2; }
.tm-share-x:hover { background: #000; }
.tm-share-facebook:hover { background: #1877F2; }
.tm-share-whatsapp:hover { background: #25D366; }
.tm-share-copy:hover { background: var(--tm-violet); }
.tm-share-copy.is-copied { background: #16a34a; color: #fff; border-color: transparent; }

/* Contenu : lisibilité long-form */
.tm-article-card .wp-block-post-content { font-size: 1.07rem; line-height: 1.78; color: var(--tm-text); }
.tm-article-card .wp-block-post-content > * { margin-top: var(--f3); }
.tm-article-card .wp-block-post-content :is(h2,h3) { color: #14172A; margin-top: var(--f5); }
.tm-article-card .wp-block-post-content h2 { font-size: 1.6rem; }
.tm-article-card .wp-block-post-content h3 { font-size: 1.28rem; }
.tm-article-card .wp-block-post-content a { color: var(--tm-violet); text-underline-offset: .18em; text-decoration-thickness: 1px; }
.tm-article-card .wp-block-post-content a:hover { color: var(--tm-pink); }
.tm-article-card .wp-block-post-content ul, .tm-article-card .wp-block-post-content ol { padding-left: 1.3rem; }
.tm-article-card .wp-block-post-content li { margin: .4rem 0; }
.tm-article-card .wp-block-post-content strong { color: #14172A; }
.tm-article-card .wp-block-pullquote { border: none; padding: var(--f3) 0; margin: var(--f4) auto; }
.tm-article-card .wp-block-pullquote p { font-family: var(--wp--preset--font-family--serif); font-style: italic; font-size: 1.55rem; line-height: 1.35; color: #2a2f45; border-left: 3px solid var(--tm-violet); padding-left: var(--f3); text-align: left; }

/* ============================================================
   TABLE DES MATIÈRES
   ============================================================ */
.tm-toc { background: var(--tm-card-2); border: 1px solid var(--tm-border); border-radius: var(--f2); padding: var(--f3) var(--f3); margin: 0 auto var(--f4); font-family: var(--wp--preset--font-family--display); }
.tm-toc summary { cursor: pointer; font-weight: 600; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--tm-muted); list-style: none; }
.tm-toc summary::-webkit-details-marker { display: none; }
.tm-toc summary::after { content: "⌄"; float: right; transition: transform .2s; }
.tm-toc[open] summary::after { transform: rotate(180deg); }
.tm-toc ol { list-style: none; margin: var(--f2) 0 0; padding: 0; counter-reset: toc; }
.tm-toc li { counter-increment: toc; margin: .15rem 0; }
.tm-toc a { display: block; padding: .35rem .5rem .35rem .8rem; color: var(--tm-text); text-decoration: none; font-size: .92rem; border-left: 2px solid transparent; transition: color .2s, border-color .2s; }
.tm-toc a::before { content: counter(toc) ". "; color: var(--tm-violet); font-weight: 600; }
.tm-toc a:hover { color: var(--tm-violet); }
.tm-toc a.is-active { color: var(--tm-violet); border-left-color: var(--tm-violet); }

/* ============================================================
   ENCADRÉ AUTEUR
   ============================================================ */
.tm-author-box { background: var(--tm-card-2); border: 1px solid var(--tm-border); border-radius: var(--f2); padding: var(--f3) var(--f3); margin: var(--f5) auto 0; gap: var(--f3) !important; align-items: flex-start; max-width: 624px; }
.tm-author-box .wp-block-avatar { flex-shrink: 0; }
.tm-author-box .wp-block-avatar img { border-radius: 50%; width: 64px; height: 64px; }
.tm-author-box .wp-block-group { margin: 0; }
.tm-author-eyebrow { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--tm-muted); margin: 0 0 .2rem; font-family: var(--wp--preset--font-family--display); font-weight: 600; }
.tm-author-box .tm-author-name { font-family: var(--wp--preset--font-family--display); font-weight: 700; font-size: 1.05rem; color: #14172A; }
.tm-author-box .wp-block-post-author-biography { font-size: .9rem; line-height: 1.55; color: var(--tm-muted); margin: .35rem 0 0; }

/* ============================================================
   « VOUS AIMEREZ AUSSI » — section pleine largeur distincte
   ============================================================ */
.tm-related { width: 100vw; margin-left: calc(50% - 50vw); margin-top: var(--f6);
  background: radial-gradient(120% 100% at 50% 0%, #161a2b 0%, #0e1120 55%, #0B0D1A 100%);
  border-top: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 3px 0 -1px rgba(139,92,246,.0);
  padding: var(--f6) var(--f4) calc(var(--f6) + var(--f3)); }
.tm-related-inner { max-width: 1180px; margin: 0 auto; }
.tm-related-head { text-align: center; margin-bottom: var(--f5); }
.tm-related-eyebrow { display: inline-block; font-family: var(--wp--preset--font-family--display); font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #C9B7FF; background: rgba(139,92,246,.12); border: 1px solid rgba(139,92,246,.3); border-radius: 999px; padding: .4rem .95rem; margin-bottom: var(--f3); }
.tm-related .tm-related-title { font-family: var(--wp--preset--font-family--display); font-weight: 700; font-size: clamp(1.7rem, 3.4vw, 2.3rem); color: #fff; margin: 0; letter-spacing: -.02em; }
.tm-related-sub { color: #9CA3AF; font-size: 1.02rem; margin: var(--f2) 0 0; }
.tm-related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 380px)); justify-content: center; gap: var(--f4); align-items: stretch; }
/* Carte riche */
.tm-rl-card { display: flex; flex-direction: column; background: var(--tm-card); border-radius: var(--f3); overflow: hidden; box-shadow: 0 24px 60px -30px rgba(0,0,0,.75); transition: transform .25s var(--ease-out, ease), box-shadow .25s; }
.tm-rl-card:hover { transform: translateY(-5px); box-shadow: 0 34px 74px -28px rgba(0,0,0,.85); }
.tm-rl-media { position: relative; display: block; line-height: 0; }
.tm-rl-media img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.tm-rl-noimg { display: block; width: 100%; aspect-ratio: 16/9; background: linear-gradient(135deg,#1a1d2f,#11141f); }
.tm-rl-time { position: absolute; top: .7rem; right: .7rem; display: inline-flex; align-items: center; gap: .3rem; background: rgba(11,13,26,.82); color: #fff; font-family: var(--wp--preset--font-family--display); font-size: .72rem; font-weight: 600; padding: .3rem .62rem; border-radius: 999px; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.tm-rl-body { padding: var(--f3) var(--f4) var(--f4); display: flex; flex-direction: column; gap: var(--f2); flex: 1; }
.tm-rl-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tm-rl-tag { font-family: var(--wp--preset--font-family--display); font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--tm-violet); background: #F1ECFF; border-radius: 999px; padding: .26rem .6rem; }
.tm-rl-h { font-family: var(--wp--preset--font-family--display); font-weight: 700; font-size: 1.18rem; line-height: 1.25; margin: 0; }
.tm-rl-h a { color: #14172A; text-decoration: none; transition: color .2s; }
.tm-rl-h a:hover { color: var(--tm-violet); }
.tm-rl-exc { font-size: .92rem; line-height: 1.55; color: var(--tm-muted); margin: 0; }
.tm-rl-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: var(--f3); border-top: 1px solid var(--tm-border); font-family: var(--wp--preset--font-family--display); font-size: .82rem; }
.tm-rl-date { display: inline-flex; align-items: center; gap: .35rem; color: var(--tm-muted); }
.tm-rl-more { display: inline-flex; align-items: center; gap: .3rem; color: var(--tm-violet); font-weight: 700; text-decoration: none; transition: gap .2s, color .2s; }
.tm-rl-more:hover { gap: .5rem; color: var(--tm-pink); }

/* ============================================================
   LISTING — cartes (φ + Fibonacci)
   ============================================================ */
.tm-blog-head { text-align: center; max-width: 760px; margin: var(--f6) auto var(--f5); }
.tm-blog-title { color: #fff; font-size: clamp(2.2rem, 5vw, 3rem); margin: 0; }
.tm-blog-sub { color: #9CA3AF; font-size: 1.05rem; margin: var(--f2) auto 0; max-width: 50ch; }

/* Toolbar : filtres catégories (gauche) + recherche (droite) */
.tm-toolbar { max-width: 1200px; margin: 0 auto var(--f6) !important; gap: var(--f4) var(--f5) !important; padding-bottom: var(--f3); border-bottom: 1px solid rgba(255,255,255,.07); }
.tm-filters { gap: .6rem !important; align-items: center; }
.tm-filter-all { font-family: var(--wp--preset--font-family--display); font-size: .82rem; font-weight: 600; color: #fff; background: var(--tm-violet); border-radius: 999px; padding: .42rem .95rem; text-decoration: none; }
.tm-cat-filter.wp-block-categories { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.tm-cat-filter li { margin: 0; }
.tm-cat-filter a { font-family: var(--wp--preset--font-family--display); font-size: .82rem; color: #C9CCD6; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 999px; padding: .42rem .95rem; text-decoration: none; transition: all .2s; display: inline-block; }
.tm-cat-filter a:hover { color: #fff; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); }
.tm-search .wp-block-search__inside-wrapper { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; overflow: hidden; padding: 2px; }
.tm-search input.wp-block-search__input { background: transparent; border: none; color: #fff; padding: .5rem .95rem; min-width: 230px; }
.tm-search input.wp-block-search__input::placeholder { color: #8A90A0; }
.tm-search button.wp-block-search__button { background: var(--tm-violet); border: none; color: #fff; border-radius: 999px; padding: .45rem .7rem; }
.tm-search button.wp-block-search__button:hover { background: #7c3aed; }

/* Grille 2 colonnes — cartes plus grandes */
.tm-query { max-width: 1200px; margin: 0 auto; padding-bottom: var(--f6); }
.tm-post-grid { grid-template-columns: repeat(2, 1fr) !important; gap: var(--f4) !important; }
.tm-post-card { display: flex; flex-direction: column; gap: 0; background: var(--tm-card); border-radius: var(--f3); overflow: hidden; box-shadow: 0 22px 55px -28px rgba(0,0,0,.7); transition: transform .25s var(--ease-out, ease), box-shadow .25s; }
.tm-post-card:hover { transform: translateY(-5px); box-shadow: 0 32px 70px -26px rgba(0,0,0,.8); }
.tm-post-card > * { margin-block-start: 0 !important; margin-top: 0 !important; }
.tm-post-card .wp-block-post-featured-image { margin: 0 !important; border-radius: 0; line-height: 0; }
.tm-post-card .wp-block-post-featured-image img { width: 100%; aspect-ratio: 1.6; object-fit: cover; display: block; } /* 16/10 — plus grand en 2 colonnes */
.tm-post-card-body { padding: var(--f4); color: var(--tm-text); display: flex; flex-direction: column; gap: var(--f2); }
/* Pills de tags */
.tm-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
.tm-tags a { font-family: var(--wp--preset--font-family--display); font-size: .7rem; font-weight: 600; color: var(--tm-violet); background: #F1ECFF; border-radius: 999px; padding: .26rem .62rem; text-decoration: none; transition: background .2s, color .2s; }
.tm-tags a:hover { background: var(--tm-violet); color: #fff; }
.tm-post-card .wp-block-post-title { font-size: 1.35rem; line-height: 1.22; margin: 0; }
.tm-post-card .wp-block-post-title a { color: #14172A; text-decoration: none; }
.tm-post-card .wp-block-post-title a:hover { color: var(--tm-violet); }
.tm-post-card .wp-block-post-excerpt { font-size: .95rem; line-height: 1.55; color: var(--tm-muted); margin: 0; }
.tm-post-card .wp-block-post-excerpt__more-text { display: none; }
.tm-card-meta { gap: 0 !important; font-size: .78rem; color: var(--tm-muted); font-family: var(--wp--preset--font-family--display); margin-top: auto; padding-top: var(--f2); align-items: center; }
.tm-card-meta > * { margin: 0; }
.tm-card-meta > * + *::before { content: "·"; margin: 0 .5rem; color: #C3C7D2; }
.tm-card-cat-foot a { color: var(--tm-violet); text-decoration: none; font-weight: 600; }
.tm-no-results { color: #9CA3AF; text-align: center; padding: var(--f5) 0; }

.tm-pagination { margin-top: var(--f4); gap: .5rem !important; }
.tm-pagination a, .tm-pagination .wp-block-query-pagination-numbers .page-numbers { color: #C9CCD6; text-decoration: none; padding: .4rem .75rem; border-radius: 8px; }
.tm-pagination a:hover { background: rgba(255,255,255,.07); color: #fff; }
.tm-pagination .page-numbers.current { background: var(--tm-violet); color: #fff; }

/* ============================================================
   RESPONSIVE — 4 niveaux (desktop / laptop / tablette / mobile)
   ============================================================ */
/* Niveau 1 — laptop ≤ 1100 : gouttières latérales */
@media (max-width: 1100px) {
  .tm-query, .tm-toolbar, .tm-blog-head { padding-left: var(--f4); padding-right: var(--f4); }
}
/* Niveau 2 — tablette ≤ 900 : 1 colonne, toolbar empilée */
@media (max-width: 900px) {
  .tm-post-grid { grid-template-columns: 1fr !important; max-width: 600px; margin-inline: auto; }
  .tm-toolbar { flex-direction: column; align-items: stretch !important; gap: var(--f3) !important; }
  .tm-filters { justify-content: center; }
  .tm-search, .tm-search .wp-block-search__inside-wrapper { width: 100%; }
  .tm-search input.wp-block-search__input { min-width: 0; width: 100%; }
  .tm-related-grid { grid-template-columns: 1fr 1fr; }
  .tm-hero.wp-block-cover { min-height: 52vh; }
}
/* Niveau 3 — mobile ≤ 600 */
@media (max-width: 600px) {
  .tm-hero.wp-block-cover { min-height: 46vh; padding: var(--f4) var(--f3); }
  .tm-hero .wp-block-post-title.tm-hero-title { font-size: clamp(1.7rem, 7vw, 2.2rem); }
  .tm-hero-sub { font-size: 1rem; }
  .tm-article-card.tm-article-card { margin: -48px 0.6rem var(--f5) !important; border-radius: 16px; padding: var(--f4) var(--f3) !important; }
  .tm-article-topbar { flex-direction: column; align-items: flex-start; gap: var(--f2) !important; }
  .tm-related-grid { grid-template-columns: 1fr; }
  .tm-related { padding: var(--f5) var(--f3); }
  .tm-author-box { flex-direction: column; }
  .tm-blog-head { margin-top: var(--f5); }
}
/* Niveau 4 — petit mobile ≤ 400 */
@media (max-width: 400px) {
  .tm-post-card-body { padding: var(--f3); }
  .tm-blog-title { font-size: 1.85rem; }
  .tm-share { gap: .4rem; }
  .tm-share-btn { width: 34px; height: 34px; }
  .tm-article-card .wp-block-post-content { font-size: 1rem; }
}
