/* ================= En-tête ================= */
.site-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 50;
    background: var(--ink);
    transition: translate var(--dur) var(--ease-out);
}

/* Même code que la barre de la visionneuse : filet tendu qui s'estompe + éclat central */
.site-header::after {
    content: '';
    position: absolute;
    right: var(--gutter);
    bottom: 0;
    left: var(--gutter);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--grey) 12%, var(--grey) 88%, transparent);
}

.site-header::before {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 50%;
    z-index: 1;
    width: 13px;
    height: 19px;
    translate: -50% 0;
    background: var(--paper);
    -webkit-mask: var(--star) center / contain no-repeat;
    mask: var(--star) center / contain no-repeat;
}

/* Cachée en haut de page, la barre glisse quand on descend (sans JS : toujours visible) */
html.js .site-header:not(.is-visible) {
    translate: 0 -110%;
}

/* Focus clavier dans la barre : elle apparaît tout de suite, sans glisser */
.site-header:has(:focus-visible) {
    translate: 0 0;
    transition: none;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: var(--header-h);
    padding: 0 var(--gutter);
}

.nav-logo {
    font-family: var(--font-display);
    font-variation-settings: var(--wide);
    font-weight: 900;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
    text-decoration: none;
    text-transform: uppercase;
}

.nav-links {
    order: 2;
    display: flex;
    gap: 0.25rem;
    margin: 0 0 0 auto;
    padding: 0;
    list-style: none;
}

.nav-links a {
    position: relative;
    isolation: isolate;
    display: block;
    padding: 0.55rem 0.75rem;
    color: var(--grey);
    transition: color var(--dur) var(--ease-out), filter var(--dur) var(--ease-out);
    font-family: var(--font-mono);
    font-size: var(--size-label);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
}

.nav-actions {
    order: 3;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0 0.85rem;
    border: 0;
    background: transparent;
    color: var(--paper);
    font-family: var(--font-mono);
    font-size: var(--size-label);
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
}

@media (max-width: 860px) {
    .nav-actions {
        margin-left: auto;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        margin: 0;
        background: var(--ink);
        visibility: hidden;
        clip-path: inset(0 0 100% 0);
        /* Fermeture rapide ; l'ouverture (ci-dessous) part vite et dure un peu plus */
        transition: clip-path var(--dur-exit) var(--ease-out), visibility var(--dur-exit);
    }

    .nav-links.is-open {
        visibility: visible;
        clip-path: inset(0 0 0 0);
        transition-duration: var(--dur);
    }

    .nav-links a {
        padding: 0.9rem var(--gutter);
        background: var(--line-fade) top / 100% 1px no-repeat;
        color: var(--grey);
        font-family: var(--font-display);
        font-variation-settings: var(--condensed);
        font-weight: 900;
        font-size: clamp(2.2rem, 12vw, 4rem);
        line-height: 1;
        letter-spacing: 0;
    }

    .nav-links a:focus-visible {
        outline-offset: -6px;
    }
}

/* ================= Sections ================= */
.section {
    position: relative;
    padding: clamp(5rem, 12vw, 10rem) var(--gutter);
    overflow: hidden;
}

.section--paper {
    background: var(--paper);
    color: var(--ink);
}

.section--light {
    background: var(--white);
    color: var(--ink);
}

