/* ==========================================================================
   COMPTOIR 7 — démo en direct : le téléphone du revendeur et celui du patron,
   côte à côte (ordinateur) ou l'un après l'autre (téléphone). Aller-retour :
   la commande part à droite, la décision revient à gauche. Aucun mode d'emploi.
   ========================================================================== */

:root { --bg: #0e1823; --bg-2: #1a2f48; --s: 1; --v: 0; --drag: 0px; --bone: #f1ece3; --dim: rgba(241, 236, 227, .62); }
html { overflow-x: clip; }
body { min-height: 100vh; background: radial-gradient(120% 80% at 50% 0%, var(--bg-2), var(--bg) 62%); color: var(--bone); }

/* ---------- 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(241, 236, 227, .08); }
.top__brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: #fff; white-space: nowrap; font-family: var(--display); font-stretch: 64%; font-weight: 800; font-size: 23px; letter-spacing: .01em; line-height: 1; }
.top__brand b { margin-left: .14em; color: var(--signal); }
.top__brand svg { width: 28px; height: 28px; flex: none; }
.top__tag { padding: 3px 10px; border: 1px solid rgba(241, 236, 227, .18); border-radius: 999px; color: var(--dim); font-size: 12.5px; text-decoration: none; white-space: nowrap; }
.top__tag b { color: var(--bone); font-weight: 600; }
.top__links { display: flex; gap: 18px; margin-left: auto; }
.top__links a { display: inline-flex; align-items: center; gap: 4px; color: #ffa36b; font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.top__links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.top__links svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Scène : deux téléphones et le fil qui les relie ---------------------------- */

.duo { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: calc(100svh - 52px); padding: 14px 20px 22px; }
/* « Quai 7 » au pochoir, très discret, derrière la scène */
.duo::before { content: "QUAI 7"; position: absolute; left: 50%; bottom: -0.12em; transform: translateX(-50%); font-family: var(--display); font-stretch: 62%; font-weight: 800; font-size: min(30vw, 420px); line-height: .8; color: rgba(241, 236, 227, .025); white-space: nowrap; pointer-events: none; }
.track { position: relative; display: grid; grid-template-columns: auto minmax(200px, 320px) auto; justify-content: center; align-items: start; gap: clamp(18px, 2.6vw, 44px); }

.dev { position: relative; margin: 0; width: calc(390px * var(--s)); height: calc(820px * var(--s) + 34px); }
.dev__frame { position: absolute; top: 0; left: 0; width: 390px; height: 820px; padding: 11px; border-radius: 58px; background: #070b10; box-shadow: 0 0 0 1.5px #2c3f56, 0 50px 90px -40px rgba(0, 0, 0, .9); transform: scale(var(--s)); transform-origin: top left; transition: box-shadow .5s var(--ease); }
.dev__screen { display: flex; flex-direction: column; height: 100%; overflow: hidden; border-radius: 47px; background: var(--sb, var(--depot)); transition: background-color .3s; }
.dev__screen iframe { flex: 1; width: 100%; min-height: 0; border: 0; display: block; background: var(--paper); }
.dev--pat .dev__screen { background: var(--sb, var(--ink)); }
.dev--pat .dev__screen iframe { background: #14171b; }

/* Barre d'état : l'îlot ne cache jamais l'application */
.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: #000; }
.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; border: 1.5px solid currentColor; border-radius: 3.5px; background: linear-gradient(90deg, currentColor 70%, transparent 70%) content-box; padding: 1.5px; opacity: .9; }

.dev figcaption { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--dim); font-size: 12.5px; white-space: nowrap; }
.dev__dot { width: 7px; height: 7px; border-radius: 2px; background: #8fb1dd; }
.dev--pat .dev__dot { background: var(--signal); }
.dev__shield { display: none; }

/* Le téléphone qui reçoit : un halo bref */
.dev.is-ping .dev__frame { animation: ping 1.3s var(--ease); }
.dev--rev.is-ping .dev__frame { animation-name: ping-ok; }
@keyframes ping {
  0% { box-shadow: 0 0 0 1.5px #2c3f56, 0 0 0 0 rgba(255, 106, 19, .6), 0 50px 90px -40px rgba(0, 0, 0, .9); }
  100% { box-shadow: 0 0 0 1.5px #2c3f56, 0 0 0 28px rgba(255, 106, 19, 0), 0 50px 90px -40px rgba(0, 0, 0, .9); }
}
@keyframes ping-ok {
  0% { box-shadow: 0 0 0 1.5px #2c3f56, 0 0 0 0 rgba(60, 207, 122, .55), 0 50px 90px -40px rgba(0, 0, 0, .9); }
  100% { box-shadow: 0 0 0 1.5px #2c3f56, 0 0 0 28px rgba(60, 207, 122, 0), 0 50px 90px -40px rgba(0, 0, 0, .9); }
}

/* ---------- Colonne du milieu : la promesse, le fil, le dépôt --------------------------- */

.mid { display: flex; flex-direction: column; justify-content: space-between; height: calc(820px * var(--s)); padding: 6px 0 2px; }
.mid__title { font-family: var(--display); font-stretch: 66%; font-weight: 800; font-size: clamp(34px, 3.3vw, 50px); line-height: .9; text-transform: uppercase; letter-spacing: -.005em; color: #fff; text-wrap: balance; }
.mid__sub { max-width: 30ch; margin-top: 14px; font-size: 14px; line-height: 1.5; color: var(--dim); }
.desk__nums small i { display: block; margin-top: 2px; font-style: normal; color: #ffa36b; }
.mid__title em { display: block; margin-top: .08em; font-style: normal; color: var(--signal); }

.wire { position: relative; height: 64px; margin: 0 calc(-1 * clamp(18px, 2.6vw, 44px)); }
.wire__line { position: absolute; left: 0; right: 0; top: 50%; height: 0; border-top: 1.5px dashed rgba(241, 236, 227, .22); }
.wire__line::before, .wire__line::after { content: ""; position: absolute; top: -4.5px; width: 7px; height: 7px; border-radius: 2px; background: rgba(241, 236, 227, .4); }
.wire__line::before { left: -3px; } .wire__line::after { right: -3px; }
.wire__pulse { position: absolute; left: -9px; top: calc(50% - 9px); width: 18px; height: 18px; border-radius: 4px; background: var(--kraft); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .18), 0 0 0 5px rgba(255, 106, 19, .22), 0 0 26px 6px rgba(255, 106, 19, .5); opacity: 0; pointer-events: none; }
.wire.is-back .wire__pulse { background: #3ccf7a; border-radius: 50%; box-shadow: 0 0 0 5px rgba(60, 207, 122, .22), 0 0 26px 6px rgba(60, 207, 122, .5); }
.wire__chip { position: absolute; left: 50%; bottom: calc(50% + 12px); display: inline-flex; align-items: center; gap: 7px; max-width: calc(100% - 40px); padding: 6px 12px 6px 9px; border-radius: 999px; background: var(--bone); color: var(--ink); font-weight: 650; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 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); }
.wire__chip.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.wire__chip svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--depot); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wire__chip.is-signal { background: var(--signal); color: #fff; }
.wire__chip.is-signal svg { stroke: #fff; }
.wire__chip.is-ok svg { stroke: var(--ok); }
.wire__chip.is-warn svg { stroke: #b26a00; }
.wire__chip.is-red svg { stroke: var(--red); }

.desk { display: block; padding: 14px 16px 14px; border-radius: 18px; background: rgba(241, 236, 227, .06); border: 1px solid rgba(241, 236, 227, .12); color: var(--bone); text-decoration: none; transition: background-color .25s, border-color .25s; }
.desk:hover { background: rgba(241, 236, 227, .1); border-color: rgba(241, 236, 227, .24); }
.desk__head { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; }
.desk__live { position: relative; width: 7px; height: 7px; border-radius: 50%; background: #3ccf7a; }
.desk__live::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #3ccf7a; animation: live 1.8s ease-out infinite; }
@keyframes live { 0% { opacity: .8; transform: scale(.4); } 100% { opacity: 0; transform: scale(1.5); } }
.desk__nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.desk__nums > span { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.desk__nums b { display: inline-block; font-family: var(--display); font-stretch: 66%; font-weight: 800; font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; transition: color .4s; transform-origin: left center; }
.desk__nums b[data-n="encours"] { font-size: 23px; line-height: 1.3; }
.desk__nums small { color: var(--dim); font-size: 11.5px; line-height: 1.25; }
.desk__nums b.is-bump { color: var(--signal); animation: bump .6s var(--ease); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.16); } 100% { transform: scale(1); } }

/* Mini tableau du dépôt : où se trouve la commande, colonne par colonne */
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-top: 14px; }
.board__col { display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 74px; padding: 7px 6px 6px; border-radius: 9px; background: rgba(241, 236, 227, .05); transition: background-color .4s; }
.board__col b { font-family: var(--display); font-stretch: 66%; font-weight: 800; font-size: 20px; line-height: 1; font-variant-numeric: tabular-nums; }
.board__col small { font-size: 10px; line-height: 1.15; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board__col--validate { box-shadow: inset 0 3px 0 var(--signal); }
.board__col--validate b { color: #ffa36b; }
.board__col.is-flash { background: rgba(255, 106, 19, .2); }
.board__tk { align-self: flex-start; margin-top: auto; padding: 2px 6px; border-radius: 5px; background: var(--bone); color: var(--ink); font-family: var(--mono); font-size: 10.5px; font-weight: 600; white-space: nowrap; animation: tk-pop .6s var(--spring); }
.board__tk.is-validate { background: var(--signal); color: #fff; }
.board__tk.is-ok { background: #3ccf7a; color: #08200f; }
@keyframes tk-pop { 0% { transform: translateY(-14px) scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* 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; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255, 253, 249, .4); box-shadow: 0 0 0 2px rgba(255, 253, 249, .92), 0 8px 22px rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; }
.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); }
@keyframes ripple { 0% { opacity: .9; transform: scale(.6); } 100% { opacity: 0; transform: scale(2.1); } }

.switch { display: none; }

/* ---------- Tablette : le fil seul entre les deux téléphones ----------------------------- */

@media (max-width: 1099px) {
  .track { grid-template-columns: auto 72px auto; gap: 14px; }
  .mid { justify-content: center; }
  .mid__head, .desk { display: none; }
  .wire { margin: 0 -14px; }
  .wire__chip { bottom: calc(50% + 14px); max-width: none; }
}

/* ---------- 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: block; height: calc(100svh - 48px); min-height: 0; padding: 10px 0 calc(78px + env(safe-area-inset-bottom, 0px)); overflow: hidden; }
  .duo::before { display: none; }
  .track { display: flex; justify-content: flex-start; gap: 10px; height: 100%; padding: 0 20px; transform: translateX(calc(var(--v) * (30px - 100vw) + var(--drag))); transition: transform .6s var(--ease); }
  .duo.is-drag .track { transition: none; }
  .mid { display: none; }
  .dev { flex: none; width: calc(100vw - 40px); height: 100%; }
  .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__screen { border-radius: 27px; }
  .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: 1fr 1fr; width: min(310px, calc(100vw - 48px)); padding: 5px; border-radius: 999px; background: rgba(8, 13, 19, .88); border: 1px solid rgba(241, 236, 227, .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(50% - 5px); border-radius: 999px; background: var(--bone); transform: translateX(calc(var(--v) * 100%)); transition: transform .5s var(--ease); }
  .switch button { position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; border: 0; border-radius: 999px; background: none; color: var(--dim); font-weight: 650; font-size: 15px; -webkit-tap-highlight-color: transparent; transition: color .35s; }
  .switch button[aria-selected="true"] { color: var(--ink); }
  .switch svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .switch__dot { position: absolute; top: 9px; right: 14px; width: 9px; height: 9px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 2px rgba(8, 13, 19, .9); }
  .switch__dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--signal); animation: dot 1.4s ease-out infinite; }
  [data-dot="0"].switch__dot { background: #3ccf7a; }
  [data-dot="0"].switch__dot::after { border-color: #3ccf7a; }
  @keyframes dot { 0% { opacity: .8; transform: scale(.5); } 100% { opacity: 0; transform: scale(1.6); } }
}
@media (max-width: 420px) { .top__tag { font-size: 12px; padding: 3px 9px; } .top__links a { font-size: 13px; } }
@media (max-width: 520px) { .top__brand span { display: none; } }

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

@media (max-height: 760px) { .mid__sub { display: none; } }
