:root {
    --fond: var(--color-1);
    --or: var(--color-4);
    --or-clair: #f6d97c;
    --doux: var(--color-2);
    --texte: var(--color-3);
    --carte: var(--color-7);
    --bord: color-mix(in srgb, var(--color-3) 15%, transparent);
    --transition: .25s cubic-bezier(.4,0,.2,1);
}

/* --- Hero 3D cinematique --- */
.hero3d {
    position: relative;
    height: 100vh;
    overflow: hidden;
    background: #030a12;
}

.hero3d__scene {
    position: relative;
    width: 100%;
    height: 100%;
    perspective: 1200px;
    overflow: hidden;
}

.hero3d__particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

/* Layers de profondeur */
.hero3d__layer {
    position: absolute;
    transition: transform .3s ease-out;
    will-change: transform;
}

.hero3d__layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero3d__layer--back {
    inset: -5%;
    z-index: 1;
    opacity: .3;
    filter: blur(2px) saturate(.6);
}

.hero3d__layer--mid-left {
    left: -2%;
    top: 15%;
    width: 30%;
    height: 65%;
    z-index: 2;
    border: 1px solid rgba(234,177,47,.2);
    box-shadow: 0 0 60px rgba(234,177,47,.1), inset 0 0 30px rgba(0,0,0,.5);
    animation: hero3d-float-1 8s ease-in-out infinite;
}

.hero3d__layer--mid-right {
    right: -2%;
    top: 10%;
    width: 28%;
    height: 70%;
    z-index: 2;
    border: 1px solid rgba(234,177,47,.2);
    box-shadow: 0 0 60px rgba(234,177,47,.1), inset 0 0 30px rgba(0,0,0,.5);
    animation: hero3d-float-2 9s ease-in-out infinite;
}

.hero3d__layer--front-left {
    left: 8%;
    bottom: 5%;
    width: 18%;
    height: 45%;
    z-index: 3;
    border: 1px solid rgba(234,177,47,.15);
    box-shadow: 0 20px 80px rgba(0,0,0,.6);
    animation: hero3d-float-3 7s ease-in-out infinite;
}

.hero3d__layer--front-right {
    right: 8%;
    bottom: 8%;
    width: 16%;
    height: 40%;
    z-index: 3;
    border: 1px solid rgba(234,177,47,.15);
    box-shadow: 0 20px 80px rgba(0,0,0,.6);
    animation: hero3d-float-4 10s ease-in-out infinite;
}

@keyframes hero3d-float-1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(15px, -20px) rotate(.5deg); }
    50% { transform: translate(-10px, -8px) rotate(-.3deg); }
    75% { transform: translate(8px, 12px) rotate(.2deg); }
}

@keyframes hero3d-float-2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-18px, 15px) rotate(-.4deg); }
    50% { transform: translate(12px, -12px) rotate(.5deg); }
    75% { transform: translate(-8px, -18px) rotate(-.2deg); }
}

@keyframes hero3d-float-3 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(20px, -15px) rotate(.8deg); }
    66% { transform: translate(-12px, 10px) rotate(-.5deg); }
}

@keyframes hero3d-float-4 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-15px, -20px) rotate(-.6deg); }
    66% { transform: translate(18px, 8px) rotate(.4deg); }
}

/* Lumieres volumetriques */
.hero3d__glow {
    position: absolute;
    left: 30%;
    top: -20%;
    width: 40%;
    height: 80%;
    background: radial-gradient(ellipse at center, rgba(234,177,47,.12) 0%, transparent 70%);
    z-index: 4;
    pointer-events: none;
    animation: hero3d-glow 6s ease-in-out infinite;
}

.hero3d__glow--2 {
    left: auto;
    right: 10%;
    top: 30%;
    width: 30%;
    height: 60%;
    background: radial-gradient(ellipse at center, rgba(89,149,168,.08) 0%, transparent 70%);
    animation: hero3d-glow2 8s ease-in-out infinite;
}

