/* Grafen — démonstration : une demande suivie avant et après (acte 1 timeline puis passage de Grafen ; acte 3 dans demo-mockup.css) */

.demo-page [hidden] { display: none !important; }
.demo-page.has-dock { padding-bottom: 150px; }
.demo-noscript { padding: 40px 0; font-size: 18px; }
.demo-noscript a { border-bottom: 1px solid var(--accent); }

/* --- en-tête et sélecteur de secteur --- */
.demo-hero .pg-hero__title { max-width: 20ch; }
.sectors { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; margin-top: 44px; }
.sectors__tabs { display: inline-flex; border: 1px solid rgba(var(--fg-rgb), 0.22); border-radius: 2px; padding: 3px; gap: 3px; }
.sectors__tab {
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 11px 18px; border-radius: 1px; opacity: 0.65; transition: background 0.25s, color 0.25s, opacity 0.25s;
}
.sectors__tab:hover { opacity: 1; color: var(--accent); }
.sectors__tab[aria-selected='true'] { background: var(--ink); color: var(--paper); opacity: 1; }
.sectors__tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- actes --- */
.act { scroll-margin-top: 90px; }
.act__next { display: none; }

/* acte 1 : la fenêtre (l'écran de l'étape active) à gauche, les étapes à droite */
.today { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; align-items: start; }

.doc__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid rgba(var(--fg-rgb), 0.1); }
.doc__time { font-size: 11.5px; opacity: 0.5; }
.doc__meta { margin: 14px 0 0; font-size: 14px; line-height: 1.5; }
.doc__meta div { display: grid; grid-template-columns: 34px 1fr; gap: 8px; }
.doc__meta dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; opacity: 0.45; padding-top: 2px; }
.doc__meta dd { margin: 0; overflow-wrap: anywhere; }
.doc__meta strong { font-weight: 500; }
.doc__mail { opacity: 0.5; }
.doc__subject { font-size: 21px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.3; margin-top: 18px; }
.doc__body { margin-top: 12px; font-size: 15px; line-height: 1.6; opacity: 0.75; }
.doc__body p + p { margin-top: 6px; }
.doc__file {
  display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 12px 14px;
  border: 1px solid rgba(var(--fg-rgb), 0.14); border-radius: 3px; background: rgba(var(--fg-rgb), 0.03); font-size: 14px;
}
.doc__file strong { font-weight: 500; display: block; overflow-wrap: anywhere; }
.doc__clip svg { width: 18px; height: 18px; display: block; opacity: 0.6; }
.doc__filemeta { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; opacity: 0.5; margin-top: 2px; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 17px; top: 8px; bottom: 8px; width: 1px; background: rgba(var(--fg-rgb), 0.16); }
.dstep { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 20px; outline: none; }
.dstep__num {
  position: relative; z-index: 1; width: 35px; height: 35px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11.5px; letter-spacing: 0.04em;
  background: var(--bg); border: 1px solid rgba(var(--fg-rgb), 0.22);
}
.dstep__card { border: 1px solid rgba(var(--fg-rgb), 0.12); border-radius: 3px; padding: 16px 20px 15px; background: rgba(255, 255, 255, 0.45); }
.dstep:focus-visible .dstep__card { box-shadow: 0 0 0 2px var(--accent); }
.dstep__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dstep__role { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em; opacity: 0.6; }
.dstep__tag { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; padding: 4px 8px; border-radius: 2px; white-space: nowrap; }
.dstep__action { font-size: 17px; line-height: 1.4; margin-top: 8px; }
.dstep__meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.04em; opacity: 0.5; }
.dstep__min { white-space: nowrap; }

