/* =====================================================
   RESET
   ===================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: #80c9e5;

  font-family: Arial, sans-serif;

  user-select: none;
}


/* =====================================================
   POLICE OLIVER
   ===================================================== */

@font-face {
  font-family: "Oliver";

  src: url("assets/Oliver-Regular.ttf")
    format("truetype");

  font-weight: normal;
  font-style: normal;
}


/* =====================================================
   JEU
   ===================================================== */

#game {
  position: relative;

  width: 100vw;
  height: 100dvh;

  overflow: hidden;

  background: #80c9e5;
}


/* =====================================================
   CIEL
   ===================================================== */

#sky {
  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  overflow: hidden;
}


/* =====================================================
   NUAGES
   ===================================================== */

#cloud-layer {
  position: absolute;

  top: 50%;
  left: -100vw;

  width: 300vw;
  height: auto;

  display: flex;

  will-change: transform;
}


.cloud-tile {
  position: relative;

  flex: 0 0 100vw;

  width: 100vw;
  height: auto;

  overflow: visible;
}


.cloud-tile img {
  position: absolute;

  top: 0;
  left: 0;

  width: 100vw;
  height: auto;

  display: block;

  pointer-events: none;
}


/* =====================================================
   PERSONNAGE + AVION
   ===================================================== */

#player {
  position: absolute;

  left: 50%;
  top: 50%;

  z-index: 10;

  width: clamp(220px, 28vw, 420px);

  transform: translate(-50%, -50%);

  pointer-events: none;
}


#player img {
  display: block;

  width: 100%;
  height: auto;
}


/* =====================================================
   BOUTONS GAUCHE / DROITE
   ===================================================== */

.control {
  position: absolute;

  z-index: 20;

  bottom: clamp(20px, 5vh, 60px);

  width: clamp(55px, 6vw, 95px);
  height: clamp(55px, 6vw, 95px);

  padding: 0;

  border: none;
  background: transparent;

  cursor: pointer;

  touch-action: none;

  -webkit-tap-highlight-color: transparent;

  transition: transform 0.08s ease;
}


.control img {
  width: 100%;
  height: 100%;

  display: block;

  pointer-events: none;
}


.control.left {
  left: clamp(15px, 3vw, 45px);
}


.control.right {
  right: clamp(15px, 3vw, 45px);
}


.control:active {
  transform: scale(0.9);
}


/*
   Empêche le halo bleu de sélection
   / focus qui reste affiché sur
   mobile lors d'un appui long sur
   les boutons gauche/droite.
*/

.control:focus,
.control:focus-visible {
  outline: none;
}

.control,
.control img {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}


/* =====================================================
   BOUTONS DU HAUT
   ===================================================== */

.top-button {
  position: absolute;

  z-index: 30;

  top: clamp(13px, 2.5vh, 28px);

  width: clamp(30px, 3vw, 48px);
  height: clamp(30px, 3vw, 48px);

  padding: 0;

  border: none;
  background: transparent;

  display: flex;

  align-items: center;
  justify-content: center;

  cursor: pointer;

  -webkit-tap-highlight-color: transparent;
}


.top-button img {
  width: 100%;
  height: 100%;

  display: block;

  pointer-events: none;
}


/* =====================================================
   HOME
   ===================================================== */

.top-button.home {
  left: clamp(12px, 2.5vw, 35px);

  text-decoration: none;
}


/* =====================================================
   SETTINGS
   ===================================================== */

.top-button.settings {
  right: clamp(12px, 2.5vw, 35px);

  display: flex;
}


/* =====================================================
   CLOSE
   ===================================================== */

/*
   Caché sur la page principale.
   Il apparaît uniquement dans My Skills.
*/

#closeSkills {
  display: none;

  right: clamp(12px, 2.5vw, 35px);
}


/* =====================================================
   NAVIGATION DU HAUT
   ===================================================== */