@keyframes hero3d-glow {
    0%, 100% { opacity: .6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

@keyframes hero3d-glow2 {
    0%, 100% { opacity: .4; transform: scale(1) translateX(0); }
    50% { opacity: .8; transform: scale(1.1) translateX(-20px); }
}

/* Contenu central */
.hero3d__content {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: grid;
    place-content: center;
    justify-items: center;
    text-align: center;
    gap: 1.2rem;
    color: var(--color-3);
    transition: transform .3s ease-out;
}

.hero3d__overline {
    font-family: var(--font-2);
    font-size: .8rem;
    font-weight: 500;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--color-4);
    opacity: 0;
    animation: hero3d-fade-in .8s .5s ease both;
}

.hero3d__title {
    display: grid;
    gap: 0;
    justify-items: center;
    margin: 0;
}

.hero3d__line {
    display: block;
    font-family: var(--font-1);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -.02em;
    text-shadow: 0 0 60px rgba(234,177,47,.3), 0 4px 20px rgba(0,0,0,.8);
}

.hero3d__line--1 {
    font-size: clamp(2rem, 6vw, 5rem);
    line-height: 1;
    opacity: 0;
    animation: hero3d-line-in .8s .3s cubic-bezier(.16,1,.3,1) both;
}

.hero3d__line--2 {
    font-size: clamp(2.5rem, 8vw, 7rem);
    line-height: .95;
    color: var(--color-4);
    opacity: 0;
    animation: hero3d-line-in .8s .5s cubic-bezier(.16,1,.3,1) both;
}

.hero3d__line--3 {
    font-size: clamp(1.5rem, 4vw, 3.5rem);
    line-height: 1.1;
    color: var(--color-2);
    opacity: 0;
    animation: hero3d-line-in .8s .7s cubic-bezier(.16,1,.3,1) both;
}

@keyframes hero3d-line-in {
    from { opacity: 0; transform: translateY(40px) scale(.9); filter: blur(8px); }
    to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes hero3d-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hero3d__sub {
    font-family: var(--font-2);
    font-size: 1rem;
    letter-spacing: .3em;
    color: var(--color-2);
    opacity: 0;
    animation: hero3d-fade-in .8s .9s ease both;
}

.hero3d__actions {
    display: flex;
    gap: 1rem;
    margin-top: .5rem;
    opacity: 0;
    animation: hero3d-fade-in .8s 1.1s ease both;
}

.hero3d__btn {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    padding: .9rem 2rem;
    background: var(--color-4);
    color: var(--color-1);
    font-family: var(--font-1);
    font-weight: 700;
    font-size: .85rem;
    letter-spacing: .08em;
    text-decoration: none;
    border-radius: 0;
    transition: transform .3s, box-shadow .3s, background .3s;
}

.hero3d__btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(234,177,47,.4);
    background: #f6d97c;
    color: var(--color-1);
}

.hero3d__btn--ghost {
    background: transparent;
    color: var(--color-3);
    border: 1px solid rgba(248,244,238,.3);
}

.hero3d__btn--ghost:hover {
    background: rgba(234,177,47,.1);
    border-color: var(--color-4);
    color: var(--color-4);
    box-shadow: 0 12px 40px rgba(234,177,47,.15);
}

/* Indicateur de scroll */
.hero3d__scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: grid;
    justify-items: center;
    gap: .5rem;
    color: var(--color-2);
    font-family: var(--font-2);
    font-size: .7rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    opacity: 0;
    animation: hero3d-fade-in 1s 1.5s ease both;
}

.hero3d__scroll-hint span {
    display: block;
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--color-4), transparent);
    animation: hero3d-scroll-pulse 2s ease-in-out infinite;
}

@keyframes hero3d-scroll-pulse {
    0%, 100% { opacity: .4; transform: scaleY(1); }
    50% { opacity: 1; transform: scaleY(1.3); }
}

