/* APYRE — feuille de style principale (nouveau design) */

:root {
    color-scheme: dark;
    --bg:        #070812;
    --bg-soft:   #0e1120;
    --bg-card:   #161a29;
    --border:    #242a3d;
    --text:      #e8ebf4;
    --muted:     #8b93ad;
    --brand:     #6c8cff;
    --brand-2:   #b06cff;
    --accent:    #35d6c3;
    --espace:    #6c8cff;
    --gaming:    #ff5c8a;
    --materiel:  #ffb347;
    --tech:      #35d6c3;
    --radius:    14px;
    --container: 1140px;
    /* Verre dépoli : surface translucide + contour lumineux réutilisables. */
    --glass:        rgba(22, 26, 41, .55);
    --glass-strong: rgba(22, 26, 41, .78);
    --glass-border: rgba(255, 255, 255, .08);
    --glass-blur:   14px;
    /* Surfaces thémables (basculent en mode clair). */
    --header-bg:          rgba(8, 10, 18, .72);
    --header-bg-scrolled: rgba(6, 8, 15, .9);
    --media-bg:      #0d1120;
    --placeholder:   #2b3350;
    --code-bg:       #0d1120;
    --code-inline-bg: rgba(255, 255, 255, .06);
    --grid-line:     rgba(255, 255, 255, .022);
    --neb-1: rgba(108, 140, 255, .20);
    --neb-2: rgba(176, 108, 255, .16);
    --neb-3: rgba(53, 214, 195, .12);
    /* Encre des chips : mélange rubrique/encre pour garder le contraste. */
    --chip-mix: 88%;
    --chip-ink: #ffffff;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- Mode clair ------------------------------------------------------------ */
/* Suivi de la préférence système… (mêmes valeurs que le bloc [data-theme] ci-dessous) */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
        --bg:      #f4f5fb;
        --bg-soft: #e9ecf6;
        --bg-card: #ffffff;
        --border:  #d8dcea;
        --text:    #1c2130;
        --muted:   #5c6478;
        --glass:        rgba(255, 255, 255, .66);
        --glass-strong: rgba(255, 255, 255, .88);
        --glass-border: rgba(23, 32, 64, .10);
        --header-bg:          rgba(248, 249, 253, .75);
        --header-bg-scrolled: rgba(244, 245, 251, .92);
        --media-bg:      #e4e8f3;
        --placeholder:   #b6bfd8;
        --code-bg:       #eef1f9;
        --code-inline-bg: rgba(23, 32, 64, .07);
        --grid-line:     rgba(23, 32, 64, .05);
        --neb-1: rgba(108, 140, 255, .14);
        --neb-2: rgba(176, 108, 255, .11);
        --neb-3: rgba(53, 214, 195, .10);
        --chip-mix: 62%;
        --chip-ink: #1c2130;
    }
}
/* …et choix explicite via le bouton de bascule (mémorisé en localStorage). */
:root[data-theme="light"] {
    color-scheme: light;
    --bg:      #f4f5fb;
    --bg-soft: #e9ecf6;
    --bg-card: #ffffff;
    --border:  #d8dcea;
    --text:    #1c2130;
    --muted:   #5c6478;
    --glass:        rgba(255, 255, 255, .66);
    --glass-strong: rgba(255, 255, 255, .88);
    --glass-border: rgba(23, 32, 64, .10);
    --header-bg:          rgba(248, 249, 253, .75);
    --header-bg-scrolled: rgba(244, 245, 251, .92);
    --media-bg:      #e4e8f3;
    --placeholder:   #b6bfd8;
    --code-bg:       #eef1f9;
    --code-inline-bg: rgba(23, 32, 64, .07);
    --grid-line:     rgba(23, 32, 64, .05);
    --neb-1: rgba(108, 140, 255, .14);
    --neb-2: rgba(176, 108, 255, .11);
    --neb-3: rgba(53, 214, 195, .10);
    --chip-mix: 62%;
    --chip-ink: #1c2130;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    /* Fondu des couleurs lors de la bascule clair / sombre. */
    transition: background-color .35s ease, color .35s ease;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow-x: hidden;
}

