/* =====================================================
   rflh.fr : la feuille de style du site

   Sommaire
   1. Couleurs et polices
   2. Bases
   3. Menu, bas de page et petits messages
   4. Accueil : logo et présentation
   5. Accueil : autocollants
   6. Accueil : gros boutons
   7. Accueil : bouton inutile
   8. Page Moi
   9. Page Projets
   10. Salle de jeux
   11. Page Contact
   12. Secrets (confettis et mode disco)
   13. Téléphone
   14. Accessibilité : moins d'animations
   ===================================================== */


/* ---------- 1. Couleurs et polices ----------
   Pour changer une couleur sur tout le site, modifie-la ici. */
:root {
  --creme: #f5ead9;      /* fond */
  --brun: #3e3428;       /* texte et logo */
  --blanc: #fffaf0;      /* contour des autocollants */
  --rouge: #e8553d;
  --jaune: #f2b632;
  --vert: #3f9b6c;
  --bleu: #3d6fd9;
  --ombre: #3e342844;    /* brun transparent */

  --police-titre: "Bagel Fat One", "Arial Black", sans-serif;
  --police-texte: "Patrick Hand", "Comic Sans MS", cursive;
}

/* Classes de couleur : à ajouter sur un élément dans le HTML.
   --fond = sa couleur, --encre = la couleur de son texte. */
.rouge { --fond: var(--rouge); --encre: var(--creme); }
.jaune { --fond: var(--jaune); --encre: var(--brun); }
.vert  { --fond: var(--vert);  --encre: var(--brun); }
.bleu  { --fond: var(--bleu);  --encre: var(--creme); }


/* ---------- 2. Bases ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--creme);
  color: var(--brun);
  font: 1.3rem/1.4 var(--police-texte);
  overflow-x: hidden;
}

/* Contour visible quand on navigue au clavier */
:focus-visible {
  outline: 4px dashed var(--bleu);
  outline-offset: 4px;
}


/* ---------- 3. Menu, bas de page et petits messages ---------- */
nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  padding: 1rem;
}

nav a {
  color: inherit;
  text-decoration: none;
  padding: .25rem 1rem;
  border: 3px solid transparent;
  border-radius: 99px;
}

nav a:hover,
nav a[aria-current] {       /* page affichée */
  border-color: var(--brun);
}

footer {
  text-align: center;
  padding: 1.5rem;
}

/* Petit message en bas de l'écran */
#toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  translate: -50% 200%;
  visibility: hidden;
  z-index: 20;
  width: max-content;
  max-width: 92vw;
  padding: .6rem 1.2rem;
  text-align: center;
  background: var(--brun);
  color: var(--creme);
  border: 3px solid var(--creme);
  border-radius: 99px;
}

#toast.vu {
  translate: -50% 0;
  visibility: visible;
}


/* ---------- 4. Accueil : logo et présentation ---------- */
.terrain {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: min(78vh, 640px);
  padding: 9rem 1.25rem;
  text-align: center;
}

#logo {
  display: block;
  width: min(720px, 88vw);
  background: none;
  border: 0;
  cursor: pointer;
}

#logo img {
  display: block;
  width: 100%;
}

#logo.saute {
  animation: saute .45s;
}

@keyframes saute {
  30% { transform: scale(1.08, .9); }
  60% { transform: scale(.95, 1.07) rotate(-3deg); }
}

.intro {
  max-width: 30ch;
  margin-top: 1.5rem;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}

.aide {
  margin-top: .75rem;
  font-size: 1.1rem;
  opacity: .8;
}


/* ---------- 5. Accueil : autocollants ---------- */
.sticker {
  position: absolute;
  z-index: 2;
  padding: .7rem 1.1rem;
  background: var(--fond);
  color: var(--encre);
  font: 1.5rem/1.15 var(--police-titre);
  border: 6px solid var(--blanc);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--ombre);
  rotate: var(--angle);
  cursor: grab;
  user-select: none;
  touch-action: none;    /* permet de les glisser au doigt */
}

.sticker:active {
  cursor: grabbing;
  scale: 1.08;
  box-shadow: 0 14px 18px var(--ombre);
}

