﻿/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
/* ─── Police ───────────────────────────────────────── */
@font-face {
  font-family: 'Inkfree';
  src: url('fonts/Inkfree.ttf') format('truetype');
  font-display: block;
}
/* ─── Page ───────────────────────────────────────────────── */
html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  width: 100%;
  min-height: 100%;
  background-color: #383958;
  overflow-x: hidden;
}

/* ─── Canvas PSD 2880×1920 (ratio 3:2) ───────────────────── */
.canvas {
  position: relative;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  aspect-ratio: 2880 / 1920;
  overflow: hidden;
  background-color: #383958;
}

/* ─── Calques positionnés ────────────────────────────────── */
.layer {
  position: absolute;
  display: block;
}

/* ══════════════════════════════════════════════════════════
   KEYFRAMES
══════════════════════════════════════════════════════════ */

/* — Apparition (opacity seulement — pas de conflit avec les transforms idle) */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* — Flottement vertical doux */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-1.4%); }
}

@keyframes floatDown {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(1.2%); }
}

/* — Balancement + légère montée (ardoise, panneau) */
@keyframes swayFloat {
  0%, 100% { transform: rotate(-1.2deg) translateY(0); }
  50%       { transform: rotate(1.2deg) translateY(-0.6%); }
}

/* — Pendule lourd : physique réelle
   - ease-out aux pics (impulse → amortissement vers l'extrême)
   - ease-in aux pics → accélération par gravité vers le centre
   - ease-out au centre → décélération vers l'autre extrême
   - amplitude décroissante (~18%/demi-cycle), repos final, rebond au loop */
@keyframes pendulumHeavy {
  /* repos → impulse rapide */
  0%    { transform: rotate(0deg);    animation-timing-function: ease-out; }
  1.5%  { transform: rotate(-4deg);   animation-timing-function: ease-in; }
  /* oscillations amorties — center = ease-out, peak = ease-in */
  9%    { transform: rotate(0deg);    animation-timing-function: ease-out; }
  16.5% { transform: rotate(3.3deg);  animation-timing-function: ease-in; }
  24%   { transform: rotate(0deg);    animation-timing-function: ease-out; }
  31.5% { transform: rotate(-2.7deg); animation-timing-function: ease-in; }
  39%   { transform: rotate(0deg);    animation-timing-function: ease-out; }
  46.5% { transform: rotate(2.2deg);  animation-timing-function: ease-in; }
  54%   { transform: rotate(0deg);    animation-timing-function: ease-out; }
  61.5% { transform: rotate(-1.8deg); animation-timing-function: ease-in; }
  69%   { transform: rotate(0deg);    animation-timing-function: ease-out; }
  76.5% { transform: rotate(1.4deg);  animation-timing-function: ease-in; }
  82%   { transform: rotate(0deg);    animation-timing-function: ease-out; }
  86.5% { transform: rotate(-1.0deg); animation-timing-function: ease-in; }
  90.5% { transform: rotate(0deg);    animation-timing-function: ease-out; }
  93.5% { transform: rotate(0.6deg);  animation-timing-function: ease-in; }
  96%   { transform: rotate(0deg); }
  /* repos jusqu'au prochain impulse (loop) */
  100%  { transform: rotate(0deg); }
}

/* — Pendule léger (tableau originaux) : plus court, plus rapide, plus amorti */
@keyframes pendulumLight {
  0%    { transform: rotate(0deg);    animation-timing-function: ease-out; }
  1%    { transform: rotate(-2.5deg); animation-timing-function: ease-in; }
  7.4%  { transform: rotate(0deg);    animation-timing-function: ease-out; }
  13.8% { transform: rotate(2.0deg);  animation-timing-function: ease-in; }
  20.2% { transform: rotate(0deg);    animation-timing-function: ease-out; }
  26.6% { transform: rotate(-1.6deg); animation-timing-function: ease-in; }
  33%   { transform: rotate(0deg);    animation-timing-function: ease-out; }
  39.4% { transform: rotate(1.3deg);  animation-timing-function: ease-in; }
  45.8% { transform: rotate(0deg);    animation-timing-function: ease-out; }
  52.2% { transform: rotate(-1.0deg); animation-timing-function: ease-in; }
  58.6% { transform: rotate(0deg);    animation-timing-function: ease-out; }
  64%   { transform: rotate(0.7deg);  animation-timing-function: ease-in; }
  69.4% { transform: rotate(0deg);    animation-timing-function: ease-out; }
  73.8% { transform: rotate(-0.5deg); animation-timing-function: ease-in; }
  77.8% { transform: rotate(0deg);    animation-timing-function: ease-out; }
  80.8% { transform: rotate(0.3deg);  animation-timing-function: ease-in; }
  83.8% { transform: rotate(0deg); }
  100%  { transform: rotate(0deg); }
}

