/* ==========================================================================
   TRAVERSE — démo en direct : le métreur, le client, l'atelier.
   Trois écrans côte à côte sur ordinateur, reliés par deux fils (devis,
   acceptation, barres coupées) et un arc au-dessus du client : les cotes en
   cours de prise partent à l'atelier sans passer par lui. Un écran à la fois
   sur téléphone. Aucun mode d'emploi : on tire une cote, ça bouge ailleurs.
   ========================================================================== */

:root { --bg: #15181b; --bg-2: #23272b; --s: 1; --v: 0; --drag: 0px; --gap: 150px; --arc: 44px; }
html { overflow-x: clip; }
body { min-height: 100vh; background: radial-gradient(120% 80% at 50% 0%, var(--bg-2), var(--bg) 64%) fixed, var(--bg); color: #f1efe9; }
body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; background-image: linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px); background-size: 24px 24px; }

/* ---------- Bandeau du haut ------------------------------------------------------- */
.top { position: relative; z-index: 20; display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 20px; padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.top__brand { display: flex; align-items: center; min-height: 44px; flex: none; text-decoration: none; color: #fff; }
.top__logo .logo-mark { width: 28px; height: 28px; }
.top__logo .logo__w b { font-size: 17px; color: #fff; }
.top__tag { position: relative; padding: 3px 10px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px; color: rgba(255, 255, 255, .66); font-size: 12.5px; text-decoration: none; white-space: nowrap; }
.top__tag::after { content: ""; position: absolute; inset: -10px -4px; }
.top__tag b { color: #fff; font-weight: 600; }
.top__links { display: flex; gap: 18px; margin-left: auto; min-width: 0; }
.top__links a { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--metre); font-size: 13.5px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.top__links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.top__links svg { flex: none; width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Scène ------------------------------------------------------------------------- */
.duo { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; min-height: calc(100svh - 52px); padding: 12px 20px 18px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; width: min(100%, calc(3 * 390px * var(--s) + 2 * var(--gap))); margin: 0 auto 6px; }
.head__title { max-width: 21ch; font-family: var(--display); font-weight: 680; font-stretch: 104%; font-size: clamp(24px, 2.1vw, 32px); line-height: 1.04; letter-spacing: -.02em; color: #fff; text-wrap: balance; }
.head__title em { font-style: normal; color: var(--metre); }

.desk { display: block; flex: none; padding: 10px 14px 11px; border-radius: 16px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); color: #fff; text-decoration: none; transition: background-color .25s, border-color .25s; }
.desk:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); }
.desk__head { display: flex; align-items: center; gap: 7px; font-size: 11px; color: rgba(255, 255, 255, .6); }
.desk__dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: #4fd18b; }
.desk__dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #4fd18b; animation: dot 1.8s ease-out infinite; }
.desk__nums { display: grid; grid-template-columns: repeat(3, auto); gap: 22px; margin-top: 6px; }
.desk__nums > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.desk__nums b { font-family: var(--mono); font-weight: 500; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.02em; transition: color .4s; }
.desk__nums small { color: rgba(255, 255, 255, .6); font-size: 11.5px; line-height: 1.25; white-space: nowrap; }
.desk__nums small i { font-style: normal; color: rgba(255, 255, 255, .42); }
.desk__nums b.is-bump { color: var(--metre); animation: bump .7s var(--ease); }
@keyframes bump { 35% { transform: scale(1.14); } }

.track { position: relative; display: grid; grid-template-columns: auto var(--gap) auto var(--gap) auto; justify-content: center; align-items: start; padding-top: var(--arc); }

.dev { position: relative; z-index: 2; margin: 0; width: calc(390px * var(--s)); height: calc(820px * var(--s) + 30px); }
.dev__frame { position: absolute; top: 0; left: 0; width: 390px; height: 820px; padding: 11px; border-radius: 58px; background: #0b0d0f; box-shadow: 0 0 0 1.5px #3a3f44, 0 50px 90px -40px rgba(0, 0, 0, .85); transform: scale(var(--s)); transform-origin: top left; }
.dev__screen { display: flex; flex-direction: column; height: 100%; overflow: hidden; border-radius: 47px; background: var(--anthracite); }
.dev__screen iframe { flex: 1; display: block; width: 100%; min-height: 0; border: 0; background: var(--calque); }
.dev__status { flex: none; display: grid; grid-template-columns: 1fr 120px 1fr; align-items: center; height: 46px; padding: 0 26px 0 34px; color: #fff; }
.dev__status time { font-weight: 700; font-size: 15px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.dev__island { justify-self: center; width: 112px; height: 32px; border-radius: 20px; background: #0b0d0f; }
.dev__icons { justify-self: end; display: flex; align-items: flex-end; gap: 2px; height: 12px; }
.dev__icons i { width: 3px; border-radius: 1px; background: currentColor; }
.dev__icons i:nth-child(1) { height: 5px; } .dev__icons i:nth-child(2) { height: 8px; } .dev__icons i:nth-child(3) { height: 11px; }
.dev__icons b { width: 22px; height: 11px; margin-left: 6px; padding: 1.5px; border: 1.5px solid currentColor; border-radius: 3.5px; background: linear-gradient(90deg, currentColor 70%, transparent 70%) content-box; opacity: .9; }

/* L'écran de l'atelier : un écran durci, pas un téléphone */
.dev--scr .dev__frame { padding: 16px 12px 22px; border-radius: 22px; background: linear-gradient(180deg, #2c3136, #1b1e21); box-shadow: 0 0 0 1.5px #4a5056, inset 0 0 0 1px rgba(255, 255, 255, .06), 0 50px 90px -40px rgba(0, 0, 0, .85); }
.dev--scr .dev__screen { border-radius: 8px; }
.dev__status--scr { display: flex; justify-content: space-between; gap: 10px; height: 30px; padding: 0 14px; font-family: var(--mono); font-size: 11px; color: rgba(255, 255, 255, .62); background: #1b1e21; }
.dev__status--scr time { font-size: 12px; font-weight: 500; color: #fff; }
.dev__cam { width: 7px; height: 7px; border-radius: 50%; background: #0b0d0f; box-shadow: 0 0 0 1.5px #3a3f44; }

.dev figcaption { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 11.5px; color: rgba(255, 255, 255, .6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev__dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--metre); }
.dev--cli .dev__dot { background: #8fd3e0; }
.dev--scr .dev__dot { background: #4fd18b; }
.dev__shield { display: none; }

.dev.is-ping .dev__frame { animation: ping 1.3s var(--ease); }
@keyframes ping {
  0% { box-shadow: 0 0 0 1.5px #3a3f44, 0 0 0 0 rgba(242, 194, 27, .7), 0 50px 90px -40px rgba(0, 0, 0, .85); }
  100% { box-shadow: 0 0 0 1.5px #3a3f44, 0 0 0 28px rgba(242, 194, 27, 0), 0 50px 90px -40px rgba(0, 0, 0, .85); }
}

/* ---------- Les fils ------------------------------------------------------------------------ */
.wire { position: relative; z-index: 3; align-self: start; height: 120px; margin-top: calc(300px * var(--s)); }
.wire__line { position: absolute; left: -6px; right: -6px; top: 50%; border-top: 1.5px dashed rgba(255, 255, 255, .2); }
.wire__line::before, .wire__line::after { content: ""; position: absolute; top: -4.5px; width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .4); }
.wire__line::before { left: -3px; } .wire__line::after { right: -3px; }
.wire__pulse, .arc__pulse { position: absolute; left: -8px; top: calc(50% - 8px); width: 16px; height: 16px; border-radius: 50%; background: var(--metre); box-shadow: 0 0 0 5px rgba(242, 194, 27, .25), 0 0 26px 7px rgba(242, 194, 27, .5); opacity: 0; pointer-events: none; }
.wire__pulse.is-ok { background: #4fd18b; box-shadow: 0 0 0 5px rgba(79, 209, 139, .25), 0 0 26px 7px rgba(79, 209, 139, .5); }

.chip { position: absolute; left: 50%; bottom: calc(50% + 14px); z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 2px; width: max-content; max-width: calc(var(--gap) + 36px); padding: 8px 12px 9px; border-radius: 14px; background: #fff; color: var(--ink); text-align: center; box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .6); opacity: 0; transform: translate(-50%, 8px) scale(.94); transition: opacity .35s, transform .5s var(--ease); pointer-events: none; }
.chip.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.chip b { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 750; line-height: 1.15; }
.chip small { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.chip svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip.is-metre { background: var(--metre); }
.chip.is-ok { background: #4fd18b; }

/* L'arc : les cotes en direct, du métreur à l'atelier, sans passer par le client */
.arc { position: absolute; z-index: 1; left: 0; top: 0; width: 100%; height: calc(var(--arc) + 30px); overflow: visible; pointer-events: none; }
.arc__line { fill: none; stroke: rgba(242, 194, 27, .3); stroke-width: 1.5; stroke-dasharray: 5 6; transition: stroke .4s; }
.arc.is-live .arc__line { stroke: rgba(242, 194, 27, .85); animation: flow 1s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -22; } }
.arc__pulse { top: 0; left: 0; z-index: 4; }
.chip--arc { bottom: auto; top: calc(var(--arc) * -0.5 - 4px); max-width: none; flex-direction: row; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--metre); }
.chip--arc small { color: var(--ink); }
.chip--arc b { white-space: nowrap; }

/* Doigt fantôme : montre le geste une fois, s'efface dès qu'on touche */
.ghost { position: fixed; left: 0; top: 0; z-index: 100; visibility: hidden; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255, 255, 255, .4); box-shadow: 0 0 0 2px rgba(255, 255, 255, .92), 0 8px 22px rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; }
.ghost.is-on { visibility: visible; }
.ghost::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #fff; opacity: 0; }
.ghost.is-tap::after { animation: ripple .6s var(--ease); }
.ghost.is-hold { background: rgba(242, 194, 27, .45); }
@keyframes ripple { 0% { opacity: .9; transform: scale(.6); } 100% { opacity: 0; transform: scale(2.1); } }

.switch { display: none; }

/* ---------- Tablette et petit ordinateur : les trois, réduits, sans titre ni compteurs --------- */
@media (max-width: 1279px) {
  :root { --gap: 74px; --arc: 36px; }
  .top__xl { display: none !important; }
  .dev__sub { display: none; }
  .head { display: none; }
  .chip { max-width: 140px; padding: 7px 9px 8px; }
  .chip b { font-size: 12px; flex-direction: column; gap: 3px; }
  .chip small { font-size: 10.5px; white-space: normal; }
  .chip--arc { max-width: none; padding: 6px 12px; }
  .chip--arc b { flex-direction: row; font-size: 12.5px; }
  .chip--arc small { white-space: nowrap; }
  .dev figcaption { font-size: 10.5px; }
}

/* ---------- Téléphone : un écran à la fois, on glisse ou on touche ------------------------------- */
@media (max-width: 759px) {
  html, body { height: 100%; overflow: hidden; }
  body { min-height: 0; }
  .top { height: 48px; padding: 0 14px; gap: 10px; }
  .top__more { display: none !important; }
  .duo { display: flex; flex-direction: column; height: calc(100svh - 48px); min-height: 0; padding: 10px 0 calc(78px + env(safe-area-inset-bottom, 0px)); overflow: hidden; }
  .track { flex: 1; min-height: 0; display: flex; justify-content: flex-start; gap: 10px; padding: 0 20px; transform: translateX(calc(var(--v) * (30px - 100vw) + var(--drag))); transition: transform .6s var(--ease); }
  .duo.is-drag .track { transition: none; }
  .wire, .arc, .arc__pulse, .chip--arc { display: none; }
  .dev { flex: none; width: calc(100vw - 40px); height: 100%; }
  .dev__frame, .dev--scr .dev__frame { position: absolute; inset: 0; width: auto; height: auto; padding: 5px; border-radius: 32px; transform: none; transition: opacity .5s, transform .6s var(--ease), box-shadow .5s; }
  .dev--scr .dev__frame { border-radius: 18px; padding: 6px; }
  .dev__screen { border-radius: 27px; }
  .dev--scr .dev__screen { border-radius: 12px; }
  .dev__status, .dev figcaption { display: none; }
  .dev:not(.is-on) .dev__frame { opacity: .45; transform: scale(.94); }
  .dev:not(.is-on) .dev__shield { display: block; position: absolute; inset: 0; z-index: 3; border: 0; background: transparent; -webkit-tap-highlight-color: transparent; }

  .switch { position: fixed; z-index: 30; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(360px, calc(100vw - 32px)); padding: 5px; border-radius: 999px; background: rgba(11, 13, 15, .9); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .7); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); transform: translateX(-50%); }
  .switch__thumb { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px) / 3); border-radius: 999px; background: var(--metre); transform: translateX(calc(var(--v) * 100%)); transition: transform .5s var(--ease); }
  .switch button { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 4px; border: 0; border-radius: 999px; background: none; color: rgba(255, 255, 255, .75); font-weight: 700; font-size: 14px; -webkit-tap-highlight-color: transparent; transition: color .35s; }
  .switch button[aria-selected="true"] { color: var(--ink); }
  .switch svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .switch__dot { position: absolute; top: 8px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: #ff5a4a; box-shadow: 0 0 0 2px rgba(11, 13, 15, .9); }
  .switch__dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #ff5a4a; animation: dot 1.4s ease-out infinite; }
}
@keyframes dot { 0% { opacity: .8; transform: scale(.5); } 100% { opacity: 0; transform: scale(1.6); } }
@media (max-width: 420px) { .top__logo .logo__w { display: none; } .top__links a { font-size: 13px; } }
@media (max-width: 360px) { .switch button svg { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .track, .dev__frame, .switch__thumb, .chip { transition: none !important; }
  .dev.is-ping .dev__frame, .desk__nums b.is-bump, .switch__dot::after, .arc.is-live .arc__line { animation: none; }
}
