/* =========================================================
   ABYSSIA — Mini-jeux
   Charte : #000000 · #bcbcbc · #553720 — secondaires #ffffff · #d01313
   Polices : Abhaya Libre (titres) · GFS Didot (cartels) · Arapey (texte)
   Principe : nuit chaude, vitrines éclairées par des sources chaudes.
   ========================================================= */

/* ---------- 1. Jetons ---------- */
:root {
    --noir:      #000000;
    --nuit:      #0b0908;
    --nuit-2:    #121010;
    --nuit-3:    #1b1715;

    --brun:      #553720;
    --brun-rgb:  85, 55, 32;
    --brun-c:    #7d5330;

    --os:        #bcbcbc;
    --os-rgb:    188, 188, 188;
    --os-c:      #e8e8e8;
    --os-f:      #8c8c8c;
    --blanc:     #ffffff;

    --rouge:     #d01313;
    --rouge-rgb: 208, 19, 19;

    --ambiance:     var(--brun-c);
    --ambiance-rgb: 125, 83, 48;
    --mur:          #140f0a;
    --mur-2:        #1e1710;

    --f-titre:  'Abhaya Libre', 'Times New Roman', serif;
    --f-cartel: 'GFS Didot', Georgia, serif;
    --f-texte:  'Arapey', Georgia, serif;
    --f-mono:   ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --large:  1180px;
    --texte:  680px;
    --entete: 72px;
    --r:      2px;
    --r-l:    4px;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--entete) + 16px);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--f-texte);
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--os-c);
    background: var(--nuit);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--ambiance); }

h1, h2, h3 {
    font-family: var(--f-titre);
    font-weight: 700;
    line-height: 1.12;
    color: var(--os-c);
    margin: 0 0 .5em;
}
p { margin: 0 0 1.15em; }
p:last-child, p.fin { margin-bottom: 0; }

code {
    font-family: var(--f-mono);
    font-size: .82em;
    color: var(--os);
    background: rgba(var(--os-rgb), .07);
    border: 1px solid rgba(var(--brun-rgb), .45);
    border-radius: var(--r);
    padding: .1em .38em;
}

::selection { background: var(--rouge); color: var(--blanc); }

:focus-visible {
    outline: 2px solid var(--blanc);
    outline-offset: 3px;
}

.saut {
    position: absolute; left: -9999px; top: 0; z-index: 9999;
    background: var(--os-c); color: var(--noir);
    padding: .7rem 1.1rem;
    font-family: var(--f-cartel); letter-spacing: .1em;
}
.saut:focus { left: 12px; top: 12px; }

.invisible {
    position: absolute; width: 1px; height: 1px; padding: 0;
    margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ---------- 3. Grain ---------- */
.grain {
    position: fixed; inset: 0; z-index: 900;
    pointer-events: none;
    opacity: .035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 4. Mise en page ---------- */
.large { width: 100%; max-width: var(--large); margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 2.5rem); }
.etroit { max-width: var(--texte); }

.bloc { padding: clamp(3rem, 7vw, 5rem) 0; position: relative; }
.bloc-mur { background: linear-gradient(180deg, var(--mur), var(--mur-2)); }
.bloc-nuit { background: var(--nuit); }

.cimaise { position: relative; }
.cimaise::before {
    content: '';
    position: absolute; inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--brun-rgb), .85) 20%, rgba(var(--brun-rgb), .85) 80%, transparent);
}

.sur-titre {
    display: block;
    font-family: var(--f-cartel);
    font-size: .82rem;
    letter-spacing: .34em;
    text-transform: uppercase;
    color: var(--ambiance);
    margin-bottom: .9rem;
}

