/* =============================================================
   MÉRIDIEN — les instruments
   Le bandeau de relevé, le panneau de contrôle et les décors de
   question. Tout est en trait fin, à l'accent, sous le texte :
   ça vit, ça ne parle jamais plus fort que la question.
   ============================================================= */

/* -------------------------------------------------------------
   Bandeau de relevé — sous l'en-tête du questionnaire
   ------------------------------------------------------------- */
.rig {
  position: relative;
  margin-bottom: 24px;
  padding: 11px 0 10px;
  border-top: 1px solid var(--hair-soft);
  border-bottom: 1px solid var(--hair-soft);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease-out);
}
.rig[data-on] { opacity: 1; transform: none; }

/* la ligne de balayage qui traverse le bandeau, comme un écran de contrôle */
.rig__scan {
  position: absolute; top: 0; bottom: 0; left: 0; width: 26%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 11%, transparent), transparent);
  animation: rigScan 7.5s var(--ease) infinite;
}
@keyframes rigScan {
  0%, 8%   { transform: translateX(-110%); }
  62%,100% { transform: translateX(430%); }
}

.rig__row { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 12px; }
.rig__cell { min-width: 0; }
.rig__cell span {
  display: block;
  font-family: var(--mono); font-size: 9px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--bone-28);
}
.rig__cell b {
  display: block; margin-top: 3px;
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: .02em; color: var(--bone-70);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rig__cell:first-child b { color: var(--accent); }

/* le spectre : une barre par dimension pesée, hauteur = poids */
.rig__spectre {
  display: flex; align-items: flex-end; gap: 2px;
  height: 14px; margin-top: 10px;
}
.rig__spectre i {
  flex: 1; min-width: 0;
  height: var(--h, 8%);
  background: color-mix(in srgb, var(--accent) 46%, transparent);
  transition: height 620ms var(--ease-out);
}
.rig__spectre i:nth-child(4n + 1) { background: color-mix(in srgb, var(--accent) 78%, transparent); }

/* -------------------------------------------------------------
   Le décor de question
   ------------------------------------------------------------- */
.motif {
  /* fixe et hors de la colonne : le clip-path d'entrée de scène le coupait,
     et le décor doit pouvoir déborder sans créer de défilement latéral */
  position: fixed; z-index: 3;
  top: 8vh; right: 0;
  width: min(44vw, 178px); aspect-ratio: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-med) var(--ease);
}
body[data-scene="quiz"] .motif { opacity: 1; }

@media (min-width: 1024px) {
  .motif { top: 13vh; right: clamp(28px, 4vw, 64px); width: 196px; }
}
.motif__art {
  width: 100%; height: 100%;
  overflow: visible;
  color: var(--accent);
  opacity: 0;
  animation: motifIn 720ms var(--ease-out) 120ms forwards;
}
.motif__art[data-out] { animation: motifOut 400ms var(--ease-in) forwards; }

@keyframes motifIn  { from { opacity: 0; transform: scale(.86) rotate(-6deg); }
                      to   { opacity: .34; transform: none; } }
@keyframes motifOut { from { opacity: .34; transform: none; }
                      to   { opacity: 0; transform: scale(1.12) rotate(5deg); } }

/* la grammaire commune des traits */
.motif__art line, .motif__art path, .motif__art rect, .motif__art ellipse, .motif__art circle {
  vector-effect: non-scaling-stroke;
}
.mo-l, .mo-o, .mo-l-s {
  fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: round;
}
.mo-o { stroke-width: .9; }
.mo-l-s { stroke-width: .8; }
.mo-fill { fill: currentColor; stroke: none; }
.mo-dim { opacity: .42; }
.mo-strong { stroke-width: 1.5; }
.mo-ray { stroke: currentColor; stroke-width: 1; }

/* --- animations des archétypes ------------------------------- */
.mo-spin      { animation: moSpin 44s linear infinite; transform-origin: 50px 50px; }
.mo-spin-slow { animation: moSpin 90s linear infinite reverse; transform-origin: 50px 50px; }
@keyframes moSpin { to { transform: rotate(360deg); } }

