/* ==================================================================
   Portfolio GEII — Nicolas Velez
   Styles communs à toutes les pages (chargés partout).
   Chaque page a en plus sa propre feuille dans son dossier.

   Direction : le vocabulaire d'un bureau d'études en automatisme.
   Gris armoire électrique (RAL 7035), papier blanc, encre graphite,
   jaune signalisation pour l'état actif. Le motif récurrent est le
   GRAFCET : étape, transition, jeton actif.
   ================================================================== */

/* Police Archivo (variable : graisse 100–900, largeur 62–125 %),
   hébergée sur le site. Licence : fonts/OFL-Archivo.txt */
@font-face {
  font-family: "Archivo"; font-style: normal; font-display: swap;
  font-weight: 100 900; font-stretch: 62% 125%;
  src: url("../fonts/archivo-latin.woff2") format("woff2-variations"), url("../fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Archivo"; font-style: normal; font-display: swap;
  font-weight: 100 900; font-stretch: 62% 125%;
  src: url("../fonts/archivo-latin-ext.woff2") format("woff2-variations"), url("../fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  /* Couleurs */
  --paper: #f4f5f2;      /* fond de page */
  --sheet: #ffffff;      /* panneaux */
  --cabinet: #dfe2dd;    /* gris armoire (RAL 7035 éclairci) */
  --cabinet-2: #eceee9;
  --rule: #c5cac3;       /* traits */
  --ink: #1c2220;        /* encre graphite */
  --ink-2: #4d5752;      /* texte secondaire */
  --ink-3: #75807a;      /* texte discret */
  --signal: #f5b700;     /* jaune signalisation : état actif */
  --signal-soft: #fdf0c4;
  --run: #2b8a50;        /* voyant « RUN » : réalisé */
  --run-soft: #e2f1e7;
  --fault: #c8382a;      /* défaut / erreur */
  --fault-soft: #fbe6e3;
  --on-signal: #1c2220;  /* texte posé sur le jaune (identique dans les deux thèmes) */
  --run-ink: #1d5e37;
  --fault-ink: #8c2318;
  --deep: #1c2220;       /* surfaces sombres (carte du méga-menu, écrans) */
  --header-bg: rgba(255,255,255,.94);
  --rail-hl: rgba(255,255,255,.9);
  --subnav-bg: rgba(236,238,233,.92);
  --thumb-top: #2b3330; --thumb-bot: #1c2220; --thumb-fg: #ffffff;
  color-scheme: light;

  /* Typo */
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: .8125rem;
  --fs-sm: .9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.3125rem;
  --fs-xl: 1.75rem;
  --fs-2xl: clamp(2rem, 1.4rem + 2.2vw, 2.75rem);
  --fs-3xl: clamp(2.5rem, 1.6rem + 3.6vw, 4rem);
  --fs-hero: clamp(3rem, 1.2rem + 7.2vw, 6.75rem);

  /* Mise en page */
  --wrap: 1200px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --header-h: 68px;

  /* Rayons : petit pour les étiquettes, moyen pour les contrôles,
     grand pour les panneaux */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;

  --line: 1.5px;
  --shadow-lift: 0 1px 0 rgba(28,34,32,.06), 0 12px 32px -18px rgba(28,34,32,.28);
  --ease: cubic-bezier(.2,.7,.2,1);
}

/* ------------------------------------------------------------------
   MODE « SALLE DE CONTRÔLE » (thème sombre)
   Activé par l'interrupteur de l'en-tête, mémorisé dans le navigateur.
   Par défaut, suit le réglage clair/sombre de l'appareil.
------------------------------------------------------------------ */
:root[data-theme="dark"] {
  --paper: #0e1311;
  --sheet: #151b19;
  --cabinet: #27312d;
  --cabinet-2: #1c2421;
  --rule: #303c37;
  --ink: #e6ebe8;
  --ink-2: #a9b4ae;
  --ink-3: #7f8b85;
  --signal-soft: rgba(245,183,0,.16);
  --run: #3cc274;
  --run-soft: rgba(60,194,116,.14);
  --fault: #ff6a57;
  --fault-soft: rgba(255,106,87,.14);
  --run-ink: #8ee0b0;
  --fault-ink: #ffb2a8;
  --deep: #090d0b;
  --header-bg: rgba(14,19,17,.9);
  --rail-hl: rgba(255,255,255,.03);
  --subnav-bg: rgba(28,36,33,.92);
  --thumb-top: #ffcb2e; --thumb-bot: #f5b700; --thumb-fg: #1c2220;
  --shadow-lift: 0 1px 0 rgba(0,0,0,.4), 0 16px 36px -18px rgba(0,0,0,.8);
  color-scheme: dark;
}
:root[data-theme="dark"] .btn-primary:hover { --btn-bg: #ffd23f; --btn-bd: #ffd23f; --btn-fg: var(--on-signal); }
:root[data-theme="dark"] .tool-logos img,
:root[data-theme="dark"] .lang-grid img { background: #f4f5f2; border-color: transparent; }
:root[data-theme="dark"] .portrait img, :root[data-theme="dark"] .slide img, :root[data-theme="dark"] .feature-media img { filter: brightness(.92); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0; line-height: 1.12; font-weight: 700; letter-spacing: -.01em; }
button { font: inherit; color: inherit; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .88em; background: var(--cabinet-2); padding: .1em .35em; border-radius: var(--r-sm); }
::selection { background: var(--signal); color: var(--on-signal); }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 1000;
  background: var(--ink); color: var(--sheet); padding: .6rem 1rem; border-radius: var(--r-md);
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

/* Titres étirés : la largeur variable d'Archivo porte la personnalité */
.display {
  font-stretch: 125%;
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: .95;
}
.wide { font-stretch: 112%; }

.lede { font-size: var(--fs-lg); line-height: 1.5; color: var(--ink-2); max-width: 60ch; }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-sm); }
.num { font-variant-numeric: tabular-nums; }

/* Lien « surligneur » */
.link {
  text-decoration: none;
  background-image: linear-gradient(var(--signal), var(--signal));
  background-size: 100% 3px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  padding-bottom: 1px;
  transition: background-size .2s var(--ease);
  font-weight: 600;
}
.link:hover { background-size: 100% 100%; }
.prose a:not(.btn) { text-decoration-color: var(--signal); text-decoration-thickness: 3px; text-underline-offset: 3px; }

/* ---------- Boutons ---------- */
.btn {
  --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 46px; padding: .7rem 1.25rem;
  font-weight: 600; font-size: var(--fs-sm); line-height: 1.1;
  color: var(--btn-fg); background: var(--btn-bg);
  border: var(--line) solid var(--btn-bd); border-radius: var(--r-md);
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s, transform .15s;
}
.btn:hover { --btn-bg: var(--ink); --btn-fg: var(--sheet); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { --btn-bg: var(--signal); --btn-bd: var(--signal); --btn-fg: var(--on-signal); }
.btn-primary:hover { --btn-bg: var(--ink); --btn-bd: var(--ink); --btn-fg: var(--signal); }
.btn-quiet { --btn-bd: var(--rule); }
.btn-quiet:hover { --btn-bg: var(--cabinet-2); --btn-fg: var(--ink); --btn-bd: var(--ink-3); }
.btn-sm { min-height: 38px; padding: .5rem .9rem; }
.btn[disabled] { opacity: .55; cursor: wait; }

.tag {
  display: inline-flex; align-items: center;
  padding: .18rem .5rem; border-radius: var(--r-sm);
  background: var(--cabinet-2); border: 1px solid var(--rule);
  font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); line-height: 1.4;
  white-space: nowrap;
}
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ==================================================================
   SECTIONS
   ================================================================== */
.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section + .section { padding-top: 0; }
.hero + .section { padding-top: clamp(1rem, 3vw, 2rem); }
.section--sheet { background: var(--sheet); border-block: 1px solid var(--rule); }
.section--sheet + .section { padding-top: clamp(3.5rem, 8vw, 6.5rem); }
.section + .section--sheet { margin-top: 0; padding-top: clamp(3.5rem, 8vw, 6.5rem); }

.section-head { display: grid; gap: 1rem; margin-bottom: clamp(2rem, 4vw, 3rem); max-width: 760px; }
.section-head h2 { font-size: var(--fs-2xl); font-stretch: 115%; font-weight: 750; letter-spacing: -.02em; }
.section-head p { margin: 0; color: var(--ink-2); font-size: var(--fs-md); max-width: 62ch; }
.section-head--split { max-width: none; grid-template-columns: 1fr auto; align-items: end; }
@media (max-width: 700px) { .section-head--split { grid-template-columns: 1fr; } }

/* En-tête de page intérieure */
.page-head { padding-block: clamp(3rem, 7vw, 5.5rem) clamp(2rem, 5vw, 3.5rem); }
.page-head h1 { font-size: var(--fs-3xl); margin-bottom: 1.25rem; }
.page-head .lede { margin: 0; }
.crumbs { display: flex; gap: .5rem; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--ink-3); margin-bottom: 1.25rem; list-style: none; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs li + li::before { content: "/"; margin-right: .5rem; color: var(--rule); }

/* ==================================================================
   GRAFCET (composant réutilisable)
   ================================================================== */
.grafcet { --step: 52px; --gap: 22px; position: relative; list-style: none; }
.g-row { position: relative; display: grid; grid-template-columns: var(--step) var(--gap) 1fr; align-items: center; }

/* Étape */
.g-step {
  position: relative; width: var(--step); height: var(--step); transition: padding .3s var(--ease), background-color .3s;
  display: grid; place-items: center;
  border: var(--line) solid var(--ink); border-radius: 2px; background: var(--sheet);
  font-weight: 700; font-stretch: 112%; font-size: 1rem;
  transition: background-color .3s;
}
.g-row--initial .g-step::after { content: ""; position: absolute; inset: 4px; border: var(--line) solid var(--ink); border-radius: 1px; pointer-events: none; }
/* jeton de l'étape active */
.g-step::before {
  content: ""; position: absolute; left: 50%; bottom: 7px; width: 9px; height: 9px; margin-left: -4.5px;
  border-radius: 50%; background: var(--on-signal);
  transform: scale(0); transition: transform .3s var(--ease);
}
.g-row.is-active .g-step { background: var(--signal); color: var(--on-signal); padding-bottom: 12px; }
.g-row.is-active .g-step::before { transform: scale(1); }
.g-row.is-done .g-step { background: var(--cabinet-2); }

/* Liaison étape → action */
.g-link { height: var(--line); background: var(--ink); }

/* Action associée */
.g-action {
  border: var(--line) solid var(--ink); border-radius: 2px; background: var(--sheet);
  padding: .55rem .8rem; line-height: 1.35;
  transition: box-shadow .3s, border-color .3s;
}
.g-action strong { display: block; font-size: var(--fs-sm); font-weight: 700; }
.g-action span { display: block; font-size: var(--fs-xs); color: var(--ink-2); }
.g-row.is-active .g-action { box-shadow: 5px 5px 0 var(--signal); }

/* Transition : trait vertical + barre + réceptivité */
.g-trans { position: relative; display: grid; grid-template-columns: var(--step) 1fr; min-height: 44px; align-items: center; }
.g-trans::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  left: calc(var(--step) / 2 - var(--line) / 2); width: var(--line); background: var(--ink);
}
.g-trans::after {
  content: ""; position: absolute; top: 50%; left: calc(var(--step) / 2 - 11px);
  width: 22px; height: var(--line); background: var(--ink);
}
.g-trans span { grid-column: 2; padding-left: calc(var(--gap) - 6px); font-size: var(--fs-xs); color: var(--ink-2); font-style: italic; }
.g-trans--open::before { background: repeating-linear-gradient(var(--ink) 0 5px, transparent 5px 9px); }
.g-trans--open::after { display: none; }

/* ==================================================================
   PIED DE PAGE — cartouche
   ================================================================== */
.site-footer { margin-top: 0; border-top: var(--line) solid var(--ink); background: var(--sheet); }
.footer-cta { display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center; padding-block: clamp(2.5rem, 6vw, 4rem); }
.footer-cta h2 { font-size: var(--fs-2xl); font-stretch: 118%; font-weight: 750; }
.footer-cta p { margin: .5rem 0 0; color: var(--ink-2); }
@media (max-width: 700px) { .footer-cta { grid-template-columns: 1fr; } }

.cartouche {
  display: grid; grid-template-columns: 1.4fr 1.2fr 1fr 1fr .9fr;
  border: var(--line) solid var(--ink); border-radius: 2px; margin-bottom: 1.5rem;
}
.cartouche > div { padding: .75rem 1rem; border-left: 1px solid var(--ink); min-width: 0; }
.cartouche > div:first-child { border-left: 0; }
.cartouche dt { font-size: var(--fs-xs); color: var(--ink-3); margin-bottom: .15rem; }
.cartouche dd { margin: 0; font-size: var(--fs-sm); font-weight: 600; overflow-wrap: anywhere; }
.cartouche a { text-decoration: none; }
.cartouche a:hover { text-decoration: underline; text-decoration-color: var(--signal); text-decoration-thickness: 3px; }
.cartouche .folio dd { font-stretch: 112%; font-size: var(--fs-md); }
@media (max-width: 900px) {
  .cartouche { grid-template-columns: 1fr 1fr; }
  .cartouche > div { border-left: 0; border-top: 1px solid var(--ink); }
  .cartouche > div:nth-child(even) { border-left: 1px solid var(--ink); }
  .cartouche > div:nth-child(-n+2) { border-top: 0; }
  .cartouche > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .cartouche { grid-template-columns: 1fr; }
  .cartouche > div:nth-child(even) { border-left: 0; }
  .cartouche > div:nth-child(2) { border-top: 1px solid var(--ink); }
}
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 2rem; padding-bottom: 2rem; font-size: var(--fs-sm); color: var(--ink-3); }
.footer-base ul { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; list-style: none; }
.footer-base a { color: var(--ink-2); }

