/* ==========================================================================
   PRAXIMECA — deux ambiances, un même atelier
   MODE CLAIR  : « dossier technique » — papier millimétré, encre, orange oxydé
   MODE SOMBRE : « pupitre HMI » — nuit, ambre signalétique, terminal
   Le thème est porté par html[data-theme="light|dark"] (bascule en haut de page).
   ========================================================================== */

:root,
html[data-theme="light"] {
  --bg: #f4f1e9;
  --bg-alt: #ece8db;
  --surface: #fcfbf6;
  --text: #1c1812;
  --muted: #6b6353;
  --line: #d6cfbe;             /* filets discrets */
  --border: #1c1812;           /* traits d'encre */
  --diagram: #1c1812;          /* traits de schéma (GRAFCET) */
  --accent: #c2410c;           /* orange oxydé, industriel */
  --accent-soft: rgba(194, 65, 12, 0.16);
  --ok: #1c7a4d;
  --marker: rgba(194, 65, 12, 0.2);
  --watermark: rgba(28, 24, 18, 0.07);
  --grid-minor: rgba(28, 24, 18, 0.045);
  --grid-major: rgba(28, 24, 18, 0.09);
  --shadow-card: 3px 3px 0 rgba(28, 24, 18, 0.1);
  --shadow-card-hover: 5px 5px 0 rgba(28, 24, 18, 0.14);
  --btn-primary-bg: #1c1812;
  --btn-primary-fg: #f4f1e9;
  --nav-active-bg: #1c1812;
  --nav-active-fg: #f4f1e9;
  --ticker-bg: #1c1812;
  --ticker-fg: #f4f1e9;
  --term-bg: #16130d;
  --th-bg: #1c1812;
  --th-fg: #f4f1e9;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0b0f14;
  --bg-alt: #0e141c;
  --surface: #121a24;
  --text: #e6edf3;
  --muted: #8b97a5;
  --line: #233040;
  --border: #2c3b4e;
  --diagram: #93a4b5;
  --accent: #ffb454;
  --accent-soft: rgba(255, 180, 84, 0.14);
  --ok: #56d4bc;
  --marker: rgba(255, 180, 84, 0.26);
  --watermark: rgba(230, 237, 243, 0.05);
  --grid-minor: rgba(255, 180, 84, 0.03);
  --grid-major: rgba(255, 180, 84, 0.06);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-card-hover: 0 10px 28px rgba(0, 0, 0, 0.5);
  --btn-primary-bg: linear-gradient(180deg, #ffb454, #e08c1a);
  --btn-primary-fg: #14100a;
  --nav-active-bg: rgba(255, 180, 84, 0.1);
  --nav-active-fg: #ffb454;
  --ticker-bg: #080b0f;
  --ticker-fg: #ffb454;
  --term-bg: #0a0e13;
  --th-bg: #121a24;
  --th-fg: #ffb454;
}

/* Le mode nuit est le mode par défaut du site : la racine est générée
   avec data-theme="dark", la variante jour/ avec data-theme="light". */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { overflow-x: clip; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  /* papier millimétré (clair) / grille de pupitre (sombre) */
  background-image:
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px),
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px, 140px 140px, 140px 140px;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 760px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 2px; }

.mono { font-family: var(--mono); font-size: 0.82em; letter-spacing: 0.06em; }
.muted { color: var(--muted); }
.center { text-align: center; }

h1, h2, h3 { line-height: 1.15; font-weight: 800; }

/* --------------------------------------------------------------------------
   Barre de navigation
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}

.topbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.14em;
}
.brand:hover { text-decoration: none; }

.brand-mark { width: 28px; height: 28px; color: var(--accent); flex: none; }

.brand-sub {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.mainnav { display: flex; gap: 2px; margin-left: auto; }

.mainnav a {
  padding: 7px 15px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1.5px solid transparent;
}
.mainnav a:hover { text-decoration: none; border-color: var(--border); }
.mainnav a.active { background: var(--nav-active-bg); color: var(--nav-active-fg); }

/* Sélecteur de thème à trois positions, façon commutateur de pupitre */
.modeswitch {
  flex: none;
  display: flex;
  border: 1.5px solid var(--border);
  background: var(--surface);
}

