/* ==================================================================
   IBRAHIM MYKODA — feuille de style unique
   1. Tokens
   2. Base
   3. Barre de marque
   4. Hero + scène 3D
   5. Section « La pièce »
   6. Animations d'entrée
   7. Responsive
   8. Accessibilité / mouvement réduit
   ================================================================== */

/* ---------- 1. Tokens ------------------------------------------- */
:root {
  /* Palette volontairement monochrome : la seule « couleur » du site
     est la lumière posée sur la maille. */
  --ink:      #0A0A0B;   /* noir mat, fond global            */
  --ink-lift: #101012;   /* panneau légèrement décollé       */
  --bone:     #EDEAE3;   /* texte principal, blanc os        */
  --ash:      #85858C;   /* texte secondaire                 */
  --line:     rgba(237, 234, 227, 0.13);
  --glow:     rgba(200, 212, 226, 0.10); /* lumière froide de studio */

  --f-display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --f-body:    'Instrument Sans', 'Helvetica Neue', Arial, sans-serif;
  --f-mono:    'DM Mono', ui-monospace, 'SFMono-Regular', monospace;

  --gutter: clamp(20px, 4.5vw, 64px);
  --ease:   cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- 2. Base --------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Côtes verticales très fines : rappel de la maille du vêtement.
   C'est la seule texture du site, elle traverse toutes les sections. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.022) 0 1px,
    transparent 1px 4px
  );
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--bone);
  color: var(--ink);
  padding: 10px 16px;
  z-index: 99;
}
.skip:focus { left: 8px; top: 8px; }

:focus-visible {
  outline: 1px solid var(--bone);
  outline-offset: 4px;
}

.eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ash);
  margin: 0;
}

/* ---------- 3. Barre de marque ---------------------------------- */
.bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--gutter);
  /* Voile qui n'apparait qu'une fois la Hero depassee : au repos la
     barre flotte sur le noir, ensuite elle se detache du contenu. */
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.5s var(--ease), border-color 0.5s var(--ease),
              padding 0.5s var(--ease), backdrop-filter 0.5s var(--ease);
}
.bar.is-stuck {
  background: rgba(10, 10, 11, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line);
  padding-top: 13px;
  padding-bottom: 13px;
}

/* Logo : uniquement « IBRAHIM MYKODA ». Jamais le domaine. */
.logo {
  display: inline-flex;
  gap: 0.5em;
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 118, 'wght' 620;
  font-size: clamp(11px, 1.05vw, 13px);
  letter-spacing: 0.15em;
  line-height: 1;
  white-space: nowrap;
}
.logo__a { color: var(--bone); opacity: 0.5; }
.logo__b { color: var(--bone); }

.bar__nav {
  display: flex;
  gap: 26px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ash);
}
.bar__nav a { transition: color 0.3s var(--ease); }
.bar__nav a:hover { color: var(--bone); }

/* ---------- 4. Hero + scène 3D ---------------------------------- */
.hero {
  position: relative;
  z-index: 1;
  --leave: 0;
  min-height: 100svh;
  /* Deux rangees : la scene occupe tout l'espace disponible, l'invite
     possede sa propre bande en bas. Aucun chevauchement possible. */
  display: grid;
  grid-template-rows: 1fr auto;
  padding: clamp(78px, 11vh, 104px) var(--gutter) clamp(22px, 4vh, 38px);
  overflow: hidden;
}

.hero__scene {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
}

/* Ombre portee par la cagoule sur le nom : c'est elle qui cree la
   profondeur. Aucune lumiere ajoutee au fond, uniquement du noir. */
.hero__contact {
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 1;
  width: min(76vw, 620px);
  height: min(52vh, 470px);
  transform: translate(-50%, -50%) scale(var(--grow, 1));
  pointer-events: none;
  opacity: calc(1 - var(--leave));
  background: radial-gradient(50% 50% at 50% 50%,
    rgba(0, 0, 0, 0.88) 0%,
    rgba(0, 0, 0, 0.62) 46%,
    rgba(0, 0, 0, 0.22) 66%,
    transparent 76%);
}