/* — Saut d'un mot du titre */
@keyframes wordJump {
  0%   { transform: translateY(0)    scale(1); }
  28%  { transform: translateY(-32%) scale(1.1); }
  50%  { transform: translateY(-6%)  scale(1.04); }
  68%  { transform: translateY(0)    scale(1.01); }
  100% { transform: translateY(0)    scale(1); }
}

/* — Saut du mot MAD : plus fort + tremblement */
@keyframes madJump {
  0%   { transform: translateY(0)    scale(1); }
  18%  { transform: translateY(-50%) scale(1.3); }
  26%  { transform: translateY(-46%) scale(1.38) rotate(-6deg); }
  30%  { transform: translateY(-43%) scale(1.38) rotate(6deg); }
  34%  { transform: translateY(-40%) scale(1.38) rotate(-5deg); }
  38%  { transform: translateY(-37%) scale(1.35) rotate(4deg); }
  44%  { transform: translateY(-30%) scale(1.28) rotate(-2deg); }
  58%  { transform: translateY(-8%)  scale(1.1);  }
  76%  { transform: translateY(0)    scale(1.03); }
  100% { transform: translateY(0)    scale(1); }
}

/* — Clignotement tooltip style dessin */
@keyframes tooltipBlink {
  0%, 49%  { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* — Respiration douce (scale) */
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.018); }
}

/* — Rotation lente (étoile) */
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* — Rebond léger (petit deco) */
@keyframes bob {
  0%, 100% { transform: translateY(0) scale(1); }
  35%       { transform: translateY(-2.5%) scale(1.03); }
  65%       { transform: translateY(-1%) scale(1.01); }
}

/* — Ondulation subtile (drapeaux/médaillons) */
@keyframes wobble {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25%       { transform: rotate(1.5deg) scale(1.01); }
  75%       { transform: rotate(-1.5deg) scale(1.01); }
}

/* — Secousse du header + tableaux quand "is mad" tremble */
@keyframes headerShake {
  0%    { transform: translateX(0)       rotate(0deg)     scale(1);     }
  8%    { transform: translateX(-0.55%)  rotate(-0.4deg)  scale(1.006); }
  18%   { transform: translateX(0.5%)    rotate(0.32deg)  scale(1.006); }
  30%   { transform: translateX(-0.38%)  rotate(-0.22deg) scale(1.003); }
  43%   { transform: translateX(0.26%)   rotate(0.13deg); }
  57%   { transform: translateX(-0.14%)  rotate(-0.07deg); }
  72%   { transform: translateX(0.07%); }
  86%   { transform: translateX(-0.03%); }
  100%  { transform: translateX(0)       rotate(0deg)     scale(1);     }
}

/* ══════════════════════════════════════════════════════════
   ANIMATIONS PAR ÉLÉMENT
   • Apparition  : fadeIn (opacity) — sans conflit transform
   • Idle        : transform seul  — sans conflit opacity
══════════════════════════════════════════════════════════ */

/* Fond — statique, pas d'animation */
.layer-bg {
  animation: fadeIn 0.6s ease-out both;
}

/* Header — conteneur du titre avec fond craie PSD */
.layer-header {
  animation: fadeIn 0.7s ease-out 0.1s both;
  overflow: visible;
}

