:root {
    --paper: #1a1a1a;
    --ink: #f1ece4;
    /* le sable de la veste sur la photo */
    --accent: #d9c79a;
    --line: #3a3a3a;
    --pill: #2a2a2a;
    --night: #101010;
    --night-ink: #f1ece4;

    --font: "Archivo", system-ui, sans-serif;
    --gutter: clamp(1.25rem, 5vw, 4rem);
    --rule: 2px solid var(--line);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* l'attribut hidden doit gagner sur les display posés plus bas */
[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1.0625rem;
    line-height: 1.55;
}

/* Contenu centré sur 68rem, fond du bloc en pleine largeur */
.band {
    padding-inline: max(var(--gutter), calc((100% - 68rem) / 2));
}

a {
    color: inherit;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 0.14em;
    text-underline-offset: 0.2em;
}

a:hover {
    color: var(--accent);
}

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

ul,
ol {
    list-style: none;
}

h2 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-stretch: 62%;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
    padding-block: 1rem 2rem;
    border-top: var(--rule);
}

h3 {
    font-size: 1.375rem;
    font-weight: 800;
    line-height: 1.25;
}

main {
    padding-top: clamp(2rem, 6vw, 4rem);
}

main > section {
    padding-bottom: clamp(3rem, 8vw, 6rem);
}

.empty,
.hint {
    opacity: 0.7;
}

/* Les états vides disparaissent dès que la liste voisine a du contenu */
.hobbies:empty,
.chips:empty {
    display: none;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    align-content: start;
    gap: 0.5rem;
}

.chips li {
    border: 1.5px solid currentColor;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.2rem 0.8rem;
}

/* ─── Navigation : pastilles flottantes, la section en cours est surlignée ─── */

nav {
    position: fixed;
    top: 1rem;
    left: max(var(--gutter), calc((100% - 68rem) / 2));
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

nav a {
    text-decoration: none;
    white-space: nowrap;
}

.nav-logo {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--pill);
    font-stretch: 62%;
    font-weight: 900;
    font-size: 1.25rem;
}

.nav-items {
    display: flex;
    padding: 0.3rem;
    border-radius: 2rem;
    background: var(--pill);
}

.nav-items > li > a {
    display: block;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

nav a[aria-current],
nav a[aria-current]:hover {
    background: var(--accent);
    color: var(--paper);
}

/* ─── J'aime : pastille fixe en haut à droite, le cœur se remplit une fois aimé ─── */

.like {
    position: fixed;
    top: 1rem;
    right: max(var(--gutter), calc((100% - 68rem) / 2));
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 3rem;
    padding-inline: 1rem;
    border: none;
    border-radius: 2rem;
    background: var(--pill);
    color: var(--ink);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}

.like:hover {
    color: var(--accent);
}

.like:disabled {
    cursor: progress;
}

.like svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
    transition: fill 0.2s, stroke 0.2s;
}

.like[aria-pressed="true"] svg {
    fill: var(--accent);
    stroke: var(--accent);
}

/* posé par js/main.js au moment où l'on aime */
.like.pop svg {
    animation: like-pop 0.35s;
}

@keyframes like-pop {
    50% {
        transform: scale(1.3);
    }
}

/* ─── En-tête ─── */

.hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: min(100vh, 58rem);
    padding-block: 6rem clamp(2.5rem, 8vw, 6rem);
    overflow: hidden;
    /* plus sombre que le reste de la page, avec une lueur sable derrière le portrait */
    background: radial-gradient(55rem 38rem at 72% 75%, rgb(217 199 154 / 0.16), transparent 70%) var(--night);
}

.hero-text {
    position: relative;
    z-index: 1;
}

