/* P2AI — Parcours d'un signal (page autonome) */
:root {
  --bg: #0b1220;
  --blue: #00aeef;
  --green: #8dc63f;
  --amber: #ffb020;
  --text: #e6edf6;
  --muted: #9fb0c6;
  --card: rgba(11, 20, 36, 0.78);
  --line: rgba(0, 174, 239, 0.35);
  --card-w: min(430px, 36vw);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }

/* ---------- Scène ---------- */
#pc-stage { position: fixed; inset: 0; z-index: 0; background: var(--bg); }
#pc-stage canvas { display: block; width: 100% !important; height: 100% !important; }
#pc-stage::after { /* vignette légère pour la lisibilité */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 60% 50%, transparent 55%, rgba(5, 9, 18, 0.55) 100%),
              linear-gradient(90deg, rgba(8, 14, 26, 0.55) 0%, rgba(8, 14, 26, 0) 38%);
}

/* ---------- Étiquettes 3D ---------- */
#pc-labels { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.pc-label {
  position: absolute; left: 0; top: 0;
  transform: translate(-50%, -100%);
  opacity: 0; transition: opacity .25s ease;
  font: 600 12.5px/1.2 Inter, system-ui, sans-serif; letter-spacing: .01em;
  color: #fff; white-space: nowrap;
  padding: 5px 10px 5px 9px; border-radius: 999px;
  background: rgba(9, 17, 31, .82); border: 1px solid rgba(0, 174, 239, .55);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  will-change: transform, opacity;
}
.pc-label::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); margin-right: 7px; vertical-align: 1px; box-shadow: 0 0 8px var(--blue); }
.pc-label::after { content: ''; position: absolute; left: 50%; top: 100%; width: 1px; height: 16px; background: linear-gradient(rgba(0,174,239,.8), rgba(0,174,239,0)); }
.pc-label.green { border-color: rgba(141, 198, 63, .6); }
.pc-label.green::before { background: var(--green); box-shadow: 0 0 8px var(--green); }
.pc-label.green::after { background: linear-gradient(rgba(141,198,63,.8), rgba(141,198,63,0)); }
.pc-label.amber { border-color: rgba(255, 176, 32, .6); }
.pc-label.amber::before { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.pc-label.amber::after { background: linear-gradient(rgba(255,176,32,.8), rgba(255,176,32,0)); }
.pc-label.purple { border-color: rgba(179, 107, 255, .65); }
.pc-label.purple::before { background: #b36bff; box-shadow: 0 0 8px #b36bff; }
.pc-label.purple::after { background: linear-gradient(rgba(179,107,255,.8), rgba(179,107,255,0)); }
/* Encart requête API WMS */
.pc-api {
  position: absolute; left: 0; top: 0; opacity: 0; transition: opacity .25s ease;
  font: 500 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #e6edf6;
  padding: 7px 10px; border-radius: 8px; white-space: nowrap;
  background: rgba(16, 11, 30, .9); border: 1px solid rgba(179, 107, 255, .6);
  box-shadow: 0 6px 22px rgba(0,0,0,.4), 0 0 18px rgba(179,107,255,.15);
}
.pc-api pre { margin: 3px 0; font: inherit; color: #d3bfff; }
.pc-api .m { display: inline-block; margin-right: 6px; padding: 0 4px; border-radius: 3px; background: #b36bff; color: #0b1220; font-weight: 700; }
.pc-api .res { color: var(--muted); }
.pc-api .res.ok { color: var(--green); font-weight: 600; }
.pc-label.lit::before { animation: pcBlink .9s ease-in-out infinite; }
.pc-label.lift { transform: translate(-50%, calc(-100% - 16px)); }
@keyframes pcBlink { 50% { opacity: .25; } }

/* ---------- En-tête ---------- */
.pc-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.2rem; pointer-events: none;
  background: linear-gradient(rgba(11, 18, 32, .85), rgba(11, 18, 32, 0));
}
.pc-header a { pointer-events: auto; }
.pc-brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--green); }
.pc-brand img { height: 52px; width: auto; display: block; }
.pc-brand-text { display: flex; flex-direction: column; font-family: Manrope, Inter, sans-serif; font-weight: 700; line-height: .95; letter-spacing: -.02em; }
.pc-brand-text span:first-child { font-size: 24px; }
.pc-brand-text span:last-child { font-size: 17px; }
.pc-back {
  font-size: .85rem; font-weight: 600; text-decoration: none; color: var(--text);
  padding: .45rem .9rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(11, 18, 32, .5); backdrop-filter: blur(6px);
}
.pc-back:hover { border-color: var(--green); color: var(--green); }

/* ---------- Progression ---------- */
#pc-progress {
  position: fixed; z-index: 20; right: 1.1rem; top: 50%; transform: translateY(-50%);
  display: flex; gap: .7rem; align-items: stretch;
}
.pc-progress-track { position: relative; width: 2px; background: rgba(255,255,255,.12); border-radius: 2px; margin: 10px 0; }
#pc-progress-fill { position: absolute; left: 0; top: 0; width: 100%; height: 0; background: linear-gradient(var(--blue), var(--green)); border-radius: 2px; }
#pc-progress ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
#pc-progress a {
  display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--muted);
  font-size: .78rem; font-weight: 600; transition: color .2s;
}
#pc-progress a b {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  font-size: .72rem; border: 1px solid rgba(255,255,255,.25); background: rgba(11,18,32,.7);
  transition: all .25s;
}
#pc-progress a span { opacity: .0; transform: translateX(-4px); transition: all .25s; white-space: nowrap; }
#pc-progress:hover a span, #pc-progress a.active span { opacity: 1; transform: none; }
#pc-progress a.done b { border-color: var(--green); color: var(--green); }
#pc-progress a.active { color: #fff; }
#pc-progress a.active b { background: var(--blue); border-color: var(--blue); color: #04111f; box-shadow: 0 0 14px rgba(0,174,239,.6); }