/* Image de fond craie (layer_14 sans texte) */
.layer-header-bg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: fill;
  display: block;
}

/* Sprites de mots — pleine hauteur du header, width auto (ratio naturel du PNG) */
.title-word {
  position: absolute;
  top: 0;
  height: 100%;
  width: auto;
  display: block;
  transform-origin: center 78%;  /* point d'ancrage au bas du texte (80% de la hauteur du header) */
}

/* états jumping (ajoutés par JS) */
.title-word.jumping        { animation: wordJump 0.27s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
.title-word.title-ismad.jumping { animation: madJump 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }

/* Personnage principal — pendule lourd (cadre accroché en haut)
   transform-origin calé sur l'épingle : x=33.9% (mesuré sur layer_12.png), y=0% */
.layer-character {
  animation: fadeIn 1s ease-out 0.3s both;
  transform-origin: 33.9% 0%;
}

/* Colonne "originaux" — pendule léger (tableau suspendu par ficelle)
   transform-origin sur l'épingle : x=52.5% (mesuré sur layer_11.png), y=0% */
.layer-originaux {
  animation: fadeIn 0.9s ease-out 0.5s both;
  transform-origin: 52.5% 0%;
}

/* Barre basse — simple apparition */
.layer-bottombar {
  animation: fadeIn 0.8s ease-out 0.8s both;
}

/* Cartes produits — flottements décalés */
.layer-card--portrait {
  animation:
    fadeIn   0.9s ease-out 0.55s both,
    float    5.5s ease-in-out 1.3s infinite;
}

.layer-card--fanzine {
  animation:
    fadeIn    0.9s ease-out 0.65s both,
    floatDown 5s   ease-in-out 1.7s infinite;
}

.layer-card--minizines {
  animation:
    fadeIn 0.9s ease-out 0.6s both,
    float  6s  ease-in-out 0.9s infinite;
}

.layer-card--print {
  animation:
    fadeIn    0.9s ease-out 0.75s both,
    floatDown 5.2s ease-in-out 2s infinite;
}

/* Ardoise prix — simple apparition, pas d'animation idle */
.layer-ardoise {
  animation: fadeIn 0.9s ease-out 0.4s both;
}

/* Drapeaux — cliquables : wrapper avec tooltip */
.flags-wrap {
  animation: fadeIn 0.8s ease-out 0.6s both;
  cursor: pointer;
  overflow: visible;
}
.flags-wrap:focus-visible {
  outline: 3px solid rgba(255,255,255,0.8);
  outline-offset: 4px;
  border-radius: 4px;
}
.flags-wrap > img {
  width: 100%;
  height: 100%;
  display: block;
}
.flags-tooltip {
  position: fixed;
  background: rgba(18, 14, 30, 0.93);
  color: #f0f0f0;
  font-family: 'Inkfree', cursive;
  font-size: max(0.9vw, 11px);
  white-space: nowrap;
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.85);
  box-shadow: 3px 3px 0 rgba(255,255,255,0.22);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 200;
}

/* Cadre décoratif — respire */
.layer-frame {
  animation:
    fadeIn  1s ease-out 0.3s both,
    breathe 4s ease-in-out 0.5s infinite;
}

/* Photo matériaux — respire légèrement */
.layer-photo {
  animation:
    fadeIn  1s ease-out 0.5s both,
    breathe 5s ease-in-out 1.4s infinite;
}

/* Étoile noire — rotation lente continue */
.layer-star {
  animation:
    fadeIn   0.7s  ease-out 0.2s both,
    spinSlow 30s   linear    0s  infinite;
  transform-origin: 50% 50%;
}

/* Petit élément déco — rebond périodique */
.layer-deco {
  animation:
    fadeIn 0.6s ease-out 0.1s both,
    bob    3.5s ease-in-out 0.7s infinite;
}

/* ─── Balayage de couleur sur le titre ───────────────────── */
/* (supprimé — remplacé par l'animation mot par mot via JS) */

/* ─── Texte masqué (SEO / accessibilité) ─────────────────── */