.sticker svg {
  display: block;
  width: 100%;
}

/* Place et angle de chaque autocollant (s1 à s6) */
.s1 { --angle: -11deg; top: 8%;    left: 8%;   font-size: 2.4rem; }
.s2 { --angle: 12deg;  top: 6%;    right: 9%;  width: 140px; border-radius: 50px; }
.s3 { --angle: 7deg;   bottom: 14%; left: 5%; }
.s4 { --angle: -7deg;  bottom: 12%; right: 6%; font-size: 1.15rem; }
.s5 { --angle: 15deg;  top: 2%;    left: 46%;  font-size: 1.1rem; }
.s6 { --angle: -14deg; bottom: 3%; right: 24%; width: 84px; }

.rond {
  display: grid;
  place-content: center;
  width: 106px;
  height: 106px;
  padding: 0;
  border-radius: 50%;
}


/* ---------- 6. Accueil : gros boutons ---------- */
.portes {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

.porte {
  padding: 1.5rem;
  background: var(--fond);
  color: var(--encre);
  text-decoration: none;
  border: 4px solid var(--brun);
  box-shadow: 7px 7px 0 var(--brun);
  transition: translate .1s, box-shadow .1s, rotate .1s;
}

.porte strong {
  display: block;
  font: 400 clamp(1.9rem, 5vw, 3rem)/1.1 var(--police-titre);
}

.porte:hover {
  rotate: -1.5deg;
}

.porte:active {
  translate: 7px 7px;
  box-shadow: 0 0 0 var(--brun);
}

/* Taille et forme de chaque bouton */
.porte:nth-child(1) { grid-column: span 7; border-radius: 40px 8px; }
.porte:nth-child(2) { grid-column: span 5; border-radius: 8px; }
.porte:nth-child(3) { grid-column: span 5; border-radius: 99px; text-align: center; }
.porte:nth-child(4) { grid-column: span 7; border-radius: 8px 40px; }


/* ---------- 7. Accueil : bouton inutile ---------- */
.inutile {
  margin-top: 4rem;
  padding: 4rem 1.25rem;
  text-align: center;
  background: var(--brun);
  color: var(--creme);
}

.inutile h2 {
  font: 400 clamp(1.8rem, 5vw, 3rem)/1.2 var(--police-titre);
}

#rien {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 2rem;
  font: 1.8rem var(--police-titre);
  background: var(--rouge);
  color: var(--creme);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 14px 0 #a3321f;
  cursor: pointer;
}

#rien:active {
  top: 12px;
  box-shadow: 0 2px 0 #a3321f;
}

#reponse {
  min-height: 3em;
}


/* ---------- 8. Page Moi ---------- */
.fiche {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.fiche section {
  margin-top: 4rem;
}

.fiche h2 {
  margin-bottom: 1.25rem;
  font: 400 clamp(1.7rem, 5vw, 2.4rem)/1.2 var(--police-titre);
}

.fiche ul {
  list-style: none;
}

/* Carte avec le prénom */
.perso {
  margin-top: 1.5rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--brun);
  color: var(--creme);
  border-radius: 60px 12px;
}

.perso h1 {
  font: 400 clamp(3rem, 13vw, 6rem)/1.1 var(--police-titre);
}

.perso p {
  font-size: 1.6rem;
}

/* Jeux préférés */
.aide-jeux {
  margin: -.75rem 0 1.25rem;
}

.jeux {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.jeu {
  display: grid;
  place-content: center;
  width: 100%;
  min-height: 150px;
  padding: 1rem;
  text-align: center;
  background: var(--fond);
  color: var(--encre);
  font: 1.7rem/1.2 var(--police-titre);
  border: 7px solid var(--blanc);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ombre);
  rotate: -2deg;
  cursor: pointer;
  transition: rotate .15s, scale .15s;
}

.jeux li:nth-child(even) .jeu {
  rotate: 2deg;
}

.jeux li .jeu:hover {
  rotate: 0deg;
  scale: 1.04;
}