/* Fond « spatial » fixe : nébuleuses colorées + fine grille tech.
   Posé sur des pseudo-éléments pour ne rien coûter au DOM. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(38rem 26rem at 82% -6%, var(--neb-1), transparent 60%),
        radial-gradient(34rem 24rem at 8% 4%,   var(--neb-2), transparent 60%),
        radial-gradient(40rem 30rem at 50% 108%, var(--neb-3), transparent 60%);
    pointer-events: none;
}
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 75%);
    pointer-events: none;
}

a { color: inherit; text-decoration: none; }

.container {
    width: min(100% - 2.5rem, var(--container));
    margin-inline: auto;
}

.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* --- En-tête -------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--header-bg);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset,
                0 10px 30px -18px rgba(108, 140, 255, .5);
    transition: background .25s ease, box-shadow .25s ease;
}
/* État posé par le JS dès que la page défile : l'en-tête se densifie. */
.site-header.is-scrolled {
    background: var(--header-bg-scrolled);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset,
                0 14px 38px -18px rgba(108, 140, 255, .65);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 66px;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.2rem; }
.brand-mark {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 1.35rem;
    filter: drop-shadow(0 0 10px rgba(108, 140, 255, .55));
    animation: brand-pulse 4s ease-in-out infinite;
}
@keyframes brand-pulse {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(108, 140, 255, .45)); }
    50%      { filter: drop-shadow(0 0 16px rgba(176, 108, 255, .7)); }
}
.brand-name { letter-spacing: .06em; }

.main-nav { display: flex; gap: 1.25rem; margin-left: 1rem; font-weight: 500; }
.main-nav a { color: var(--muted); transition: color .15s; position: relative; padding-block: .2rem; }
/* Soulignement dégradé qui se déploie au survol / sur la rubrique active. */
.main-nav a::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .25s cubic-bezier(.2, .7, .2, 1);
}
.main-nav a:hover { color: var(--text); }
.main-nav a:hover::after,
.main-nav a[aria-current="true"]::after { transform: scaleX(1); }
.main-nav a[aria-current="true"] { color: var(--text); }

/* Badge « en direct sur Twitch » : pastille discrète, révélée par app.js
   uniquement quand un partenaire est en live (sinon rien n'est visible). */
.main-nav a.twitch-live {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    align-self: center;
    padding: .18rem .7rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 92, 138, .4);
    background: rgba(255, 92, 138, .1);
    color: var(--text);
    font-size: .82rem;
}
.main-nav a.twitch-live[hidden] { display: none; }
.main-nav a.twitch-live::after { content: none; }
.twitch-live-label {
    color: var(--gaming);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-size: .72rem;
}
.twitch-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gaming);
    box-shadow: 0 0 0 0 rgba(255, 92, 138, .55);
    animation: twitch-pulse 1.8s ease-out infinite;
}
@keyframes twitch-pulse {
    70%, 100% { box-shadow: 0 0 0 7px rgba(255, 92, 138, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .twitch-live-dot { animation: none; }
}

/* Bouton burger (mobile uniquement). */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 0 10px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform .25s ease, opacity .2s ease;
}
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Bascule clair / sombre. */
.theme-toggle {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.theme-toggle:hover {
    border-color: var(--brand);
    box-shadow: 0 0 18px -6px color-mix(in srgb, var(--brand) 80%, transparent);
}
.theme-toggle:active { transform: scale(.92); }
.theme-toggle span { display: block; animation: theme-pop .35s cubic-bezier(.2, .7, .2, 1); }
@keyframes theme-pop {
    from { transform: rotate(-90deg) scale(.4); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

.search { margin-left: auto; }
.search input {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    padding: .5rem 1rem;
    width: 200px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, width .25s ease;
}
.search input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent),
                0 0 20px -6px color-mix(in srgb, var(--brand) 60%, transparent);
    width: 240px;
}

/* --- Hero ----------------------------------------------------------------- */
.hero {
    padding: 5rem 0 3rem;
    background:
        radial-gradient(60rem 30rem at 70% -10%, rgba(108, 140, 255, .18), transparent 60%),
        radial-gradient(50rem 26rem at 15% 10%, rgba(176, 108, 255, .14), transparent 60%);
}
.eyebrow {
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: .78rem;
    color: var(--accent);
    margin: 0 0 1rem;
}
.hero-title { font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.05; margin: 0 0 1rem; font-weight: 800; }
.grad {
    background: linear-gradient(120deg, var(--brand), var(--brand-2), var(--accent), var(--brand));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: grad-shift 9s ease-in-out infinite;
}
@keyframes grad-shift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}
.hero-lead { font-size: 1.2rem; color: var(--muted); max-width: 40ch; margin: 0 0 2rem; }

.status-card {
    display: inline-block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}
.status-card .ok   { color: var(--accent); margin: 0; }
.status-card .warn { color: var(--materiel); margin: 0; }
.status-card code  { background: var(--code-inline-bg); padding: .1rem .4rem; border-radius: 6px; }

/* --- Grille rubriques ----------------------------------------------------- */
.sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
    padding-block: 3rem;
}
.topic-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: transform .18s, border-color .18s;
    position: relative;
    overflow: hidden;
}
.topic-card::before {
    content: "";
    position: absolute; inset: 0 auto 0 0;
    width: 4px;
}
.topic-card::before          { background: var(--chip, var(--brand)); }
.topic-card:hover { transform: translateY(-3px); border-color: var(--brand); }
.topic-card h2 { margin: 0 0 .4rem; font-size: 1.25rem; }
.topic-card p  { margin: 0; color: var(--muted); font-size: .95rem; }

