/* =====================================================================================
   REFONTE 2026 (« v2 ») : couche de style commune aux pages du site (outils, /beta, manuel, pages légales, 404).
   Elle ne s'applique que si <html> porte la classe « v2 », posée par la ligne DESIGN_V2 en tête de chaque page :
   false en production tant que la refonte n'est pas validée, true dans le paquet de TEST (tools/package_site.py).
   Sans la classe, ce fichier n'a AUCUN effet : les pages gardent leur style actuel.
   Même direction que le nouvel accueil (index-v2.html) : graphite profond, halo bordeaux, grain léger, en-tête
   flottant, cartes « verre », boutons en dégradé. Mêmes polices. Les retouches propres à une page vont dans cette page
   (ou dans son fichier CSS, ex. journal.css), toujours sous « html.v2 ».
   ===================================================================================== */

html.v2 {
  color-scheme: dark;
  --bg: #111111;
  /* Jetons des anciennes feuilles, réglés pour le fond sombre : les règles existantes qui s'en servent suivent. */
  --graphite-0: #131313;
  --graphite-1: #181818;
  --graphite-2: #202020;
  --graphite-3: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --ink: #f2efec;
  --ink-2: #c9c5c0;
  --ink-3: #8f8b87;
  --wine-edge: #33040b;
  --wine: #8a1b2c;
  --wine-hi: #a8263d;
  --rose: #e7a1ab;
  --radius: 12px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --glass: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e7a1ab' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  background:
    radial-gradient(900px 560px at 8% -8%, rgba(138, 27, 44, 0.34), transparent 62%) fixed,
    radial-gradient(760px 520px at 96% 4%, rgba(231, 161, 171, 0.07), transparent 60%) fixed,
    radial-gradient(1100px 700px at 50% 115%, rgba(138, 27, 44, 0.12), transparent 62%) fixed,
    #111111;
  scrollbar-color: #3a3a3a #111111;
}
html.v2 body { background: transparent; overflow-x: clip; }
/* Grain léger, fixé derrière le contenu. */
html.v2::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.07; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
html.v2 body::before { width: 3px; }
html.v2 ::selection { background: rgba(231, 161, 171, 0.32); color: #fff; }
html.v2 :focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; border-radius: 6px; }

/* ---------- En-tête flottant ---------- */
html.v2 .top { top: 0; padding: calc(10px + env(safe-area-inset-top, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)) 0 max(var(--gutter), env(safe-area-inset-left, 0px)); background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
/* Site ouvert comme une app sur iPhone (journal installé : barre d'état translucide) : l'en-tête et ce qui est fixé en haut
   passent sous l'heure, la batterie et l'encoche (env(safe-area-inset-*) ; 0 dans un navigateur, rien ne change), avec
   une bande opaque derrière l'heure pour que la page ne défile pas dessous. */
html.v2 .top::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: env(safe-area-inset-top, 0px); background: #111; pointer-events: none; }
html.v2 .hub-drawer { top: calc(10px + env(safe-area-inset-top, 0px)); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); left: calc(10px + env(safe-area-inset-left, 0px)); }
@media (max-width: 640px) { html.v2 .acct-pan { top: calc(70px + env(safe-area-inset-top, 0px)); } }
html.v2 .top .wrap { max-width: 1240px; min-height: 56px; padding: 6px 8px 6px 16px; gap: 16px; border-radius: 16px; background: rgba(18, 18, 18, 0.86); border: 1px solid var(--line); -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%); box-shadow: 0 16px 40px -22px rgba(0, 0, 0, 0.85); }
html.v2 .maker { padding-left: 14px; margin-left: -4px; }
html.v2 .maker img { width: 28px; height: 28px; }
html.v2 .top-links { gap: 2px; align-items: center; }
html.v2 .top-links a { padding: 8px 12px; border-radius: 9px; transition: background 0.2s, color 0.2s; }
html.v2 .top-links a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
html.v2 .top-links a[aria-current="page"] { color: var(--ink); text-decoration: none; background: rgba(138, 27, 44, 0.3); box-shadow: inset 0 0 0 1px rgba(231, 161, 171, 0.25); }
/* Lien « bêta » de l'en-tête : bouton. */
html.v2 .top-links a[href="beta.html"]:not([aria-current="page"]), html.v2 .top-links a[href="/beta"]:not([aria-current="page"]) { margin-left: 6px; color: #fff; background: linear-gradient(180deg, #a8263d, #8a1b2c); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 22px -10px rgba(138, 27, 44, 0.95); }
html.v2 .lang { padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 11px; background: rgba(0, 0, 0, 0.2); overflow: visible; }
html.v2 .lang button { padding: 7px 9px; border-radius: 8px; }
html.v2 .lang button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.1); color: var(--ink); }
@media (max-width: 600px) {
  html.v2 .top { padding: calc(8px + env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) 0 max(10px, env(safe-area-inset-left, 0px)); }
  html.v2 .top .wrap { gap: 10px; padding-left: 12px; }
  html.v2 .lang button span, html.v2 .maker small, html.v2 .maker b { display: none; }
  html.v2 .maker { padding-left: 10px; margin-left: 0; }
}
/* Très petits écrans (320 px) : le bouton ☰ prend la place de la signature. */
@media (max-width: 360px) { html.v2 .hub-menu-btn ~ .maker { display: none; } }