/* Portrait détouré, posé en bas à droite et fondu dans le fond */
.hero-photo {
    position: absolute;
    bottom: 0;
    right: max(var(--gutter), calc((100% - 68rem) / 2));
    height: 100%;
    width: auto;
    mask-image: linear-gradient(to bottom, #000 72%, transparent);
}

.hero h1 {
    font-size: clamp(4rem, 12vw, 11rem);
    font-stretch: 62%;
    font-weight: 900;
    line-height: 0.82;
    text-transform: uppercase;
}

.hero h1 span {
    display: block;
}

.role {
    font-size: clamp(1.125rem, 2.2vw, 1.5rem);
    font-stretch: 125%;
    font-weight: 600;
    margin-top: 1.75rem;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 1.25rem;
}

/* ─── À propos ─── */

.about {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: var(--gutter);
}

.about-text p {
    font-size: 1.1875rem;
    max-width: 60ch;
}

.about-text p + p {
    margin-top: 1em;
}

/* ─── Commun à Projets et Hobbies : fond flouté de l'élément sélectionné, compteur, grand titre ─── */

.blur-section {
    position: relative;
    overflow: hidden;
}

/* main.js y met l'image de l'élément sélectionné et ajoute .visible quand il y en a une */
.blur-bg {
    position: absolute;
    inset: 0;
    background: center / cover no-repeat;
    filter: blur(28px);
    scale: 1.2;
    opacity: 0;
    transition: opacity 0.4s ease, background-image 0.5s ease;
}

.blur-bg.visible {
    opacity: 0.4;
}

.blur-section > :not(.blur-bg) {
    position: relative;
}

/* « 01 / 04 » */
.item-index {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.item-title {
    font-size: clamp(2.25rem, 4.5vw, 3.25rem);
    font-stretch: 62%;
    font-weight: 900;
    line-height: 0.95;
    text-transform: uppercase;
    margin-block: 0.5rem 1rem;
}

/* ─── Projets : description du projet sélectionné à gauche, rangée de cartes à droite ─── */

.projects-layout {
    display: grid;
    grid-template-columns: minmax(0, 19rem) minmax(0, 1fr);
    gap: 1.5rem clamp(2rem, 4vw, 3.5rem);
}

.project-panel {
    grid-row: span 2;
    align-self: center;
}

/* les liens du panneau, pas ceux que contient la description */
.project-panel > a {
    display: inline-block;
    font-weight: 700;
    margin-top: 1.25rem;
    margin-right: 1.25rem;
}

.projects {
    position: relative;
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    /* la rangée file jusqu'au bord droit de l'écran ; la section coupe ce qui dépasse */
    margin-right: calc(-1 * max(var(--gutter), (100vw - 68rem) / 2));
}

/* Carte carrée : image en fond (ou panneau uni sans image), étiquettes en bas à gauche */
.project {
    flex: 0 0 min(72vw, 21rem);
    scroll-snap-align: start;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 0.4rem;
    aspect-ratio: 1;
    padding: 1rem;
    border-radius: 1.25rem;
    background: radial-gradient(18rem 14rem at 80% 10%, rgb(217 199 154 / 0.14), transparent 70%) var(--pill);
    background-position: center;
    background-size: cover;
    transition: opacity 0.3s ease;
}

.project:not(:has([aria-pressed="true"])) {
    opacity: 0.55;
}

/* Bouton transparent qui couvre la carte : un clic sélectionne le projet */
.project-select {
    position: absolute;
    inset: 0;
    border: 0;
    border-radius: inherit;
    background: none;
    cursor: pointer;
}

/* Contour tracé à l'intérieur de la carte : régulier sur une photo et jamais rogné par la rangée */
.project-select[aria-pressed="true"] {
    box-shadow: inset 0 0 0 3px var(--accent);
}

.project-desc {
    display: none;
}

/* Sur plusieurs lignes, main.js resserre la largeur sur la ligne la plus longue (impossible en CSS seul) */
.project h3 {
    background: #000;
    color: #fff;
    border-radius: 0.5rem;
    font-size: 1rem;
    line-height: 1.25;
    padding: 0.5rem 0.9rem;
    text-transform: uppercase;
    text-wrap: balance;
}

.project-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.project-stack li,
.project-tag {
    background: #fff;
    color: #111;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 700;
    padding: 0.35rem 0.8rem;
}

.project-tag {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-variant-numeric: tabular-nums;
}

.project-nav {
    display: flex;
    gap: 0.75rem;
}

.arrow-button:disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ─── Hobbies ─── */

.hobbies {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
    gap: 1.5rem var(--gutter);
    padding-bottom: 2.5rem;
}

/* ─── Hobbies : pastilles de choix + pile de cartes ─── */

/* Toute la section est la bande sombre : le titre est dedans, sur le fond flouté */
#hobbies {
    background: var(--night);
    color: var(--night-ink);
}

.music {
    --size: clamp(15rem, 30vw, 22rem);
    display: grid;
    /* paragraphe | pile | titre et flèches */
    grid-template-columns: minmax(0, 1fr) var(--size) minmax(0, 1fr);
    /* pastilles / texte (prend la place libre) / flèches : les flèches restent au bas de la pile */
    grid-template-rows: auto 1fr auto;
    gap: 2rem clamp(2.5rem, 5vw, 4rem);
    padding-top: 0.5rem;
}

.hobby-tabs {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hobby-tabs button {
    border: 1.5px solid currentColor;
    border-radius: 2rem;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: 600;
    padding: 0.4rem 1rem;
    cursor: pointer;
}

.hobby-tabs button[aria-pressed="true"] {
    background: var(--night-ink);
    color: var(--night);
}

.hobby-text {
    grid-row: span 2;
    align-self: center;
}

.album-stack {
    position: relative;
    grid-row: span 2;
    width: var(--size);
    aspect-ratio: 1;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
}

.album-stack:active {
    cursor: grabbing;
}

/* --pos : 0 = carte du dessus, 1 = juste derrière, etc. (posé par main.js) */
.album-card {
    position: absolute;
    inset: 0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1.5rem 3rem rgb(0 0 0 / 0.6);
    translate: calc(var(--pos) * 24px) calc(var(--pos) * 6px);
    rotate: calc(var(--pos) * 4deg);
    scale: calc(1 - var(--pos) * 0.04);
    opacity: calc(1 - var(--pos) * 0.15);
    transition: translate 0.55s cubic-bezier(0.23, 1, 0.32, 1),
        rotate 0.55s cubic-bezier(0.23, 1, 0.32, 1),
        scale 0.55s cubic-bezier(0.23, 1, 0.32, 1),
        opacity 0.55s ease;
}

/* Carte sans image : l'année sur fond bleu nuit */
.album-card.no-image {
    display: grid;
    place-items: center;
    background: #0d2b52;
    border: 1px solid rgb(255 255 255 / 0.25);
    font-size: calc(var(--size) * 0.36);
    font-stretch: 62%;
    font-weight: 900;
}

.album-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.album-info {
    align-self: end;
}

/* laisse dépasser les cartes décalées derrière sans toucher au texte */
.album-info,
.album-nav {
    padding-left: 2.5rem;
}

.album-info > p {
    transition: opacity 0.2s ease;
}

.album-info.changing > p {
    opacity: 0;
}

.album-year {
    border: 1.5px solid currentColor;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
    margin-left: 0.5rem;
    padding: 0.15rem 0.7rem;
}

.album-fav {
    margin-top: 0.5rem;
}

.music a {
    text-decoration-color: currentColor;
}

.music a:hover {
    color: inherit;
    text-decoration-thickness: 0.22em;
}

.music :focus-visible {
    outline-color: var(--night-ink);
}

.album-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.arrow-button {
    width: 3.5rem;
    height: 3.5rem;
    border: 2px solid currentColor;
    border-radius: 50%;
    background: none;
    color: inherit;
    font: inherit;
    font-size: 1.375rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.arrow-button:hover {
    background: var(--night-ink);
    color: var(--night);
}

.hint {
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

/* ─── Pied de page ─── */

footer {
    padding-block: 2rem;
    font-size: 0.875rem;
}

/* Écran moyen : le paragraphe passe au-dessus, sur toute la largeur */
@media (max-width: 1000px) {
    .music {
        grid-template-columns: var(--size) minmax(0, 1fr);
        grid-template-rows: auto auto 1fr auto;
    }

    .hobby-text {
        grid-column: 1 / -1;
        grid-row: auto;
        max-width: 60ch;
    }
}

@media (max-width: 900px) {
    .projects-layout {
        grid-template-columns: 1fr;
    }

    .project-panel {
        grid-row: auto;
    }
}

@media (max-width: 760px) {
    .about,
    .music {
        grid-template-columns: 1fr;
    }

    .music {
        --size: min(100%, 20rem);
        grid-template-rows: none;
    }

    .hero {
        flex-direction: column;
        align-items: start;
        padding-bottom: 0;
    }

    .hero-photo {
        position: static;
        align-self: center;
        width: min(100%, 22rem);
        height: auto;
        margin-top: 2rem;
    }

    .album-info,
    .album-nav {
        padding-left: 0;
    }

    .album-stack {
        grid-row: auto;
        /* place pour les cartes décalées derrière */
        margin-bottom: 1.5rem;
    }

    /* le menu occupe toute la largeur en haut : le cœur descend en bas à droite */
    .like {
        top: auto;
        bottom: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html,
    .projects {
        scroll-behavior: auto;
    }

    .blur-bg,
    .project,
    .album-card,
    .album-info > p,
    .like svg {
        animation: none;
        transition: none;
    }
}