/* --- Pied de page --------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
    margin-top: 4rem;
    padding: 2.5rem 0;
}
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: space-between;
}
.footer-nav { display: flex; gap: 1.25rem; }
.footer-nav a { color: var(--muted); }
.footer-nav a:hover { color: var(--text); }

/* --- Container étroit (lecture d'article) --------------------------------- */
.container--narrow { width: min(100% - 2.5rem, 760px); margin-inline: auto; }

/* --- Chip (étiquette rubrique) -------------------------------------------- */
.chip {
    display: inline-block;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: .28rem .6rem;
    border-radius: 999px;
    color: color-mix(in srgb, var(--chip, var(--brand)) var(--chip-mix, 88%), var(--chip-ink, #fff));
    background: color-mix(in srgb, var(--chip, var(--brand)) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--chip, var(--brand)) 40%, transparent);
    box-shadow: 0 0 14px -4px color-mix(in srgb, var(--chip, var(--brand)) 70%, transparent);
    transition: box-shadow .2s ease, transform .2s ease;
}
a.chip:hover { transform: translateY(-1px); box-shadow: 0 0 18px -2px color-mix(in srgb, var(--chip, var(--brand)) 85%, transparent); }

/* Plusieurs rubriques sur une page article. */
.post-cats { display: flex; flex-wrap: wrap; gap: .4rem; }

/* --- En-tête de section --------------------------------------------------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 2.5rem 0 1.25rem; }
.section-head h2 { font-size: 1.4rem; margin: 0; position: relative; padding-left: .9rem; }
.section-head h2::before {
    content: ""; position: absolute; left: 0; top: .1em; bottom: .1em; width: 4px;
    border-radius: 3px; background: linear-gradient(var(--brand), var(--brand-2));
}

/* --- Article à la une ----------------------------------------------------- */
.featured { padding-top: 2.5rem; }
.featured-card {
    position: relative;
    display: grid; grid-template-columns: 1.1fr 1fr; gap: 0;
    background: var(--glass); border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--radius); overflow: hidden;
    transition: border-color .22s ease, box-shadow .22s ease;
    box-shadow: 0 24px 60px -34px rgba(108, 140, 255, .55);
}
.featured-card:hover {
    border-color: color-mix(in srgb, var(--brand) 55%, transparent);
    box-shadow: 0 28px 70px -30px rgba(108, 140, 255, .7);
}
/* Liseré lumineux qui tourne autour de la carte (fallback : liseré statique). */
@property --ang { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
.featured-card::after {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(from var(--ang, 0deg),
        transparent 0turn, transparent .62turn,
        color-mix(in srgb, var(--brand) 85%, transparent) .78turn,
        color-mix(in srgb, var(--brand-2) 85%, transparent) .88turn,
        transparent .98turn);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    animation: border-spin 7s linear infinite;
    pointer-events: none;
}
@keyframes border-spin { to { --ang: 360deg; } }
.featured-media { min-height: 320px; background: var(--media-bg); overflow: hidden; }
.featured-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.featured-card:hover .featured-media img { transform: scale(1.045); }
.featured-body { padding: 2rem; align-self: center; }
.featured-title { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: .8rem 0 .6rem; line-height: 1.15; }
.featured-excerpt { color: var(--muted); margin: 0 0 1rem; }

/* --- Grille de cartes ----------------------------------------------------- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
/* Le wrapper .reveal (animation) ne doit pas casser la hauteur des cartes. */
.cards-grid > .reveal { display: flex; }
.cards-grid > .reveal > .card { flex: 1; }
.card {
    position: relative;
    background: var(--glass); border: 1px solid var(--glass-border);
    border-radius: var(--radius); overflow: hidden;
    backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
    display: flex; flex-direction: column;
    transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
    will-change: transform;
}
.card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--chip, var(--brand)) 55%, transparent);
    box-shadow: 0 18px 40px -22px color-mix(in srgb, var(--chip, var(--brand)) 85%, transparent),
                0 0 0 1px color-mix(in srgb, var(--chip, var(--brand)) 22%, transparent) inset;
}
/* Halo qui suit le curseur (coordonnées --mx / --my posées par le JS). */
.card::after,
.lead-card::after,
.post-row::after {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%),
        color-mix(in srgb, var(--chip, var(--brand)) 14%, transparent), transparent 65%);
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}
.card:hover::after,
.lead-card:hover::after,
.post-row:hover::after { opacity: 1; }
.card-media { display: block; aspect-ratio: 16 / 9; background: var(--media-bg); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.card:hover .card-media img { transform: scale(1.05); }
.card-media--placeholder { display: grid; place-items: center; height: 100%; font-size: 2rem; color: var(--placeholder); }
.card-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .55rem; }
.card-title { font-size: 1.12rem; line-height: 1.3; margin: 0; }
.card-title a:hover { color: var(--brand); }
.card-excerpt { color: var(--muted); font-size: .92rem; margin: 0; }
.card-meta { color: var(--muted); font-size: .82rem; margin: 0; margin-top: auto; }

