/* Page /journal/<slug> (lecture d'un article) — complément de pages.css (préfixe ja-).
 * Couverture en relief, sommaire collant construit depuis les h2/h3, barre de lecture,
 * typographie de lecture. Le rendu des blocs (journal.css, .journal-article .jn-*) n'est pas touché :
 * seule l'enveloppe (.ja-prose) règle la typographie autour.
 * Servie aussi sur kiloecho.fr (.ja-echo : palette eau, variables du layout KiloEcho).
 */

/* KiloEcho : son layout ne définit pas les variables de site.css ; on les pose ici. */
.pg.ja-echo { --f: #81C4FF; --e: #4A9AD4; --v: #FFC53D; --line: rgba(129,196,255,.22); --card: rgba(10,35,66,.72);
  --text: #E9F2FB; --text-muted: #8FAECB; --text-dim: #5F7FA0; --border: rgba(129,196,255,.14); --border-strong: rgba(129,196,255,.28); --accent: #81C4FF; --top: 62px; }
.pg.ja-echo .pg-btn-fire { background: linear-gradient(120deg, #1B4F86, #4A9AD4); }
.ja [hidden] { display: none !important; }
.ja .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Barre de lecture (progression dans l'article, pas dans la page) ── */
.ja-progress { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 300; pointer-events: none; }
.ja-progress i { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, #FF6B35, #f24cc0, #b39dff); box-shadow: 0 0 12px rgba(242,76,192,.6); }
body:has(.ja-echo) .ja-progress i { background: linear-gradient(90deg, #1B4F86, #81C4FF, #FFC53D); }

/* ── En-tête ── */
.ja-hero { position: relative; isolation: isolate; overflow: hidden; padding: 58px 0 40px; }
.ja-hero-bg { position: absolute; inset: -60px; z-index: -2;
  background: radial-gradient(60% 70% at 78% 30%, hsl(var(--h) 80% 45% / .28), transparent 70%),
              radial-gradient(45% 60% at 10% 10%, rgba(255,107,53,.12), transparent 70%); }
.ja-hero-bg img { width: 100%; height: 100%; object-fit: cover; filter: blur(46px) saturate(1.3); opacity: .32; transform: translateY(var(--py, 0)) scale(1.1); }
.ja-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10,22,40,.2), var(--navy, #0A1628) 96%); }
.ja-echo .ja-hero::after { background: linear-gradient(180deg, rgba(3,15,36,.2), #030F24 96%); }
.ja-hero-in { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 44px; align-items: center; }
.ja-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ja-crumb a { display: inline-flex; align-items: center; gap: 6px; font: 700 12px Inter, sans-serif; letter-spacing: .1em; text-transform: uppercase;
  color: var(--f); text-decoration: none; margin-right: 6px; }
.ja-crumb a:hover { color: #fff; }
.ja-tag { display: inline-flex; padding: 3px 10px; border-radius: 999px; font: 600 11px 'JetBrains Mono', monospace; letter-spacing: .03em;
  color: var(--accent, #4FC3F7); background: rgba(79,195,247,.08); border: 1px solid rgba(79,195,247,.22); }
.ja-hero h1 { font-size: clamp(30px, 4.4vw, 52px); line-height: 1.07; letter-spacing: -.025em; margin: 16px 0 14px; font-weight: 800; text-wrap: balance; }
.ja-sub { font-size: 19px; line-height: 1.55; color: #c6d2e2; font-style: italic; margin: 0 0 4px; max-width: 640px; }
.ja-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 18px; font: 600 12px 'JetBrains Mono', monospace; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.ja-meta span::before { content: "·"; margin-right: 14px; color: var(--f); }
.ja-author { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.08); }
.ja-author b { display: block; font-size: 14.5px; color: var(--text); }
.ja-author small { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.ja-avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font: 800 15px 'JetBrains Mono', monospace; color: #0A1628;
  background: linear-gradient(135deg, var(--c, #4FC3F7), var(--e, #FF6B35)); box-shadow: 0 0 0 3px rgba(255,255,255,.06); }
.ja-avatar.lg { width: 56px; height: 56px; font-size: 20px; }

/* Couverture : carte en relief qui suit le pointeur, halo de la même image derrière */
.ja-cover { margin: 0; perspective: 1300px; --rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 30%; }
.ja-cover-in { position: relative; aspect-ratio: 16 / 10; border-radius: 22px; overflow: hidden; background: #0b1628;
  border: 1px solid rgba(255,255,255,.1); transform: rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--cy, 0)); transform-style: preserve-3d;
  box-shadow: 0 40px 90px rgba(0,0,0,.55), 0 0 70px hsl(var(--h) 80% 50% / .18); transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.ja-cover.tilting .ja-cover-in { transition: transform .08s linear; }
.ja-cover-in img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.08) translate(var(--ix, 0px), var(--iy, 0px)); transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.ja-cover-in img.ko { display: none; }
.ja-glare { position: absolute; inset: 0; pointer-events: none; opacity: .0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--gx) var(--gy), rgba(255,255,255,.16), transparent 60%); }
.ja-cover:hover .ja-glare { opacity: 1; }
.ja-gen { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 16px 18px;
  background: radial-gradient(120% 90% at 85% 10%, hsl(var(--h) 85% 55% / .55), transparent 60%),
              radial-gradient(90% 80% at 10% 100%, hsl(calc(var(--h) + 50) 85% 50% / .45), transparent 65%),
              linear-gradient(160deg, #0d1a30, #09111f); }
.ja-gen i { position: absolute; inset: -20%; opacity: .5; background: repeating-radial-gradient(circle at 70% 35%, transparent 0 14px, hsl(var(--h) 90% 75% / .22) 14px 15px); }
.ja-gen b { position: relative; font: 700 12px 'JetBrains Mono', monospace; letter-spacing: .06em; text-transform: uppercase; color: #fff;
  padding: 4px 9px; border-radius: 7px; background: rgba(7,17,31,.55); border: 1px solid rgba(255,255,255,.14); }
.ja-cover-gen i { animation: ja-ripple 16s linear infinite; }
@keyframes ja-ripple { to { transform: scale(1.18) rotate(8deg); } }

/* ── Mise en page de lecture ── */
.ja-body { padding-top: 18px; padding-bottom: 70px; }
.ja-layout { display: grid; grid-template-columns: 230px minmax(0, 720px); gap: 56px; justify-content: center; align-items: start; }
.ja-side { position: sticky; top: calc(var(--top) + 26px); display: grid; gap: 26px; max-height: calc(100vh - var(--top) - 52px); overflow-y: auto; scrollbar-width: thin; }
.ja-toc b, .ja-share-side b { display: block; font: 700 11px Inter, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px; }
.ja-toc ol, .ja-toc-m ol { list-style: none; margin: 0; padding: 0; counter-reset: t; }
.ja-toc li a { position: relative; display: block; padding: 6px 10px 6px 12px; border-left: 2px solid var(--border); color: var(--text-muted);
  text-decoration: none; font-size: 13.5px; line-height: 1.4; transition: color .2s, border-color .2s, background .2s; }
.ja-toc li.l3 a { padding-left: 24px; font-size: 12.8px; }
.ja-toc li a:hover { color: var(--text); }
.ja-toc li a.on { color: #fff; border-left-color: var(--f); background: color-mix(in srgb, var(--f) 8%, transparent); }
.ja-toc li a.done { color: color-mix(in srgb, var(--text-muted) 70%, transparent); }
.ja-left { margin: 12px 0 0; font: 600 11.5px 'JetBrains Mono', monospace; color: var(--text-dim); letter-spacing: .03em; }
.ja-left span { color: var(--f); }
.ja-share-side > div { display: flex; gap: 8px; flex-wrap: wrap; }
.ja-sh { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; border: 1px solid var(--border); background: rgba(255,255,255,.02);
  color: var(--text-muted); cursor: pointer; transition: all .2s; text-decoration: none; }
.ja-sh:hover, .ja-sh.done { color: #fff; border-color: var(--f); background: color-mix(in srgb, var(--f) 12%, transparent); }
.ja-toc-m { margin: 0 0 22px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.ja-toc-m summary { cursor: pointer; padding: 13px 16px; font: 700 13px Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--f); }
.ja-toc-m ol { padding: 0 16px 12px; }
.ja-toc-m li a { display: block; padding: 6px 0; color: var(--text-muted); text-decoration: none; font-size: 14.5px; }
.ja-toc-m li.l3 a { padding-left: 14px; font-size: 13.5px; }

/* ── Typographie (enveloppe des blocs) ── */
.ja-prose { font-size: 18px; line-height: 1.78; color: #d6deea; }
.ja-echo .ja-prose { color: #d3e2f1; }
.ja-prose .journal-article { font-size: inherit; line-height: inherit; }
.ja-prose .ja-lead { font-size: 21px; line-height: 1.6; color: var(--text); margin: 0 0 30px; padding: 4px 0 4px 20px;
  border-left: 3px solid; border-image: linear-gradient(180deg, var(--e), var(--f)) 1; }
.ja-prose p { margin: 0 0 1.15em; }
.ja-prose h2 { font-size: clamp(24px, 2.6vw, 31px); line-height: 1.2; letter-spacing: -.015em; color: var(--text); margin: 2em 0 .6em; scroll-margin-top: calc(var(--top) + 24px); }
.ja-prose h3 { font-size: 21px; line-height: 1.3; color: var(--text); margin: 1.7em 0 .5em; scroll-margin-top: calc(var(--top) + 24px); }
.ja-prose h4 { font-size: 18px; color: var(--text); margin: 1.5em 0 .4em; }
.ja-prose h2 [id], .ja-prose h3 [id] { scroll-margin-top: calc(var(--top) + 24px); }
.ja-prose .heading-permalink { float: left; margin-left: -1.1em; width: 1em; color: var(--f); opacity: 0; text-decoration: none; transition: opacity .2s; }
.ja-prose h2:hover .heading-permalink, .ja-prose h3:hover .heading-permalink, .ja-prose .heading-permalink:focus { opacity: .8; }
.ja-prose a { color: var(--accent, #4FC3F7); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent, #4FC3F7) 40%, transparent); text-underline-offset: 3px; }
.ja-prose a:hover { text-decoration-color: currentColor; }
.ja-prose strong, .ja-prose b { color: var(--text); }
.ja-prose ul, .ja-prose ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.ja-prose li { margin: .35em 0; }
.ja-prose li::marker { color: var(--f); }
.ja-prose blockquote { margin: 1.6em 0; padding: 14px 20px; border-left: 3px solid var(--f); border-radius: 0 14px 14px 0; background: color-mix(in srgb, var(--f) 6%, transparent); color: var(--text); font-style: italic; }
.ja-prose blockquote p:last-child { margin-bottom: 0; }
.ja-prose code { font: .86em 'JetBrains Mono', monospace; padding: .12em .4em; border-radius: 6px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.ja-prose pre { margin: 1.4em 0; padding: 16px 18px; border-radius: 12px; background: #0a0e14; border: 1px solid #1f2d45; overflow-x: auto; font-size: 14px; line-height: 1.65; }
.ja-prose pre code { padding: 0; border: 0; background: none; font-size: inherit; }
.ja-prose table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: 15px; display: block; overflow-x: auto; }
.ja-prose th { text-align: left; font: 700 12px Inter, sans-serif; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); padding: 10px 12px; border-bottom: 1px solid var(--border-strong); }
.ja-prose td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ja-prose img { max-width: 100%; height: auto; border-radius: 12px; }
.ja-prose hr { border: 0; height: 1px; margin: 2.4em 0; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); }
.ja-prose figure { margin: 1.8em 0; }
.ja-prose figcaption { font-size: 13.5px; color: var(--text-muted); text-align: center; margin-top: 8px; }
.ja-prose .footnotes { font-size: 14.5px; color: var(--text-muted); border-top: 1px solid var(--border); margin-top: 2.5em; padding-top: 1em; }

/* ── Blocs de fin ── */
.ja-block { margin-top: 48px; }
.ja-block h2 { font-size: clamp(22px, 2.6vw, 28px); margin: 6px 0 16px; letter-spacing: -.015em; }
.ja-video { margin: 0 0 18px; }
.ja-video video { display: block; width: 100%; max-height: 70vh; background: #000; border-radius: 14px; border: 1px solid var(--border); }
.ja-video figcaption { margin-top: 7px; font: 600 11.5px 'JetBrains Mono', monospace; color: var(--text-muted); }
.ja-atts { display: grid; gap: 10px; }
.ja-att { display: grid !important; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 13px 16px; color: var(--text) !important; }
.ja-ext { font: 800 10.5px 'JetBrains Mono', monospace; letter-spacing: .05em; padding: 5px 8px; border-radius: 7px; color: var(--f);
  background: color-mix(in srgb, var(--f) 12%, transparent); border: 1px solid color-mix(in srgb, var(--f) 30%, transparent); }
.ja-att-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14.5px; }
.ja-att-s { font: 600 12px 'JetBrains Mono', monospace; color: var(--text-muted); }
.ja-att svg { color: var(--text-muted); transition: transform .2s, color .2s; }
.ja-att:hover svg { color: var(--f); transform: translateY(2px); }

.ja-end { margin-top: 52px; padding-top: 30px; border-top: 1px solid var(--border); display: grid; gap: 24px; }
.ja-share > b { display: block; font-size: 15px; color: var(--text); margin-bottom: 12px; }
.ja-share > div { display: flex; flex-wrap: wrap; gap: 8px; }
.ja-btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: rgba(255,255,255,.02);
  color: var(--text); font: 600 13.5px Inter, sans-serif; text-decoration: none; cursor: pointer; transition: all .2s; }
.ja-btn:hover, .ja-btn.done { border-color: var(--f); color: #fff; background: color-mix(in srgb, var(--f) 12%, transparent); }
.ja-btn:focus-visible, .ja-sh:focus-visible, .ja-toc a:focus-visible, .ja-top:focus-visible { outline: 2px solid var(--f); outline-offset: 2px; }
.ja-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ja-bio { display: flex; gap: 16px; padding: 20px 22px; border-radius: 18px; border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255,107,53,.07), rgba(242,76,192,.06)); }
.ja-bio b { font-size: 16px; color: var(--text); }
.ja-bio small { display: block; font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.ja-bio p, .ja-contact { margin: 10px 0 0; font-size: 14.5px; line-height: 1.65; color: var(--text-muted); }
.ja-stores { margin-top: 0; flex-wrap: wrap; }
/* kiloecho.fr ne charge pas site.css : habillage minimal des badges stores. */
.ja-echo .store-badges { display: flex; flex-wrap: wrap; gap: 10px; }
.ja-echo .store-badge { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 10px; background: #000;
  border: 1px solid rgba(255,255,255,.22); color: #fff; text-decoration: none; }
.ja-echo .store-badge__text { display: grid; line-height: 1.1; }
.ja-echo .store-badge__caption { font-size: 10px; opacity: .8; }
.ja-echo .store-badge__name { font-size: 15px; font-weight: 700; }

/* ── À lire ensuite ── */
.ja-related { margin-top: 70px; padding-top: 34px; border-top: 1px solid var(--border); }
.ja-related-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ja-related h2 { font-size: clamp(26px, 3.2vw, 36px); margin: 6px 0 0; letter-spacing: -.02em; }
.ja-rel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.ja-rel { display: flex !important; flex-direction: column; padding: 0 !important; }
.ja-rel::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--c2); opacity: 0; transition: opacity .3s; z-index: 2; }
.ja-rel:hover::after { opacity: 1; }
.ja-rel-cover { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #0b1628; }
.ja-rel-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.ja-rel:hover .ja-rel-cover img, .ja-rel:hover .ja-rel-cover .ja-gen i { transform: scale(1.06); }
.ja-rel-cover .ja-gen i { transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.ja-rel-meta { display: flex; gap: 10px; padding: 14px 18px 0; font: 600 11px 'JetBrains Mono', monospace; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.ja-rel-meta span::before { content: "·"; margin-right: 10px; color: var(--f); }
.ja-rel-t { display: block; padding: 8px 18px 18px; font-size: 17px; font-weight: 700; line-height: 1.35; }

/* Retour en haut */
.ja-top { position: fixed; right: 22px; bottom: 22px; z-index: 60; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  color: #fff; border: 1px solid var(--line); background: rgba(15,28,51,.85); backdrop-filter: blur(8px); box-shadow: 0 10px 30px rgba(0,0,0,.4);
  transition: transform .2s, border-color .2s; }
.ja-top:hover { transform: translateY(-3px); border-color: var(--f); }

/* ── Responsive ── */
@media (min-width: 1001px) { .ja-toc-m { display: none !important; } }
@media (max-width: 1100px) {
  .ja-layout { grid-template-columns: 200px minmax(0, 1fr); gap: 36px; }
}
@media (max-width: 1000px) {
  .ja-hero-in { grid-template-columns: 1fr; gap: 28px; }
  .ja-cover { max-width: 680px; }
  .ja-layout { grid-template-columns: minmax(0, 1fr); max-width: 720px; margin: 0 auto; }
  .ja-side { display: none; }
  .ja-rel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .ja-hero { padding: 36px 0 26px; }
  .ja-sub { font-size: 17px; }
  .ja-cover-in { border-radius: 16px; }
  .ja-prose { font-size: 17px; line-height: 1.72; }
  .ja-prose .ja-lead { font-size: 18.5px; }
  .ja-rel-grid { grid-template-columns: 1fr; }
  .ja-att { grid-template-columns: auto minmax(0, 1fr) auto; }
  .ja-att-s { display: none; }
  .ja-bio { flex-direction: column; }
  .ja-top { right: 14px; bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .ja-cover-in, .ja-cover-in img, .ja-rel-cover img { transition: none !important; transform: none !important; }
  .ja-cover-gen i { animation: none; }
  .ja-hero-bg img { transform: scale(1.1); }
}