.mo-ray {
  animation: moRay 3.4s var(--ease) infinite;
  animation-delay: calc(var(--i) * -120ms);
  transform-origin: 50px 50px;
}
@keyframes moRay { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

.mo-fall {
  animation: moFall 9s linear infinite;
  animation-delay: calc(var(--i) * -640ms);
}
@keyframes moFall {
  0%   { transform: translateY(-6px); opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: translateY(80px); opacity: 0; }
}

.mo-breathe {
  animation: moBreathe 6.2s var(--ease) infinite;
  animation-delay: calc(var(--i) * -460ms);
  transform-origin: 50px 52px;
}
@keyframes moBreathe { 0%, 100% { transform: scale(.96); opacity: .5; } 50% { transform: scale(1.05); opacity: 1; } }

.mo-bar {
  fill: currentColor; stroke: none;
  animation: moBar 4.6s var(--ease) infinite;
  animation-delay: calc(var(--i) * -170ms);
  transform-origin: 50px 88px;
}
@keyframes moBar { 0%, 100% { transform: scaleY(.5); } 50% { transform: scaleY(1); } }

.mo-col {
  fill: none; stroke: currentColor; stroke-width: .9;
  animation: moCol 5.4s var(--ease) infinite;
  animation-delay: calc(var(--i) * -230ms);
  transform-origin: 50px 86px;
}
@keyframes moCol { 0%, 100% { transform: scaleY(.28); } 50% { transform: scaleY(1); } }

.mo-pulse { animation: moPulse 2.8s var(--ease) infinite; transform-origin: 50px 50px; }
@keyframes moPulse { 0%, 100% { transform: scale(.9); opacity: .5; } 50% { transform: scale(1.15); opacity: 1; } }

.mo-ripple {
  animation: moRipple 4.4s var(--ease-out) infinite;
  animation-delay: calc(var(--i) * -880ms);
  transform-origin: 50px 50px;
}
@keyframes moRipple { 0% { transform: scale(.06); opacity: .95; } 100% { transform: scale(1); opacity: 0; } }

.mo-swing { animation: moSwing 7s var(--ease) infinite; transform-origin: 50px 50px; }
@keyframes moSwing { 0%, 100% { transform: rotate(-18deg); } 50% { transform: rotate(26deg); } }

.mo-tick-swing { animation: moTick 2.2s var(--ease) infinite; transform-origin: 50px 80px; }
@keyframes moTick { 0%, 100% { transform: rotate(-21deg); } 50% { transform: rotate(21deg); } }

.mo-travel { opacity: .9; }

.mo-scroll { animation: moScroll 6s linear infinite; }
@keyframes moScroll { from { transform: translateX(0); } to { transform: translateX(-100px); } }

.mo-blink {
  animation: moBlink 3.6s var(--ease) infinite;
  animation-delay: calc(var(--i) * -290ms);
}
@keyframes moBlink { 0%, 100% { opacity: .25; } 45% { opacity: 1; } }

.mo-drift-l { animation: moDriftL 8.5s var(--ease) infinite; }
.mo-drift-r { animation: moDriftR 8.5s var(--ease) infinite; }
@keyframes moDriftL { 0%, 100% { transform: translateX(0); opacity: .5; } 50% { transform: translateX(-7px); opacity: 1; } }
@keyframes moDriftR { 0%, 100% { transform: translateX(0); opacity: 1; } 50% { transform: translateX(7px); opacity: .5; } }

.mo-type {
  animation: moType 5.2s var(--ease-out) infinite;
  animation-delay: calc(var(--i) * -430ms);
  transform-origin: 25px 50px;
}
@keyframes moType { 0%, 100% { transform: scaleX(.1); opacity: 0; } 22%, 78% { transform: scaleX(1); opacity: .42; } }

.mo-stamp { animation: moStamp 4.8s var(--ease-out) infinite; transform-origin: 66px 70px; }
@keyframes moStamp {
  0%, 55%  { transform: scale(1.5) rotate(-14deg); opacity: 0; }
  66%      { transform: scale(1) rotate(-8deg);    opacity: 1; }
  96%,100% { transform: scale(1) rotate(-8deg);    opacity: .9; }
}

/* -------------------------------------------------------------
   Le panneau de contrôle — grands écrans seulement
   ------------------------------------------------------------- */
.hud { display: none; }

@media (min-width: 1180px) {
  .hud {
    display: block;
    position: fixed; z-index: 22;
    right: clamp(28px, 4vw, 64px);
    top: 50%; transform: translateY(-50%);
    width: 208px;
    padding: 12px 13px 14px;
    border: 1px solid var(--hair-soft);
    background: var(--panel);
    backdrop-filter: blur(3px);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--t-slow) var(--ease), transform var(--t-med) var(--ease-out);
  }
  /* le panneau ne s'allume que quand il a quelque chose à dire */
  body[data-scene="quiz"] .hud,
  body[data-scene="compute"] .hud { opacity: 1; }
  body[data-scene="result"] .hud { opacity: .55; }
}