@media (max-width: 899px) {
    .hero3d__layer--front-left,
    .hero3d__layer--front-right { display: none; }
    .hero3d__layer--mid-left { width: 40%; left: -5%; }
    .hero3d__layer--mid-right { width: 38%; right: -5%; }
    .hero3d__line--2 { font-size: clamp(2rem, 12vw, 4rem); }
    .hero3d__actions { flex-direction: column; align-items: center; }
}

/* --- Marquee / Ticker (Ciao-style) --- */
.marquee {
    overflow: hidden;
    white-space: nowrap;
    padding: 1.2rem 0;
    background: var(--color-4);
    color: var(--color-1);
    font-family: var(--font-1);
    font-weight: 900;
    font-size: clamp(1rem, 2vw, 1.4rem);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.marquee__track {
    display: inline-flex;
    animation: marquee-scroll 20s linear infinite;
}

.marquee__track span {
    padding: 0 2rem;
}

.marquee__track span::after {
    content: '\2022';
    margin-left: 2rem;
    opacity: .4;
}

@keyframes marquee-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}


/* --- Section plein ecran --- */
.section-musee {
    padding: var(--space-2) var(--space-1);
    overflow: clip;
}

.section-musee--sombre {
    background: var(--color-1);
    color: var(--color-3);
}

.section-musee--clair {
    background: var(--color-5);
    color: var(--color-1);
}

.section-musee--accent {
    background: var(--color-7);
    color: var(--color-3);
}

.auth-form {
    display: grid;
    gap: 1.5rem;
    width: min(100%, 34rem);
    margin: 0 auto;
}

.auth-form__fields {
    display: grid;
    gap: 1rem;
}

.auth-form__fields .m-btn {
    justify-self: start;
    margin-top: .5rem;
}

.section-musee h2 {
    font-family: var(--font-1);
    font-weight: 900;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.08;
    letter-spacing: -.02em;
    margin-bottom: clamp(2rem, 5vw, 4rem);
}

.section-musee h2 em {
    font-style: normal;
    color: var(--color-4);
}

/* --- Boutons --- */
.bouton {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .7rem 1.4rem .7rem 1rem;
    border: 0;
    background: var(--color-4);
    color: var(--color-1);
    font-family: var(--font-1);
    font-weight: 700;
    font-size: .9375rem;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
}

.bouton:hover {
    background: color-mix(in srgb, var(--color-4) 80%, #000);
    color: var(--color-1);
}

.bouton:disabled { opacity: .5; cursor: default; }

.bouton--ghost {
    background: transparent;
    color: var(--color-3);
    border: 1.5px solid color-mix(in srgb, var(--color-3) 40%, transparent);
}

.bouton--ghost:hover {
    border-color: var(--color-4);
    color: var(--color-4);
    background: transparent;
}

/* --- Grille & Cartes (visite) --- */
.grille {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: clamp(12px, 1.6vw, 24px);
}

.carte {
    background: var(--carte);
    color: var(--texte);
    text-decoration: none;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr;
    transition: transform var(--transition), box-shadow var(--transition);
}

.carte:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 50px rgba(0,0,0,.4);
}

.carte[hidden] { display: none; }

.carte-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    filter: grayscale(1) contrast(1.05);
    transition: filter .5s;
}
.carte-img-cat {
    width: 100%;
    object-fit: contain;
    transition: filter .5s;
}

.carte:hover .carte-img { filter: grayscale(0); }

.carte-body {
    padding: 1.3rem;
    display: grid;
    gap: .4rem;
    align-content: start;
}