.section-title {
    margin: 0;
    font-family: var(--font-display);
    font-variation-settings: var(--condensed);
    font-weight: 900;
    font-size: var(--size-title);
    line-height: 0.82;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

/* Titres qui débordent volontairement du cadre */
.section-title--giant {
    font-size: var(--size-giant);
    margin-left: -0.04em;
    white-space: nowrap;
}

.section-title--right {
    text-align: right;
    margin-right: -0.04em;
}

.section-intro {
    max-width: 34ch;
    margin: 1.5rem 0 clamp(3rem, 8vw, 6rem);
    font-size: var(--size-lead);
    color: var(--paper);
}

.section-intro--right {
    margin-left: auto;
    text-align: right;
}

.section-intro--ink {
    color: var(--ink);
}

/* ================= Hero : couches superposées ================= */
.hero {
    position: relative;
    isolation: isolate;
    min-height: 100svh;
    padding: 2rem var(--gutter) 2rem;
    overflow: hidden;
}

.hero-kicker {
    position: relative;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    color: var(--white);
}

.hero-kicker::before {
    content: '';
    width: 0.9rem;
    height: 1.2rem;
    background: var(--white);
    -webkit-mask: var(--star) center / contain no-repeat;
    mask: var(--star) center / contain no-repeat;
}

.hero-title,
.hero-name-echo {
    position: absolute;
    left: var(--gutter);
    right: var(--gutter);
    bottom: clamp(1.5rem, 6vh, 4rem);
    margin: 0;
    font-family: var(--font-display);
    font-weight: 900;
    line-height: 0.8;
    text-transform: uppercase;
}

.hero-title {
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.hero-hello {
    font-variation-settings: var(--wide);
    font-size: clamp(1.4rem, 3.6vw, 3.4rem);
    line-height: 1;
    color: var(--white);
}

.hero-name,
.hero-name-echo {
    font-variation-settings: var(--condensed);
    font-size: clamp(4rem, 25vw, 31rem);
    letter-spacing: -0.025em;
    white-space: nowrap;
}

.hero-name {
    color: var(--paper);
}

/* ---------- Repères « HUD / grimoire » : crochets, micro-croix, règles graduées ---------- */
.hero-hud {
    position: absolute;
    inset: calc(var(--header-h) + 0.5rem) var(--gutter) 1.25rem;
    z-index: 0;
    color: var(--grey-dim);
    pointer-events: none;
}

.hero-hud::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--corner-marks);
    opacity: 0.7;
}

.hud-cross {
    position: absolute;
    width: 11px;
    height: 11px;
    background:
        linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat,
        linear-gradient(currentColor, currentColor) center / 1px 100% no-repeat;
}

.hud-cross--a { top: 34%; left: 36%; }
.hud-cross--b { top: 58%; left: 2%; }
.hud-cross--c { top: 8%; right: 30%; }
.hud-cross--d { bottom: 34%; right: 1%; }

/* Règle verticale graduée, bord gauche */
.hud-ruler {
    position: absolute;
    top: 30%;
    left: -0.6rem;
    width: 6px;
    height: 22%;
    background: repeating-linear-gradient(currentColor 0 1px, transparent 1px 10px);
}

/* Ligne de repérage pointillée sous l'intro */
.hud-line {
    position: absolute;
    top: 44%;
    left: 0;
    width: 30%;
    height: 1px;
    background: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 8px);
}

@media (max-width: 860px) {
    /* Téléphone : seulement deux micro-croix dans les vides, rien sur le texte */
    .hero-hud::before,
    .hud-ruler,
    .hud-line,
    .hud-cross--a,
    .hud-cross--c {
        display: none;
    }
}

/* Contour du nom, posé AU-DESSUS de la mascotte : superposition */
.hero-name-echo {
    z-index: 3;
    color: transparent;
    -webkit-text-stroke: 2px var(--white);
    pointer-events: none;
}

.hero-visual {
    position: absolute;
    z-index: 2;
    top: 1.5rem;
    right: clamp(0rem, 5vw, 6rem);
    bottom: 0;
    display: flex;
    align-items: flex-start;
    /* Points blancs inversés en noir là où ils croisent les lettres du nom */
    mix-blend-mode: difference;
}

.hero-card {
    position: relative;
    z-index: 4;
    max-width: 26rem;
    margin-top: clamp(1.5rem, 5vh, 3.5rem);
    color: var(--grey);
}