/* ==================================================================
   COMPOSANTS PARTAGÉS
   ================================================================== */
/* Accordéon générique */
.accordion { border-top: var(--line) solid var(--ink); }
.acc-item { border-bottom: 1px solid var(--rule); }
.acc-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.25rem .25rem; background: none; border: 0; cursor: pointer; text-align: left;
  font-size: var(--fs-lg); font-weight: 650; font-stretch: 108%;
}
.acc-btn:hover { color: var(--ink-2); }
.acc-btn .tag { margin-left: .75rem; font-stretch: 100%; background: var(--signal-soft); border-color: var(--signal); color: var(--ink); }
.acc-icon { position: relative; width: 22px; height: 22px; flex: none; }
.acc-icon::before, .acc-icon::after { content: ""; position: absolute; left: 3px; right: 3px; top: 50%; height: 2px; margin-top: -1px; background: currentColor; transition: transform .25s var(--ease); }
.acc-icon::after { transform: rotate(90deg); }
.acc-btn[aria-expanded="true"] .acc-icon::after { transform: rotate(0); }
.acc-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease); }
.acc-panel > div { overflow: hidden; }
.acc-btn[aria-expanded="true"] + .acc-panel { grid-template-rows: 1fr; }
.acc-panel .acc-inner { padding: 0 .25rem 1.5rem; color: var(--ink-2); max-width: 72ch; }
.check-list { list-style: none; display: grid; gap: .55rem; }
.check-list li { position: relative; padding-left: 1.6rem; font-size: var(--fs-sm); }
.check-list li::before { content: ""; position: absolute; left: 0; top: .45em; width: 10px; height: 10px; border: var(--line) solid var(--ink); border-radius: 1px; }