#top-nav {
  position: absolute;

  z-index: 30;

  left: 50%;

  /*
     Légèrement descendu pour être
     au milieu des boutons Home / Settings.
  */

  top: clamp(22px, 3.5vh, 38px);

  transform: translateX(-50%);

  display: flex;

  align-items: center;
  justify-content: center;

  gap: clamp(18px, 3.5vw, 55px);

  width: max-content;

  white-space: nowrap;
}


/* =====================================================
   LIENS
   ===================================================== */

#top-nav a {
  position: relative;

  font-family: "Oliver", sans-serif;

  font-size: clamp(
    14px,
    1.7vw,
    25px
  );

  font-weight: normal;

  line-height: 1;

  color: white;

  text-decoration: none;

  padding-bottom: 5px;

  transition: none;
}


/* =====================================================
   SOULIGNEMENT
   ===================================================== */

#top-nav a::after {
  content: "";

  position: absolute;

  left: 0;
  bottom: 0;

  width: 100%;
  height: 2px;

  background: white;

  opacity: 0;
}


#top-nav a:hover::after {
  opacity: 1;
}


/* =====================================================
   MY SKILLS
   ===================================================== */

#skills-section {
  position: absolute;

  inset: 0;

  z-index: 40;

  display: none;

  background: #87CEEB;

  overflow: hidden;

  font-family: "Oliver", sans-serif;
}


/* =====================================================
   CONTENEUR SKILLS
   ===================================================== */

.skills-container {
  position: absolute;

  left: 50%;
  top: 50%;

  transform: translate(-50%, -50%);

  width: min(850px, 75vw);

  display: flex;

  flex-direction: column;

  gap: clamp(18px, 3vh, 32px);
}


/* =====================================================
   SKILL
   ===================================================== */

.skill {
  width: 100%;
}


/* =====================================================
   TITRE SKILL
   ===================================================== */

.skill h2 {
  margin-bottom: 7px;

  color: white;

  font-size: clamp(
    18px,
    2vw,
    28px
  );

  font-weight: normal;

  line-height: 1;
}


/* =====================================================
   BARRE BLANCHE
   ===================================================== */

.skill-bar {
  position: relative;

  width: 100%;

  height: clamp(
    18px,
    2.2vw,
    28px
  );

  background: white;

  overflow: visible;
}


/* =====================================================
   PROGRESSION VERTE
   ===================================================== */

.skill-progress {
  height: 100%;

  background: #6CA265;
}


/* =====================================================
   DIALOGUE ABOUT ME
   ===================================================== */

#dialogue {
  position: absolute;

  left: 50%;
  bottom: clamp(25px, 5vh, 60px);

  z-index: 50;

  width: min(
    850px,
    calc(100vw - 40px)
  );

  transform: translateX(-50%);

  display: flex;

  align-items: flex-end;

  pointer-events: none;
}


/* =====================================================
   BOÎTE DE DIALOGUE
   ===================================================== */

#dialogue-box {
  position: relative;

  width: 100%;

  min-height: clamp(
    120px,
    16vh,
    180px
  );

  padding: clamp(
    25px,
    3vw,
    40px
  );

  padding-left: clamp(
    100px,
    12vw,
    150px
  );

  background: #6CA265;

  color: white;

  font-family: "Oliver", sans-serif;

  font-size: clamp(
    18px,
    2vw,
    28px
  );

  line-height: 1.35;

  border: none;

  border-radius: 0;

  box-shadow: none;

  pointer-events: auto;

  cursor: pointer;
}


/* =====================================================
   TÊTE DU PERSONNAGE
   ===================================================== */

#dialogue-character {
  position: absolute;

  left: clamp(
    -35px,
    -3vw,
    -20px
  );

  bottom: 0;

  z-index: 2;

  width: clamp(
    100px,
    13vw,
    170px
  );

  pointer-events: none;
}


#dialogue-character img {
  display: block;

  width: 100%;
  height: auto;
}