/* --- Section « magazine » par rubrique (accueil) -------------------------- */
.home-section { margin-top: 3rem; }
.home-section .section-head h2::before { background: linear-gradient(var(--chip, var(--brand)), color-mix(in srgb, var(--chip, var(--brand)) 40%, var(--brand-2))); }
.home-section .section-head h2 a:hover { color: var(--chip, var(--brand)); }
.section-more {
    font-size: .86rem; font-weight: 600; color: var(--chip, var(--brand));
    white-space: nowrap; transition: gap .2s ease;
    display: inline-flex; align-items: center; gap: .35rem;
}
.section-more:hover span { transform: translateX(3px); }
.section-more span { transition: transform .2s ease; display: inline-block; }

.section-split { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1.5rem; align-items: stretch; }

.lead-card {
    position: relative;
    display: flex; flex-direction: column;
    background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius);
    overflow: hidden; backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
    transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.lead-card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--chip, var(--brand)) 55%, transparent);
    box-shadow: 0 22px 50px -26px color-mix(in srgb, var(--chip, var(--brand)) 85%, transparent);
}
.lead-media { display: block; aspect-ratio: 16 / 9; background: var(--media-bg); overflow: hidden; }
.lead-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.lead-card:hover .lead-media img { transform: scale(1.04); }
.lead-body { padding: 1.2rem 1.35rem 1.4rem; display: flex; flex-direction: column; gap: .6rem; }
.lead-title { font-size: 1.35rem; line-height: 1.25; font-weight: 700; }
.lead-card:hover .lead-title { color: var(--chip, var(--brand)); }
.lead-excerpt { color: var(--muted); font-size: .95rem; }