.carte-body strong {
    color: var(--or);
    font-family: var(--font-2);
    font-size: .8125rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.carte-body h2 {
    font-family: var(--font-1);
    font-weight: 700;
    font-size: clamp(1.15rem, 1.5vw, 1.4rem);
    margin: 0;
    color: var(--texte);
}

.carte-body span {
    color: var(--doux);
    font-size: .85rem;
    margin-top: auto;
}

/* --- Select / Filtre --- */
.filtre-wrap {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin-bottom: 2rem;
}

select {
    padding: .6rem 1.2rem;
    background: var(--carte);
    color: var(--texte);
    border: 1px solid var(--bord);
    font: inherit;
    font-size: .9rem;
    cursor: pointer;
    transition: border-color var(--transition);
}

select:hover, select:focus { border-color: var(--or); }

/* Filtres multiples de la visite */
.filtres { flex-wrap: wrap; row-gap: 1rem; }
.filtres .filtre { display: flex; align-items: center; gap: .5rem; }
.filtres input {
    padding: .6rem 1rem;
    background: var(--carte);
    color: var(--texte);
    border: 1px solid var(--bord);
    font: inherit;
    font-size: .9rem;
    transition: border-color var(--transition);
}
.filtres input:hover, .filtres input:focus { border-color: var(--or); outline: none; }
.filtres-compteur { margin: -1rem 0 1.5rem; }

/* --- Article / Fiche --- */
.fiche {
    max-width: 760px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
    gap: clamp(28px, 5vw, 64px);
    align-items: start;
}

.fiche img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    filter: grayscale(1) contrast(1.05);
}

