@font-face { font-family: "Bagnard"; src: url("fonts/bagnard.otf") format("opentype"); font-display: swap; }
@font-face { font-family: "Orkney"; src: url("fonts/orkney-regular-webfont.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Orkney"; src: url("fonts/orkney-medium-webfont.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Orkney"; src: url("fonts/orkney-bold-webfont.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  --papier: #fbf7ee;
  --encre: #1f2a3a;
  --accent: #5d87ad;
}
body[data-saison="hiver"]     { --accent: #4f7fa8; }
body[data-saison="printemps"] { --accent: #5f8f4e; }
body[data-saison="ete"]       { --accent: #c9801a; }
body[data-saison="automne"]   { --accent: #b24a2c; }

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  background: #8fb3cf;
  color: var(--encre);
  font-family: "Orkney", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  user-select: none;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#scene:active { cursor: grabbing; }

/* Grain de papier posé sur toute la scène */
.grain {
  position: fixed; inset: 0; pointer-events: none; opacity: .2; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

.tete {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 20px clamp(16px, 3vw, 40px);
}
.marque {
  font-family: "Bagnard", Georgia, serif; font-size: 26px; letter-spacing: .04em;
  color: var(--encre); text-decoration: none;
  background: var(--papier); padding: 8px 16px 6px; border-radius: 3px;
  box-shadow: 3px 4px 0 rgba(31, 42, 58, .18); transform: rotate(-1.5deg);
}
.saisons {
  display: flex; gap: 4px; flex-wrap: wrap; align-items: center; justify-content: flex-end;
  background: var(--papier); padding: 7px 10px 7px 8px; border-radius: 4px;
  box-shadow: 3px 4px 0 rgba(31, 42, 58, .18); transform: rotate(.8deg);
}
.logo { width: 34px; height: 34px; margin-left: 8px; order: 1; color: var(--encre); flex: none; will-change: transform; }
.saisons button {
  font: 500 13px/1 "Orkney", sans-serif; letter-spacing: .06em; text-transform: uppercase;
  color: var(--encre); background: transparent; border: 0; border-radius: 3px;
  padding: 11px 12px 9px; cursor: pointer;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), background-color .25s, color .25s;
}
.saisons button:hover { transform: translateY(-2px) rotate(-1deg); }
.saisons button:focus-visible, .marque:focus-visible { outline: 3px solid var(--encre); outline-offset: 3px; }
.saisons button[aria-current="true"] { background: var(--accent); color: var(--papier); }

.legende {
  position: fixed; left: clamp(16px, 3vw, 40px); bottom: clamp(20px, 4vh, 44px);
  max-width: min(440px, 80vw);
  background: var(--papier); padding: 20px 26px 18px; border-radius: 4px;
  box-shadow: 5px 6px 0 rgba(31, 42, 58, .2); transform: rotate(-1deg);
}
.etape { font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--accent); transition: color .4s; }
.legende h2 {
  font-family: "Bagnard", Georgia, serif; font-weight: 400;
  font-size: clamp(44px, 6vw, 76px); line-height: .95; margin: 6px 0 10px;
}
.phrase { font-size: 16px; line-height: 1.45; text-wrap: pretty; }
.legende.change h2, .legende.change .phrase { animation: monte .5s cubic-bezier(.2, .8, .2, 1); }
@keyframes monte { from { opacity: 0; transform: translateY(10px); } }

.projet {
  position: fixed; right: clamp(16px, 3vw, 40px); bottom: clamp(20px, 4vh, 44px);
  background: var(--papier); padding: 12px 18px 10px; border-radius: 3px; text-align: right;
  box-shadow: 4px 5px 0 rgba(31, 42, 58, .2); transform: rotate(1.2deg);
}
.projet span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); transition: color .4s; }
.projet strong { font-family: "Bagnard", Georgia, serif; font-weight: 400; font-size: 26px; }

.consigne {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  color: var(--papier); text-shadow: 0 1px 0 rgba(31, 42, 58, .35);
  transition: opacity .6s; white-space: nowrap;
}
.consigne.vu { opacity: 0; }

/* Écran de chargement : une pastille de papier en relief, sur un fond qui passe par les quatre saisons */
.voile {
  position: fixed; inset: 0; display: grid; place-items: center; background: #8fb3cf;
  animation: saisons 4.8s linear infinite;
  transition: opacity .8s .1s, visibility 0s .9s;
}
.voile::after {   /* grain de papier */
  content: ""; position: absolute; inset: 0; opacity: .2; mix-blend-mode: multiply; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes saisons { 0%, 100% { background-color: #8fb3cf; } 25% { background-color: #a9c686; } 50% { background-color: #f2bd55; } 75% { background-color: #cf6f47; } }
.voile.fini { opacity: 0; visibility: hidden; }
/* Deux découpes lisses à bord blanc, comme les arbres : un disque pour le logo, une plaque pour le mot.
   Elles flottent chacune à leur rythme, avec une ombre plus ou moins éloignée, pour donner de la profondeur. */
.chargement { position: relative; z-index: 1; display: grid; justify-items: center; }
.pastille, .plaque {
  background: var(--papier); color: var(--encre); border: 7px solid #ffffff;
  display: grid; place-items: center; will-change: transform, filter;
}
.pastille {
  width: 138px; aspect-ratio: 1; border-radius: 50%;
  animation: flotte-a 3.3s ease-in-out infinite alternate;
}
.plaque {
  margin-top: 12px; padding: 10px 18px 4px; border-radius: 10px;
  animation: flotte-b 4.7s ease-in-out -1.2s infinite alternate;
}
@keyframes flotte-a {
  from { transform: translate(-7px, -10px) rotate(-4deg); filter: drop-shadow(26px 34px 0 rgba(31, 42, 58, .2)); }
  to { transform: translate(6px, 7px) rotate(3deg); filter: drop-shadow(17px 22px 0 rgba(31, 42, 58, .2)); }
}
@keyframes flotte-b {
  from { transform: translate(9px, 4px) rotate(3.5deg); filter: drop-shadow(10px 13px 0 rgba(31, 42, 58, .2)); }
  to { transform: translate(-8px, -5px) rotate(-2.5deg); filter: drop-shadow(15px 19px 0 rgba(31, 42, 58, .2)); }
}
.voile .logo { width: 100%; height: 100%; margin: 0; order: 0; color: var(--encre); animation: tourne 1.6s cubic-bezier(.6, 0, .4, 1) infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
.voile p { font: 400 44px/1 "Bagnard", Georgia, serif; letter-spacing: .05em; }
.tete__gauche { display: flex; align-items: center; gap: 12px; }

@media (max-width: 700px) {
  .tete { flex-direction: column; align-items: flex-start; padding-top: 14px; }
  .saisons { justify-content: flex-start; }
  .saisons button { padding: 9px 10px 7px; font-size: 11px; }
  .projet { display: none; }   /* sur cellulaire, elle chevauchait la navigation : les pancartes de la scène nomment déjà les projets */
  .legende { padding: 14px 18px 12px; }
  .phrase { font-size: 14px; }
  .consigne { display: none; }
  .contact summary { padding: 10px 11px 8px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .legende.change h2, .legende.change .phrase, .contact__carte { animation: none; }
  .voile .logo { animation-duration: 6s; }
  .voile, .pastille, .plaque { animation: none; filter: drop-shadow(14px 18px 0 rgba(31, 42, 58, .2)); }
  .voile { filter: none; }
}

/* ---------- Bouton Contact (présent sur toutes les pages) ---------- */
.contact { position: relative; }
.contact summary {
  list-style: none; cursor: pointer; font: 700 13px/1 "Orkney", sans-serif; letter-spacing: .1em; text-transform: uppercase;
  color: var(--papier); background: var(--encre); padding: 12px 15px 10px; border-radius: 3px;
  box-shadow: 3px 4px 0 var(--accent); transform: rotate(1.2deg); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.contact summary { position: relative; z-index: 61; }
.contact summary:focus:not(:focus-visible) { outline: none; }
.contact summary::-webkit-details-marker { display: none; }
.contact summary:hover { transform: rotate(-1deg) translateY(-2px); }
.contact__carte {
  position: absolute; top: calc(100% + 30px); left: 0; z-index: 60; width: max-content; max-width: min(300px, 80vw);
  background: var(--papier); color: var(--encre); padding: 18px 22px 16px; border-radius: 4px;
  box-shadow: 5px 6px 0 rgba(31, 42, 58, .22);
  font: 400 16px/1.5 "Orkney", sans-serif;
  /* La carte tombe du haut de l'écran au bout de son fil, se balance d'avant en arrière, puis se berce doucement */
  transform-origin: 34px -140px;
  transform: rotate(-1.2deg);
}
.contact__carte.ouvre { animation: suspend 1.5s both, berce 4s ease-in-out 1.5s infinite alternate; }
.contact__carte.ferme { animation: remonte .75s both; }
@keyframes remonte {
  0% { transform: perspective(800px) translateY(0) rotateX(0deg) rotateZ(-1.2deg); animation-timing-function: ease-out; }
  22% { transform: perspective(800px) translateY(16px) rotateX(-16deg) rotateZ(1deg); animation-timing-function: cubic-bezier(.6, 0, .9, .5); }
  100% { transform: perspective(800px) translateY(-110vh) rotateX(26deg) rotateZ(-3deg); }
}
.contact__carte::before {
  content: ""; position: absolute; left: 33px; bottom: 100%; width: 2px; height: 100vh;
  background: var(--papier); box-shadow: 1px 1px 0 rgba(31, 42, 58, .18);
}
.contact__carte::after {
  content: ""; position: absolute; left: 29px; top: -5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 1px 1px 0 rgba(31, 42, 58, .25);
}
.contact[open] summary { transform: rotate(-1deg); }
.contact__titre { font: 400 24px/1.1 "Bagnard", Georgia, serif; margin-bottom: 6px; }
.contact__carte a { color: inherit; font-weight: 700; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.contact__carte p + p { margin-top: 4px; }
@keyframes suspend {
  0% { transform: perspective(800px) translateY(-110vh) rotateX(0deg) rotateZ(-3deg); animation-timing-function: cubic-bezier(.5, 0, .9, .6); }
  38% { transform: perspective(800px) translateY(0) rotateX(-38deg) rotateZ(2.5deg); animation-timing-function: ease-out; }
  52% { transform: perspective(800px) translateY(-14px) rotateX(24deg) rotateZ(-2deg); animation-timing-function: ease-in-out; }
  66% { transform: perspective(800px) translateY(0) rotateX(-14deg) rotateZ(1.4deg); animation-timing-function: ease-in-out; }
  79% { transform: perspective(800px) translateY(-3px) rotateX(8deg) rotateZ(-1.4deg); animation-timing-function: ease-in-out; }
  90% { transform: perspective(800px) translateY(0) rotateX(-3.5deg) rotateZ(-1deg); animation-timing-function: ease-in-out; }
  100% { transform: perspective(800px) translateY(0) rotateX(0deg) rotateZ(-1.2deg); }
}
@keyframes berce { from { transform: perspective(800px) rotateX(1.5deg) rotateZ(-1.2deg); } to { transform: perspective(800px) rotateX(-1.5deg) rotateZ(1.2deg); } }


@media (prefers-reduced-motion: reduce) { .contact__carte { animation: none; transform: rotate(-1.2deg); } }

/* Compteur de jongles (surprise du ballon) */
.jongles {
  position: fixed; left: 50%; bottom: 62px; transform: translate(-50%, 14px) rotate(-2deg); opacity: 0; pointer-events: none;
  font: 400 30px/1 "Bagnard", Georgia, serif; color: var(--encre); background: var(--papier); padding: 12px 20px 9px; border-radius: 4px;
  box-shadow: 4px 5px 0 rgba(31, 42, 58, .2); transition: opacity .25s, transform .3s cubic-bezier(.2, .9, .3, 1.4);
}
.jongles.visible { opacity: 1; transform: translate(-50%, 0) rotate(-2deg); }