.section-side { display: flex; flex-direction: column; gap: .75rem; }
.post-row {
    position: relative; overflow: hidden;
    display: flex; gap: .9rem; align-items: center; padding: .6rem;
    background: var(--glass); border: 1px solid var(--glass-border); border-radius: 12px;
    backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; flex: 1;
}
.post-row:hover {
    transform: translateX(3px);
    border-color: color-mix(in srgb, var(--chip, var(--brand)) 50%, transparent);
    box-shadow: 0 10px 26px -18px color-mix(in srgb, var(--chip, var(--brand)) 85%, transparent);
}
.post-row-media {
    flex: 0 0 84px; height: 60px; border-radius: 8px; overflow: hidden;
    background: var(--media-bg); display: block;
}
.post-row-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-row-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.post-row-title {
    font-weight: 600; font-size: .96rem; line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-row:hover .post-row-title { color: var(--chip, var(--brand)); }
.post-row-meta { color: var(--muted); font-size: .78rem; }

/* --- En-tête de page (rubrique / recherche) ------------------------------- */
.page-head {
    position: relative;
    overflow: hidden;
    padding: 3rem 0 1.5rem;
    background: radial-gradient(50rem 22rem at 20% -20%, color-mix(in srgb, var(--chip, var(--brand)) 18%, transparent), transparent 60%);
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}
/* Aurore de la rubrique : voile coloré qui dérive lentement. */
.page-head::before {
    content: "";
    position: absolute; inset: -40% -20%;
    background:
        radial-gradient(30rem 16rem at 75% 20%, color-mix(in srgb, var(--chip, var(--brand)) 14%, transparent), transparent 60%),
        radial-gradient(24rem 14rem at 35% 80%, color-mix(in srgb, var(--chip, var(--brand)) 8%, transparent), transparent 60%);
    animation: nebula-drift 26s ease-in-out infinite alternate;
    pointer-events: none;
}
.page-head > .container { position: relative; }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: .3rem 0; }
.page-head-desc { color: var(--muted); max-width: 60ch; }
.subnav { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }

/* Entrée en cascade des en-têtes de page (rubrique, recherche, article). */
.page-head .eyebrow, .page-head h1, .page-head-desc, .page-head .subnav, .page-head .search--page,
.post-head .breadcrumb, .post-head .post-cats, .post-head .post-title, .post-head .post-lead, .post-head .post-byline {
    animation: rise-in .55s cubic-bezier(.2, .7, .2, 1) backwards;
}
.page-head h1, .post-head .post-cats { animation-delay: .07s; }
.page-head-desc, .page-head .search--page, .post-head .post-title { animation-delay: .14s; }
.page-head .subnav, .post-head .post-lead { animation-delay: .21s; }
.post-head .post-byline { animation-delay: .28s; }
@keyframes rise-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* --- Article -------------------------------------------------------------- */
.post-head { padding: 3rem 0 1.5rem; }
.post-title { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; margin: .8rem 0 .8rem; }
.post-lead { font-size: 1.2rem; color: var(--muted); }
.post-byline { color: var(--muted); font-size: .9rem; }
.post-hero { margin: 1rem auto 2rem; }
.post-hero img { width: 100%; height: auto; border-radius: var(--radius); display: block; }
.post-content { font-size: 1.08rem; line-height: 1.8; }
.post-content > * { margin: 0 0 1.3rem; }
.post-content h2 { font-size: 1.6rem; margin-top: 2.2rem; }
.post-content h3 { font-size: 1.3rem; margin-top: 1.8rem; }
.post-content a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.post-content img { max-width: 100%; height: auto; border-radius: 10px; }
.post-content figure { margin: 1.6rem 0; }
.post-content figcaption { font-size: .85rem; color: var(--muted); text-align: center; margin-top: .5rem; }
.post-content blockquote {
    border-left: 3px solid var(--brand); margin: 1.6rem 0; padding: .4rem 0 .4rem 1.2rem; color: var(--text);
}
.post-content pre {
    background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px;
    padding: 1rem; overflow-x: auto; font-size: .9rem;
}
.embed-ratio { position: relative; padding-top: 56.25%; }
.embed-ratio iframe { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 10px; }
.table-wrap { overflow-x: auto; }
.block-table { width: 100%; border-collapse: collapse; }
.block-table th, .block-table td { border: 1px solid var(--border); padding: .6rem .8rem; text-align: left; }
.related { margin-top: 3rem; }