.hero-subtitle {
    margin: 0 0 1.2rem;
    font-size: var(--size-lead);
    line-height: 1.45;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Grande étoile acérée évidée, derrière la mascotte ET derrière le nom (z-index 0 < titre 1 < mascotte 2) */
.hero-star {
    position: absolute;
    z-index: 0;
    top: -4%;
    right: clamp(-9rem, -5vw, 0rem);
    width: clamp(32rem, 74vw, 72rem);
    height: auto;
    aspect-ratio: 1;
    overflow: visible;
    /* Trait fin et régulier ; l'onglet (miter) très long garde les pointes parfaitement acérées */
    fill: none;
    stroke: var(--grey-dim);
    stroke-width: 7px;
    stroke-linejoin: miter;
    stroke-miterlimit: 60;
    opacity: 0.55;
    /* Très légère lueur : l'étoile structure l'espace derrière le fennec */
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--paper) 22%, transparent));
    pointer-events: none;
}

/* Découpe à la silhouette de la mascotte (coordonnées posées par js/hero-star.js) */
.hero-star.has-hole {
    -webkit-mask-image: linear-gradient(var(--ink), var(--ink)), var(--hole-src);
    mask-image: linear-gradient(var(--ink), var(--ink)), var(--hole-src);
    -webkit-mask-size: 100% 100%, var(--hole-w) var(--hole-h);
    mask-size: 100% 100%, var(--hole-w) var(--hole-h);
    -webkit-mask-position: 0 0, var(--hole-x) var(--hole-y);
    mask-position: 0 0, var(--hole-x) var(--hole-y);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.hero-scroll {
    position: absolute;
    z-index: 4;
    right: var(--gutter);
    top: calc(var(--header-h) + 2rem);
    margin: 0;
    writing-mode: vertical-rl;
    color: var(--grey);
}

@media (max-width: 860px) {
    .hero {
        display: flex;
        flex-direction: column;
        min-height: auto;
        padding-bottom: 3rem;
    }

    .hero-title {
        position: relative;
        inset: auto;
        order: 1;
        margin: 1.25rem 0 0;
    }

    .hero-name {
        font-size: 24vw;
    }

    .hero-name-echo,
    .hero-scroll {
        display: none;
    }

    .hero-visual {
        position: relative;
        inset: auto;
        order: 2;
        justify-content: center;
        margin-top: 0; /* sans chevauchement : le visage reste sous le nom */
    }

    .hero-card {
        order: 3;
        max-width: none;
        margin: 1.5rem 0 0;
    }

    /* Téléphone : étoile centrée sur la tête de la mascotte (position posée par js/hero-star.js) */
    .hero-star {
        top: var(--head-y, 30%);
        right: auto;
        left: var(--head-x, 50%);
        width: 135vw;
        max-width: none;
        translate: -50% -50%;
    }
}

/* ================= Dictons ================= */
.dictons {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Téléphone : hauteur liée à la largeur (stable quand la fenêtre d'une app se redimensionne au défilement) */
@media (max-width: 860px) {
    .dictons {
        min-height: min(170vw, 52rem);
    }
}

.dictons-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1.5rem;
    margin-bottom: clamp(2rem, 6vw, 4.5rem);
}

.dictons-head .section-title {
    font-size: clamp(3rem, 9vw, 9rem);
}

.dictons-kicker {
    margin: 0 0 0.6rem;
}

.dictons-counter {
    margin-left: auto;
}

.dicton {
    margin: 0;
}

.dictons-footnote {
    margin: 2.5rem 0 0;
    font-family: var(--font-mono);
    font-size: var(--size-label);
}

/* Trame d'encre dans un coin du papier */
.dictons::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 0;
    width: min(100vw, 90rem);
    height: 100%;
    color: var(--ink);
    background-image: var(--dots-fat);
    background-size: var(--dot-step-fat) var(--dot-step-fat);
    -webkit-mask-image: radial-gradient(ellipse 85% 95% at 100% 100%, var(--ink) 0, transparent 75%);
    mask-image: radial-gradient(ellipse 85% 95% at 100% 100%, var(--ink) 0, transparent 75%);
    opacity: 0.26;
    pointer-events: none;
}

/* Second voile de trame, plus fin, depuis le coin opposé */
.dictons::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    width: min(70vw, 60rem);
    height: 70%;
    color: var(--ink);
    background-image: var(--dots);
    background-size: var(--dot-step) var(--dot-step);
    -webkit-mask-image: radial-gradient(ellipse at 0 0, var(--ink) 0, transparent 70%);
    mask-image: radial-gradient(ellipse at 0 0, var(--ink) 0, transparent 70%);
    opacity: 0.14;
    pointer-events: none;
}