/* Nom de la marque, en arriere-plan du modele */
.wordmark {
  z-index: 0;
  opacity: calc(1 - var(--leave));
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
  width: 100%;
  text-align: center;
  pointer-events: none;
  user-select: none;
}
.wordmark__over {
  display: block;
  font-family: var(--f-mono);
  font-size: clamp(9px, 1vw, 12px);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--ash);
  margin-bottom: clamp(8px, 1.4vw, 18px);
}
.wordmark__main {
  display: block;
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 118, 'wght' 600;
  /* Plafonne pour que MYKODA tienne toujours dans la largeur */
  font-size: clamp(46px, 13.5vw, 190px);
  line-height: 0.84;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: transparent;
  /* Deux couches : un reflet qui balaie les lettres, et le metal de fond.
     La position du reflet est donnee par --sweep, calculee en JS a partir
     de l'angle reel de la cagoule. Une seule lumiere pour les deux. */
  background-image:
    linear-gradient(102deg,
      transparent 34%,
      rgba(255, 255, 255, 0.30) 44%,
      rgba(255, 255, 255, 0.92) 50%,
      rgba(255, 255, 255, 0.30) 56%,
      transparent 66%),
    linear-gradient(178deg, #FFFFFF 0%, #A9A9B0 38%, #303036 100%);
  background-size: 240% 100%, 100% 100%;
  background-position: var(--sweep, 50%) 0, 0 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
}

/* Conteneur du modèle */
.stage {
  opacity: calc(1 - var(--leave) * 0.85);
  position: relative;
  z-index: 2;
  width: min(92vw, 680px);
  height: 100%;
  max-height: 660px;
}

model-viewer {
  width: 100%;
  height: 100%;
  /* Fond de scène totalement transparent : le noir vient du site */
  background-color: transparent;
  --poster-color: transparent;
  --progress-bar-height: 0px;
  outline: none;
}

/* Barre de chargement : un simple trait qui se remplit */
.loader {
  position: absolute;
  left: 50%;
  bottom: 12%;
  width: 132px;
  height: 1px;
  transform: translateX(-50%);
  background: var(--line);
}
.loader.is-done { opacity: 0; transition: opacity 0.5s var(--ease); }
.loader__bar {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--bone);
  transition: width 0.35s var(--ease);
}

/* Bouton réalité augmentée */
.ar-btn {
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  padding: 11px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(237, 234, 227, 0.04);
  backdrop-filter: blur(8px);
  color: var(--bone);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.ar-btn:hover {
  background: rgba(237, 234, 227, 0.1);
  border-color: rgba(237, 234, 227, 0.3);
}

#ar-prompt { display: none; }
model-viewer[ar-status='session-started'] #ar-prompt {
  display: block;
  position: absolute;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
}

/* Pied de Hero */
.hero__foot {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  padding-top: clamp(12px, 2.4vh, 22px);
}
.cue {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.cue__label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ash);
  transition: color 0.4s var(--ease);
}
.cue:hover .cue__label { color: var(--bone); }

/* Un rail vertical dans lequel un point descend en boucle :
   l'invite indique la direction sans fleche ni texte superflu. */
.cue__track {
  position: relative;
  display: block;
  width: 1px;
  height: 42px;
  background: linear-gradient(180deg, var(--line), transparent);
  overflow: hidden;
}
.cue__track i {
  position: absolute;
  left: -1px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--bone);
  animation: fall 2.4s var(--ease) infinite;
}
@keyframes fall {
  0%   { top: -4px;  opacity: 0; }
  22%  { opacity: 1; }
  78%  { opacity: 1; }
  100% { top: 42px;  opacity: 0; }
}

/* ---------- 5. L'histoire : l'arbre ----------------------------- */
.wrap { max-width: 1160px; margin: 0 auto; }

.story {
  position: relative;
  z-index: 1;
  background: var(--ink-lift);
  border-top: 1px solid var(--line);
  padding: clamp(80px, 13vh, 160px) var(--gutter) clamp(70px, 11vh, 140px);
}

/* ================= Marqueur de chapitre ================= */
.chapter {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 22px);
  margin-bottom: clamp(52px, 8vw, 104px);
}
/* L'amplitude d'ages remplace le numero de section : le repere porte
   du sens au lieu de compter les blocs. */
.chapter__span {
  display: inline-flex;
  align-items: center;
  gap: 0.18em;
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 118, 'wght' 620;
  font-size: clamp(34px, 5.6vw, 72px);
  line-height: 0.82;
  letter-spacing: -0.035em;
  white-space: nowrap;
  color: transparent;
  background: linear-gradient(176deg, #FFFFFF 0%, #9C9CA3 46%, #2C2C31 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
/* La fleche reste fine et grise : elle relie, elle ne pese pas. */
.chapter__span i {
  font-style: normal;
  font-family: var(--f-mono);
  font-size: 0.34em;
  color: var(--ash);
  background: none;
  -webkit-text-fill-color: var(--ash);
  transform: translateY(-0.15em);
}
.chapter__label {
  font-family: var(--f-mono);
  font-size: clamp(10px, 1.1vw, 12px);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--bone);
  white-space: nowrap;
}
.chapter__rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1.1s var(--ease) 0.15s;
}
.chapter.is-in .chapter__rule { transform: scaleX(1); }

.story__head { max-width: 720px; margin-bottom: clamp(56px, 9vw, 110px); }