/* --- Galerie -------------------------------------------------------------- */
.block-gallery { margin: 1.8rem 0; }
.gallery-grid { display: grid; gap: .5rem; grid-template-columns: repeat(2, 1fr); }
.gallery-grid[data-count="1"] { grid-template-columns: 1fr; }
@media (min-width: 641px) {
    .gallery-grid { grid-template-columns: repeat(3, 1fr); } /* 3, 5, 6, 7… */
    .gallery-grid[data-count="1"] { grid-template-columns: 1fr; }
    .gallery-grid[data-count="2"], .gallery-grid[data-count="4"] { grid-template-columns: repeat(2, 1fr); } /* 4 → 2×2 */
    /* Nombre de colonnes explicite (repris de WordPress) — prioritaire sur data-count. */
    .gallery-grid[data-columns="2"] { grid-template-columns: repeat(2, 1fr); }
    .gallery-grid[data-columns="3"] { grid-template-columns: repeat(3, 1fr); }
    .gallery-grid[data-columns="4"] { grid-template-columns: repeat(4, 1fr); }
    .gallery-grid[data-columns="5"] { grid-template-columns: repeat(5, 1fr); }
    .gallery-grid[data-columns="6"] { grid-template-columns: repeat(6, 1fr); }
}
.gallery-item {
    display: block; overflow: hidden; border-radius: 10px; aspect-ratio: 1 / 1;
    background: var(--bg-soft); cursor: zoom-in;
}
.gallery-item img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    margin: 0; border-radius: 0; transition: transform .3s ease;
}
.gallery-item:hover img { transform: scale(1.04); }
.block-gallery figcaption { font-size: .85rem; color: var(--muted); text-align: center; margin-top: .6rem; }
.post-content .block-image img { cursor: zoom-in; }

/* --- Carte de lien interne (bookmark card, façon Ghost) ------------------- */
.block-bookmark { margin: 1.8rem 0; }
.post-content .bookmark-card,
.bookmark-card {
    display: flex; align-items: stretch; justify-content: space-between;
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
    background: var(--bg-soft); color: var(--text); text-decoration: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.bookmark-card:hover {
    border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
    box-shadow: 0 6px 24px color-mix(in srgb, var(--brand) 12%, transparent);
}
.bookmark-body {
    flex: 1; min-width: 0; padding: 1rem 1.2rem;
    display: flex; flex-direction: column; gap: .35rem;
}
.bookmark-title { font-weight: 600; line-height: 1.3; }
.bookmark-desc {
    font-size: .9rem; color: var(--muted); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bookmark-meta {
    margin-top: auto; padding-top: .45rem;
    display: flex; align-items: center; gap: .5rem;
    font-size: .8rem; color: var(--muted);
}
.post-content .bookmark-icon,
.bookmark-icon { width: 18px; height: 18px; border-radius: 4px; margin: 0; }
.bookmark-thumb { flex: 0 0 30%; max-width: 15rem; }
.post-content .bookmark-thumb img,
.bookmark-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    margin: 0; border-radius: 0; cursor: pointer;
}
@media (max-width: 560px) {
    .bookmark-thumb { display: none; }
}

/* --- Lightbox (galeries + images d'article) ------------------------------- */
.apyre-lb {
    position: fixed; inset: 0; z-index: 2000; display: none;
    align-items: center; justify-content: center; padding: 2rem;
    background: rgba(3, 4, 10, .93);
}
.apyre-lb.is-open { display: flex; }
.apyre-lb-fig { margin: 0; display: flex; flex-direction: column; align-items: center; gap: .8rem; max-width: 94vw; }
.apyre-lb-fig img { max-width: 94vw; max-height: 80vh; object-fit: contain; border-radius: 8px; box-shadow: 0 24px 70px rgba(0, 0, 0, .6); }
.apyre-lb-fig figcaption { color: var(--text); font-size: .95rem; text-align: center; margin: 0; }
.apyre-lb button {
    position: absolute; display: flex; align-items: center; justify-content: center;
    color: #fff; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px; cursor: pointer; transition: background .15s;
}
.apyre-lb button:hover { background: rgba(255, 255, 255, .22); }
.apyre-lb-close { top: 1rem; right: 1rem; width: 44px; height: 44px; font-size: 1.15rem; }
.apyre-lb-prev, .apyre-lb-next { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; font-size: 1.9rem; line-height: 1; }
.apyre-lb-prev { left: 1rem; }
.apyre-lb-next { right: 1rem; }
@media (max-width: 640px) {
    .apyre-lb { padding: 1rem; }
    .apyre-lb-prev, .apyre-lb-next { width: 40px; height: 40px; font-size: 1.5rem; }
    .apyre-lb-close { width: 38px; height: 38px; }
}

/* --- Pagination ----------------------------------------------------------- */
.pagination { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: 3rem 0 1rem; }
.page-link {
    padding: .5rem .9rem; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--muted);
    transition: color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.page-link:hover {
    color: var(--text); border-color: var(--brand);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--brand) 80%, transparent);
}
.page-link.is-current {
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    color: #fff; border-color: transparent;
    box-shadow: 0 8px 22px -10px color-mix(in srgb, var(--brand) 85%, transparent);
}
.page-gap { padding: .5rem .3rem; color: var(--muted); }