/* =====================================================
   TEXTE DU DIALOGUE
   ===================================================== */

#dialogue-text {
  margin: 0;

  min-height: 2.7em;
}


/* =====================================================
   FLÈCHE DU DIALOGUE
   ===================================================== */

#dialogue-next {
  position: absolute;

  right: 20px;
  bottom: 12px;

  width: clamp(28px, 3vw, 50px);
  height: auto;
  animation: dialogue-arrow-pulse 0.8s ease-in-out infinite alternate;
}

body.boarding-active #game {
  pointer-events: none;
}

#boardingScreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 5vw, 72px);
  color: white;
  background: #80c9e5;
  font-family: "Oliver", sans-serif;
  text-align: center;
  transition: opacity 360ms ease, visibility 360ms ease;
}

#boardingScreen.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boarding-content {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  animation: boarding-arrival 420ms ease-out both;
}

.boarding-content h1 {
  margin-bottom: 14px;
  font-size: clamp(40px, 5vw, 68px);
  font-weight: normal;
  line-height: 1.05;
}

.boarding-content > p {
  max-width: 480px;
  margin: 0 auto;
  font-size: clamp(18px, 2vw, 26px);
  line-height: 1.35;
}

.language-picker {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  font-size: clamp(18px, 2vw, 25px);
}

.language-button {
  padding: 2px 3px 5px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-family: "Oliver", sans-serif;
  font-size: inherit;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}

.language-button:hover,
.language-button:focus-visible,
.language-button.is-selected {
  border-bottom-color: white;
  color: white;
}

.boarding-actions {
  position: absolute;
  z-index: 2;
  bottom: clamp(24px, 5vw, 54px);
  display: flex;
  align-items: center;
  gap: clamp(28px, 4vw, 48px);
}

.boarding-icon {
  width: clamp(35px, 4vw, 52px);
  height: clamp(35px, 4vw, 52px);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: transform 150ms ease;
}

.boarding-icon img { display: block; width: 100%; height: 100%; }

.boarding-enter {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: transform 150ms ease;
}

.boarding-enter img { width: clamp(35px, 4vw, 50px); height: auto; }
.boarding-enter:hover,
.boarding-icon:hover { transform: scale(1.12); }

@keyframes boarding-arrival {
  from { opacity: 0; transform: translateY(28px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 360px) {
  #boardingScreen { padding: 20px; }
  .boarding-content h1 { font-size: 36px; }
  .boarding-actions { bottom: 22px; }
}

#dialogue-next img {
  display: block;
  width: 100%;
  height: auto;
}


/* =====================================================
   DIALOGUE CACHÉ
   ===================================================== */

.dialogue-hidden {
  display: none !important;
}


/* =====================================================
   MY SKILLS OUVERT
   ===================================================== */

/* On cache les éléments de la page principale */

#game.skills-open #homeBtn,
#game.skills-open #settingsBtn,
#game.skills-open #top-nav,
#game.skills-open .control {
  display: none;
}


/* Le bouton Close reste visible */

#game.skills-open #closeSkills {
  display: flex;

  align-items: center;
  justify-content: center;
}


/* =====================================================
   DIALOGUE OUVERT
   ===================================================== */

/*
   Quand le dialogue est ouvert,
   on bloque les boutons du haut.
*/

#game.dialogue-open #homeBtn,
#game.dialogue-open #settingsBtn,
#game.dialogue-open #top-nav,
#game.dialogue-open .control {
  display: none !important;
}

#game.dialogue-open #closeSkills {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

@keyframes dialogue-enter {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(90px) scale(0.78);
  }

  70% {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px) scale(1.04);
  }

  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

#dialogue:not(.dialogue-hidden) {
  animation: dialogue-enter 480ms cubic-bezier(0.22, 0.8, 0.3, 1.15) both;
  transform-origin: center bottom;
}

@keyframes dialogue-arrow-pulse {
  from { transform: translateX(0); opacity: 0.6; }
  to { transform: translateX(5px); opacity: 1; }
}

