/* John'cremental — page de présentation.
   Couleurs reprises de l'interface du jeu : parchemin, bois, laiton, encre. */

:root {
  --parchment: #f3e6c4;
  --parchment-2: #e8d5aa;
  --parchment-edge: #c9ad7a;
  --ink: #3b2a26;
  --ink-soft: #6b5446;
  --wood: #9a5a43;
  --wood-mid: #7a4a35;
  --wood-dark: #4a2f22;
  --night: #1f1820;
  --night-2: #2b2129;
  --brass: #d6a54a;
  --brass-light: #face6e;
  --brass-dark: #a8772f;
  --cream: #fff2d8;
  --red: #b13e53;
  --grass: #63c74d;
  --outline: #2a1d1a;
  --radius: 4px;
  --px: 3; /* agrandissement des sprites */
  --title: "MedievalSharp", Georgia, serif;
  --body: "Alegreya", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.15rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--title); font-weight: 400; line-height: 1.15; margin: 0 0 .6em; }
h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
.center { text-align: center; }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--brass); color: var(--outline); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Sprites du jeu (planches animées en CSS) ---------- */
.sprite {
  display: inline-block;
  image-rendering: pixelated;
  background-repeat: no-repeat;
  width: calc(var(--w) * var(--px) * 1px);
  height: calc(var(--h) * var(--px) * 1px);
  background-size: calc(var(--w) * var(--n, 1) * var(--px) * 1px) calc(var(--h) * var(--px) * 1px);
  animation: sprite-play var(--d, .9s) steps(var(--n, 1)) infinite;
  flex-shrink: 0;
}
@keyframes sprite-play {
  to { background-position-x: calc(var(--w) * var(--n, 1) * var(--px) * -1px); }
}
.sprite--goblin { --w: 18; --h: 16; --n: 8; --d: 1.1s; background-image: url(assets/sprites/goblin_idle.png); }
.sprite--goblin-run { --w: 20; --h: 18; --n: 8; --d: .7s; background-image: url(assets/sprites/goblin_run.png); }
.sprite--john { --w: 19; --h: 20; --n: 4; --d: .9s; background-image: url(assets/sprites/john_idle.png); }
.sprite--barnabe { --w: 19; --h: 19; --n: 9; --d: 1.6s; background-image: url(assets/sprites/barnabe_idle.png); }
.sprite--grandpa { --w: 18; --h: 26; --n: 4; --d: 1s; background-image: url(assets/sprites/grandpa_idle.png); }
.sprite--sage { --w: 21; --h: 37; --n: 6; --d: 1s; background-image: url(assets/sprites/sage.png); }
.sprite--chicken { --w: 16; --h: 19; --n: 4; --d: .8s; background-image: url(assets/sprites/chicken.png); }
.sprite--egg { --w: 10; --h: 11; background-image: url(assets/sprites/egg.png); animation: egg-pop 2.4s ease-in-out infinite; }
.sprite--coin { --w: 6; --h: 6; --px: 3; background-image: url(assets/sprites/coin.png); animation: none; }
.sprite--john-head { --w: 19; --h: 16; --px: 2; background-image: url(assets/sprites/john_head.png); animation: none; }
.sprite--crop { --w: 16; --h: 16; background-size: contain; background-position: center bottom; animation: none; }
.sprite--radish { background-image: url(assets/sprites/radish.png); }
.sprite--sunflower { background-image: url(assets/sprites/sunflower.png); }
.sprite--potato { background-image: url(assets/sprites/potato.png); }
@keyframes egg-pop {
  0%, 20% { transform: scale(0); opacity: 0; }
  30%, 75% { transform: scale(1); opacity: 1; }
  100% { transform: translateY(-24px); opacity: 0; }
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55em;
  font-family: var(--title); font-size: 1.1rem; text-decoration: none;
  padding: .7em 1.2em; border-radius: var(--radius);
  border: 3px solid var(--outline);
  box-shadow: 0 4px 0 var(--outline), inset 0 -4px 0 rgb(0 0 0 / .15), inset 0 3px 0 rgb(255 255 255 / .25);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  cursor: pointer;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--outline), inset 0 -4px 0 rgb(0 0 0 / .15), inset 0 3px 0 rgb(255 255 255 / .25); filter: brightness(1.05); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--outline), inset 0 -2px 0 rgb(0 0 0 / .15); }