.title-color-sweep,
.mad-overlay {
  display: none; /* supprimés — remplacés par l'animation JS */
}

/* ─── Calques texte HTML (overlay sur les images) ────────── */
/* Conteneur pour les calques avec texte HTML */
.layer-wrap {
  overflow: visible;
}
.layer-wrap > img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: block;
}

/* Texte HTML overlay */
.layer-text {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Inkfree', cursive;
  color: #f0f0f0;
  white-space: pre-line;
  line-height: 1.35;
}

/* Ardoise (layer_05) : zone intérieure du tableau noir (sans le cadre bois haut ~13%) */
.layer-text--ardoise {
  top: 13%;  left: 7%;
  width: 86%; height: 78%;
  font-size: clamp(10px, 1.6vw, 27px);
}

/* Bulle microédition en haut (layer_09) — starburst 0–22% hauteur */
.layer-text--micro {
  top: 2%;  left: 4%;
  width: 92%; height: 30%;
  font-size: clamp(8px, 1.3vw, 22px);
}

/* Bulle originaux en bas (layer_11) — starburst ~66–96% hauteur */
.layer-text--originaux {
  top: 63%; left: 5%;
  width: 90%; height: 33%;
  font-size: clamp(8px, 1.25vw, 20px);
}

/* Bulle drapeaux à droite (layer_04) */
.layer-text--flags {
  top: 10%;  left: 61%;
  width: 36%; height: 80%;
  font-size: clamp(7px, 1.1vw, 18px);
}

/* Portfolio bulle (layer_12) — bulle speech haut-droite ~55-98% x, 2-55% y */
.layer-text--portfolio {
  top: 2%;  left: 55%;
  width: 43%; height: 53%;
  font-size: clamp(8px, 1.3vw, 22px);
  line-height: 1.25;
}

/* Étoile "en création" (layer_01) — texte centré dans le starburst */
.layer-text--encreation {
  top: 12%; left: 12%;
  width: 76%; height: 76%;
  font-size: clamp(7px, 1.1vw, 18px);
  line-height: 1.25;
}

/* ─── Texte masqué (SEO / accessibilité) ─────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Lien Instagram (fixe, bas-droite) ──────────────────── */
.instagram-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  padding: 0.6rem 1.1rem;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: 'Inkfree', cursive;
  font-size: 1.1rem;
  text-decoration: none;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: background 0.2s;
  z-index: 100;
}
.instagram-link svg { width: 22px; height: 22px; }

.instagram-link:hover,
.instagram-link:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ─── Accessibilité : mouvement réduit ───────────────────── */
@media (prefers-reduced-motion: reduce) {
  .layer {
    animation: none !important;
    opacity: 1 !important;
  }
}

/* ─── Panels (display:contents sur desktop) ─────────────── */
.panel {
  display: contents;
}

/* ─── Footer ──────────────────────────────────────── */
.site-footer {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 16px;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  font-family: 'Inkfree', cursive;
  font-size: clamp(11px, 1.1vw, 15px);
  color: rgba(255,255,255,0.65);
}

.site-footer__name {
  color: #fff;
  font-size: clamp(12px, 1.3vw, 17px);
  letter-spacing: 0.03em;
}

.site-footer__red { color: #d94040; }

.site-footer__sep { opacity: 0.35; }

.site-footer__tagline { font-style: italic; }

.site-footer__ig {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  transition: color 0.2s;
}
.site-footer__ig:hover { color: #fff; }

.site-footer__copy {
  font-size: clamp(9px, 0.9vw, 12px);
  opacity: 0.4;
}

/* ─── Mobile header + grid (cachés sur desktop) ─────────── */
.mobile-header,
.mobile-grid {
  display: none;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE MOBILE ≤767px
   Canvas visible et identique au desktop — tout est en %
   donc se redimensionne proportionnellement au viewport.
═══════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  /* Canvas affiché tel quel — layers en % scalent avec lui */
  .canvas { overflow: visible; }

  /* Bouton Instagram caché sur mobile */
  .instagram-link { display: none; }
}