.fiche-content {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.fiche-content h1 {
    font-family: var(--font-1);
    font-weight: 700;
    font-size: clamp(1.6rem, 2.5vw, 2.4rem);
    color: var(--texte);
    line-height: 1.15;
}

.fiche-content p {
    color: var(--doux);
    font-size: 1.05rem;
    line-height: 1.7;
}

.fiche-content a { font-weight: 600; color: var(--or); }

.carte-possédée {
    display: inline-block;
    width: fit-content;
    padding: .55rem .85rem;
    border: 1px solid color-mix(in srgb, var(--color-4) 45%, transparent);
    background: linear-gradient(120deg, rgba(234, 177, 47, .12), rgba(96, 220, 202, .1) 55%, rgba(162, 124, 255, .12));
    background-clip: padding-box;
    color: #ffe28a;
    text-shadow:
        0 1px 0 #b77620,
        0 2px 0 #89551e,
        0 3px 0 #563c35,
        0 5px 12px rgba(0, 0, 0, .45),
        0 0 18px rgba(234, 177, 47, .28);
    transform: perspective(500px) rotateX(7deg);
    animation: carte-possédée-apparition .65s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes carte-possédée-apparition {
    from { opacity: 0; transform: perspective(500px) rotateX(18deg) translateY(8px) scale(.96); }
    to { opacity: 1; transform: perspective(500px) rotateX(7deg) translateY(0) scale(1); }
}

.fiche-achat { display: grid; justify-items: start; gap: .5rem; }
.fiche-achat__status { min-height: 1.5em; }
.fiche--achetee > div:first-child img { animation: achat-carte-succes .7s ease-out; }
@keyframes achat-carte-succes {
    0% { transform: scale(1); filter: grayscale(1) contrast(1.05); }
    45% { transform: scale(1.035); filter: grayscale(0) contrast(1.05); }
    100% { transform: scale(1); filter: grayscale(1) contrast(1.05); }
}
@media (prefers-reduced-motion: reduce) {
    .fiche--achetee > div:first-child img { animation: none; }
    .carte-possédée { animation: none; transform: none; }
}

@media (max-width: 699px) {
    .fiche { grid-template-columns: 1fr; }
}

/* --- Badge --- */
.badge-futur {
    display: inline-block;
    background: rgba(234, 177, 47, .12);
    color: var(--or);
    font-size: .75rem;
    font-weight: 700;
    padding: .25rem .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.badge-reel {
    display: inline-block;
    background: rgba(80, 200, 120, .12);
    color: #50c878;
    font-size: .75rem;
    font-weight: 700;
    padding: .25rem .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* --- Canvas / Jeu --- */
canvas {
    display: block;
    width: 100%;
    max-width: 640px;
    margin: 1.5rem auto;
    background: var(--carte);
    border: 1px solid var(--bord);
    touch-action: none;
}

/* --- Stats row (Ciao-style) --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-top: 1px solid var(--bord);
    border-bottom: 1px solid var(--bord);
}

.stats-row__item {
    padding: 2rem 1.5rem;
    text-align: center;
    border-right: 1px solid var(--bord);
}

.stats-row__item:last-child { border-right: 0; }

.stats-row__number {
    font-family: var(--font-1);
    font-weight: 900;
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--color-4);
    line-height: 1;
}

.stats-row__label {
    font-size: .8125rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-top: .5rem;
    color: var(--doux);
}

@media (max-width: 599px) {
    .stats-row { grid-template-columns: 1fr; }
    .stats-row__item { border-right: 0; border-bottom: 1px solid var(--bord); }
    .stats-row__item:last-child { border-bottom: 0; }
}

/* --- Footer musee --- */
.footer-musee {
    background: var(--color-3);
    color: var(--color-2);
    padding: var(--space-2) var(--space-1) 2.5rem;
}

.footer-musee__word {
    font-family: var(--font-1);
    font-weight: 900;
    font-size: min(15vw, 10rem);
    line-height: .92;
    text-transform: uppercase;
    letter-spacing: -.02em;
    margin-bottom: 3rem;
    color: var(--color-1);
    opacity: .08;
}

.footer-musee__cols {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2rem;
    padding-top: 2rem;
    border-top: 1px solid color-mix(in srgb, var(--color-2) 30%, transparent);
}

.footer-musee__cols h3 {
    font-family: var(--font-2);
    font-size: .8125rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: .9rem;
    color: var(--color-1);
}

.footer-musee__cols ul { list-style: none; padding: 0; margin: 0; }
.footer-musee__cols li { margin-bottom: .4rem; }
.footer-musee__cols a { text-decoration: none; color: var(--color-2); transition: color .25s; }
.footer-musee__cols a:hover { color: var(--color-4); }

.footer-musee__base {
    margin-top: 3rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    justify-content: space-between;
    font-size: .875rem;
}

@media (max-width: 899px) {
    .footer-musee__cols { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 599px) {
    .footer-musee__cols { grid-template-columns: 1fr; }
}

/* --- Accessibilite --- */
.evitement { position: absolute; left: -999px; }
.evitement:focus { left: 1rem; top: 1rem; z-index: 1000; background: var(--or); color: var(--fond); padding: .5rem 1rem; }

/* --- Scroll animations --- */

/* Slide-in from left/right */
[data-scroll-slide] {
    opacity: 0;
    transition: transform .8s cubic-bezier(.16,1,.3,1), opacity .8s;
}

[data-scroll-slide="left"] { transform: translateX(-80px); }
[data-scroll-slide="right"] { transform: translateX(80px); }
[data-scroll-slide="up"] { transform: translateY(60px); }

[data-scroll-slide].is-visible {
    opacity: 1;
    transform: translate(0);
}

/* Cards stagger entrance */
.carte {
    opacity: 0;
    transform: translateY(40px) rotate(-1deg);
    transition: transform .7s cubic-bezier(.16,1,.3,1), opacity .6s, box-shadow var(--transition);
    transition-delay: calc(var(--card-i, 0) * .1s);
}

.carte.is-visible {
    opacity: 1;
    transform: translateY(0) rotate(0);
}

.carte:hover {
    transform: translateY(-6px) rotate(0) !important;
    box-shadow: 0 20px 50px rgba(0,0,0,.4);
}

/* Floating decorative glyphs */
.scroll-glyph {
    position: absolute;
    font-family: var(--font-1);
    font-weight: 900;
    color: var(--color-4);
    opacity: .08;
    pointer-events: none;
    user-select: none;
    will-change: transform;
}

/* Marquee hover pause */
.marquee:hover .marquee__track {
    animation-play-state: paused;
}

/* Section headings will-change for parallax */
.section-musee h2 {
    will-change: transform;
}

/* Hero images will-change for parallax */
.ciao-hero__left img,
.ciao-hero__right img {
    will-change: transform;
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
    [data-scroll-slide], .carte { opacity: 1; transform: none; }
    .ciao-hero__left img, .ciao-hero__right img { transform: none !important; }
}