/* Menu mobile des pages hub (bouton ☰ + tiroir, ajoutés par hub.js) : sous 1100 px, où les liens de l'en-tête sont
   masqués. Même tiroir que celui de l'accueil. */
html.v2 .hub-menu-btn { display: none; flex: none; width: 40px; height: 40px; padding: 0; place-content: center; gap: 4px; background: transparent; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; transition: background 0.2s, border-color 0.2s; }
html.v2 .hub-menu-btn:hover, html.v2 .hub-menu-btn[aria-expanded="true"] { background: var(--wine); border-color: var(--wine); }
html.v2 .hub-menu-btn span { display: block; width: 16px; height: 2px; border-radius: 2px; background: var(--ink); }
@media (max-width: 1100px) { html.v2 .hub-menu-btn { display: grid; } }
html.v2 .hub-drawer-bg { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity 0.25s; }
html.v2 .hub-drawer { position: fixed; top: 10px; bottom: 10px; left: 10px; z-index: 71; width: min(310px, calc(100vw - 20px)); display: flex; flex-direction: column; background: rgba(20, 20, 20, 0.94); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); transform: translateX(calc(-100% - 24px)); visibility: hidden; transition: transform 0.32s var(--ease), visibility 0s linear 0.32s; overflow: hidden; }
/* Visible tout de suite à l'ouverture (sinon le focus ne peut pas aller sur « Fermer »), masqué après l'animation. */
html.v2 body.hub-menu-open .hub-drawer { transform: none; visibility: visible; transition: transform 0.32s var(--ease), visibility 0s; }
html.v2 body.hub-menu-open .hub-drawer-bg { opacity: 1; pointer-events: auto; }
html.v2 .hub-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--line); }
html.v2 .hub-drawer-head .brand { font-size: 1.4rem; }
html.v2 .hub-drawer-x { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--ink-2); font-size: 1.4rem; line-height: 1; cursor: pointer; }
html.v2 .hub-drawer-x:hover { color: var(--ink); }
html.v2 .hub-drawer ol { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
html.v2 .hub-drawer li a { display: flex; align-items: baseline; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; }
html.v2 .hub-drawer li a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
html.v2 .hub-drawer li a[aria-current="page"] { color: var(--ink); background: rgba(138, 27, 44, 0.25); }
html.v2 .hub-drawer .n { font: 500 0.72rem/1 var(--f-mono); color: var(--rose); min-width: 30px; }
html.v2 .hub-drawer li.sep { border-top: 1px solid var(--line); margin: 8px 12px; }
html.v2 .hub-drawer-foot { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; border-top: 1px solid var(--line); }
html.v2 .hub-drawer-foot .btn { text-align: center; }

/* Liens entre les outils (sous le titre) */
html.v2 .tools-nav { gap: 6px; }
html.v2 .tools-nav a { padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); color: var(--ink-2); transition: background 0.2s, border-color 0.2s, color 0.2s; }
html.v2 .tools-nav a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.26); }
html.v2 .tools-nav a[aria-current="page"] { color: #fff; border-color: rgba(255, 255, 255, 0.12); background: linear-gradient(180deg, #a8263d, #8a1b2c); box-shadow: 0 8px 22px -10px rgba(138, 27, 44, 0.95); }

/* ---------- Titres de page ---------- */
html.v2 .head { position: relative; isolation: isolate; padding-block: clamp(36px, 6vw, 72px) 0; }
/* Quadrillage discret derrière le titre, fondu sur les bords (comme l'appel final de l'accueil). */
html.v2 .head::before { content: ""; position: absolute; z-index: -1; inset: -90px calc(-1 * var(--gutter)) -30px; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px); background-size: 56px 56px; background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(ellipse 55% 75% at 22% 45%, #000 15%, transparent 72%); mask-image: radial-gradient(ellipse 55% 75% at 22% 45%, #000 15%, transparent 72%); }
html.v2 .head h1 { font-size: clamp(2.8rem, 7.4vw, 5.2rem); line-height: 0.9; letter-spacing: 0.004em; text-wrap: balance; }
html.v2 .head .lead { color: var(--ink-2); }
html.v2 .eyebrow { letter-spacing: 0.14em; }

/* ---------- Composants ---------- */
html.v2 .card { border-radius: 16px; border: 1px solid var(--line); background: var(--glass); }
html.v2 .card h2 { letter-spacing: 0.01em; }
html.v2 .btn { position: relative; isolation: isolate; overflow: hidden; border-radius: 12px; transition: transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s, border-color 0.2s; }
html.v2 .btn-primary { color: #fff; background: linear-gradient(180deg, #a8263d, #8a1b2c); border-color: rgba(255, 255, 255, 0.12); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 12px 32px -12px rgba(138, 27, 44, 0.95); }
html.v2 .btn-primary:hover { color: #fff; transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 18px 40px -12px rgba(168, 38, 61, 1); }
html.v2 .btn-primary::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.22) 50%, transparent 65%); transform: translateX(-120%); transition: transform 0.75s ease; }
html.v2 .btn-primary:hover::after { transform: translateX(120%); }
html.v2 .btn-primary[disabled], html.v2 .btn-primary[aria-disabled="true"] { transform: none; }
html.v2 .btn-ghost { color: var(--ink); background: rgba(255, 255, 255, 0.04); border-color: var(--line-2); }
html.v2 .btn-ghost:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.28); }
html.v2 .chip { border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); color: var(--ink-2); transition: background 0.2s, border-color 0.2s, color 0.2s; }
html.v2 .chip:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.26); }
html.v2 .chip[aria-pressed="true"] { color: #fff; border-color: rgba(255, 255, 255, 0.12); background: linear-gradient(180deg, #a8263d, #8a1b2c); }

/* Encart d'appel en bas des pages hub (« Rejoindre la bêta », « Suivre sur X ») : halo bordeaux + quadrillage,
   comme l'appel final de l'accueil, en plus discret. */
html.v2 .card.tip { position: relative; isolation: isolate; overflow: hidden; margin-top: clamp(28px, 4vw, 44px); padding: clamp(20px, 3vw, 32px); border-color: rgba(231, 161, 171, 0.2);
  background: radial-gradient(520px 220px at 100% 0%, rgba(231, 161, 171, 0.12), transparent 65%), radial-gradient(760px 320px at 0% 140%, rgba(138, 27, 44, 0.5), transparent 70%), #151515;
  box-shadow: 0 30px 70px -44px rgba(138, 27, 44, 0.9); }
html.v2 .card.tip::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px); background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 60% 90% at 85% 30%, #000 10%, transparent 70%); mask-image: radial-gradient(ellipse 60% 90% at 85% 30%, #000 10%, transparent 70%); }
html.v2 .card.tip .eyebrow { color: var(--rose); }
html.v2 .card.tip p:not(.eyebrow) { color: var(--ink-2); font-size: 0.98rem; line-height: 1.6; }