/* ---------- Histoire ---------- */
#pc-story { position: relative; z-index: 5; }
.pc-hero { height: 100vh; display: flex; align-items: center; padding: 0 6vw; }
.pc-hero-inner { max-width: 620px; margin-top: 4vh; }
.pc-kicker { color: var(--green); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; margin: 0 0 .8rem; }
.pc-hero h1 { font-family: Manrope, Inter, sans-serif; font-weight: 800; font-size: clamp(2.4rem, 5.4vw, 4.4rem); line-height: 1.02; letter-spacing: -.03em; margin: 0 0 1.1rem; text-shadow: 0 4px 30px rgba(0,0,0,.5); }
.pc-hero h1 em { font-style: normal; color: var(--blue); }
.pc-lead { font-size: clamp(1rem, 1.35vw, 1.15rem); color: #d3dcea; max-width: 34em; text-shadow: 0 2px 14px rgba(0,0,0,.7); }
.pc-scroll-cue { margin-top: 2rem; display: inline-flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .85rem; }
.pc-scroll-cue span { width: 22px; height: 34px; border: 2px solid rgba(255,255,255,.4); border-radius: 12px; position: relative; }
.pc-scroll-cue span::after { content: ''; position: absolute; left: 50%; top: 6px; width: 4px; height: 7px; margin-left: -2px; border-radius: 2px; background: var(--green); animation: pcCue 1.6s ease-in-out infinite; }
@keyframes pcCue { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }

.pc-step { position: relative; height: 260vh; }
.pc-step-last { height: 200vh; }
/* Les cartes sont fixes ; le script active celle de l’étape courante (scroll → T) */
.pc-card {
  position: fixed; z-index: 6; left: 3.2vw; top: calc(50% + 28px);
  width: var(--card-w); max-height: calc(100vh - 150px); overflow-y: auto;
  padding: 1.35rem 1.4rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--line); border-left: 3px solid var(--green);
  border-radius: 12px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 30px rgba(0,174,239,.08);
  opacity: 0; visibility: hidden; transform: translateY(-46%);
  transition: opacity .45s ease, transform .45s ease, visibility 0s linear .45s;
  scrollbar-width: thin;
}
.pc-card.active { opacity: 1; visibility: visible; transform: translateY(-50%); transition: opacity .45s ease, transform .45s ease, visibility 0s; }
.pc-num { margin: 0 0 .35rem; font-family: Manrope, Inter, sans-serif; font-weight: 800; color: var(--blue); font-size: .95rem; letter-spacing: .04em; }
.pc-num span { color: var(--muted); font-weight: 700; margin-left: .45rem; text-transform: uppercase; font-size: .75rem; letter-spacing: .1em; }
.pc-card h2 { font-family: Manrope, Inter, sans-serif; font-weight: 800; font-size: 1.55rem; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .7rem; }
.pc-card p { margin: 0 0 .7rem; color: #d4dde9; font-size: .97rem; }
.pc-card strong { color: #fff; font-weight: 600; }
.pc-card em { color: var(--green); font-style: normal; font-weight: 600; }
.pc-tags { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: .9rem 0 .7rem; padding: 0; }
.pc-tags li { font-size: .74rem; font-weight: 600; color: var(--green); padding: .22rem .6rem; border-radius: 999px; border: 1px solid rgba(141,198,63,.45); background: rgba(141,198,63,.08); }
.pc-more { font-size: .86rem; font-weight: 600; color: var(--blue); text-decoration: none; }
.pc-more:hover { text-decoration: underline; }
.pc-rule { font-family: Manrope, Inter, sans-serif; font-weight: 700; font-size: 1.02rem !important; color: #fff !important; padding: .5rem .75rem; border-radius: 8px; background: rgba(0,174,239,.1); border: 1px dashed rgba(0,174,239,.5); }
.pc-rule b { color: var(--green); }

/* Ladder */
.pc-ladder { margin: .4rem 0 .2rem; padding: .4rem .35rem .2rem; border-radius: 8px; background: rgba(3, 8, 16, .55); border: 1px solid rgba(255,255,255,.08); }
.pc-ladder svg { width: 100%; height: auto; display: block; }
.pc-ladder line, .pc-ladder path { stroke: #4b5b72; stroke-width: 3; fill: none; stroke-linecap: round; transition: stroke .25s, filter .25s; }
.pc-ladder .rail { stroke: #6b7b92; stroke-width: 4; }
.pc-ladder .rail.on { stroke: var(--green); }
.pc-ladder text { font: 600 10.5px Inter, sans-serif; fill: #8796ab; text-anchor: middle; }
.pc-ladder text.tag { fill: #c9d4e3; font-weight: 700; }
.pc-ladder text.ck { font-size: 11px; fill: #8796ab; }
.pc-ladder .on, .pc-ladder .on line, .pc-ladder .on path { stroke: var(--green); filter: drop-shadow(0 0 4px rgba(141,198,63,.9)); }
.pc-ladder .coil.on path { stroke: var(--blue); filter: drop-shadow(0 0 5px rgba(0,174,239,1)); }
.pc-ladder .coil.on text { fill: var(--blue); }

/* Readout */
.pc-readout { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .5rem; margin: .7rem 0 .2rem; padding: .7rem; border-radius: 10px; background: rgba(3,8,16,.6); border: 1px solid rgba(255,255,255,.08); }
.pc-readout div { display: flex; flex-direction: column; }
.pc-readout span { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.pc-readout b { font: 800 1.45rem/1.1 Manrope, Inter, sans-serif; color: #fff; font-variant-numeric: tabular-nums; }
.pc-readout small { font-size: .72rem; color: var(--muted); }
.pc-readout .ro-state { font-size: 1.05rem; padding-top: .25rem; color: var(--muted); }
.pc-readout .ro-state.on { color: var(--green); }
.pc-readout .ro-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.pc-readout .ro-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--green)); }

/* Conclusion */
.pc-chain { list-style: none; counter-reset: c; margin: .3rem 0 .9rem; padding: 0; display: grid; gap: .3rem; }
.pc-chain li { counter-increment: c; font-size: .95rem; color: #d4dde9; }
.pc-chain li::before { content: counter(c); display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: .55rem; border-radius: 50%; font-size: .7rem; font-weight: 800; background: rgba(0,174,239,.15); color: var(--blue); border: 1px solid rgba(0,174,239,.5); }
.pc-chain b { color: #fff; }
.pc-cta-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.pc-cta { display: inline-block; padding: .75rem 1.3rem; border-radius: 999px; font-weight: 700; text-decoration: none; background: var(--green); color: #0b1220; box-shadow: 0 6px 24px rgba(141,198,63,.35); transition: transform .15s, box-shadow .15s; }
.pc-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(141,198,63,.5); }
.pc-cta-ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.3); box-shadow: none; }
.pc-cta-ghost:hover { border-color: var(--blue); color: var(--blue); box-shadow: none; }

/* ---------- Chargement ---------- */
#pc-loader { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #12203a, #0b1220 70%); transition: opacity .7s ease, visibility .7s; }
#pc-loader.done { opacity: 0; visibility: hidden; }
.pc-loader-inner { text-align: center; width: min(320px, 80vw); }
.pc-loader-logo { height: 84px; width: auto; margin-bottom: 1rem; animation: pcPulse 2s ease-in-out infinite; }
@keyframes pcPulse { 50% { opacity: .55; } }
.pc-loader-title { margin: 0 0 .9rem; font-weight: 600; color: var(--muted); }
.pc-loader-bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,.1); overflow: hidden; }
#pc-loader-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width .25s; }
.pc-loader-pct { margin: .6rem 0 0; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pc-noscript { position: fixed; inset: auto 1rem 1rem 1rem; z-index: 200; padding: 1rem; background: #111827; border: 1px solid var(--line); border-radius: 8px; }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  :root { --card-w: auto; }
  #pc-stage::after { background: linear-gradient(180deg, rgba(8,14,26,0) 45%, rgba(8,14,26,.75) 100%); }
  .pc-brand img { height: 38px; }
  .pc-brand-text span:first-child { font-size: 18px; }
  .pc-brand-text span:last-child { font-size: 13px; }
  .pc-back { font-size: .75rem; padding: .35rem .7rem; }
  #pc-progress { top: auto; bottom: auto; right: 0; left: 0; top: 64px; transform: none; justify-content: center; }
  .pc-progress-track { display: none; }
  #pc-progress ol { flex-direction: row; gap: .35rem; }
  #pc-progress a span { display: none; }
  #pc-progress a b { width: 22px; height: 22px; }
  .pc-hero { align-items: flex-end; padding: 0 1.1rem 12vh; }
  .pc-step { height: 240vh; }
  .pc-card {
    left: .6rem; right: .6rem; width: auto; top: auto; bottom: .6rem;
    max-height: 46vh; padding: 1rem 1.05rem;
    transform: translateY(14px);
    background: rgba(9, 16, 30, .9);
  }
  .pc-card.active { transform: none; }
  .pc-label { font-size: 11px; padding: 4px 8px 4px 7px; }
  .pc-api { font-size: 9.5px; padding: 5px 8px; }
  .pc-card h2 { font-size: 1.25rem; }
  .pc-card p { font-size: .9rem; }
  .pc-readout b { font-size: 1.15rem; }
}