/* =====================================================
   TABLETTES
   ===================================================== */

@media (min-width: 601px) and (max-width: 1000px) {

  /* Avion */

  #player {
    width: 36vw;

    max-width: 350px;
  }


  /* Boutons */

  .control {
    width: 75px;
    height: 75px;
  }


  /* Navigation */

  #top-nav {
    top: 30px;

    gap: clamp(
      18px,
      3vw,
      35px
    );
  }


  #top-nav a {
    font-size: clamp(
      16px,
      2.2vw,
      21px
    );

    padding-bottom: 4px;
  }


  /* Skills */

  .skills-container {
    width: 80vw;
  }
}


/* =====================================================
   TÉLÉPHONES
   ===================================================== */

@media (max-width: 600px) {

  /* Avion */

  #player {
    width: 55vw;

    max-width: 300px;
  }


  /* Boutons de déplacement */

  .control {
    width: 65px;
    height: 65px;

    bottom: 25px;
  }


  /* Boutons du haut */

  .top-button {
    width: 32px;
    height: 32px;

    top: 13px;
  }


  .top-button.home {
    left: 12px;
  }


  .top-button.settings,
  #closeSkills {
    right: 12px;
  }


  /* Navigation */

  #top-nav {
    top: 22px;

    gap: clamp(
      10px,
      3vw,
      18px
    );

    max-width: calc(100vw - 110px);

    overflow: visible;
  }


  #top-nav a {
    font-size: clamp(
      14px,
      4vw,
      18px
    );

    padding-bottom: 4px;
  }


  /* Skills */

  .skills-container {
    width: calc(100vw - 40px);

    gap: 20px;
  }


  .skill h2 {
    margin-bottom: 6px;

    font-size: 16px;
  }


  .skill-bar {
    height: 18px;
  }


  /* Dialogue */

  #dialogue {
    width: calc(100vw - 24px);

    bottom: 20px;
  }


  #dialogue-box {
    min-height: 125px;

    padding: 20px;

    padding-left: 85px;

    font-size: 16px;
  }


  #dialogue-character {
    left: -20px;

    width: 100px;
  }


  #dialogue-next {
    right: 12px;
    bottom: 8px;

    font-size: 13px;
  }
}


/* =====================================================
   PETITS TÉLÉPHONES
   ===================================================== */

@media (max-width: 400px) {

  /* Avion */

  #player {
    width: 58vw;
  }


  /* Boutons de déplacement */

  .control {
    width: 55px;
    height: 55px;

    bottom: 18px;
  }


  .control.left {
    left: 12px;
  }


  .control.right {
    right: 12px;
  }


  /* Boutons du haut */

  .top-button {
    width: 34px;
    height: 34px;

    top: 12px;
  }


  .top-button.home {
    left: 12px;
  }


  .top-button.settings,
  #closeSkills {
    right: 12px;
  }


  /* Navigation */

  #top-nav {
    top: 20px;

    gap: 8px;

    max-width: calc(100vw - 85px);
  }


  #top-nav a {
    font-size: 12px;

    padding-bottom: 3px;
  }


  #top-nav a::after {
    height: 1.5px;
  }


  /* Skills */

  .skills-container {
    width: calc(100vw - 28px);

    gap: 16px;
  }


  .skill h2 {
    font-size: 14px;
  }


  .skill-bar {
    height: 15px;
  }


  /* Dialogue */

  #dialogue {
    width: calc(100vw - 16px);

    bottom: 15px;
  }


  #dialogue-box {
    min-height: 115px;

    padding: 16px;

    padding-left: 72px;

    font-size: 14px;
  }


  #dialogue-character {
    left: -15px;

    width: 85px;
  }
}


/* =====================================================
   TRÈS PETITS TÉLÉPHONES
   ===================================================== */

@media (max-width: 350px) {

  #top-nav {
    gap: 6px;

    max-width: calc(100vw - 75px);
  }


  #top-nav a {
    font-size: 10px;
  }
}


