/*
 * Cartes transparentes à fond ASCII, avec un effet au passage de la souris.
 *
 * Plus aucun fond plein (blanc en thème clair) : le fond de la carte est transparent, bordé d'un
 * filet. Un motif de caractères ASCII très discret (`::before`, 7 % d'opacité) la remplit, blanc en
 * thème sombre et bleu profond en thème clair. Sous le pointeur, une seconde couche du même motif
 * s'allume dans un halo de 130 px (`::after`, positionné par ascii-cards.js avec `--mx` / `--my`)
 * et se décale par à-coups de 80 ms : le motif « glitche » là où passe la souris.
 *
 * Cartes concernées : expertises (accueil et « Souvent associé à »), cartes de la page Expertise,
 * cartes de projet hors Mur, articles.
 */
:root {
    --ascii-card-ink: #1d3fb8;
    --ascii-card-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='182' height='154'%3E%3Cg font-family='Menlo,Consolas,monospace' font-size='11' fill='black'%3E%3Ctext x='0' y='11' xml:space='preserve' textLength='182'%3E%23.$;@::$;/  ;/%23%23;=; $   $0%3C/text%3E%3Ctext x='0' y='25' xml:space='preserve' textLength='182'%3E%25/  ;&amp;  :&gt;0&amp;:   1  : :|   %3C/text%3E%3Ctext x='0' y='39' xml:space='preserve' textLength='182'%3E&lt; %25~.|/&amp;%25\   &gt;  /=/;|&gt;~   %3C/text%3E%3Ctext x='0' y='53' xml:space='preserve' textLength='182'%3E~  $&lt;&amp; : *.;*  - \  *  &amp;%230%3C/text%3E%3Ctext x='0' y='67' xml:space='preserve' textLength='182'%3E =- %23   ^  1 /@/   /  @+  %3C/text%3E%3Ctext x='0' y='81' xml:space='preserve' textLength='182'%3E-  1 /&amp;-~ ^^*   =^&lt;: %23;  ~%3C/text%3E%3Ctext x='0' y='95' xml:space='preserve' textLength='182'%3E  $+^%23- \@;$%231   @%23+    %23*%3C/text%3E%3Ctext x='0' y='109' xml:space='preserve' textLength='182'%3E @&amp; $-*$:~  \$ /   $ %25*0/-%3C/text%3E%3Ctext x='0' y='123' xml:space='preserve' textLength='182'%3E   ^ %23 *&amp;/&gt; &gt;01$+@ :/ \=%23 %3C/text%3E%3Ctext x='0' y='137' xml:space='preserve' textLength='182'%3E   $   . :+  /*0 \ /  =| -%3C/text%3E%3Ctext x='0' y='151' xml:space='preserve' textLength='182'%3E@ + +  &amp;%25^&amp;&lt; - ^1  ^ =&lt;  /%3C/text%3E%3C/g%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
    :root { --ascii-card-ink: #eef5ff; }
}

html body .home-expertise-card,
html body .expertise-stack-grid .project-card,
html body .project-card:not(.pw-tuile),
html body .articles-item {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: transparent !important;
    box-shadow: none !important;
    border: 1px solid var(--ui-card-line);
    transition: border-color .2s ease;
}

html body .home-expertise-card:hover,
html body .expertise-stack-grid .project-card:hover,
html body .project-card:not(.pw-tuile):hover,
html body .articles-item:hover {
    border-color: var(--ui-card-line-hover);
}

html body .home-expertise-card::before,
html body .expertise-stack-grid .project-card::before,
html body .project-card:not(.pw-tuile)::before,
html body .articles-item::before,
html body .home-expertise-card::after,
html body .expertise-stack-grid .project-card::after,
html body .project-card:not(.pw-tuile)::after,
html body .articles-item::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: var(--ascii-card-ink);
    -webkit-mask-image: var(--ascii-card-pattern);
            mask-image: var(--ascii-card-pattern);
    -webkit-mask-size: 182px 154px;
            mask-size: 182px 154px;
}

/* Motif au repos : à peine là. */
html body .home-expertise-card::before,
html body .expertise-stack-grid .project-card::before,
html body .project-card:not(.pw-tuile)::before,
html body .articles-item::before {
    opacity: .07;
}

/* Halo sous le pointeur : même motif, décalé par à-coups, visible seulement près de la souris. */
html body .home-expertise-card::after,
html body .expertise-stack-grid .project-card::after,
html body .project-card:not(.pw-tuile)::after,
html body .articles-item::after {
    opacity: 0;
    transition: opacity .2s ease;
    -webkit-mask-image: var(--ascii-card-pattern), radial-gradient(circle 130px at var(--mx, 50%) var(--my, 50%), #000 0, transparent 100%);
            mask-image: var(--ascii-card-pattern), radial-gradient(circle 130px at var(--mx, 50%) var(--my, 50%), #000 0, transparent 100%);
    -webkit-mask-composite: source-in;
            mask-composite: intersect;
}

html body .home-expertise-card:hover::after,
html body .expertise-stack-grid .project-card:hover::after,
html body .project-card:not(.pw-tuile):hover::after,
html body .articles-item:hover::after {
    opacity: .6;
    animation: ascii-card-glitch .32s steps(1, end) infinite;
}

@keyframes ascii-card-glitch {
    0%   { -webkit-mask-position: 0 0, 0 0; mask-position: 0 0, 0 0; }
    25%  { -webkit-mask-position: 14px 0, 0 0; mask-position: 14px 0, 0 0; }
    50%  { -webkit-mask-position: -9px 14px, 0 0; mask-position: -9px 14px, 0 0; }
    75%  { -webkit-mask-position: 5px -14px, 0 0; mask-position: 5px -14px, 0 0; }
}

@media (prefers-reduced-motion: reduce) {
    html body .home-expertise-card:hover::after,
    html body .expertise-stack-grid .project-card:hover::after,
    html body .project-card:not(.pw-tuile):hover::after,
    html body .articles-item:hover::after { animation: none; }
}

html[data-glitch='off'] body .home-expertise-card:hover::after,
html[data-glitch='off'] body .expertise-stack-grid .project-card:hover::after,
html[data-glitch='off'] body .project-card:not(.pw-tuile):hover::after,
html[data-glitch='off'] body .articles-item:hover::after { animation: none; }

/*
 * Hub /expertise : pas d'animation de fond au passage de la souris. Le motif ASCII reste
 * à peine visible au repos ; le halo qui suit le pointeur et le brouillage du logo sont retirés.
 */
html body .expertise-stack-grid .project-card:hover::after {
    opacity: 0;
    animation: none;
}

/*
 * Bandeau de contact (.hire-cta) : même langage que les autres cartes du site : fond transparent,
 * filet bleu, motif ASCII à peine visible, texte lisible ; un bouton plein (action principale) et des
 * boutons en contour (actions secondaires, définis dans site-ui.css), jamais de pastilles blanches.
 */
html body .hire-cta {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: transparent;
    border: 1px solid var(--ui-card-line);
    border-radius: 14px;
    box-shadow: none;
    transition: border-color .2s ease;
}

html body .hire-cta:hover {
    background: transparent;
    color: inherit;
    border-color: var(--ui-card-line-hover);
}

html body .hire-cta::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: var(--ascii-card-ink);
    -webkit-mask-image: var(--ascii-card-pattern);
            mask-image: var(--ascii-card-pattern);
    -webkit-mask-size: 182px 154px;
            mask-size: 182px 154px;
    opacity: .07;
}

html body .hire-cta .hire-cta__text {
    color: #dfe4ff;
    line-height: 1.6;
}