/* ---------- 5. En-tête ---------- */
.entete {
    position: sticky; top: 0; z-index: 800;
    height: var(--entete);
    display: flex; align-items: center;
    background: rgba(11, 9, 8, .88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(var(--brun-rgb), .5);
}
.entete-int { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }

.marque { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.marque-sceau { width: 30px; height: 24px; fill: var(--os-c); flex: none; }
.marque-txt { display: flex; flex-direction: column; line-height: 1.1; }
.marque-nom {
    font-family: var(--f-titre); font-size: 1.15rem; font-weight: 700;
    letter-spacing: .18em; text-transform: uppercase; color: var(--os-c);
}
.marque-sous {
    font-family: var(--f-cartel); font-size: .66rem;
    letter-spacing: .26em; text-transform: uppercase; color: var(--os-f);
}
.marque:hover .marque-sceau, .marque:hover .marque-nom { fill: var(--blanc); color: var(--blanc); }

.menu { display: flex; gap: 1.5rem; }
.menu a {
    font-family: var(--f-cartel); font-size: .8rem;
    letter-spacing: .18em; text-transform: uppercase;
    color: var(--os-f); text-decoration: none;
    padding-bottom: 3px; border-bottom: 1px solid transparent;
    transition: color .2s, border-color .2s;
}
.menu a:hover { color: var(--os-c); }
.menu a[aria-current="page"] { color: var(--os-c); border-bottom-color: var(--ambiance); }

@media (max-width: 560px) { .menu a:not([aria-current]) { display: none; } }

/* ---------- 6. Hero ---------- */
.hero {
    padding: clamp(3.5rem, 9vw, 6.5rem) 0 clamp(2.5rem, 6vw, 4rem);
    background:
        radial-gradient(120% 80% at 50% -10%, rgba(var(--ambiance-rgb), .16), transparent 65%),
        var(--nuit);
}
.hero h1 {
    font-size: clamp(2.75rem, 8vw, 5rem);
    letter-spacing: .02em;
    margin-bottom: .35em;
}
.chapo {
    max-width: var(--texte);
    color: var(--os);
    font-size: clamp(1.05rem, 2.2vw, 1.24rem);
}
.compteur {
    font-family: var(--f-cartel);
    font-size: .8rem; letter-spacing: .22em; text-transform: uppercase;
    color: var(--os-f);
    margin: 1.4rem 0 0;
    min-height: 1.4em;
}

/* ---------- 7. Barre (recherche + tri) ---------- */
.barre {
    display: flex; flex-wrap: wrap; gap: 1rem;
    align-items: center; justify-content: space-between;
    margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
}
.champ { position: relative; flex: 1 1 260px; max-width: 380px; }
.champ-icone {
    position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
    width: 17px; height: 17px; pointer-events: none;
    fill: none; stroke: var(--os-f); stroke-width: 1.7; stroke-linecap: round;
}
.champ input {
    width: 100%;
    font-family: var(--f-texte); font-size: 1rem;
    color: var(--os-c);
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(var(--brun-rgb), .6);
    border-radius: var(--r-l);
    padding: .68rem .9rem .68rem 2.5rem;
    transition: border-color .2s, background .2s;
}
.champ input::placeholder { color: var(--os-f); opacity: .8; }
.champ input:focus {
    outline: none;
    border-color: var(--ambiance);
    background: rgba(0, 0, 0, .55);
}
.champ:focus-within .champ-icone { stroke: var(--ambiance); }
.champ input::-webkit-search-cancel-button { filter: invert(.7); }

.tri { display: flex; border: 1px solid rgba(var(--brun-rgb), .6); border-radius: var(--r-l); overflow: hidden; }
.tri-btn {
    font-family: var(--f-cartel); font-size: .74rem;
    letter-spacing: .18em; text-transform: uppercase;
    color: var(--os-f); background: transparent;
    border: 0; padding: .68rem 1.05rem; cursor: pointer;
    transition: color .2s, background .2s;
}
.tri-btn + .tri-btn { border-left: 1px solid rgba(var(--brun-rgb), .6); }
.tri-btn:hover { color: var(--os-c); }
.tri-btn.actif { color: var(--noir); background: var(--os); }

/* ---------- 8. Vitrines ---------- */
.vitrines {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
    gap: clamp(1.25rem, 2.5vw, 1.75rem);
}

.vitrine {
    position: relative;
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, var(--nuit-2), var(--nuit));
    border: 1px solid rgba(var(--brun-rgb), .55);
    border-radius: var(--r-l);
    overflow: hidden;
    text-decoration: none; color: inherit;
    transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.vitrine::after {
    content: '';
    position: absolute; inset: 0;
    border-radius: var(--r-l);
    box-shadow: inset 0 0 0 1px rgba(var(--os-rgb), .04);
    pointer-events: none;
}
.vitrine:hover, .vitrine:focus-visible {
    transform: translateY(-4px);
    border-color: rgba(var(--ambiance-rgb), .95);
    box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .95),
                0 0 0 1px rgba(var(--ambiance-rgb), .35);
}

.vitrine-cadre {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: linear-gradient(140deg, var(--nuit-3), var(--noir));
    border-bottom: 1px solid rgba(var(--brun-rgb), .5);
}
.vitrine-cadre img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .5s ease, filter .3s ease;
    filter: saturate(.85) contrast(1.03);
}
.vitrine:hover .vitrine-cadre img { transform: scale(1.045); filter: saturate(1) contrast(1.06); }

/* Vitrine sans image : sceau typographique */
.vitrine-sceau {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    background:
        radial-gradient(90% 90% at 50% 20%, rgba(var(--ambiance-rgb), .28), transparent 70%),
        linear-gradient(140deg, var(--nuit-3), var(--noir));
}
.vitrine-sceau span {
    font-family: var(--f-titre);
    font-size: clamp(2.6rem, 8vw, 3.4rem);
    font-weight: 800;
    letter-spacing: .1em;
    color: rgba(var(--os-rgb), .82);
    text-shadow: 0 2px 18px rgba(0, 0, 0, .8);
}
.vitrine-sceau::after {
    content: '';
    position: absolute; inset: 14px;
    border: 1px solid rgba(var(--os-rgb), .16);
    border-radius: var(--r);
}