/* --- Recherche (page) ----------------------------------------------------- */
.search--page { display: flex; gap: .6rem; max-width: 560px; margin: 1rem 0; }
.search--page input { flex: 1; width: auto; }
.search--page button {
    padding: .5rem 1.2rem; border-radius: 999px; border: none; cursor: pointer;
    background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 600;
}

/* --- Divers --------------------------------------------------------------- */
.empty { color: var(--muted); padding: 2rem 0; }
.error-page { text-align: center; padding: 5rem 0; }
.error-code {
    font-size: clamp(5rem, 16vw, 8rem); font-weight: 800; margin: 0; line-height: 1;
    background: linear-gradient(120deg, var(--brand), var(--brand-2), var(--accent), var(--brand));
    background-size: 300% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: grad-shift 6s ease-in-out infinite, float-soft 5s ease-in-out infinite;
    display: inline-block;
}
@keyframes float-soft {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}
.btn {
    display: inline-block; margin-top: 1.5rem; padding: .7rem 1.4rem; border-radius: 999px;
    background: var(--bg-card); border: 1px solid var(--border);
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.btn:hover {
    border-color: var(--brand);
    transform: translateY(-2px);
    box-shadow: 0 12px 30px -16px color-mix(in srgb, var(--brand) 80%, transparent);
}

/* --- Fil d'Ariane --------------------------------------------------------- */
.breadcrumb { margin: 0 0 1rem; font-size: .85rem; color: var(--muted); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0; padding: 0; }
.breadcrumb li { display: flex; align-items: center; gap: .35rem; }
.breadcrumb li + li::before { content: "›"; color: var(--border); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb [aria-current="page"] { color: var(--text); }

/* --- Légende de l'image à la une ------------------------------------------ */
.post-hero figcaption { margin-top: .5rem; font-size: .82rem; color: var(--muted); text-align: center; }

/* --- Étiquettes (tags) ---------------------------------------------------- */
.post-tags { margin: 2rem auto; }
.tag-list { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 1.2rem 0 0; border-top: 1px solid var(--border); }
.tag { font-size: .8rem; color: var(--muted); padding: .3rem .7rem; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-soft); }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 860px) {
    .featured-card { grid-template-columns: 1fr; }
    .featured-media { min-height: 220px; }
    .section-split { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .nav-toggle { display: flex; }
    /* La nav devient un panneau en verre qui se déplie sous l'en-tête. */
    .main-nav {
        position: absolute;
        top: 100%; left: 0; right: 0;
        flex-direction: column;
        gap: 0;
        margin: 0;
        padding: .5rem 1.25rem 1rem;
        background: var(--header-bg-scrolled);
        backdrop-filter: blur(18px) saturate(140%);
        -webkit-backdrop-filter: blur(18px) saturate(140%);
        border-bottom: 1px solid var(--glass-border);
        box-shadow: 0 24px 50px -24px rgba(0, 0, 0, .8);
        opacity: 0;
        transform: translateY(-8px);
        visibility: hidden;
        transition: opacity .25s ease, transform .25s cubic-bezier(.2, .7, .2, 1), visibility 0s .25s;
    }
    .nav-open .main-nav {
        opacity: 1;
        transform: none;
        visibility: visible;
        transition: opacity .25s ease, transform .25s cubic-bezier(.2, .7, .2, 1);
    }
    .main-nav a { padding: .7rem 0; border-bottom: 1px solid rgba(255, 255, 255, .05); font-size: 1.05rem; }
    .main-nav a:last-child { border-bottom: 0; }
    /* Dans le panneau mobile, le badge live redevient une pastille compacte. */
    .main-nav a.twitch-live { align-self: flex-start; margin-top: .7rem; padding: .3rem .8rem; border-bottom: 0; font-size: .9rem; }
    .main-nav a::after { bottom: .35rem; right: auto; width: 2.2rem; }
    .search input { width: 140px; }
    .search input:focus { width: 160px; }
}

/* --- Animations légères --------------------------------------------------- */
/* Dérive très lente des nébuleuses du fond. */
body::before { animation: nebula-drift 34s ease-in-out infinite alternate; }
@keyframes nebula-drift {
    from { transform: translate3d(-1.5%, -1%, 0) scale(1.02); }
    to   { transform: translate3d(1.5%, 1.5%, 0) scale(1.06); }
}

/* Révélation au scroll : n'agit QUE si le JS a posé .reveal-ready
   (sinon le contenu reste visible pour les navigateurs sans JS). */
.reveal-ready .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1);
}
.reveal-ready .reveal.is-visible { opacity: 1; transform: none; }