.btn:focus-visible, .lang:focus-visible, .gallery__item:focus-visible, summary:focus-visible { outline: 3px solid var(--brass-light); outline-offset: 3px; }
.btn--brass { background: linear-gradient(var(--brass-light), var(--brass)); color: var(--outline); }
.btn--ghost { background: rgb(42 29 26 / .75); color: var(--cream); border-color: var(--brass); box-shadow: 0 4px 0 var(--outline); }
.btn--big { font-size: 1.25rem; padding: .8em 1.4em; }
.btn--small { font-size: .95rem; padding: .45em .9em; box-shadow: 0 3px 0 var(--outline); }
.btn__icon { font-size: .95em; }
.btn.is-soon { filter: saturate(.85); }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(var(--wood-mid), var(--wood-dark));
  border-bottom: 3px solid var(--outline);
  box-shadow: 0 2px 0 rgb(0 0 0 / .3);
}
.topbar__inner { display: flex; align-items: center; gap: 24px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--cream); }
.brand__name { font-family: var(--title); font-size: 1.35rem; text-shadow: 2px 2px 0 var(--outline); }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { color: var(--parchment); text-decoration: none; font-weight: 600; }
.nav a:hover { color: var(--brass-light); }
.topbar__actions { display: flex; align-items: center; gap: 12px; }
.lang {
  font: 600 .9rem var(--body); color: var(--parchment); background: transparent;
  border: 2px solid var(--parchment-edge); border-radius: var(--radius); padding: .25em .55em; cursor: pointer;
}
.lang:hover { color: var(--brass-light); border-color: var(--brass-light); }

/* ---------- Haut de page ---------- */
.hero { position: relative; min-height: min(88vh, 760px); display: grid; align-items: end; overflow: hidden; background: var(--night); }
.hero__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.hero__shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgb(31 24 32 / .92) 0%, rgb(31 24 32 / .7) 38%, rgb(31 24 32 / 0) 70%),
    linear-gradient(0deg, rgb(31 24 32 / .9) 0%, rgb(31 24 32 / 0) 45%);
}
.hero__content { position: relative; padding: 120px 0 64px; color: var(--cream); max-width: 1160px; }
.hero__content > * { max-width: 600px; }
.hero__content > .hero__title { max-width: none; }
.eyebrow { font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .82rem; color: var(--brass-light); margin-bottom: .8em; }
.eyebrow--ink { color: var(--wood); }
.hero__title {
  font-size: clamp(2.3rem, 10vw, 5.6rem); margin-bottom: .15em; color: var(--brass-light); white-space: nowrap;
  text-shadow: 4px 4px 0 var(--outline), 0 0 40px rgb(250 206 110 / .25);
}
.hero__tagline { font-family: var(--title); font-size: clamp(1.35rem, 2.6vw, 1.8rem); color: var(--cream); margin-bottom: .6em; }
.hero__text { font-size: 1.2rem; color: var(--parchment); }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin: 26px 0 22px; max-width: none !important; }
.badges { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; max-width: none !important; }
.badges li {
  font-size: .95rem; font-weight: 600; color: var(--parchment);
  padding: .3em .8em; border: 2px solid rgb(250 206 110 / .5); border-radius: 999px; background: rgb(31 24 32 / .5);
}

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 9vw, 112px) 0; position: relative; }
.section--parchment {
  background:
    radial-gradient(circle at 20% 10%, rgb(255 255 255 / .35), transparent 40%),
    var(--parchment);
  color: var(--ink);
}
.section--wood {
  background:
    repeating-linear-gradient(0deg, rgb(0 0 0 / .06) 0 2px, transparent 2px 18px),
    linear-gradient(var(--wood-mid), var(--wood-dark));
  color: var(--cream);
}
.section--wood h2, .section--night h2 { color: var(--brass-light); text-shadow: 3px 3px 0 var(--outline); }
.section--night { background: var(--night); color: var(--parchment); }
.section--parchment h2 { color: var(--wood-dark); }

/* Cadre de tableau autour des captures */
.frame {
  margin: 0; padding: 10px; background: var(--wood);
  border: 4px solid var(--outline); border-radius: var(--radius);
  box-shadow: 0 10px 0 rgb(42 29 26 / .25), inset 0 0 0 3px var(--brass-dark);
}
.frame img { border: 3px solid var(--outline); width: 100%; }
.frame figcaption { color: var(--cream); font-style: italic; text-align: center; padding-top: 8px; font-size: 1rem; }
.frame--tilt { transform: rotate(-1.5deg); }
.frame--tilt-right { transform: rotate(1.5deg); }

.split { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(32px, 5vw, 64px); align-items: center; }
.split__text p { font-size: 1.2rem; }
.cast { display: flex; align-items: flex-end; gap: 22px; margin-top: 28px; }
.cast--big { justify-content: center; --px: 4; margin: 0 0 24px; }

