/* ============================================================
   COULEURS ET THÈME (clair / sombre)
   ============================================================ */

:root {
  --bg: #F5F0E6;
  --fg: #1A1A38;
  --card: #FFFBF3;
  --blue: #2B4EE0;
  --red: #EA4B2D;
  --yel: #F7C316;
  --grn: #3C9A52;
  --pnk: #F35BA8;
  --lil: #8D6BDA;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #16132B;
    --fg: #F5F0E6;
    --card: #221E44;
  }
}

:root[data-theme=dark] {
  --bg: #16132B;
  --fg: #F5F0E6;
  --card: #221E44;
}

/* ============================================================
   BASE : réglages globaux, typographie, boutons
   ============================================================ */

:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

html {
  overflow-x: clip;
  scroll-padding-top: env(safe-area-inset-top, 0px);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 18px/1.6 'DM Sans', system-ui, sans-serif;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  line-height: 1;
  margin: 0;
  font-weight: 800;
  letter-spacing: -.025em;
}

.wrap {
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 22px;
  position: relative;
}

svg.sh {
  display: block;
  width: 100%;
  height: 100%;
  fill: var(--c);
  stroke: none;
}

svg.ln {
  fill: none;
  stroke: var(--c);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btns {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.btn {
  font: 700 17px 'DM Sans', sans-serif;
  color: #1A1A38;
  background: var(--yel);
  border: 2.5px solid var(--fg);
  border-radius: 999px;
  padding: 13px 26px;
  text-decoration: none;
  box-shadow: 5px 5px 0 var(--fg);
  transition: transform .15s, box-shadow .15s;
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--fg);
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--fg);
}

.btn:focus-visible,
a:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.btn.alt {
  background: var(--card);
  color: var(--fg);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    animation: none!important;
    transition: none!important;
  }
}

.c-pnk {
  --c: var(--pnk);
}

.c-blue {
  --c: var(--blue);
}

.c-yel {
  --c: var(--yel);
}

.c-grn {
  --c: var(--grn);
}

.c-red {
  --c: var(--red);
}

.c-lil {
  --c: var(--lil);
}

/* ============================================================
   HERO : écran d'accueil
   ============================================================ */

.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero .wrap {
  z-index: 2;
  width: 100%;
  pointer-events: none;
}

.hero h1,
.hero .sub,
.hero .btns,
.hero .under {
  pointer-events: auto;
}

.hero h1,
.hero .btns {
  width: fit-content;
}

.hero h1 {
  font-size: clamp(58px, 16vw, 176px);
  line-height: .88;
}

.hero .sub {
  max-width: 30ch;
  font-size: clamp(19px, 3.4vw, 26px);
  margin: 26px 0 30px;
  font-weight: 500;
}

.under {
  width: min(70%, 420px);
  height: 22px;
  margin-top: 10px;
}

.shape {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  position: absolute;
  transform: translate(calc(var(--x, 0px) + var(--dx, 0px)), calc(var(--y, 0px) + var(--dy, 0px)));
  transition: transform .25s ease-out;
  z-index: 1;
}

.shape svg {
  animation: pop .7s cubic-bezier(.3, 1.6, .5, 1) both;
  animation-delay: var(--dl, 0s);
}

@keyframes pop {
  from {
    transform: scale(0) rotate(-40deg);
  }
}

.under path {
  stroke-width: 6;
  vector-effect: non-scaling-stroke;
}

.hero-shape--1 {
  left: 6%;
  top: 9%;
  width: clamp(70px, 13vw, 150px);
  height: clamp(70px, 13vw, 150px);
  --dl: .1s;
}

.hero-shape--2 {
  right: 9%;
  top: 8%;
  width: clamp(60px, 11vw, 130px);
  height: clamp(60px, 11vw, 130px);
  --dl: .2s;
}

.hero-shape--3 {
  left: 44%;
  top: 5%;
  width: clamp(36px, 6vw, 70px);
  height: clamp(36px, 6vw, 70px);
  --dl: .3s;
}

.hero-shape--4 {
  right: 3%;
  top: 42%;
  width: clamp(80px, 14vw, 170px);
  height: clamp(80px, 14vw, 170px);
  --dl: .4s;
}

.hero-shape--5 {
  left: 3%;
  bottom: 9%;
  width: clamp(70px, 12vw, 140px);
  height: clamp(70px, 12vw, 140px);
  --dl: .5s;
}

.hero-shape--6 {
  left: 38%;
  bottom: 5%;
  width: clamp(80px, 13vw, 160px);
  height: clamp(40px, 7vw, 80px);
  --dl: .6s;
}

