@font-face { font-family: "Fredoka"; src: url("fonts/Fredoka.ttf"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/Nunito.ttf"); font-weight: 200 1000; font-display: swap; }

:root {
  --encre: #1B2559;      /* texte, boutons principaux */
  --gris: #59617F;       /* textes secondaires */
  --rouge: #E2001A;      /* prix CSE, remises */
  --jaune: #F6C343;      /* coups de cœur */
  --neige: #F3F6FB;      /* fond de page */
  --trait: #DDE3EE;      /* bordures */
  --bois: #E6C38E;       /* rails en hêtre */
  --bois-sombre: #C4955A;
  --rayon: 14px;
  --barre: 58px;
  --bleu: #1F5FAD;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--barre) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--neige); color: var(--encre); font: 400 1rem/1.55 "Nunito", system-ui, sans-serif; }
h1, h2, h3 { font-family: "Fredoka", "Nunito", sans-serif; line-height: 1.08; margin: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--bleu, #1F5FAD); outline-offset: 3px; border-radius: 6px; }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.evitement { position: absolute; left: 16px; top: -60px; background: var(--encre); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; }
.evitement:focus { top: 8px; }

/* ------------------------------------------------ boutons */
.b-acheter { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--encre); color: #fff;
             text-decoration: none; font: 600 .95rem "Fredoka"; padding: 9px 18px; border-radius: 999px; white-space: nowrap; }
.b-acheter:hover { background: #2A3A80; }
.b-acheter.grand { font-size: 1.15rem; padding: 14px 26px; }
.b-video { display: inline-flex; align-items: center; gap: 5px; background: #fff; color: var(--c); border: 2px solid var(--c);
           font: 600 .9rem "Fredoka"; padding: 7px 14px; border-radius: 999px; }
.b-video svg { width: 12px; height: 12px; fill: currentColor; }
.b-video:hover { background: var(--pale); }

/* ------------------------------------------------ barre */
.barre { position: sticky; top: 0; z-index: 20; height: var(--barre); display: flex; align-items: center; gap: 16px;
         padding: 0 max(16px, calc((100vw - 1240px) / 2)); background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
         border-bottom: 1px solid var(--trait); }
.marque { font: 500 1.05rem "Fredoka"; text-decoration: none; margin-right: auto; }
.marque b { font-weight: 700; color: #1F5FAD; }
.limite { margin: 0; font-size: .9rem; color: var(--gris); }
.limite b { color: var(--rouge); }

/* ------------------------------------------------ accueil */
.accueil { max-width: 1240px; margin: 0 auto; padding: 56px 16px 20px; }
.sur { margin: 0 0 10px; font-weight: 800; color: var(--rouge); }
.accueil h1 { font-weight: 700; font-size: clamp(2.7rem, 8.5vw, 6.2rem); letter-spacing: -.01em; max-width: 9.5em; }
.chapo { font-size: clamp(1.05rem, 2vw, 1.3rem); max-width: 34em; margin: 20px 0 0; color: #34406F; }
.chapo b { color: var(--rouge); }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin: 28px 0 0; }
.lien { font-weight: 700; text-underline-offset: 4px; }

/* ------------------------------------------------ circuit BRIO de l’en-tête */
.circuit { position: relative; overflow-x: auto; overflow-y: hidden; padding: 28px 0 40px; scrollbar-width: thin; }
.train { display: flex; align-items: flex-end; gap: 16px; width: max-content; margin: 0 auto; padding: 0 24px;
         animation: arrivee 1.8s cubic-bezier(.2,.7,.25,1) both; }
@keyframes arrivee { from { transform: translateX(70vw); } to { transform: none; } }
.voie { width: max-content; min-width: 100%; }
.rails { height: 22px; margin-top: -9px; width: 100%;
         background: linear-gradient(to bottom, var(--bois) 0 28%, var(--bois-sombre) 28% 40%, var(--bois) 40% 60%,
                     var(--bois-sombre) 60% 72%, var(--bois) 72%); border-radius: 4px; }

.loco { position: relative; width: 150px; height: 150px; flex: none; }
.loco .chaudiere { position: absolute; left: 0; bottom: 26px; width: 100px; height: 62px; background: var(--rouge); border-radius: 32px 10px 10px 32px; }
.loco .cheminee { position: absolute; left: 20px; bottom: 82px; width: 22px; height: 34px; background: var(--encre); border-radius: 5px 5px 0 0; }
.loco .cabine { position: absolute; right: 0; bottom: 26px; width: 58px; height: 104px; background: #1F5FAD; border-radius: 10px 10px 6px 6px; }
.loco .cabine::before { content: ""; position: absolute; left: 12px; right: 12px; top: 14px; height: 30px; background: #CFE0F6; border-radius: 6px; }
.loco .cabine::after { content: ""; position: absolute; left: -8px; right: -8px; top: -6px; height: 12px; background: var(--encre); border-radius: 6px; }
.loco .roues { position: absolute; left: 8px; right: 8px; bottom: 0; display: flex; justify-content: space-between; }

.roues i { width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle, #fff 0 4px, var(--encre) 5px); display: block; }
.wagon { position: relative; flex: none; width: 196px; display: flex; flex-direction: column; align-items: center; text-decoration: none; }
.wagon::before { content: ""; position: absolute; left: -17px; bottom: 34px; width: 18px; height: 7px; background: #3D4466; border-radius: 3px; }
.caisse { width: 100%; height: 128px; padding: 8px; background: #fff; border: 3px solid var(--c); border-bottom: 0; border-radius: 12px 12px 0 0; }
.caisse img { width: 100%; height: 100%; object-fit: contain; }
.plateau { width: 100%; background: var(--c); color: #fff; border-radius: 0 0 8px 8px; padding: 7px 12px 9px; display: flex; flex-direction: column; }
.plateau b { font: 600 1.1rem "Fredoka"; line-height: 1.1; }
.plateau small { font-weight: 700; font-size: .78rem; opacity: .9; }
.wagon .roues { display: flex; justify-content: space-between; width: 72%; margin-top: -6px; }
.wagon:hover .caisse, .wagon:focus-visible .caisse { transform: translateY(-5px); transition: transform .2s; }

/* ------------------------------------------------ comment commander */
.commander { max-width: 1240px; margin: 0 auto; padding: 24px 16px 8px; }
.commander h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 700; }
.etapes { list-style: none; counter-reset: etape; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.etapes li { counter-increment: etape; background: #fff; border: 1px solid var(--trait); border-radius: var(--rayon); padding: 16px 18px; }
.etapes li::before { content: counter(etape); display: block; font: 700 2rem/1 "Fredoka"; color: var(--rouge); margin-bottom: 8px; }
.etapes b { font-family: "Fredoka"; font-weight: 600; font-size: 1.08rem; }
.attente { margin: 16px 0 0; padding: 12px 16px; background: #FFF6DB; border-left: 5px solid var(--jaune); border-radius: 8px; font-weight: 700; }
.contact { margin: 14px 0 0; color: var(--gris); }
.contact b { color: var(--encre); }

/* ------------------------------------------------ outils de tri */
.catalogue { max-width: 1240px; margin: 0 auto; padding: 32px 16px 40px; }
.outils { position: sticky; top: var(--barre); z-index: 10; background: rgba(243,246,251,.96); backdrop-filter: blur(8px);
          margin: 0 -16px; padding: 12px 16px; border-bottom: 1px solid var(--trait); }
.puces { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.puce { flex: none; background: #fff; border: 2px solid var(--c, var(--encre)); color: var(--c, var(--encre)); border-radius: 999px;
        padding: 5px 14px; font: 600 .95rem "Fredoka"; }
.puce span { color: var(--encre); margin-left: 3px; }
.puce[aria-pressed="true"] { background: var(--c, var(--encre)); color: #fff; }
.puce[aria-pressed="true"] span { color: #fff; }
.reglages { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 10px; }
.recherche { flex: 1 1 260px; }
.recherche input, .tri select { width: 100%; font: inherit; color: var(--encre); background: #fff; border: 1.5px solid var(--trait); border-radius: 10px; padding: 8px 12px; }
.recherche input:focus, .tri select:focus { border-color: #1F5FAD; outline: none; box-shadow: 0 0 0 3px #CFE0F6; }
.coche { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.coche input { width: 18px; height: 18px; accent-color: var(--encre); }
.resultat { margin: 8px 0 0; font-size: .9rem; color: var(--gris); }
.vide { text-align: center; font-weight: 700; padding: 40px 0; }

/* ------------------------------------------------ gammes */
.univers { padding-top: 40px; }
.tete-univers { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; border-bottom: 4px solid var(--c); padding-bottom: 8px; margin-bottom: 20px; }
.tete-univers h2 { color: var(--c); font-size: clamp(2rem, 4.5vw, 2.8rem); font-weight: 700; }
.tete-univers p { margin: 0; color: var(--gris); }
.compte { font-weight: 800; color: var(--encre); }

.principe { display: grid; grid-template-columns: 1.25fr 1fr; gap: 28px; align-items: center; background: var(--pale);
            border-radius: 20px; padding: 24px 28px; margin-bottom: 24px; }
.principe h3 { color: var(--c); font-size: 1.45rem; font-weight: 700; margin-bottom: 8px; }
.principe p { margin: 8px 0 0; max-width: 38em; }
.lecteur { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--encre); }
.lecteur img { width: 100%; height: 100%; object-fit: cover; }
.lecteur .play { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -40px 0 0 -32px; border-radius: 50%; background: var(--c);
                 display: grid; place-items: center; }
.lecteur .play svg { width: 26px; height: 26px; fill: #fff; margin-left: 4px; }
.lecteur .legende { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 14px 10px; color: #fff; font-weight: 700; font-size: .88rem; text-align: left;
                    background: linear-gradient(transparent, rgba(27,37,89,.85)); }
.lecteur:hover .play { transform: scale(1.06); }

.grille { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 20px; grid-auto-flow: dense; }
.carte { display: flex; flex-direction: column; background: #fff; border: 1.5px solid var(--trait); border-radius: var(--rayon); padding: 10px 10px 14px; }
.carte .photo { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; padding: 14px; border: 0; border-radius: 10px; background: var(--pale); }
.carte .photo img { width: 100%; height: 100%; object-fit: contain; }
.remise { position: absolute; top: 6px; right: 6px; width: 58px; height: 58px; display: grid; place-items: center; background: var(--rouge); color: #fff;
          font: 700 .95rem "Fredoka"; transform: rotate(-9deg);
          clip-path: polygon(50% 0%, 59% 10%, 72% 5%, 76% 18%, 89% 19%, 87% 32%, 99% 39%, 91% 50%, 99% 61%, 87% 68%, 89% 81%, 76% 82%, 72% 95%, 59% 90%, 50% 100%, 41% 90%, 28% 95%, 24% 82%, 11% 81%, 13% 68%, 1% 61%, 9% 50%, 1% 39%, 13% 32%, 11% 19%, 24% 18%, 28% 5%, 41% 10%); }
.age { position: absolute; left: 8px; bottom: 8px; background: #fff; color: var(--c); border: 2px solid var(--c); border-radius: 8px; padding: 0 8px; font: 700 .85rem/1.5 "Fredoka"; }
.coeur { position: absolute; left: -6px; top: 10px; background: var(--jaune); color: var(--encre); font: 700 .85rem "Fredoka"; padding: 3px 10px; border-radius: 6px; transform: rotate(-5deg); }
.carte h3 { margin-top: 12px; font-size: 1.12rem; font-weight: 600; }
.carte h3 button { background: none; border: 0; padding: 0; text-align: left; }
.carte h3 button:hover { color: var(--c); text-decoration: underline; text-underline-offset: 3px; }
.carte .public { margin: 4px 0 0; color: var(--c); font-weight: 800; font-size: .85rem; }
.prix { display: flex; align-items: baseline; gap: 10px; margin: auto 0 0; padding-top: 12px; }
.prix strong { font: 700 1.9rem/1 "Fredoka"; color: var(--rouge); }
.prix strong span { font-size: .55em; vertical-align: .6em; }
.prix s { color: var(--gris); text-decoration-color: var(--rouge); text-decoration-thickness: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.comparer { margin-top: 10px; font-size: .84rem; color: var(--gris); text-underline-offset: 3px; }
.comparer:hover { color: var(--encre); }

.carte.coup { grid-column: span 2; border: 3px solid var(--jaune); background: #FFFCF2; }
.carte.coup .photo { aspect-ratio: 16 / 9; background: #fff; }
.carte.coup h3 { font-size: 1.45rem; font-weight: 700; color: var(--c); }
.carte.coup .prix strong { font-size: 2.4rem; }
.trie .carte.coup { grid-column: auto; }
.trie .carte.coup .photo { aspect-ratio: 4 / 3; }

/* ------------------------------------------------ fenêtres */
dialog { border: 0; padding: 0; border-radius: 20px; color: var(--encre); max-height: 92vh; }
dialog::backdrop { background: rgba(27, 37, 89, .6); }
.fermer { position: absolute; top: 10px; right: 10px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff;
          font-size: 1.6rem; line-height: 1; box-shadow: 0 0 0 1.5px var(--trait); }
.fiche { width: min(940px, calc(100vw - 32px)); }
.fiche[open] { animation: ouvre .22s ease-out; }
@keyframes ouvre { from { opacity: 0; transform: translateY(12px); } }
.fiche-corps { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; padding: 28px; }
.vitrine { background: var(--pale); border-radius: 14px; aspect-ratio: 1; padding: 20px; }
.vitrine img { width: 100%; height: 100%; object-fit: contain; }
.miniatures { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.miniatures button { width: 64px; height: 64px; padding: 3px; border: 2px solid var(--trait); border-radius: 10px; background: #fff; }
.miniatures button[aria-current="true"] { border-color: var(--c); }
.miniatures img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.fiche h2 { font-size: 1.8rem; font-weight: 700; color: var(--c); padding-right: 36px; }
.fiche .public { color: var(--c); font-weight: 800; margin: 6px 0 0; }
.fiche .desc { margin: 14px 0 0; }
.fiche .details { margin: 8px 0 0; color: var(--gris); font-size: .92rem; }
.fiche .refs { margin: 8px 0 0; color: var(--gris); font-size: .85rem; }
.fiche .prix { padding-top: 18px; }
.fiche .prix strong { font-size: 2.6rem; }
.fiche .remise-texte { color: var(--rouge); font-weight: 800; }

.cinema { width: min(1000px, calc(100vw - 24px)); background: #000; overflow: visible; }
.ecran { aspect-ratio: 16 / 9; }
.ecran iframe { width: 100%; height: 100%; border: 0; border-radius: 20px; display: block; }
.cinema .fermer { top: -18px; right: -12px; }

/* ------------------------------------------------ pied */
.pied { max-width: 1240px; margin: 0 auto; padding: 24px 16px 48px; color: var(--gris); font-size: .88rem; border-top: 1px solid var(--trait); }
.pied p { margin: 4px 0; max-width: 60em; }

/* ------------------------------------------------ petits écrans */
@media (max-width: 860px) {
  .etapes { grid-template-columns: repeat(2, 1fr); }
  .principe { grid-template-columns: 1fr; padding: 20px; }
  .fiche-corps { grid-template-columns: 1fr; padding: 20px; gap: 18px; }
  .vitrine { aspect-ratio: 4 / 3; }
}
@media (max-width: 560px) {
  .limite { display: none; }
  .accueil { padding-top: 32px; }
  .etapes { grid-template-columns: 1fr; gap: 8px; }
  .etapes li { display: grid; grid-template-columns: 30px 1fr; padding: 12px 14px; }
  .etapes li::before { margin: 0; font-size: 1.6rem; }
  .circuit { padding: 16px 0 28px; }
  .train { gap: 12px; padding: 0 16px; }
  .wagon { width: 138px; }
  .caisse { height: 92px; padding: 6px; }
  .plateau b { font-size: .95rem; }
  .loco { transform: scale(.75); transform-origin: bottom right; width: 112px; }
  .grille { grid-template-columns: 1fr 1fr; gap: 12px; }
  .carte { padding: 8px 8px 12px; }
  .carte h3 { font-size: 1rem; }
  .prix { flex-wrap: wrap; gap: 2px 8px; }
  .prix strong { font-size: 1.55rem; }
  .remise { width: 46px; height: 46px; font-size: .8rem; }
  .actions .b-acheter, .actions .b-video { padding: 6px 12px; font-size: .85rem; }
  .carte.coup .prix strong { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .train, .fiche[open] { animation: none; }
  .wagon:hover .caisse { transform: none; }
}