/* Boucle de jeu */
.loop { list-style: none; padding: 0; margin: 48px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; counter-reset: none; }
.card {
  background: var(--parchment); color: var(--ink);
  border: 4px solid var(--outline); border-radius: var(--radius);
  padding: 20px 20px 22px; box-shadow: 0 6px 0 var(--outline), inset 0 0 0 3px var(--parchment-edge);
  position: relative;
}
.card:not(:last-child)::after {
  content: "➜"; position: absolute; right: -20px; top: 56px; transform: translateX(50%);
  color: var(--brass-light); font-size: 1.4rem; text-shadow: 2px 2px 0 var(--outline); z-index: 1;
}
.card__art {
  height: 124px; display: flex; align-items: flex-end; justify-content: center; gap: 10px;
  background: linear-gradient(#8fd17a, #63c74d); border: 3px solid var(--outline); border-radius: var(--radius);
  margin-bottom: 16px; padding-bottom: 10px;
}
.card h3 { color: var(--wood-dark); display: flex; align-items: center; gap: 8px; }
.card p { font-size: 1.05rem; margin: 0; }
.step {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0;
  font-family: var(--title); font-size: 1rem; color: var(--outline);
  background: linear-gradient(var(--brass-light), var(--brass)); border: 2px solid var(--outline); border-radius: 50%;
}

/* Points forts */
.features { display: grid; gap: clamp(56px, 8vw, 96px); }
.feature { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.feature--flip .frame { order: 2; }
.feature__text p { font-size: 1.2rem; }
.feature__text .sprite { margin-bottom: 14px; --px: 4; }

/* Galerie */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.gallery__item {
  padding: 0; border: 4px solid var(--outline); border-radius: var(--radius); background: var(--wood);
  cursor: zoom-in; overflow: hidden; box-shadow: 0 6px 0 rgb(0 0 0 / .4);
}
.gallery__item img { transition: transform .3s ease; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.gallery__item:hover img { transform: scale(1.04); }
.gallery__item--wide { grid-column: 1 / -1; }

.lightbox { padding: 0; border: 4px solid var(--outline); border-radius: var(--radius); background: var(--night); max-width: min(1280px, 94vw); }
.lightbox::backdrop { background: rgb(15 10 14 / .85); }
.lightbox img { width: 100%; }
.lightbox__close {
  position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--outline); background: var(--brass); color: var(--outline); font-size: 1.1rem; cursor: pointer;
}

/* Démo */
.demo { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(32px, 5vw, 64px); align-items: center; }
.demo__text p { font-size: 1.2rem; color: var(--parchment); }
.facts { list-style: none; padding: 0; margin: 0 0 28px; display: grid; grid-template-columns: repeat(2, auto); gap: 10px 28px; justify-content: start; }
.facts li { display: flex; align-items: center; gap: 10px; font-weight: 600; }

/* Liste de souhaits */
.wishlist { text-align: center; }
.wishlist__inner { max-width: 760px; }
.wishlist p { font-size: 1.2rem; }
.wishlist .btn { margin-top: 10px; }
.note { margin-top: 18px; font-style: italic; color: var(--ink-soft); }

/* FAQ */
.faq { max-width: 820px; }
.faq h2 { margin-bottom: 36px; }
.faq details {
  background: var(--night-2); border: 3px solid #3d2f37; border-radius: var(--radius);
  margin-bottom: 12px; padding: 0 20px;
}
.faq summary {
  cursor: pointer; font-family: var(--title); font-size: 1.2rem; color: var(--cream);
  padding: 16px 0; list-style: none; display: flex; justify-content: space-between; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brass-light); font-size: 1.4rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--parchment); padding-bottom: 6px; }

/* Pied de page */
.footer { background: var(--wood-dark); border-top: 3px solid var(--outline); color: var(--parchment); padding: 40px 0; }
.footer__inner { display: grid; gap: 10px; justify-items: center; text-align: center; }
.footer__links { display: flex; gap: 22px; margin: 6px 0; }
.footer__links a { color: var(--brass-light); font-weight: 600; text-decoration: none; }
.footer__small { font-size: .9rem; opacity: .8; margin: 0; }

/* Apparition au défilement */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Écrans plus étroits ---------- */
@media (max-width: 980px) {
  .loop { grid-template-columns: repeat(2, 1fr); }
  .card:nth-child(2)::after { display: none; }
}
@media (max-width: 820px) {
  .nav { display: none; }
  .topbar__actions { margin-left: auto; }
  .split, .feature, .demo { grid-template-columns: 1fr; }
  .feature--flip .frame { order: 0; }
  /* La vidéo au-dessus du texte, dans ses proportions (sinon elle serait trop zoomée). */
  .hero { display: block; min-height: auto; }
  .hero__video { position: relative; height: auto; aspect-ratio: 16 / 9; }
  .hero__shade { inset: 0 0 auto; height: calc((100vw) * 9 / 16); background: linear-gradient(0deg, rgb(31 24 32 / 1) 0%, rgb(31 24 32 / 0) 35%); }
  .hero__content { padding: 8px 0 48px; }
}
@media (max-width: 560px) {
  :root { --px: 2.5; }
  body { font-size: 1.05rem; }
  .brand__name { font-size: 1.1rem; }
  .topbar .btn--small { display: none; }
  .loop { grid-template-columns: 1fr; }
  .card::after { display: none; }
  .gallery { grid-template-columns: 1fr; }
  .btn--big { width: 100%; justify-content: center; }
  .facts { grid-template-columns: 1fr; }
  .frame--tilt, .frame--tilt-right { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sprite, .sprite--egg { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .gallery__item img { transition: none; }
}