.hero-shape--7 {
  right: 30%;
  top: 20%;
  width: clamp(30px, 5vw, 56px);
  height: clamp(30px, 5vw, 56px);
  --dl: .7s;
}

.hero-shape--8 {
  left: 16%;
  top: 46%;
  width: clamp(26px, 4vw, 46px);
  height: clamp(26px, 4vw, 46px);
  --dl: .8s;
}

/* ============================================================
   SECTIONS : projets, échappées, outils, parcours, contact
   ============================================================ */

section {
  padding: clamp(64px, 10vw, 110px) 0;
  position: relative;
  overflow-x: clip;
}

h2 {
  font-size: clamp(36px, 7vw, 64px);
  margin-bottom: 12px;
}

.lead {
  max-width: 48ch;
  margin: 0 0 40px;
  opacity: .85;
}

.grid {
  display: grid;
  gap: 30px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

svg.badge {
  position: absolute;
  top: -30px;
  right: 20px;
  width: 62px;
  height: 62px;
  transform: rotate(8deg);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.chips span {
  font-weight: 700;
  font-size: 14.5px;
  color: #1A1A38;
  border: 2px solid var(--fg);
  border-radius: 999px;
  padding: 4px 14px;
  background: var(--b, var(--yel));
}

.chips span:nth-child(3n+2) {
  --b: #F9A9D0;
}

.chips span:nth-child(3n) {
  --b: #A9C0FF;
}

.path {
  list-style: none;
  margin: 34px 0 0;
  padding: 0;
  display: grid;
  gap: 26px;
}

.path li {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 18px;
  align-items: start;
}

.path .dot {
  width: 60px;
  height: 60px;
}

.path b {
  font: 800 24px 'Bricolage Grotesque', sans-serif;
  display: block;
  margin-bottom: 2px;
}

.end {
  text-align: center;
  overflow: hidden;
}

.end h2 {
  font-size: clamp(44px, 11vw, 120px);
}

.end .btns {
  justify-content: center;
  margin-top: 30px;
}

.end .shape {
  opacity: .95;
}

footer {
  text-align: center;
  padding: 0 0 40px;
  font-size: 14px;
  opacity: .6;
}

.end .lead {
  margin-inline: auto;
}

.end-shape--1 {
  left: 2%;
  top: 10%;
  width: clamp(50px, 9vw, 100px);
  height: clamp(50px, 9vw, 100px);
}

.end-shape--2 {
  right: 3%;
  bottom: 8%;
  width: clamp(60px, 10vw, 120px);
  height: clamp(60px, 10vw, 120px);
}

:root {
  --edge: clamp(-50px, calc((100vw - 1000px) / 4 - 50px), 160px);
}

.side {
  z-index: 0;
}

.side--l {
  left: var(--edge);
}

.side--r {
  right: var(--edge);
}

.side-1 {
  top: 30%;
  width: 110px;
  height: 110px;
}

.side-2 {
  top: 16%;
  width: 80px;
  height: 80px;
}

.side-3 {
  top: 64%;
  width: 120px;
  height: 120px;
}

.side-4 {
  top: 22%;
  width: 110px;
  height: 110px;
}

.side-5 {
  top: 56%;
  width: 100px;
  height: 100px;
}

.side-6 {
  top: 74%;
  width: 70px;
  height: 70px;
}

.side-7 {
  top: 26%;
  width: 90px;
  height: 90px;
}

.side-8 {
  top: 38%;
  width: 120px;
  height: 60px;
}

.side-9 {
  top: 18%;
  width: 110px;
  height: 110px;
}

.side-10 {
  top: 52%;
  width: 90px;
  height: 90px;
}

.side-11 {
  top: 74%;
  width: 70px;
  height: 70px;
}

/* ============================================================
   INTERFACE : barre du haut, bouton thème, message
   ============================================================ */

.nav {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 16px;
  z-index: 10;
  display: flex;
  gap: 10px;
  align-items: center;
}

.nav .btn {
  padding: 9px 18px;
  font-size: 15px;
  box-shadow: 3px 3px 0 var(--fg);
}

.tg {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 2.5px solid var(--fg);
  background: var(--card);
  color: var(--fg);
  font-size: 20px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--fg);
  display: grid;
  place-items: center;
}

.tg:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

/* ============================================================
   FORMES DÉPLAÇABLES
   ============================================================ */

.shape.dragging {
  cursor: grabbing;
  transition: none;
  z-index: 6;
}

/* ============================================================
   À PROPOS
   ============================================================ */

.about-grid {
  display: grid;
  grid-template-columns: minmax(250px, 330px) 1fr;
  gap: clamp(28px, 6vw, 70px);
  align-items: center;
}

.portrait {
  position: relative;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1;
  margin-inline: auto;
}

.portrait-frame {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--yel);
  border: 3px solid var(--fg);
  border-radius: 58% 42% 47% 53% / 52% 56% 44% 48%;
  box-shadow: 10px 10px 0 var(--pnk);
}