/* Fenêtre qui s'ouvre quand on clique sur un jeu */
.fenetre {
  margin: auto;
  width: min(560px, 92vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--creme);
  color: var(--brun);
  border: 5px solid var(--brun);
  border-radius: 28px;
}

.fenetre::backdrop {
  background: #3e3428cc;
}

.fenetre[open] {
  animation: ouvrir .45s cubic-bezier(.2, 1.4, .4, 1);
}

@keyframes ouvrir {
  from { transform: scale(.2) rotate(-12deg); opacity: 0; }
}

.fenetre-titre {
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--fond);
  color: var(--encre);
}

.fenetre-titre h2 {
  margin: 0;
  font: 400 clamp(2rem, 8vw, 3rem)/1.15 var(--police-titre);
}

.fenetre-corps {
  padding: 1.5rem;
  text-align: center;
}

.fenetre-corps > * + * {
  margin-top: 1.25rem;
}

.fenetre-heures {
  font: 1.4rem/1.3 var(--police-titre);
}

.fenetre-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.bouton {
  padding: .5rem 1.4rem;
  background: var(--creme);
  color: var(--brun);
  font: 1.3rem var(--police-texte);
  text-decoration: none;
  border: 4px solid var(--brun);
  border-radius: 99px;
  box-shadow: 4px 4px 0 var(--brun);
  cursor: pointer;
}

/* Compétences */
.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.skills li {
  padding: .5rem 1.5rem;
  font-size: 1.6rem;
  border: 4px solid var(--brun);
  border-radius: 99px;
  box-shadow: 5px 5px 0 var(--brun);
}

/* Point faible */
.fiche .faible {
  margin-bottom: 3rem;
  text-align: center;
}

#python {
  margin-bottom: 1rem;
  padding: .6rem 1.6rem;
  background: var(--jaune);
  color: var(--brun);
  font: 1.8rem var(--police-titre);
  border: 4px solid var(--brun);
  border-radius: 14px;
  cursor: pointer;
  transition: translate .2s;
}


/* ---------- 9. Page Projets ---------- */
.projet {
  overflow: hidden;
  border: 4px solid var(--brun);
  border-radius: 40px 10px;
  box-shadow: 8px 8px 0 var(--brun);
}

.fiche .projet h2 {
  margin: 0;
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--fond);
  color: var(--encre);
}

.projet-corps {
  padding: 1.5rem;
  text-align: center;
}

.projet-corps .bouton {
  display: inline-block;
  margin-top: 1.25rem;
}

/* Animations des blocs de projets */
.projet {
  animation: arriver .6s cubic-bezier(.2, 1.4, .4, 1) backwards;
  transition: translate .2s, rotate .2s, box-shadow .2s;
}

.projet + .projet {
  margin-top: 2.5rem;
}

@keyframes arriver {
  from { transform: translateY(60px) rotate(4deg) scale(.85); opacity: 0; }
}

/* Au survol (ou au clavier), le bloc se soulève */
.projet:hover,
.projet:focus-within {
  translate: 0 -8px;
  rotate: -1deg;
  box-shadow: 14px 16px 0 var(--brun);
}

/* ... et son titre se trémousse */
.projet:hover h2,
.projet:focus-within h2 {
  animation: tremousser .5s;
}

@keyframes tremousser {
  25% { letter-spacing: .08em; rotate: -3deg; }
  50% { rotate: 3deg; }
  75% { rotate: -1deg; }
}

.projet-corps .bouton {
  transition: scale .15s, background-color .15s;
}

.projet-corps .bouton:hover {
  scale: 1.1;
  background: var(--jaune);
}

.fiche .suite {
  margin-bottom: 3rem;
  text-align: center;
}


/* ---------- 10. Salle de jeux ---------- */
.snake {
  max-width: 540px;
  margin: 1.5rem auto 0;
  text-align: center;
}

.snake-scores {
  font: 1.4rem var(--police-titre);
  margin-bottom: .75rem;
}

.snake-terrain {
  position: relative;
  border: 6px solid var(--brun);
  border-radius: 18px;
  overflow: hidden;
  background: var(--brun);
  box-shadow: 8px 8px 0 var(--ombre);
}