.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.5rem, 3vw, 2.5rem); }
.trio > div { border-top: var(--line) solid var(--ink); padding-top: 1rem; }
.trio h3 { font-size: var(--fs-md); margin-bottom: .5rem; }
.trio p { color: var(--ink-2); font-size: var(--fs-sm); margin: 0; }
@media (max-width: 760px) { .trio { grid-template-columns: 1fr; } }

.block h3 { font-size: var(--fs-md); font-weight: 700; margin-bottom: .75rem; }
.blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem clamp(1.5rem, 4vw, 3rem); }
.block { border-top: var(--line) solid var(--ink); padding-top: 1rem; }
.block--wide { grid-column: 1 / -1; }
.bullet-list { list-style: none; display: grid; gap: .5rem; }
.bullet-list li { position: relative; padding-left: 1.25rem; font-size: var(--fs-sm); color: var(--ink-2); }
.bullet-list li::before { content: ""; position: absolute; left: 0; top: .7em; width: 8px; height: var(--line); background: var(--ink); }
.bullet-list li strong { color: var(--ink); }
.steps-list { list-style: none; counter-reset: s; display: grid; gap: .6rem; }
.steps-list li { counter-increment: s; position: relative; padding-left: 2.25rem; font-size: var(--fs-sm); color: var(--ink-2); }
.steps-list li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border: var(--line) solid var(--ink); border-radius: 2px; font-size: var(--fs-xs); font-weight: 700; color: var(--ink); }
.steps-list li strong { color: var(--ink); }
@media (max-width: 760px) { .blocks { grid-template-columns: 1fr; } }