/* prévisible : discret, gris */
.dstep--predictable .dstep__card { color: rgba(var(--fg-rgb), 0.78); }
.dstep--predictable .dstep__tag { border: 1px solid rgba(var(--fg-rgb), 0.2); color: rgba(var(--fg-rgb), 0.55); }
.dstep--predictable .dstep__num { color: rgba(var(--fg-rgb), 0.55); }
/* jugement : accentué */
.dstep--judgment .dstep__card { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, #fff); box-shadow: 0 14px 40px rgba(201, 110, 185, 0.14); }
.dstep--judgment .dstep__tag { background: var(--accent); color: var(--on-accent); }
.dstep--judgment .dstep__num { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.dstep--judgment .dstep__role { color: var(--accent); opacity: 1; }

/* états au défilement : à venir (éteinte), passée, active (allumée) ; réversibles vers le haut */
.dstep { opacity: 0.3; transition: opacity 0.45s cubic-bezier(0.2, 0.7, 0.2, 1); }
/* pas de transition d'ombre : elle force à redessiner la carte à chaque image */
.dstep .dstep__card { transition: border-color 0.35s, background 0.35s, transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1); }
.dstep.is-in { opacity: 0.62; }
.dstep.is-active { opacity: 1; }
.dstep--predictable.is-active .dstep__card { border-color: rgba(var(--fg-rgb), 0.55); background: #fff; box-shadow: 0 18px 50px rgba(18, 38, 46, 0.12); transform: translateX(-6px); }
.dstep--predictable.is-active .dstep__num { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.dstep--judgment.is-active .dstep__card { box-shadow: 0 18px 54px rgba(201, 110, 185, 0.3); transform: translateX(-6px); }
.dstep + .dstep { margin-top: 16vh; }

.today__end { margin: 28px 0 0 56px; opacity: 0; transition: opacity 0.6s; }
.today__end.is-in { opacity: 1; }

/* --- passage de Grafen : le titre de l'acte 2 arrive dans la colonne, les étapes prévisibles rejoignent le système --- */
.grafen-mark { margin: 22vh 0 0 56px; scroll-margin-top: 30vh; }
.grafen-mark .kicker { margin-bottom: 20px; position: relative; display: inline-block; }
.grafen-mark .kicker::after { content: ''; position: absolute; left: 0; bottom: -8px; height: 1px; width: 0; background: var(--accent); transition: width 0.7s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1); }
.today.is-shifted .grafen-mark .kicker::after { width: 32px; }
.grafen-mark__title { font-size: clamp(26px, 2.8vw, 38px); font-weight: 300; letter-spacing: -0.025em; line-height: 1.15; }
.grafen-mark__note { margin-top: 16px; font-size: 17px; line-height: 1.55; opacity: 0.62; max-width: 46ch; }
/* laisse la fenêtre collée assez longtemps pour lire la dernière étape et le passage de Grafen */
.today__spacer { height: 34vh; }

.dstep__moved, .dstep__kept { display: none; }
.today.is-shifted .dstep { opacity: 1; }
.today.is-shifted .dstep--predictable .dstep__card { position: relative; border-style: dashed; border-color: rgba(var(--fg-rgb), 0.22); background: transparent; box-shadow: none; transform: none; }
.today.is-shifted .dstep--predictable .dstep__card > :not(.dstep__moved) { opacity: 0.16; transition: opacity 0.4s; }
.today.is-shifted .dstep--predictable .dstep__num { background: var(--bg); border-style: dashed; color: rgba(var(--fg-rgb), 0.35); }
.today.is-shifted .dstep__moved {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em; color: #1f7a45; padding: 6px 12px; border-radius: 14px; background: #eaf6ee;
  animation: rise 0.45s 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.today.is-shifted .dstep__moved svg { width: 13px; height: 13px; }
.today.is-shifted .dstep--judgment .dstep__card { box-shadow: 0 18px 54px rgba(201, 110, 185, 0.3); }
.today.is-shifted .dstep__kept { display: inline-block; margin-top: 10px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); animation: rise 0.45s 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.today__sum { font-size: 17px; line-height: 1.55; padding: 18px 0 0 18px; border-left: 1px solid var(--accent); }

/* --- compteur fixe en bas d'écran --- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(18, 38, 46, 0.96); color: var(--paper);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateY(105%); transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.dock.is-visible { transform: none; }
.dock__inner { padding: 10px var(--gutter); }
@media (min-width: 1600px) { .dock__inner { padding: 10px clamp(48px, 4vw, 96px); } }
.dock__row { display: grid; grid-template-columns: 200px repeat(4, minmax(0, 1fr)) minmax(0, 1.3fr); align-items: center; gap: 16px; padding: 8px 0; }
.dock__row + .dock__row { border-top: 1px solid rgba(255, 255, 255, 0.1); }
.dock__who { display: flex; flex-direction: column; gap: 3px; font-family: var(--font-mono); }
.dock__name { font-size: 12px; letter-spacing: 0.16em; }
.dock__status { font-size: 11px; letter-spacing: 0.08em; opacity: 0.5; }
.dock__dot { display: none; }
.dock__m { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dock__n { font-size: 26px; font-weight: 300; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock__l { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.5; }
.dock__row--before[data-state='frozen'] .dock__status { color: var(--paper); opacity: 0.8; }
.dock__row--before[data-state='frozen'] .dock__status::before { content: '■ '; font-size: 8px; vertical-align: 1px; }
.dock__row--after .dock__n { color: var(--accent); font-weight: 400; }
.dock__row--after .dock__name { color: var(--accent); }
.dock__n.is-bump { animation: bump 0.45s cubic-bezier(0.2, 0.7, 0.2, 1); }
.dock__row--after:not([hidden]) { animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes bump { 0% { transform: translateY(6px); opacity: 0.3; } 100% { transform: none; opacity: 1; } }


/* --- curseur de niveau --- */
.lvl { border-top: 1px solid rgba(var(--fg-rgb), 0.14); padding-top: 36px; }
.lvl__scale { position: relative; }
.lvl__range {
  --p: 0; -webkit-appearance: none; appearance: none; width: 100%; height: 36px; margin: 0; background: transparent; cursor: pointer;
}
.lvl__range::-webkit-slider-runnable-track {
  height: 2px; background: linear-gradient(to right, var(--accent) calc(var(--p) * 100%), rgba(var(--fg-rgb), 0.18) calc(var(--p) * 100%));
}
.lvl__range::-moz-range-track { height: 2px; background: rgba(var(--fg-rgb), 0.18); }
.lvl__range::-moz-range-progress { height: 2px; background: var(--accent); }
.lvl__range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -10px; border-radius: 50%;
  background: var(--accent); border: 4px solid var(--bg); box-shadow: 0 0 0 1px var(--accent); transition: transform 0.2s;
}
.lvl__range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 4px solid var(--bg); box-shadow: 0 0 0 1px var(--accent); }
.lvl__range:focus-visible { outline: none; }
.lvl__range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--accent), 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent); }
.lvl__range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 1px var(--accent), 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent); }
.lvl__range:active::-webkit-slider-thumb { transform: scale(1.12); }
.lvl__ticks { position: relative; height: 52px; margin-top: 8px; }
/* chaque libellé sous la position réelle du curseur (pouce de 22 px) */
.lvl__tick {
  position: absolute; top: 0; left: calc(11px + var(--i) * (100% - 22px) / 5); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; font-size: 14px; white-space: nowrap;
  opacity: 0.45; transition: opacity 0.25s, color 0.25s;
}
.lvl__tick:first-child { left: 0; transform: none; align-items: flex-start; }
.lvl__tick:last-child { left: auto; right: 0; transform: none; align-items: flex-end; }
.lvl__tick .mono { font-size: 11px; letter-spacing: 0.1em; }
.lvl__tick:hover { opacity: 0.8; }
.lvl__tick.is-on { opacity: 1; color: var(--accent); }
.lvl__out { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 56px; margin-top: 44px; align-items: start; }
.lvl__figures { display: grid; grid-template-columns: auto 1fr; gap: 40px; }
.lvl__figure { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid rgba(var(--fg-rgb), 0.14); padding-top: 18px; }
.lvl__num { font-size: clamp(44px, 5vw, 72px); font-weight: 300; letter-spacing: -0.04em; line-height: 1; color: var(--accent); }
.lvl__num--text { font-size: clamp(28px, 3vw, 40px); letter-spacing: -0.02em; line-height: 1.1; padding-top: 0.3em; }
.lvl__name { font-size: 12px; letter-spacing: 0.16em; opacity: 0.55; }
.lvl__sentence { font-size: 21px; font-weight: 300; line-height: 1.45; margin-top: 12px; letter-spacing: -0.01em; }
.lvl__verbs { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.lvl__verbs li { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; padding: 7px 12px; border: 1px solid rgba(var(--fg-rgb), 0.22); border-radius: 2px; }
.lvl__verbs li::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 1px; }
.lvl__out.is-mockup .lvl__name::after { content: ' · LA MAQUETTE CI-DESSUS'; color: var(--accent); }
.demo-motion .lvl__out > * { animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

/* --- sortie --- */
.demo-final__lead { font-size: 19px; line-height: 1.55; opacity: 0.62; margin-top: 24px; max-width: 52ch; }
.demo-final .final__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 28px; margin-top: 44px; }