/* --- Transitions entre pages (View Transitions, navigation MPA) ----------- */
/* Fondu doux entre deux pages sur les navigateurs qui le supportent. */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(root) { animation: vt-out .16s ease both; }
    ::view-transition-new(root) { animation: vt-in .28s cubic-bezier(.2, .7, .2, 1) both; }
}
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* --- Barre de progression de lecture (article) ----------------------------- */
/* Injectée par le JS sur les pages article ; pilotée par le défilement en CSS
   pur quand le navigateur le permet, sinon par le JS. */
.reading-progress {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 3px;
    z-index: 60;
    background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--accent));
    transform: scaleX(0);
    transform-origin: 0 50%;
    pointer-events: none;
}
@supports (animation-timeline: scroll()) {
    .reading-progress {
        animation: progress-grow linear both;
        animation-timeline: scroll(root);
    }
}
@keyframes progress-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* --- Bouton « retour en haut » --------------------------------------------- */
.to-top {
    position: fixed;
    right: 1.25rem; bottom: 1.25rem;
    z-index: 55;
    width: 46px; height: 46px;
    display: grid; place-items: center;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: var(--glass-strong);
    backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    visibility: hidden;
    transition: opacity .25s ease, transform .25s ease, border-color .2s ease, box-shadow .2s ease, visibility 0s .25s;
}
.to-top.is-visible {
    opacity: 1; transform: none; visibility: visible;
    transition: opacity .25s ease, transform .25s ease, border-color .2s ease, box-shadow .2s ease;
}
.to-top:hover {
    border-color: var(--brand);
    box-shadow: 0 10px 30px -14px color-mix(in srgb, var(--brand) 85%, transparent);
}

/* --- Lien d'évitement (accessibilité clavier) ------------------------------ */
.skip-link {
    position: absolute;
    left: 1rem; top: -3rem;
    z-index: 100;
    padding: .55rem 1rem;
    border-radius: 0 0 10px 10px;
    background: var(--brand);
    color: #fff; font-weight: 600;
    transition: top .2s ease;
}
.skip-link:focus { top: 0; }

/* Respect des préférences d'accessibilité : on coupe tout mouvement. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
    .reveal-ready .reveal { opacity: 1 !important; transform: none !important; }
}