/* Tableaux type fiche technique */
.datasheets { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.datasheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
.datasheet caption, .datasheet .ds-title { display: block; text-align: left; padding: .6rem .85rem; font-size: var(--fs-xs); font-weight: 700; background: var(--cabinet-2); border-bottom: 1px solid var(--rule); }
.datasheet table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.datasheet td { padding: .5rem .85rem; border-top: 1px solid var(--cabinet); vertical-align: top; }
.datasheet tr:first-child td { border-top: 0; }
.datasheet td:first-child { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; width: 1%; }
.datasheet td:nth-child(2) { font-weight: 600; }
.datasheet td:nth-child(3) { color: var(--ink-2); }
.note { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 1rem; padding-left: 1rem; border-left: 3px solid var(--signal); }

.comp-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.comp-chip {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .9rem; border: var(--line) solid var(--ink); border-radius: var(--r-md); background: var(--sheet);
  font-weight: 650; font-size: var(--fs-sm); cursor: pointer; text-decoration: none;
}
.comp-chip:hover { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.comp-chip .count { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); padding: 0 .35rem; border-radius: 3px; background: var(--cabinet-2); }
.comp-chip:hover .count { background: rgba(255,255,255,.6); }
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 1.5rem; }
.panel h3 { font-size: var(--fs-lg); font-weight: 700; margin-bottom: .5rem; }
.panel--accent { border: var(--line) solid var(--ink); box-shadow: 6px 6px 0 var(--signal); }