.dictons > * {
    position: relative;
    z-index: 1;
}

/* ================= Fursona : trois colonnes de même largeur, en escalier ================= */
.facts {
    counter-reset: fact;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 2rem var(--gutter);
    margin: 0 0 clamp(4rem, 10vw, 8rem);
    padding: 0;
    list-style: none;
}

.fact {
    counter-increment: fact;
    grid-column: 1 / span 4;
}

.fact:nth-child(2) {
    grid-column: 5 / span 4;
    margin-top: 7rem;
}

.fact:nth-child(3) {
    grid-column: 9 / span 4;
    margin-top: 14rem; /* escalier : 03 sous 02, lui-même sous 01 */
}

@media (max-width: 860px) {
    .facts {
        grid-template-columns: 1fr;
    }

    .fact,
    .fact:nth-child(2),
    .fact:nth-child(3) {
        grid-column: auto;
        margin-top: 0;
    }
}

.refsheet-slot {
    margin-top: clamp(4rem, 10vw, 8rem);
}

/* ================= Galerie ================= */
/* Vignettes moyennes (jusqu’à 3 par ligne) ; l'œuvre entière s'ouvre dans la visionneuse */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 24rem));
    gap: clamp(1.5rem, 4vw, 3rem) var(--gutter);
    margin: 0;
    padding: 0;
    list-style: none;
}

.gallery-grid[hidden] {
    display: none;
}

/* ================= Réseaux ================= */
.social-list {
    margin: 0;
    padding: 0;
    list-style: none;
    color: color-mix(in srgb, var(--grey) 45%, transparent);
    background: var(--line-fade) bottom / 100% 1px no-repeat;
}

/* Éclat acéré en exposant des titres de section */
.section-title::after {
    content: '';
    display: inline-block;
    width: 0.22em;
    height: 0.36em;
    margin-left: 0.12em;
    vertical-align: top;
    background: currentColor;
    -webkit-mask: var(--star) center / contain no-repeat;
    mask: var(--star) center / contain no-repeat;
}

/* Liens et boutons de la barre : nus, gris ; au survol une étoile pâle s'allume derrière */
.nav-links a::before,
.site-header .lang-toggle::before {
    content: '';
    position: absolute;
    inset: -6px 0;
    z-index: -1;
    background: var(--paper);
    -webkit-mask: var(--star) center / contain no-repeat;
    mask: var(--star) center / contain no-repeat;
    opacity: 0;
    scale: 0.3;
    rotate: -45deg;
    transition: opacity var(--dur) var(--ease-out), scale var(--dur) var(--ease-out), rotate var(--dur) var(--ease-out);
}

.site-header .lang-toggle {
    position: relative;
    isolation: isolate;
    transition: color var(--dur) var(--ease-out), filter var(--dur) var(--ease-out);
}

.site-header .nav-links a:focus-visible,
.site-header .lang-toggle:focus-visible {
    background: none;
    color: var(--paper);
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--paper) 45%, transparent));
}

.nav-links a:focus-visible::before,
.site-header .lang-toggle:focus-visible::before {
    opacity: 0.12;
    scale: 1;
    rotate: 0deg;
}

/* Survol réservé à la souris : au toucher, le lien resterait allumé */
@media (hover: hover) and (pointer: fine) {
    .site-header .nav-links a:hover,
    .site-header .lang-toggle:hover {
        background: none;
        color: var(--paper);
        filter: drop-shadow(0 0 6px color-mix(in srgb, var(--paper) 45%, transparent));
    }

    .nav-links a:hover::before,
    .site-header .lang-toggle:hover::before {
        opacity: 0.12;
        scale: 1;
        rotate: 0deg;
    }
}