.ruban {
    position: absolute; top: .8rem; left: .8rem; z-index: 2;
    font-family: var(--f-cartel); font-size: .64rem;
    letter-spacing: .2em; text-transform: uppercase;
    color: var(--blanc); background: var(--rouge);
    padding: .28rem .6rem;
    border-radius: var(--r);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .6);
}

.vitrine-corps {
    display: flex; flex-direction: column; flex: 1;
    padding: 1.15rem 1.25rem 1.35rem;
}
.vitrine-titre {
    font-family: var(--f-titre);
    font-size: 1.42rem; font-weight: 700; line-height: 1.18;
    color: var(--os-c);
    margin: 0 0 .45rem;
}
.vitrine:hover .vitrine-titre { color: var(--blanc); }
.vitrine-desc {
    font-size: .97rem; line-height: 1.6;
    color: var(--os-f);
    margin: 0 0 1rem;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
}
.vitrine-pied {
    display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
    margin-top: auto;
    padding-top: .9rem;
    border-top: 1px solid rgba(var(--brun-rgb), .4);
}
.etiquette {
    font-family: var(--f-cartel); font-size: .66rem;
    letter-spacing: .14em; text-transform: uppercase;
    color: var(--os-f);
    border: 1px solid rgba(var(--brun-rgb), .7);
    border-radius: 999px;
    padding: .18rem .58rem;
}
.vitrine-date {
    margin-left: auto;
    font-family: var(--f-cartel); font-size: .68rem;
    letter-spacing: .1em; color: var(--os-f);
    white-space: nowrap;
}
.vitrine-jouer {
    display: inline-flex; align-items: center; gap: .4rem;
    margin-top: .95rem;
    font-family: var(--f-cartel); font-size: .74rem;
    letter-spacing: .2em; text-transform: uppercase;
    color: var(--ambiance);
}
.vitrine-jouer svg { width: 13px; height: 13px; fill: currentColor; transition: transform .25s ease; }
.vitrine:hover .vitrine-jouer { color: var(--blanc); }
.vitrine:hover .vitrine-jouer svg { transform: translateX(4px); }

/* ---------- 9. États ---------- */
.etat {
    grid-column: 1 / -1;
    font-family: var(--f-cartel);
    letter-spacing: .16em; text-transform: uppercase;
    font-size: .82rem; color: var(--os-f);
    text-align: center;
    padding: clamp(2.5rem, 7vw, 4.5rem) 1rem;
    border: 1px dashed rgba(var(--brun-rgb), .6);
    border-radius: var(--r-l);
}
.etat-chargement { animation: respire 1.9s ease-in-out infinite; }
@keyframes respire { 0%, 100% { opacity: .45; } 50% { opacity: .95; } }
.etat-erreur { color: var(--rouge); border-color: rgba(var(--rouge-rgb), .5); }
.etat strong { display: block; font-family: var(--f-titre); font-size: 1.5rem; letter-spacing: 0; text-transform: none; color: var(--os-c); margin-bottom: .5rem; }
.etat code { text-transform: none; letter-spacing: 0; }

/* ---------- 10. Bloc de code ---------- */
.bloc-code {
    font-family: var(--f-mono);
    font-size: .84rem; line-height: 1.75;
    color: var(--os);
    background: rgba(0, 0, 0, .45);
    border: 1px solid rgba(var(--brun-rgb), .55);
    border-left: 2px solid var(--ambiance);
    border-radius: var(--r-l);
    padding: 1.1rem 1.25rem;
    margin: 0 0 1.15em;
    overflow-x: auto;
}
.bloc-code code { background: none; border: 0; padding: 0; font-size: inherit; }

/* ---------- 11. Pied ---------- */
.pied {
    border-top: 1px solid rgba(var(--brun-rgb), .5);
    background: var(--noir);
    padding: 2.25rem 0;
}
.pied-int {
    display: flex; flex-wrap: wrap; gap: .75rem 2rem;
    align-items: center; justify-content: space-between;
}
.pied p { margin: 0; }
.pied-marque {
    font-family: var(--f-cartel); font-size: .72rem;
    letter-spacing: .26em; text-transform: uppercase; color: var(--os-f);
}
.pied-liens a {
    font-family: var(--f-cartel); font-size: .78rem;
    letter-spacing: .12em; color: var(--os-f); text-decoration: none;
    border-bottom: 1px solid rgba(var(--brun-rgb), .8);
}
.pied-liens a:hover { color: var(--os-c); border-bottom-color: var(--os-c); }