.page-sub { font-size: var(--fs-lg); font-weight: 600; font-stretch: 105%; margin: 0 0 1rem; }

/* ==================================================================
   DIALOGUES (contact, compétences, mot de passe, recherche)
   ================================================================== */
dialog.ui-dialog {
  width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
  padding: 0; border: 1px solid var(--rule); border-radius: var(--r-lg);
  background: var(--sheet); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(28,34,32,.45);
}
dialog.ui-dialog::backdrop { background: rgba(28,34,32,.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@media (prefers-reduced-motion: no-preference) {
  dialog.ui-dialog[open] { animation: dlg .2s var(--ease); }
  @keyframes dlg { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
}
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.5rem 1rem; border-bottom: 1px solid var(--rule); }
.dlg-head h2 { font-size: var(--fs-lg); font-weight: 750; font-stretch: 110%; }
.dlg-head p { margin: .25rem 0 0; font-size: var(--fs-sm); color: var(--ink-2); }
.dlg-close { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 1px solid var(--rule); border-radius: var(--r-md); background: none; cursor: pointer; }
.dlg-close:hover { background: var(--cabinet-2); }
.dlg-close svg { width: 18px; height: 18px; }
.dlg-body { padding: 1.25rem 1.5rem 1.5rem; }
.dlg-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.5rem; border-top: 1px solid var(--rule); background: var(--cabinet-2); }

.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field label { font-size: var(--fs-sm); font-weight: 600; }
.field label span { font-weight: 400; color: var(--ink-3); }
.input {
  width: 100%; padding: .7rem .85rem; font: inherit; font-size: var(--fs-sm); color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.input:hover { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--ink); background: var(--sheet); box-shadow: 0 0 0 3px var(--signal-soft); }
textarea.input { resize: vertical; min-height: 120px; }
.input[aria-invalid="true"] { border-color: var(--fault); box-shadow: 0 0 0 3px var(--fault-soft); }
.form-msg { font-size: var(--fs-sm); margin: 0 0 1rem; padding: .65rem .85rem; border-radius: var(--r-md); }
.form-msg[hidden] { display: none; }
.form-msg.is-error { background: var(--fault-soft); color: var(--fault-ink); }
.form-msg.is-ok { background: var(--run-soft); color: var(--run-ink); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.form-row .small { margin: 0; color: var(--ink-3); }
@media (prefers-reduced-motion: no-preference) {
  .shake { animation: shake .35s; }
  @keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
}

.ac-dlg-list { list-style: none; display: grid; gap: .75rem; }
.ac-dlg-list li { display: grid; grid-template-columns: 6.5rem 1fr; gap: .75rem; padding: .75rem; border: 1px solid var(--cabinet); border-radius: var(--r-md); font-size: var(--fs-sm); }
.ac-dlg-list strong { font-variant-numeric: tabular-nums; }
.ac-dlg-level { font-size: var(--fs-xs); color: var(--ink-3); margin-bottom: 1rem; }

/* Bouton flottant de contact */
.contact-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  display: inline-flex; align-items: center; gap: .55rem;
  height: 52px; padding: 0 1.1rem 0 1rem; border: 0; border-radius: 99px;
  background: var(--ink); color: var(--sheet); font-weight: 650; font-size: var(--fs-sm);
  box-shadow: 0 10px 30px -10px rgba(28,34,32,.6); cursor: pointer;
  transition: transform .2s var(--ease), background-color .15s;
}
.contact-fab:hover { transform: translateY(-2px); }
.contact-fab svg { width: 20px; height: 20px; color: var(--signal); }
@media (max-width: 600px) { .contact-fab .label { display: none; } .contact-fab { width: 52px; padding: 0; justify-content: center; } }

/* Recherche */
dialog.search-dialog { width: min(640px, calc(100vw - 2rem)); margin-top: 10vh; }
.search-field { display: flex; align-items: center; gap: .75rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--rule); }
.search-field svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
.search-field input { flex: 1; border: 0; outline: 0; background: none; font: inherit; font-size: var(--fs-lg); color: var(--ink); min-width: 0; }
.search-results { list-style: none; max-height: min(60vh, 460px); overflow-y: auto; padding: .5rem; }
.search-results a { display: grid; gap: .1rem; padding: .7rem .85rem; border-radius: var(--r-md); text-decoration: none; }
.search-results a .r-title { font-weight: 650; font-size: var(--fs-sm); }
.search-results a .r-where { font-size: var(--fs-xs); color: var(--ink-3); }
.search-results a .r-text { font-size: var(--fs-xs); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results a[aria-selected="true"], .search-results a:hover { background: var(--cabinet-2); box-shadow: inset 3px 0 0 var(--signal); }
.search-results mark { background: var(--signal-soft); color: inherit; border-radius: 2px; padding: 0 1px; }
.search-empty { padding: 1.5rem 1.25rem; color: var(--ink-2); font-size: var(--fs-sm); margin: 0; }
.search-hint { display: flex; gap: 1rem; padding: .6rem 1.25rem; border-top: 1px solid var(--rule); font-size: var(--fs-xs); color: var(--ink-3); background: var(--cabinet-2); }
/* Bannière d'annonce (admin) */
.adm-banner { position: relative; z-index: 60; }

@media print {
  .site-header, .contact-fab, .slide-controls, .site-footer .footer-cta { display: none !important; }
  body { background: #fff; }
}
/* Bouton flottant : seulement sur petits écrans (l'en-tête a déjà « Me contacter ») */
@media (min-width: 921px) { .contact-fab { display: none; } }

select.input {
  appearance: none; -webkit-appearance: none; padding-right: 2.5rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231c2220' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; background-size: 16px;
}
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ==================================================================
   EMPLACEMENTS D'IMAGES + VISIONNEUSE
   <figure class="ph" data-img="images/stage/maquette"> : si un fichier
   maquette.webp / .jpg / .png / .gif existe, il remplace l'emplacement.
   ================================================================== */
.ph { margin: 0; }
.ph-frame {
  position: relative; display: grid; place-content: center; justify-items: center; gap: .55rem;
  aspect-ratio: var(--ratio, 4 / 3); padding: 1.5rem; border-radius: var(--r-lg);
  color: var(--ink-3); text-align: center;
  background:
    repeating-linear-gradient(135deg, transparent 0 11px, var(--cabinet) 11px 12px),
    var(--cabinet-2);
  border: 1px dashed var(--rule);
}
/* repères de coupe aux angles, comme sur un plan */
.ph-frame::before, .ph-frame::after {
  content: ""; position: absolute; width: 18px; height: 18px; border: var(--line) solid var(--ink-3);
}
.ph-frame::before { left: 10px; top: 10px; border-right: 0; border-bottom: 0; }
.ph-frame::after { right: 10px; bottom: 10px; border-left: 0; border-top: 0; }
.ph-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--sheet); border: 1px solid var(--rule); color: var(--ink-2); }
.ph-icon svg { width: 22px; height: 22px; }
.ph-title { font-weight: 650; font-size: var(--fs-sm); color: var(--ink-2); }
.ph-sub { font-size: var(--fs-xs); }
.ph-path { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .72rem; padding: .15rem .45rem; border-radius: 4px; background: var(--sheet); border: 1px solid var(--rule); color: var(--ink-2); }
.ph figcaption, .zoomable + figcaption { font-size: var(--fs-xs); color: var(--ink-3); margin-top: .5rem; }
.ph img, img.zoomable { width: 100%; border-radius: var(--r-lg); background: var(--cabinet); display: block; }
.ph img { aspect-ratio: var(--ratio, 4 / 3); object-fit: cover; }
.zoomable { cursor: zoom-in; transition: filter .2s; }
.zoomable:hover { filter: brightness(1.04); }
@media (prefers-reduced-motion: no-preference) { .ph img { animation: ph-in .5s var(--ease); } @keyframes ph-in { from { opacity: 0; } } }