.portrait-frame b {
  font: 800 clamp(64px, 12vw, 96px) / 1 'Bricolage Grotesque', sans-serif;
  color: #1A1A38;
}

.portrait-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about p {
  max-width: 52ch;
  margin: 0 0 16px;
}

.about .chips {
  margin-top: 22px;
  padding-top: 0;
}

/* ============================================================
   MINI-JEU
   ============================================================ */

.game {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(26, 26, 56, .88);
}

.game[hidden] {
  display: none;
}

.game:focus {
  outline: none;
}

.game-box {
  position: relative;
}

.game canvas {
  display: block;
  width: min(92vw, 360px, calc((100svh - 80px) * .6667));
  height: auto;
  border: 3px solid #F5F0E6;
  border-radius: 24px;
  box-shadow: 8px 8px 0 var(--yel);
  touch-action: none;
}

.game-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 18px;
  color: #F5F0E6;
  background: #1A1A38;
  border: 2px solid #F5F0E6;
  border-radius: 50%;
  cursor: pointer;
}

@media (min-width: 700px) {
  .grid--duo {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================
   BUT ET BALLON (MINI-JEU SECRET)
   ============================================================ */

.hero-shape--9 {
  right: 25%;
  bottom: 8%;
  width: clamp(54px, 8vw, 84px);
  height: clamp(54px, 8vw, 84px);
  --dl: .9s;
}

.goal {
  position: absolute;
  right: 5%;
  bottom: 9%;
  z-index: 1;
  width: clamp(96px, 15vw, 160px);
  padding: 0;
  color: var(--fg);
  background: none;
  border: 0;
  transition: transform .2s, filter .2s;
}

.goal svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.goal {
  cursor: pointer;
}

.goal:focus-visible,
.game-close:focus-visible {
  outline: 3px solid var(--yel);
  outline-offset: 3px;
}

.goal.hot {
  transform: scale(1.1);
  filter: drop-shadow(0 0 12px var(--yel));
}

.goal.hot .net {
  opacity: .9;
}

/* ============================================================
   MES ÉCHAPPÉES
   ============================================================ */

.escape {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  background: var(--card);
  border: 2.5px solid var(--fg);
  border-radius: 30px 12px 30px 12px;
  box-shadow: 7px 7px 0 var(--tone);
  transform: rotate(-.6deg);
}

.escape:nth-child(even) {
  border-radius: 12px 30px 12px 30px;
  transform: rotate(.6deg);
}

.escape-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  font-size: 38px;
  line-height: 1;
  background: var(--tone);
  border: 2.5px solid var(--fg);
  border-radius: 58% 42% 47% 53% / 52% 56% 44% 48%;
}

.escape h3 {
  font-size: 30px;
}

.escape p {
  margin: 0;
  font-size: 16.5px;
}

.escape--cinema {
  --tone: var(--yel);
}

.escape--lecture {
  --tone: #F9A9D0;
}

.escape--jeux {
  --tone: #A9C0FF;
}

.escape--sport {
  --tone: #9ED8A8;
}

/* ============================================================
   BOÎTE À OUTILS
   ============================================================ */

.tools {
  border-top: 2.5px solid var(--fg);
}

.tool-row {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 20px 36px;
  align-items: center;
  padding: 26px 0;
  border-bottom: 2.5px solid var(--fg);
}

.tool-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tool-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 64px;
  height: 64px;
  font-size: 30px;
  background: var(--tone);
  border: 2.5px solid var(--fg);
  border-radius: 58% 42% 47% 53% / 52% 56% 44% 48%;
}

.tool-head h3 {
  font-size: 26px;
}

.tool-head p {
  margin: 4px 0 0;
  font-size: 14.5px;
  opacity: .75;
}

.tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tool-list li {
  padding: 6px 16px;
  font: 700 18px 'DM Sans', sans-serif;
  color: #1A1A38;
  background: var(--tone);
  border-radius: 10px;
}

.tool-row--a {
  --tone: var(--yel);
}

.tool-row--b {
  --tone: #F9A9D0;
}

.tool-row--c {
  --tone: #A9C0FF;
}

.tool-row--d {
  --tone: #9ED8A8;
}

/* ============================================================
   PROJETS (cartes générées par JS/script.js)
   ============================================================ */