.h2 {
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 96, 'wght' 500;
  font-size: clamp(30px, 5.2vw, 66px);
  line-height: 1.05;
  letter-spacing: -0.028em;
  margin: 20px 0 24px;
}
.h2 em {
  font-style: normal;
  font-variation-settings: 'wdth' 78, 'wght' 400;
  /* la chute de la phrase est ciselee dans la lumiere, comme le nom */
  color: transparent;
  background: linear-gradient(178deg, #FFFFFF 0%, #B4B4BB 55%, #55555C 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.story__intro {
  margin: 0;
  max-width: 46ch;
  font-size: clamp(15px, 1.35vw, 18px);
  line-height: 1.7;
  color: var(--ash);
}

/* -- Le tronc ----------------------------------------------------- */
.tree {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.tree__trunk {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: var(--line);
}
/* Le trait clair se remplit au fil du defilement (hauteur pilotee en JS) */
.tree__grow {
  display: block;
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, rgba(237,234,227,0.12) 0%, var(--bone) 20%, var(--bone) 100%);
  will-change: height;
}
/* -- Une etape ---------------------------------------------------- */
.step {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: clamp(26px, 4vw, 52px) 0;
}
.step:first-child { padding-top: 0; }
.step:last-child  { padding-bottom: 0; }

/* Le noeud, pose sur le tronc */
.step__node {
  position: absolute;
  left: 50%;
  top: clamp(30px, 4.4vw, 58px);
  width: 9px;
  height: 9px;
  margin: -4px 0 0 -4px;
  transform: rotate(45deg) scale(0.2);
  background: var(--ink-lift);
  border: 1px solid var(--ash);
  transition: transform 0.6s var(--ease), background 0.6s var(--ease), border-color 0.6s var(--ease);
}
/* La branche qui relie le tronc a la carte */
.step__branch {
  position: absolute;
  top: clamp(30px, 4.4vw, 58px);
  height: 1px;
  width: clamp(24px, 4vw, 56px);
  background: var(--line);
  transform: scaleX(0);
  transition: transform 0.7s var(--ease);
}

.step__card { max-width: 44ch; }
.step__year {
  display: block;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ash);
  margin-bottom: 10px;
}
.step__title {
  margin: 0 0 12px;
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 106, 'wght' 560;
  font-size: clamp(21px, 2.7vw, 32px);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.step__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ash);
}

/* Alternance gauche / droite autour du tronc */
.step:nth-child(odd)  .step__card { grid-column: 1; text-align: right; justify-self: end; padding-right: clamp(36px, 5.5vw, 76px); }
.step:nth-child(odd)  .step__branch { right: 50%; transform-origin: right center; }
.step:nth-child(even) .step__card { grid-column: 2; padding-left: clamp(36px, 5.5vw, 76px); }
.step:nth-child(even) .step__branch { left: 50%; transform-origin: left center; }

/* Etat actif : la branche se deploie, le noeud s'allume, le texte monte */
.step .step__card { opacity: 0; transform: translateY(22px); transition: opacity 0.85s var(--ease) 0.08s, transform 0.85s var(--ease) 0.08s; }
.step.is-in .step__card { opacity: 1; transform: none; }
.step.is-in .step__branch { transform: scaleX(1); }
.step.is-in .step__node {
  transform: rotate(45deg) scale(1);
  background: var(--bone);
  border-color: var(--bone);
}
/* Petit halo sur le noeud atteint, tres discret */
.step.is-in .step__node::after {
  content: '';
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(237, 234, 227, 0.22);
  transform: rotate(0deg);
}

/* -- Pied de page ------------------------------------------------- */
.foot {
  position: relative;
  z-index: 1;
  background: var(--ink);
  border-top: 1px solid var(--line);
  padding: 22px var(--gutter);
}
.foot__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ash);
}

/* ---------- 6. Animations d'entrée ------------------------------ */
/* Séquence de chargement : le nom monte, l'objet se pose. */
.is-loading .wordmark,
.is-loading .stage,
.is-loading .hero__foot,
.is-loading .bar { opacity: 0; }

.wordmark, .stage, .hero__foot, .bar {
  opacity: 1;
  transition: opacity 1s var(--ease), transform 1.2s var(--ease);
}
.is-loading .wordmark { transform: translate(-50%, -50%); }
.is-loading .stage    { transform: translateY(26px) scale(0.97); }
.stage { transition-delay: 0.15s; }
.hero__foot  { transition-delay: 0.55s; }
.bar         { transition-delay: 0.65s; }

/* Révélations au défilement */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- 7. Responsive --------------------------------------- */
@media (max-width: 860px) {
  /* Tronc cale a gauche, toutes les branches partent du meme cote :
     c'est la seule mise en page lisible sur un ecran etroit. */
  .tree__trunk { left: 7px; transform: none; }
  .step { grid-template-columns: 1fr; padding: 22px 0; }
  .step__node { left: 7px; top: 26px; }
  .step__branch { left: 7px; right: auto; top: 26px; width: 20px; transform-origin: left center; }
  .step:nth-child(odd) .step__card,
  .step:nth-child(even) .step__card {
    grid-column: 1;
    text-align: left;
    justify-self: start;
    padding: 0 0 0 40px;
    max-width: none;
  }
  .step:nth-child(odd) .step__branch { right: auto; left: 7px; transform-origin: left center; }
}

@media (max-width: 680px) {
  .hero { padding-top: 84px; }
  .stage { width: 100%; max-height: 56svh; }
  .wordmark { transform: translate(-50%, -54%); }
  .wordmark__main { font-size: clamp(40px, 17vw, 96px); }
  .bar__nav { gap: 16px; }
  .table dd { text-align: right; }
}

@media (max-width: 380px) {
  .bar__mute { display: none; }
}

/* ---------- 8. Mouvement réduit --------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