.modeswitch a {
  padding: 7px 11px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  border-left: 1px solid var(--line);
}
.modeswitch a:first-child { border-left: none; }
.modeswitch a:hover { color: var(--accent); text-decoration: none; }
.modeswitch a.active { background: var(--nav-active-bg); color: var(--nav-active-fg); }

/* --------------------------------------------------------------------------
   Héro
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  padding: 76px 0 64px;
  overflow: hidden;
}

/* mot géant en filigrane, façon fond de plan */
.hero::after {
  content: "FLUX";
  position: absolute;
  right: -30px;
  bottom: -60px;
  font-size: clamp(7rem, 20vw, 15rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  color: transparent;
  -webkit-text-stroke: 2px var(--watermark);
  pointer-events: none;
  user-select: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.1rem, 4.8vw, 3.3rem);
  margin: 22px 0 18px;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

/* surligneur sur la deuxième ligne */
.marker {
  background: linear-gradient(transparent 55%, var(--marker) 55%);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.lead { font-size: 1.12rem; color: var(--muted); max-width: 56ch; }
.lead strong { color: var(--text); }

/* entrée du contenu du héro, dans la foulée du démarrage du pupitre */
.hero-text > * { animation: boot 0.4s ease backwards; }
.hero-text > :nth-child(2) { animation-delay: 0.08s; }
.hero-text > :nth-child(3) { animation-delay: 0.16s; }
.hero-text > :nth-child(4) { animation-delay: 0.24s; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
}

/* tampon « EN SERVICE » */
.stamp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border: 3px double var(--ok);
  color: var(--ok);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.led { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.led-ok { background: var(--ok); animation: pulse 2s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: 0.3; } }

.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }

/* Boutons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border-color: transparent;
}
.btn-big { padding: 15px 30px; font-size: 1.05rem; }

/* --------------------------------------------------------------------------
   Panneau du héro : pupitre (clair) / terminal (sombre)
   -------------------------------------------------------------------------- */

/* Pupitre de supervision — visible en mode clair */
.pupitre {
  border: 2px solid var(--text);
  background: #16130d;
  color: #f4f1e9;
  box-shadow: var(--shadow-card);
}

.pupitre-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  border-bottom: 1px solid rgba(244, 241, 233, 0.2);
}

.pupitre-bar em {
  margin-left: auto;
  font-style: normal;
  color: rgba(244, 241, 233, 0.5);
  font-weight: 400;
}

.pupitre-body { padding: 18px 16px; }