.works {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(30px, 4vw, 44px);
}

@media (min-width: 900px) {
  .works {
    grid-template-columns: repeat(2, 1fr);
  }
}

.work {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 2.5px solid var(--fg);
  border-radius: 30px 12px 30px 12px;
  box-shadow: 8px 8px 0 var(--tone);
  transition: transform .15s, box-shadow .15s;
}

.work:nth-child(even) {
  border-radius: 12px 30px 12px 30px;
}

.work:hover {
  transform: translate(-2px, -2px);
  box-shadow: 10px 10px 0 var(--tone);
}

@media (min-width: 900px) {
  .work:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    flex-direction: row;
  }

  .work:last-child:nth-child(odd) .work-art {
    flex: 1;
    border-bottom: 0;
    border-right: 2.5px solid var(--fg);
  }

  .work:last-child:nth-child(odd) .work-info {
    flex: 1;
    justify-content: center;
  }
}

.work-art {
  display: grid;
  align-content: center;
  padding: clamp(20px, 3.5vw, 32px);
  background: var(--tone);
  border-bottom: 2.5px solid var(--fg);
}

.win {
  overflow: hidden;
  color: #1A1A38;
  background: #FFFBF3;
  border: 2.5px solid #1A1A38;
  border-radius: 14px;
}

.win-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 2.5px solid #1A1A38;
  font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.win-bar i {
  width: 10px;
  height: 10px;
  background: #EA4B2D;
  border-radius: 50%;
}

.win-bar i:nth-child(2) { background: #F7C316; }
.win-bar i:nth-child(3) { background: #3C9A52; }

.win-bar span {
  margin-left: 8px;
  opacity: .6;
}

.pitch,
.shot {
  display: block;
  width: 100%;
  height: auto;
}

.todo {
  display: grid;
  gap: 16px;
  padding: 24px 20px;
}

.line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.box {
  flex: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid #1A1A38;
  border-radius: 5px;
}

.box.done {
  background: #3C9A52;
}

.bar {
  height: 10px;
  background: #1A1A38;
  border-radius: 6px;
  opacity: .25;
}

.bar--s { width: 35%; }
.bar--m { width: 55%; }
.bar--l { width: 75%; }

.code {
  margin: 0;
  padding: 24px 20px;
  font: 600 14px / 1.9 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}

.c1 { color: #2B4EE0; }
.c2 { color: #3C9A52; }
.c3 { color: #EA4B2D; }

.work-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  padding: 26px 28px 30px;
}

.work-kind {
  align-self: flex-start;
  padding: 4px 14px;
  font: 700 14px 'DM Sans', sans-serif;
  color: #1A1A38;
  background: var(--tint);
  border: 2px solid var(--fg);
  border-radius: 999px;
}

.work-info h3 {
  font-size: clamp(30px, 4.5vw, 40px);
}

.work-info p {
  margin: 0;
}

.work-info .chips {
  margin-top: auto;
  padding-top: 6px;
}

.work-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.btn--sm {
  padding: 8px 18px;
  font-size: 15px;
  box-shadow: 3px 3px 0 var(--fg);
}

.work--pnk  { --tone: var(--pnk);  --tint: #F9A9D0; }
.work--blue { --tone: var(--blue); --tint: #A9C0FF; }
.work--grn  { --tone: var(--grn);  --tint: #9ED8A8; }
.work--red  { --tone: var(--red);  --tint: #FFB199; }
.work--yel  { --tone: var(--yel);  --tint: #FBE38A; }
.work--lil  { --tone: var(--lil);  --tint: #CDBBF2; }


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 800px) {
  :root {
    --edge: -34px;
  }

  .shape.side {
    width: 54px;
    height: 54px;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .nav {
    right: 10px;
    gap: 8px;
  }

  .nav .btn {
    padding: 8px 14px;
    font-size: 14px;
  }
}

@media (max-width: 520px) {
  .path li {
    grid-template-columns: 54px 1fr;
  }

  .path .dot {
    width: 48px;
    height: 48px;
  }

  .end .btns .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 800px) {
  .goal {
    right: 4%;
    bottom: 6%;
  }

  .hero-shape--9 {
    right: 32%;
    bottom: 7%;
  }

  .hero-shape--4 {
    top: auto;
    right: 6%;
    bottom: 24%;
  }

  .hero-shape--8 {
    top: auto;
    left: 42%;
    bottom: 22%;
  }
}

@media (max-width: 800px) {
  .tool-row {
    grid-template-columns: 1fr;
    padding: 22px 0;
  }

  .escape,
  .escape:nth-child(even) {
    transform: none;
  }
}