.hud__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 9px; margin-bottom: 10px;
  border-bottom: 1px solid var(--hair-soft);
  font-family: var(--mono); font-size: 9px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--bone-45);
}
.hud__led {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  animation: hudLed 2.4s var(--ease) infinite;
}
@keyframes hudLed { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.hud__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; }
.hud__grid span {
  display: block;
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--bone-28);
}
.hud__grid b {
  display: block; margin-top: 2px;
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  color: var(--bone-70); font-variant-numeric: tabular-nums;
}

/* le scope : le même spectre de poids, en plus haut */
.hud__scope {
  display: flex; align-items: flex-end; gap: 2px;
  height: 34px; margin: 13px 0 12px;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--hair-soft);
}
.hud__scope i {
  flex: 1; height: var(--h, 6%);
  background: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: height 720ms var(--ease-out);
}
.hud__scope i:nth-child(4n + 1) { background: color-mix(in srgb, var(--accent) 82%, transparent); }

.hud__axes { display: grid; gap: 7px; }
.hud__axes li {
  display: grid; grid-template-columns: 1fr 46px; align-items: center; gap: 8px;
  animation: hudAxis 460ms var(--ease-out) both;
  animation-delay: calc(var(--i) * 70ms);
}
@keyframes hudAxis { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: none; } }
.hud__axes span {
  font-family: var(--mono); font-size: 9px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--bone-45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hud__axes i {
  display: block; height: 2px; background: var(--accent);
  transform: scaleX(var(--w, .5)); transform-origin: left;
  transition: transform 620ms var(--ease-out);
}

/* -------------------------------------------------------------
   Le cadran : lecture fine sous la valeur nommée
   ------------------------------------------------------------- */
.dial__fine {
  margin-left: auto;
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  color: var(--bone-45); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dial__fine b { color: var(--accent); font-weight: 500; }

/* le repère saute d'un cran à l'autre : on le voit bouger même d'un pas */
.dial__needle::before {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px;
  background: var(--accent); border-radius: 50%;
  transition: transform 160ms var(--ease-out);
}
.dial__track[data-live] .dial__needle::before { transform: scale(1.7); }
.dial__track[data-live] .dial__needle::after { animation: dialHalo 1.4s var(--ease-out) infinite; }
@keyframes dialHalo {
  0%   { transform: scale(.7); opacity: .5; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { opacity: 0; }
}

/* -------------------------------------------------------------
   Le méridien respire pendant le calcul
   ------------------------------------------------------------- */
body[data-scene="compute"] .meridian { animation: railPulse 1.6s var(--ease) infinite; }
@keyframes railPulse {
  0%, 100% { border-right-color: var(--hair-soft); }
  50%      { border-right-color: color-mix(in srgb, var(--accent) 44%, transparent); }
}

/* -------------------------------------------------------------
   Mouvement réduit : les décors se figent, les valeurs restent
   ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .rig__scan { display: none; }
  .motif { display: none; }
  .hud__led { animation: none; opacity: .8; }
  .meridian { animation: none !important; }
}

/* -------------------------------------------------------------
   Le balayage du calcul — les pays défilent, la barre se remplit
   ------------------------------------------------------------- */
.compute__scan {
  margin-top: 30px; padding-top: 16px;
  border-top: 1px solid var(--hair-soft);
  display: grid; gap: 11px;
}
.compute__name {
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em;
  color: var(--bone-45); min-height: 1.3em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.compute__bar { display: block; height: 2px; background: var(--hair); overflow: hidden; }
.compute__bar i {
  display: block; height: 100%; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform 120ms linear;
}

.mo-tip { animation: moTip 6.4s var(--ease) infinite; transform-origin: 50px 40px; }
@keyframes moTip {
  0%, 100% { transform: rotate(-9deg); }
  38%      { transform: rotate(7deg); }
  72%      { transform: rotate(-2deg); }
}