/* =====================================================
   GRANDS ÉCRANS
   ===================================================== */

@media (min-width: 1400px) {

  #player {
    width: 360px;
  }


  .control {
    width: 85px;
    height: 85px;
  }
}

#closeSkills {
  display: none;
  position: absolute;
  top: clamp(13px, 2.5vh, 28px);
  right: clamp(12px, 2.5vw, 35px);
  z-index: 9999;
  width: clamp(30px, 3vw, 48px);
  height: clamp(30px, 3vw, 48px);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#closeSkills img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* Quand My Skills est ouvert */
#game.skills-open #closeSkills {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

/* On cache tout le reste */
#game.skills-open #homeBtn,
#game.skills-open #settingsBtn,
#game.skills-open #top-nav,
#game.skills-open .control {
  display: none !important;
}

/* =========================
   PROJECTS
========================= */

#projects-section {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: none;
  background: #87CEEB;
  overflow: hidden;
  font-family: "Oliver", sans-serif;
}

.projects-content {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.projects-content p {
  margin: 0;
  color: white;
  font-family: "Oliver", sans-serif;
  font-size: clamp(35px, 6vw, 80px);
}


/* =========================
   SETTINGS
========================= */

#settings-section {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: none;
  background: #87CEEB;
  overflow: hidden;
  font-family: "Oliver", sans-serif;
}

.settings-content {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(600px, calc(100vw - 40px));
  color: white;
  text-align: center;
}

.settings-content h2 {
  margin-bottom: 45px;
  font-size: clamp(28px, 4vw, 50px);
  font-weight: normal;
}

.setting {
  margin-bottom: 50px;
}

.setting label {
  display: block;
  margin-bottom: 15px;
  font-size: clamp(18px, 2vw, 28px);
}

#volumeSlider {
  width: 100%;
  height: 8px;
  appearance: none;
  -webkit-appearance: none;
  accent-color: #6CA265;
  background: white;
  border: none;
  border-radius: 0;
  outline: none;
  cursor: pointer;
  -webkit-user-select: auto;
  user-select: auto;
  touch-action: none;
}

.credits {
  font-size: clamp(15px, 1.5vw, 21px);
  line-height: 1.7;
}

.credits p {
  margin: 0;
}


/* =========================
   CLOSE BUTTON
========================= */

#game.skills-open #closeSkills,
#game.projects-open #closeSkills,
#game.settings-open #closeSkills {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

#game.skills-open #homeBtn,
#game.skills-open #settingsBtn,
#game.skills-open #top-nav,
#game.skills-open .control,

#game.projects-open #homeBtn,
#game.projects-open #settingsBtn,
#game.projects-open #top-nav,
#game.projects-open .control,

#game.settings-open #homeBtn,
#game.settings-open #settingsBtn,
#game.settings-open #top-nav,
#game.settings-open .control {
  display: none !important;
}


/* =========================
   LONG CREATIVITY BAR
========================= */

.skill.creativity .skill-progress {
  width: 1000% !important;
}

#projects-section {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  background: #87CEEB;
  overflow: hidden;
  font-family: "Oliver", sans-serif;
}

#projects-section .projects-content {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

#projects-section .projects-content p {
  margin: 0;
  color: white;
  font-family: "Oliver", sans-serif;
  font-size: clamp(40px, 7vw, 100px);
  line-height: 1;
}

#volumeSlider::-webkit-slider-runnable-track {
  height: 8px;
  background: white;
  border-radius: 0;
}

#volumeSlider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -6px;
  background: #6CA265;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

#volumeSlider::-moz-range-track {
  height: 8px;
  background: white;
  border-radius: 0;
}

#volumeSlider::-moz-range-progress {
  height: 8px;
  background: #6CA265;
}

#volumeSlider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #6CA265;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

#volumeValue {
  margin-top: 25px;
  color: white;
}