/* séquence de démarrage : les lignes du synoptique s'allument une à une */
@keyframes boot {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.prow {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  animation: boot 0.3s ease backwards;
}

.prow:nth-child(1) { animation-delay: 0.15s; }
.prow:nth-child(2) { animation-delay: 0.35s; }
.prow:nth-child(3) { animation-delay: 0.55s; }
.prow:nth-child(4) { animation-delay: 0.75s; }
.prow:nth-child(5) { animation-delay: 1.05s; }

/* pointillés de liaison, façon synoptique */
.prow i { flex: 1; border-bottom: 2px dotted rgba(244, 241, 233, 0.3); }

.prow b { font-weight: 700; }
.st-run { color: #5fd99f; }
.st-auto { color: #ff8a3d; }

.prow-hl {
  margin-top: 8px;
  padding: 10px;
  background: rgba(255, 138, 61, 0.13);
  outline: 1px dashed #ff8a3d;
}
.prow-hl b { color: #ff8a3d; font-size: 0.95rem; }

/* Terminal — visible en mode sombre, avec un léger effet d'écran CRT */
.terminal {
  position: relative;
  display: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--term-bg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* lignes de balayage du vieux moniteur */
.terminal::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.03) 0 1px,
    transparent 1px 3px
  );
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.terminal-bar span { width: 11px; height: 11px; border-radius: 50%; background: var(--line); }
.terminal-bar span:first-child { background: #e0654f; }
.terminal-bar span:nth-child(2) { background: #ffb454; }
.terminal-bar span:nth-child(3) { background: #56d4bc; }

.terminal-bar em {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-style: normal;
  color: var(--muted);
}

.terminal-body {
  margin: 0;
  padding: 18px;
  animation: boot 0.5s ease 0.2s backwards, scintille 9s steps(1) infinite;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.8;
  color: #56d4bc;
  text-shadow: 0 0 6px rgba(86, 212, 188, 0.35);
  white-space: pre;
  overflow-x: auto;
}

/* micro-scintillement du phosphore */
@keyframes scintille {
  0%, 100% { opacity: 1; }
  93% { opacity: 1; }
  93.5% { opacity: 0.93; }
  94% { opacity: 1; }
}

.cursor { animation: blink 1.1s step-end infinite; color: #ffb454; }
@keyframes blink { 50% { opacity: 0; } }

html[data-theme="dark"] .pupitre { display: none; }
html[data-theme="dark"] .terminal { display: block; }

/* --------------------------------------------------------------------------
   Bandeau défilant
   -------------------------------------------------------------------------- */

.ticker {
  overflow: hidden;
  background: var(--ticker-bg);
  color: var(--ticker-fg);
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker 30s linear infinite;
}

.ticker-track span {
  padding: 10px 0;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  white-space: nowrap;
}

@keyframes ticker { to { transform: translateX(-50%); } }

/* le bandeau se fige au survol, comme un convoyeur qu'on inspecte */
.ticker:hover .ticker-track { animation-play-state: paused; }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section { padding: 72px 0; }

.section-alt {
  background: var(--bg-alt);
  border-top: 1.5px solid var(--border);
  border-bottom: 1.5px solid var(--border);
}

.section-title {
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  margin: 0 0 34px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 14px;
}

.sec-index {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  background: var(--nav-active-bg);
  color: var(--nav-active-fg);
  border: 1.5px solid var(--border);
  font-size: 0.95rem;
}

.page-head { padding-bottom: 16px; }
.page-head h1 {
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  margin: 16px 0 12px;
  text-transform: uppercase;
}

.breadcrumb { margin: 0 0 8px; }

.facts { font-size: 0.74rem; margin-top: 18px; }

/* Grilles */
.grid { display: grid; gap: 22px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* Cartes */
.cardbox {
  position: relative;
  padding: 24px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.cardbox:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--accent);
}

/* voyant de façade sur les cartes services : s'allume au survol */
.grid-4 .cardbox::after {
  content: "";
  position: absolute;
  top: 22px; right: 20px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--line);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.grid-4 .cardbox:hover::after {
  background: #2ea36b;
  box-shadow: 0 0 10px rgba(46, 163, 107, 0.8);
}

.cardbox h3 { margin: 10px 0 8px; font-size: 1.1rem; }
.cardbox p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.cardbox p + p { margin-top: 16px; }
.cardbox p strong { color: var(--text); }

.tagline {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--border);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.68rem;
}

/* Cartes d'articles */
.card-article h3 a { color: var(--text); }
.card-article h3 a:hover { color: var(--accent); text-decoration: none; }

.card-meta { color: var(--muted); font-size: 0.74rem; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

.tag {
  padding: 2px 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   GRAFCET — étape initiale à double carré, barres de transition
   sur la liaison verticale, réceptivités à droite.
   -------------------------------------------------------------------------- */

/* le diagramme et son pupitre opérateur côte à côte */
.grafcet-zone {
  display: grid;
  grid-template-columns: minmax(0, 680px) 230px;
  gap: 44px;
  align-items: start;
  margin-top: 40px;
}

.grafcet {
  position: relative;
  max-width: 680px;
  padding-bottom: 4px;
}

.pupitre-au {
  position: sticky;
  top: 90px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: 18px 16px 22px;
  text-align: center;
}

.pa-title {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.pa-note {
  margin: 16px 0 0;
  font-size: 0.6rem;
  line-height: 1.9;
  letter-spacing: 0.08em;
}

/* liaison verticale, dans l'axe des étapes (étape = 64px -> axe à 32px) */
.grafcet::before {
  content: "";
  position: absolute;
  left: 31px;
  top: 32px;
  bottom: 24px;
  width: 2px;
  background: var(--diagram);
}

.gx-row {
  position: relative;
  display: flex;
  align-items: center;
}

/* étape : carré numéroté */
.gx-step {
  position: relative;
  z-index: 1;
  flex: none;
  width: 64px; height: 64px;
  display: grid;
  place-items: center;
  border: 2px solid var(--diagram);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 700;
}

/* étape initiale : double carré */
.gx-initial {
  box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 6px var(--diagram);
}

/* liaison horizontale étape -> rectangle d'action */
.gx-action {
  position: relative;
  margin-left: 30px;
  padding: 12px 18px;
  border: 1.5px solid var(--diagram);
  background: var(--surface);
}

.gx-action::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 50%;
  width: 32px;
  height: 2px;
  background: var(--diagram);
}

.gx-action h3 { margin: 0 0 2px; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.04em; }
.gx-action p { margin: 0; color: var(--muted); font-size: 0.88rem; }

/* transition : barre perpendiculaire sur la liaison + réceptivité */
.gx-trans {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0 14px 64px;
  min-height: 24px;
}

.gx-trans i {
  position: absolute;
  left: 18px;             /* centré sur l'axe : 32 - 28/2 = 18 */
  width: 28px;
  height: 4px;
  background: var(--accent);
}

.gx-trans span {
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.gx-trans span::before { content: "— "; color: var(--accent); font-weight: 800; }

/* Le cycle s'exécute tout seul : chaque étape s'active à son tour.
   6 étapes x 2 s = boucle de 12 s. Désactivé si prefers-reduced-motion. */
@keyframes gx-run {
  0%, 14% {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--btn-primary-fg);
  }
  17%, 100% {
    background: var(--surface);
    border-color: var(--diagram);
    color: var(--text);
  }
}

.gx-step { animation: gx-run 12s linear infinite; }
.gx-s0 { animation-delay: 0s; }
.gx-s1 { animation-delay: 2s; }
.gx-s2 { animation-delay: 4s; }
.gx-s3 { animation-delay: 6s; }
.gx-s4 { animation-delay: 8s; }
.gx-s5 { animation-delay: 10s; }

.gx-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 26px 0 0;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

/* reprise de cycle */
.gx-loop span { color: var(--accent); }

.gx-loop::after {
  content: "↺";
  position: absolute;
  left: 22px;
  bottom: -12px;
  font-size: 1.1rem;
  color: var(--diagram);
  background: var(--bg-alt);
  line-height: 1;
}

/* --------------------------------------------------------------------------
   Synoptique animé — mini-ligne de production, pur CSS
   -------------------------------------------------------------------------- */

.section-syno { padding-top: 56px; padding-bottom: 56px; }

.syno {
  border: 1.5px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.syno-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.syno-bar em {
  margin-left: auto;
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.6rem;
}

.syno-body { position: relative; height: 132px; }

/* convoyeur : bande hachurée qui défile en continu */
.convoyeur {
  position: absolute;
  left: 24px; right: 24px; bottom: 28px;
  height: 12px;
  border: 1.5px solid var(--diagram);
  background: repeating-linear-gradient(-45deg, transparent 0 9px, var(--line) 9px 12px);
  animation: tapis 0.9s linear infinite;
}

@keyframes tapis { to { background-position: 17px 0; } }

/* la pièce : entre brute (grise), ressort finie (orange) après l'usinage */
.piece {
  position: absolute;
  bottom: 13.5px;
  left: -30px;
  width: 26px; height: 20px;
  background: #9ca3af;
  border: 1.5px solid var(--diagram);
  animation: piece 8s linear infinite;
}

@keyframes piece {
  0% { left: -30px; background: #9ca3af; }
  49% { background: #9ca3af; }
  53% { background: var(--accent); }
  100% { left: 100%; background: var(--accent); }
}

/* postes au-dessus du convoyeur, reliés par leur tige */
.poste {
  position: absolute;
  bottom: 56px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.p1 { left: 25%; }
.p2 { left: 50%; }
.p3 { left: 75%; }

.poste::after {
  content: "";
  width: 2px;
  height: 14px;
  background: var(--diagram);
  order: 3;
}

.poste-nom { font-size: 0.56rem; letter-spacing: 0.14em; color: var(--muted); order: 1; }

/* fiche d'inspection au survol, façon supervision SCADA */
.poste { cursor: help; }

.poste::before {
  content: attr(data-info);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 6px 12px;
  background: var(--term-bg);
  color: #e8e2d2;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  border: 1px solid var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 5;
}

.poste:hover::before { opacity: 1; }

/* consignation : survoler la ligne l'arrête, comme avant toute inspection */
.syno:hover .piece,
.syno:hover .convoyeur,
.syno:hover .voyant { animation-play-state: paused; }

.voyant {
  order: 2;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--line);
  border: 1px solid var(--diagram);
}

/* chaque voyant s'allume au passage de la pièce (déphasage 2 s) */
@keyframes capt {
  0%, 22% { background: var(--line); box-shadow: none; }
  25%, 31% { background: #2ea36b; box-shadow: 0 0 10px rgba(46, 163, 107, 0.9); }
  34%, 100% { background: var(--line); box-shadow: none; }
}

.v1 { animation: capt 8s infinite; }
.v2 { animation: capt 8s infinite 2s; }
.v3 { animation: capt 8s infinite 4s; }

.syno-foot {
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  font-style: italic;
}

.rss-line { margin: 28px 0 0; font-size: 0.7rem; letter-spacing: 0.08em; }

/* --------------------------------------------------------------------------
   Bandeau CTA — liseré de signalisation
   -------------------------------------------------------------------------- */

.cta-band {
  background: var(--bg-alt);
  border-bottom: 1.5px solid var(--border);
}

.cta-band::before {
  content: "";
  display: block;
  height: 10px;
  background: repeating-linear-gradient(
    -45deg,
    var(--border) 0 12px,
    var(--accent) 12px 24px
  );
  border-top: 1.5px solid var(--border);
  border-bottom: 1.5px solid var(--border);
  opacity: 0.85;
}

.cta-band-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 48px 0;
}

.cta-band h2 { margin: 0 0 6px; font-size: 1.45rem; text-transform: uppercase; }
.cta-band p { margin: 0; }

/* --------------------------------------------------------------------------
   Checklist (contact)
   -------------------------------------------------------------------------- */

.checklist { list-style: none; padding: 0; margin: 18px 0 36px; }

.checklist li {
  position: relative;
  padding: 11px 0 11px 42px;
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 14px;
  width: 16px; height: 16px;
  border: 1.5px solid var(--diagram);
  background: var(--surface);
}

.checklist li::after {
  content: "✓";
  position: absolute;
  left: 7px;
  top: 9px;
  color: var(--accent);
  font-weight: 800;
}

/* --------------------------------------------------------------------------
   Jauge de progression de lecture (articles) — CSS scroll-timeline.
   Les navigateurs qui ne la gèrent pas ne voient simplement rien.
   -------------------------------------------------------------------------- */

.lecture {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 40;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
  display: none;
}

@supports (animation-timeline: scroll()) {
  .lecture {
    display: block;
    animation: lit linear both;
    animation-timeline: scroll(root);
  }
}

@keyframes lit {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* --------------------------------------------------------------------------
   Prose des articles (sortie Markdown)
   -------------------------------------------------------------------------- */

.prose { font-size: 1.04rem; }

.prose h2 {
  margin: 48px 0 16px;
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.prose h2::before { content: "▸ "; color: var(--accent); }

.prose h3 { margin: 34px 0 10px; font-size: 1.15rem; }

.prose p { margin: 0 0 18px; }

.prose ul, .prose ol { margin: 0 0 18px; padding-left: 26px; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--accent); font-weight: 700; }

.prose blockquote {
  margin: 26px 0;
  padding: 16px 22px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  background: var(--surface);
  color: var(--muted);
  font-style: italic;
}
.prose blockquote p { margin: 0; }

.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1px 6px;
  color: var(--accent);
}

/* les blocs de code restent « écran » dans les deux thèmes */
.prose pre {
  margin: 26px 0;
  padding: 18px;
  background: var(--term-bg);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.84rem;
  line-height: 1.7;
  color: #e8e2d2;
}

.prose img { max-width: 100%; border: 1.5px solid var(--border); }

.prose hr { border: none; border-top: 1px dashed var(--line); margin: 40px 0; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 26px 0;
  font-size: 0.92rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
}

.prose th, .prose td {
  padding: 9px 14px;
  border: 1px solid var(--line);
  text-align: left;
}

.prose th {
  background: var(--th-bg);
  color: var(--th-fg);
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

/* --------------------------------------------------------------------------
   Pied de page — cartouche façon bloc-titre de plan, posé en bas à droite
   -------------------------------------------------------------------------- */

.footer {
  border-top: 2px solid var(--border);
  background: var(--bg);
  padding: 44px 0 24px;
}

.cartouche {
  margin-left: auto;
  max-width: 680px;
  display: grid;
  grid-template-columns: 1.7fr 1.1fr 1.2fr 0.6fr 0.6fr;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 0.7rem;
}

.c-cell {
  padding: 8px 12px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
}

.c-cell span {
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.c-cell b { font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-cell a { color: var(--text); }

.c-title {
  grid-row: 1 / 4;
  border-left: none;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.c-sub { font-size: 0.6rem; color: var(--muted); letter-spacing: 0.06em; }

.c-logo { width: 26px; height: 26px; color: var(--accent); flex: none; }

.c-contact { grid-column: 2 / 4; border-top: 1px solid var(--line); }
.c-siret { grid-column: 4 / 6; border-top: 1px solid var(--line); }
.c-siret b { font-size: 0.68rem; letter-spacing: 0; }
.c-zone { grid-column: 2 / 4; border-top: 1px solid var(--line); }
.c-date { grid-column: 4 / 6; border-top: 1px solid var(--line); }

.footer-legal {
  margin-top: 20px;
  font-size: 0.68rem;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Page « arrêt d'urgence »
   -------------------------------------------------------------------------- */

.arret { text-align: center; padding: 24px 0 8px; }
.arret h1 { font-size: clamp(2rem, 4.5vw, 2.8rem); margin: 18px 0 12px; text-transform: uppercase; }
.arret .lead { margin: 0 auto; }

.chips-center { justify-content: center; }

.stamp-alarm { border-color: #c81e1e; color: #c81e1e; }
.led-alarm {
  background: #c81e1e;
  box-shadow: 0 0 8px #c81e1e;
  animation: pulse 0.7s steps(1) infinite;
}

.journal {
  display: inline-block;
  text-align: left;
  margin: 30px auto 18px;
  padding: 18px 24px;
  background: var(--term-bg);
  color: #ffb4a8;
  border: 1px solid var(--border);
  font-size: 0.76rem;
  line-height: 2.1;
  overflow-x: auto;
  max-width: 100%;
}

/* bande d'alarme défilante en haut de page */
.alarmband {
  height: 14px;
  background: repeating-linear-gradient(-45deg, #c81e1e 0 16px, #18140e 16px 32px);
  border-bottom: 1.5px solid var(--border);
  animation: defile 0.7s linear infinite;
}

@keyframes defile { to { background-position: 45.25px 0; } }

.arret-ps { margin-top: 36px; font-size: 0.7rem; letter-spacing: 0.08em; }

/* --------------------------------------------------------------------------
   Boutonnerie industrielle — pur CSS
   -------------------------------------------------------------------------- */

/* étiquette gravée sous les boutons */
.pb-plate {
  display: inline-block;
  margin-top: 14px;
  padding: 4px 14px;
  background: #24211c;
  color: #e8e2d2;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  border-radius: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* coup de poing rouge sur platine jaune */
.austation { display: inline-flex; flex-direction: column; align-items: center; }
.austation:hover { text-decoration: none; }

.au-disc {
  width: 112px; height: 112px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #fde047, #eab308 55%, #a16207 100%);
  box-shadow:
    inset 0 -4px 8px rgba(0, 0, 0, 0.25),
    inset 0 3px 5px rgba(255, 255, 255, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.3);
  display: grid;
  place-items: center;
}

.au-mush {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 28%, #f87171, #dc2626 45%, #7f1d1d 100%);
  box-shadow:
    0 8px 12px rgba(0, 0, 0, 0.45),
    inset 0 -8px 12px rgba(0, 0, 0, 0.35),
    inset 0 4px 6px rgba(255, 255, 255, 0.35);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.austation:hover .au-mush {
  transform: translateY(3px);
  box-shadow:
    0 4px 7px rgba(0, 0, 0, 0.4),
    inset 0 -6px 10px rgba(0, 0, 0, 0.35),
    inset 0 3px 5px rgba(255, 255, 255, 0.3);
}

.austation:active .au-mush {
  transform: translateY(6px);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.4),
    inset 0 -4px 8px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.25);
}

/* bouton MARCHE vert à collerette, marquage « I » */
.pb-marche { display: inline-flex; flex-direction: column; align-items: center; margin-top: 12px; }
.pb-marche:hover { text-decoration: none; }

.pb-bezel {
  width: 112px; height: 112px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #5b5b5b, #161616 75%);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.45), inset 0 2px 3px rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
}

.pb-cap {
  width: 74px; height: 74px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 28%, #4ade80, #16a34a 50%, #14532d 100%);
  box-shadow:
    0 5px 8px rgba(0, 0, 0, 0.5),
    inset 0 -7px 10px rgba(0, 0, 0, 0.35),
    inset 0 4px 6px rgba(255, 255, 255, 0.35);
  display: grid;
  place-items: center;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.pb-i {
  width: 6px; height: 24px;
  border-radius: 3px;
  background: #f0fdf4;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

.pb-marche:hover .pb-cap {
  transform: translateY(3px);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.45),
    inset 0 -5px 8px rgba(0, 0, 0, 0.35),
    inset 0 3px 5px rgba(255, 255, 255, 0.3);
}

.pb-marche:active .pb-cap {
  transform: translateY(6px);
  box-shadow:
    0 0 2px rgba(0, 0, 0, 0.4),
    inset 0 -3px 6px rgba(0, 0, 0, 0.45),
    inset 0 2px 4px rgba(255, 255, 255, 0.25);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero-grid { grid-template-columns: 1fr; }
  .grafcet-zone { grid-template-columns: 1fr; gap: 32px; }
  .pupitre-au { position: static; max-width: 280px; margin: 0 auto; width: 100%; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar-in { flex-wrap: wrap; height: auto; padding-top: 12px; padding-bottom: 12px; gap: 8px; }
  .mainnav { margin-left: 0; }
  .brand-sub { display: none; }
  .hero { padding: 52px 0 44px; overflow: visible; }
  .hero::after { display: none; }
  .hero h1 { font-size: clamp(1.7rem, 8vw, 2.1rem); }
  .terminal-body { font-size: 0.7rem; padding: 14px; }
  .pupitre-body { padding: 14px 12px; }
  .prow { font-size: 0.7rem; letter-spacing: 0.05em; }
  .poste::before { display: none; }
  .gx-action h3 { font-size: 0.9rem; }
  .stamp { font-size: 0.64rem; letter-spacing: 0.12em; padding: 5px 12px; }
  .journal { font-size: 0.62rem; padding: 14px 12px; line-height: 1.9; }
  .arret .lead { font-size: 1rem; }
  .cartouche { max-width: none; grid-template-columns: 1fr 1fr; }
  .c-title { grid-row: auto; grid-column: 1 / 3; border-bottom: 1px solid var(--line); }
  .c-cell { border-left: none; border-top: 1px solid var(--line); }
  .c-cell:nth-child(even) { border-left: 1px solid var(--line); }
  .c-contact, .c-siret, .c-zone, .c-date { grid-column: auto; }
  .c-contact, .c-zone { grid-column: 1 / 3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --------------------------------------------------------------------------
   Impression — la page d'accueil se transforme en plaquette papier
   -------------------------------------------------------------------------- */

@media print {
  .topbar, .ticker, .modeswitch, .hero-panel, .cta-row,
  .hero::after, .footer-legal, .section-syno, .pupitre-au,
  .lecture, .rss-line { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .section { padding: 18pt 0; }
  .section-alt, .cta-band { border: none; background: none; }
  .cta-band::before { display: none; }
  .cardbox, .gx-action, .gx-step, .cartouche { box-shadow: none; }
  a { color: #000; text-decoration: none; }
  /* l'adresse email reste lisible sur papier */
  .cta-band a.btn::after { content: ""; }
  .hero { padding: 12pt 0; }
}