/* Champs : fond sombre, bordure discrète, anneau rose au focus. */
html.v2 input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]), html.v2 select, html.v2 textarea {
  color: var(--ink); background-color: rgba(0, 0, 0, 0.32); border: 1px solid var(--line-2); border-radius: 10px; transition: border-color 0.2s, box-shadow 0.2s; }
html.v2 input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):focus, html.v2 select:focus, html.v2 textarea:focus { outline: none; border-color: rgba(231, 161, 171, 0.6); box-shadow: 0 0 0 4px rgba(231, 161, 171, 0.12); }
html.v2 select option { background: #1b1b1b; color: var(--ink); }
html.v2 input[type="checkbox"], html.v2 input[type="radio"] { accent-color: var(--wine-hi); }

/* ---------- Compte (bouton et panneau injectés par account.js, sur toutes les pages) ---------- */
html.v2 .acct-btn { height: 38px; border-color: var(--line-2); background: rgba(255, 255, 255, 0.04); transition: background 0.2s, border-color 0.2s; }
html.v2 .acct-btn:hover { background: rgba(255, 255, 255, 0.08); }
html.v2 .acct-btn.in { width: 38px; }
html.v2 .acct-btn .acct-dot { border-color: #141414; }
html.v2 .acct-pan { padding: 18px; gap: 11px; background: rgba(20, 20, 20, 0.96); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
html.v2 .acct-go { padding: 12px 14px; border-radius: 12px; background: linear-gradient(180deg, #a8263d, #8a1b2c); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 10px 26px -12px rgba(138, 27, 44, 0.95); }
html.v2 .acct-go:hover { background: linear-gradient(180deg, #b52c45, #94203a); }
html.v2 .acct-go.danger { background: #5c1624; box-shadow: none; }
html.v2 .acct-go.danger:hover { background: #7a1c2f; }
html.v2 .acct-item { border-radius: 10px; }
html.v2 .acct-item.out { border-radius: 0; }

/* ---------- Bas de page ---------- */
html.v2 .disclaimer { border-top: 1px solid var(--line); }
html.v2 .foot { margin-top: 40px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 70%); border-top: 1px solid var(--line); }
html.v2 .foot .wrap { padding-block: 34px 28px; }
html.v2 .foot nav a { padding: 4px 0; }
html.v2 .foot .copy { padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- Pages légales (<body class="legal"> : mentions légales, CGU, confidentialité, FR et EN) ----------
   Texte long : même colonne de lecture (780 px), en-tête flottant, titre plus grand, encadré et sections aérés. */
html.v2 body.legal { border-left-width: 3px; }
html.v2 .legal > header { position: sticky; top: 0; z-index: 40; padding: 10px 10px 0; border-bottom: 0; }
html.v2 .legal > header .wrap { min-height: 56px; padding: 6px 8px 6px 16px; gap: 10px; border-radius: 16px; background: rgba(18, 18, 18, 0.86); border: 1px solid var(--line); -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%); box-shadow: 0 16px 40px -22px rgba(0, 0, 0, 0.85); }
html.v2 .legal .alt { padding: 9px 11px; border-radius: 10px; border-color: var(--line-2); background: rgba(255, 255, 255, 0.04); color: var(--ink-2); transition: background 0.2s, color 0.2s; }
html.v2 .legal .alt:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
html.v2 .legal .back { padding: 9px 13px; border-radius: 10px; color: var(--ink); background: rgba(138, 27, 44, 0.3); box-shadow: inset 0 0 0 1px rgba(231, 161, 171, 0.25); transition: background 0.2s; }
html.v2 .legal .back:hover { background: rgba(138, 27, 44, 0.5); }
html.v2 .legal main { position: relative; isolation: isolate; padding: clamp(40px, 7vw, 84px) 0 80px; }
/* Quadrillage discret derrière le titre (comme les autres pages). */
html.v2 .legal main::before { content: ""; position: absolute; z-index: -1; left: 0; right: 0; top: -80px; height: 460px; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px); background-size: 56px 56px; background-position: center -1px;
  -webkit-mask-image: radial-gradient(ellipse 50% 60% at 50% 40%, #000 15%, transparent 72%); mask-image: radial-gradient(ellipse 50% 60% at 50% 40%, #000 15%, transparent 72%); }
html.v2 .legal h1 { font-size: clamp(2.6rem, 7vw, 4.4rem); line-height: 0.9; letter-spacing: 0.004em; text-wrap: balance; margin-bottom: 20px; }
/* Téléphone : « Politique de confidentialité » (mot long) débordait de 6 px à 390 px (15 novembre). */
@media (max-width: 440px) { html.v2 .legal h1 { font-size: 2.2rem; } }
html.v2 .legal .upd { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); color: var(--ink-2); margin-bottom: 36px; }
html.v2 .legal .upd::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--rose); }
html.v2 .legal .box { padding: 18px 20px; border-radius: 14px; border-color: rgba(231, 161, 171, 0.22); background: linear-gradient(180deg, rgba(138, 27, 44, 0.16), rgba(255, 255, 255, 0.02)); }
html.v2 .legal h2 { margin-top: 46px; padding-top: 22px; font-size: 1.22rem; letter-spacing: 0.005em; }
html.v2 .legal mark.fill { border-radius: 5px; }
html.v2 .legal > footer { padding: 28px 0 34px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 70%); }
html.v2 .legal > footer a:hover { color: var(--ink); }

/* ---------- Animations : rien avec « réduire les animations » ---------- */
@media (prefers-reduced-motion: reduce) {
  html.v2 .btn, html.v2 .btn-primary::after, html.v2 .hub-drawer, html.v2 body.hub-menu-open .hub-drawer, html.v2 .hub-drawer-bg { transition: none; }
}

/* Contenu dessiné par le script (journal : #view, threads : #grid) : tant qu'il est vide, ce qui le suit (avertissement,
   carte « Follow », pied de page) est masqué, puis apparaît directement à sa place. Sinon le premier affichage, avant le
   script, montrait ces blocs en haut de l'écran puis les poussait vers le bas : décalage de mise en page (CLS 0,3 à 0,5
   dans Lighthouse, audit du 12 novembre). Navigateur sans :has() : rien ne change. Threads sans aucun thread : #empty
   s'affiche et la règle ne s'applique plus. */
html.v2:has(#view:empty) .jr-local, html.v2:has(#view:empty) main .disclaimer, html.v2:has(#view:empty) .foot,
html.v2:has(#grid:empty):has(#empty[hidden]) .tip.follow, html.v2:has(#grid:empty):has(#empty[hidden]) main .disclaimer,
html.v2:has(#grid:empty):has(#empty[hidden]) .foot { display: none; }