/* --- responsive --- */
@media (max-width: 1080px) {
  .dock__row { grid-template-columns: 150px repeat(4, minmax(0, 1fr)) minmax(0, 1.3fr); }
}

@media (max-width: 880px) {
  .demo-page.has-dock { padding-bottom: 170px; }
  .sectors { margin-top: 32px; gap: 12px; }
  .sectors__tabs { width: 100%; }
  .sectors__tab { flex: 1; padding: 12px 6px; font-size: 11.5px; letter-spacing: 0.04em; }
  .act__next {
    display: inline-flex; align-items: center; gap: 10px; margin-top: 32px;
    font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.1em; text-transform: uppercase;
    padding: 12px 18px; border: 1px solid rgba(var(--fg-rgb), 0.25); border-radius: 2px;
  }
  .today { grid-template-columns: 1fr; gap: 32px; }
  .today { gap: 20px; }
  .grafen-mark { margin-top: 14vh; }
  .today__spacer { height: 24vh; }
  .dstep + .dstep { margin-top: 10vh; }
  .dstep { grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
  .dstep__num { width: 30px; height: 30px; font-size: 10.5px; }
  .timeline::before { left: 14.5px; }
  .dstep__card { padding: 14px 14px 13px; }
  .dstep__action { font-size: 16px; }
  .today__end { margin-left: 42px; }
  .lvl__tick { font-size: 11px; }
  .lvl__out { grid-template-columns: 1fr; gap: 28px; margin-top: 32px; }
  .lvl__figures { gap: 24px; }
  .lvl__sentence { font-size: 18px; }
  .lvl__out.is-mockup .lvl__name::after { content: ' · LA MAQUETTE'; }

  /* compteur : le nom de la ligne passe au-dessus, cinq colonnes alignées dessous */
  .dock__inner { padding: 6px 16px; }
  .dock__row { grid-template-columns: 1fr 1.25fr 1.3fr 1fr 1.4fr; gap: 2px 8px; padding: 6px 0; }
  .dock__who { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 8px; }
  .dock__name { font-size: 10px; letter-spacing: 0.12em; }
  .dock__status { font-size: 10px; letter-spacing: 0.02em; }
  .dock__n { font-size: 19px; }
  .dock__m--delay .dock__n { font-size: 14px; white-space: normal; line-height: 1.15; }
  .dock__l { font-size: 8.5px; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dock__row--after .dock__l { display: none; }
}

@media (max-width: 400px) {
  .lvl__tick { font-size: 0; gap: 0; }
  .lvl__tick .mono { font-size: 11px; }
  .dock__n { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .dock { transition: none; }
}