#snake {
  display: block;
  width: 100%;
  touch-action: none;       /* glisser sans faire défiler la page */
}

/* Écran affiché avant, pendant la pause et après une partie */
.snake-voile {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 1rem;
  background: #3e3428d9;
  color: var(--creme);
  font: 1.7rem var(--police-titre);
}

.snake-voile[hidden] {
  display: none;
}

/* Flèches en forme de croix */
.manette {
  display: grid;
  grid-template-areas: ". haut ." "gauche pause droite" ". bas .";
  justify-content: center;
  gap: .6rem;
  margin-top: 1.25rem;
  touch-action: manipulation;
}

.manette [data-sens="haut"]   { grid-area: haut; }
.manette [data-sens="gauche"] { grid-area: gauche; }
.manette [data-sens="droite"] { grid-area: droite; }
.manette [data-sens="bas"]    { grid-area: bas; }
.manette #snake-pause         { grid-area: pause; }

.mur {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.gros-bouton {
  min-height: 120px;
  padding: .75rem;
  background: var(--fond);
  color: var(--encre);
  font: 1.4rem var(--police-titre);
  border: 5px solid var(--brun);
  border-radius: 30px;
  box-shadow: 0 10px 0 var(--brun);
  cursor: pointer;
  transition: rotate .15s, scale .2s;
}

.gros-bouton:hover {
  rotate: -3deg;
}

.gros-bouton:active {
  translate: 0 8px;
  box-shadow: 0 2px 0 var(--brun);
}

.fiche .mur-section {
  margin-bottom: 3rem;
  text-align: center;
}

#mur-reponse {
  min-height: 3em;
  margin-top: 1.75rem;
  font-size: 1.6rem;
}

main {
  transition: rotate .4s;
}

main.penche {
  rotate: 4deg;
}


/* ---------- 11. Page Contact ---------- */
.pseudo {
  text-align: center;
}

.pseudo-nom {
  margin-bottom: 1.25rem;
  font: clamp(3rem, 14vw, 5rem)/1.2 var(--police-titre);
  font-variant-ligatures: none;   /* le pseudo reste lisible lettre par lettre */
}

.liens {
  display: grid;
  gap: 1.5rem;
}

.liens .porte:nth-child(n) {
  grid-column: 1;           /* tous les liens sur la même largeur */
}

.fiche .encart {
  margin-bottom: 3rem;
  padding: 1.5rem;
  text-align: center;
  border: 4px dashed var(--brun);
  border-radius: 24px;
}


/* ---------- 12. Secrets (confettis et mode disco) ---------- */
.confetti {
  position: fixed;
  top: -20px;
  z-index: 15;
  width: 12px;
  height: 18px;
  pointer-events: none;
  animation: tombe linear forwards;
}

@keyframes tombe {
  to { transform: translateY(110vh) rotate(720deg); }
}

body.disco .sticker,
body.disco .porte {
  animation: disco .6s infinite alternate;
}

@keyframes disco {
  to { filter: hue-rotate(180deg); transform: scale(1.05); }
}


/* ---------- 13. Téléphone ---------- */
@media (max-width: 700px) {
  .terrain { padding: 8.5rem 1.25rem; }

  .porte:nth-child(n) { grid-column: span 12; }

  .sticker { font-size: 1rem; border-width: 4px; }

  .s1 { top: 2%; left: 4%; font-size: 1.5rem; }
  .s2 { top: 2%; right: 4%; width: 92px; }
  .s3 { bottom: 4%; left: 3%; }
  .s4 { bottom: 3%; right: 3%; font-size: .8rem; }
  .s5 { top: 3%; left: 40%; width: 78px; height: 78px; font-size: .85rem; }
  .s6 { bottom: 10%; right: 40%; width: 70px; padding: .7rem; }
}

@media (max-width: 600px) {
  .jeux { grid-template-columns: 1fr; }
  .mur { grid-template-columns: 1fr 1fr; }
}


/* ---------- 14. Accessibilité : moins d'animations ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}