.gallery { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 800px) { .gallery { grid-template-columns: 1fr; } }

dialog.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(10,14,12,.92); color: #fff; display: none;
}
dialog.lightbox[open] { display: grid; grid-template-rows: 1fr auto; place-items: center; }
dialog.lightbox::backdrop { background: transparent; }
dialog.lightbox img { max-width: min(1400px, 94vw); max-height: 82vh; object-fit: contain; border-radius: 10px; box-shadow: 0 30px 80px rgba(0,0,0,.6); cursor: zoom-out; }
dialog.lightbox p { margin: 0 0 1.5rem; font-size: var(--fs-sm); color: rgba(255,255,255,.75); padding-inline: 1rem; text-align: center; }
dialog.lightbox .dlg-close { position: fixed; top: 16px; right: 16px; color: #fff; border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.06); }
@media (prefers-reduced-motion: no-preference) { dialog.lightbox[open] img { animation: lb-in .35s cubic-bezier(.2,.9,.3,1.1); } @keyframes lb-in { from { opacity: 0; transform: scale(.96); } } }

/* ---------------------------------------------------------------
   Manette discrète (pied de page)
--------------------------------------------------------------- */
.pad-trigger {
  --n: 0;
  display: inline-grid; place-items: center; vertical-align: middle;
  width: 26px; height: 20px; margin-left: .6rem; padding: 0;
  border: 0; background: none; color: var(--ink-3); cursor: default;
  opacity: calc(.45 + var(--n) * .11);
  transition: color .2s var(--ease), opacity .2s var(--ease), transform .2s var(--ease);
}
.pad-trigger svg { width: 22px; height: 15px; }
.pad-trigger:hover { color: var(--ink-2); opacity: .9; }
.pad-trigger:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 4px; }
.pad-trigger.pulse { animation: pad-pulse .22s var(--ease); }
@keyframes pad-pulse { 50% { transform: scale(1.18) rotate(-6deg); color: var(--signal); } }
.pad-dialog { width: min(380px, calc(100vw - 2rem)); }
.pad-form { display: grid; gap: .75rem; }
.pad-form input {
  font: inherit; font-size: var(--fs-md); padding: .75rem .9rem; letter-spacing: .12em;
  border: var(--line) solid var(--rule); border-radius: var(--r-md); background: var(--sheet); color: var(--ink);
}
.pad-form input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--signal-soft); }
.pad-msg { margin: 0; color: var(--fault-ink); font-size: var(--fs-sm); font-weight: 600; }
:root[data-theme="dark"] .pad-msg { color: var(--fault); }
@media (prefers-reduced-motion: reduce) { .pad-trigger.pulse { animation: none; } }
