/* Pages intérieures d'ilhembelghazi.fr : une seule structure, deux ambiances.
   sombre = « Fret » (nuit de terminal, signalisation ambre, titres Big Shoulders)
   clair  = « Sobre » (papier argenté, marine, titres Geist serrés, accents Instrument Serif) */
:root, html[data-mode="sombre"] {
  --bg: #0b1220; --bg2: #0f1829; --surface: #121c30; --surface-2: #16223a; --fg: #e8ecf4; --mut: #8c99b2; --soft: #b8c2d6;
  --line: rgba(232, 236, 244, .09); --shell: rgba(232, 236, 244, .035); --acc: #e3a03c; --acc-hi: #f1b862; --acc-ink: #1a1206;
  --acc-soft: rgba(227, 160, 60, .1); --ok: #4cc38a; --ok-soft: rgba(76, 195, 138, .12); --warn: #ef8a6a; --warn-soft: rgba(239, 138, 106, .12);
  --blue: #5e7fb8; --nav-bg: rgba(15, 24, 41, .66); --shadow: 0 30px 60px -30px rgba(0, 0, 0, .7);
  --display: "Big Shoulders Display", "Arial Narrow", sans-serif; --display-w: 800; --display-tt: uppercase; --display-ls: .005em; --display-lh: .9;
  --accent-font: "Big Shoulders Display", "Arial Narrow", sans-serif; --accent-style: normal;
  color-scheme: dark;
}
html[data-mode="clair"] {
  --bg: #eef0f3; --bg2: #ffffff; --surface: #ffffff; --surface-2: #f6f7f9; --fg: #0f1f3d; --mut: #59647a; --soft: #3d4a63;
  --line: rgba(15, 31, 61, .09); --shell: rgba(15, 31, 61, .04); --acc: #c98a1f; --acc-hi: #a8720f; --acc-ink: #ffffff;
  --acc-soft: rgba(201, 138, 31, .1); --ok: #2f7a55; --ok-soft: rgba(47, 122, 85, .1); --warn: #b5482b; --warn-soft: rgba(181, 72, 43, .08);
  --blue: #3f5f99; --nav-bg: rgba(255, 255, 255, .74); --shadow: 0 24px 48px -28px rgba(15, 31, 61, .28);
  --display: "Geist", "Helvetica Neue", sans-serif; --display-w: 700; --display-tt: none; --display-ls: -.05em; --display-lh: .96;
  --accent-font: "Instrument Serif", Georgia, serif; --accent-style: italic;
  color-scheme: light;
}
:root { --sans: "Geist", "Helvetica Neue", sans-serif; --mono: "Geist Mono", ui-monospace, Menlo, monospace; --ease: cubic-bezier(.32, .72, 0, 1); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 110px; }
body { margin: 0; font: 16px/1.6 var(--sans); background: var(--bg); color: var(--fg); overflow-x: hidden; transition: background .6s var(--ease), color .6s var(--ease); }
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 3; opacity: .045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"); }
html[data-mode="clair"] body::after { opacity: .03; mix-blend-mode: multiply; }
.halo { position: absolute; inset: 0 0 auto; height: 900px; pointer-events: none; z-index: 0;
  background: radial-gradient(40% 40% at 85% 0%, var(--acc-soft), transparent 70%), radial-gradient(40% 40% at 0% 10%, rgba(94, 127, 184, .14), transparent 70%); }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; border-radius: 6px; }
.gut { padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); }
.wrap { max-width: 1180px; margin: 0 auto; position: relative; z-index: 1; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.accent { font-family: var(--accent-font); font-style: var(--accent-style); font-weight: 400; color: var(--acc); letter-spacing: 0; }
html[data-mode="sombre"] .accent { font-weight: 800; }

/* navigation flottante */
.nav { position: sticky; top: calc(14px + env(safe-area-inset-top, 0px)); z-index: 5; display: flex; justify-content: center; padding-block: 14px 0; }
.nav .pill { display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 999px; background: var(--nav-bg); box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
  backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); max-width: 100%; }
.nav .marque { font: 700 15px/1 var(--sans); letter-spacing: -.02em; padding: 0 12px; text-decoration: none; white-space: nowrap; }
.nav .liens { display: flex; gap: 2px; }
.nav .liens a { text-decoration: none; font-size: 14px; font-weight: 500; color: var(--mut); padding: 9px 12px; border-radius: 999px; white-space: nowrap; transition: background .5s var(--ease), color .5s var(--ease); }
.nav .liens a:hover { color: var(--fg); background: var(--shell); }
.nav .liens a[aria-current="page"] { color: var(--fg); background: var(--shell); box-shadow: inset 0 0 0 1px var(--line); }
.mode { width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--shell); cursor: pointer; flex: none; transition: transform .6s var(--ease); }
.mode:hover { transform: rotate(-18deg); }
.mode .lune { display: block; } .mode .soleil { display: none; }
html[data-mode="clair"] .mode .lune { display: none; } html[data-mode="clair"] .mode .soleil { display: block; }
.burger { display: none; border: 0; background: var(--shell); border-radius: 999px; padding: 10px 14px; font-size: 14px; font-weight: 600; cursor: pointer; }
.menu { position: fixed; inset: 0; z-index: 4; display: grid; align-content: center; gap: 6px; padding: 90px max(24px, env(safe-area-inset-left, 0px)) 40px;
  background: var(--nav-bg); backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px); }
.menu a { font: var(--display-w) clamp(34px, 9vw, 54px)/1 var(--display); text-transform: var(--display-tt); letter-spacing: var(--display-ls); text-decoration: none; padding: 8px 0;
  transform: translateY(14px); transition: transform .7s var(--ease); }
.menu.ouvert a { transform: none; }
.menu.ouvert a:nth-child(2) { transition-delay: .05s; } .menu.ouvert a:nth-child(3) { transition-delay: .1s; } .menu.ouvert a:nth-child(4) { transition-delay: .15s; } .menu.ouvert a:nth-child(5) { transition-delay: .2s; } .menu.ouvert a:nth-child(6) { transition-delay: .25s; }
@media (max-width: 860px) { .nav .liens { display: none; } .burger { display: inline-flex; } }

/* en-tête de page */
.tete { padding-block: 72px 46px; display: grid; gap: 22px; max-width: 900px; }
.eyebrow { justify-self: start; display: inline-flex; align-items: center; gap: 9px; padding: 6px 12px; border-radius: 999px; font: 500 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase;
  color: var(--acc-hi); background: var(--acc-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc) 30%, transparent); }
.tete h1 { font: var(--display-w) clamp(46px, 7.4vw, 104px)/var(--display-lh) var(--display); text-transform: var(--display-tt); letter-spacing: var(--display-ls); }
.tete .lead { font-size: clamp(17px, 1.7vw, 20px); color: var(--soft); max-width: 58ch; }
.h2 { font: var(--display-w) clamp(32px, 4.2vw, 56px)/var(--display-lh) var(--display); text-transform: var(--display-tt); letter-spacing: var(--display-ls); }
.h3 { font: 650 20px/1.25 var(--sans); letter-spacing: -.02em; }
.sous { color: var(--mut); max-width: 60ch; }
.section { padding-block: 56px; display: grid; gap: 28px; }
.section + .section { border-top: 1px solid var(--line); }

/* cartes à double cadre */
.coque { padding: 6px; border-radius: 28px; background: var(--shell); box-shadow: inset 0 0 0 1px var(--line); min-width: 0; }
.coeur { height: 100%; border-radius: 22px; background: var(--surface); box-shadow: inset 0 1px 1px rgba(255, 255, 255, .06), var(--shadow); padding: clamp(20px, 3vw, 30px); }
html[data-mode="clair"] .coeur { box-shadow: inset 0 1px 1px #fff, 0 20px 40px -30px rgba(15, 31, 61, .3); }

/* boutons avec rond intégré */
.btn { display: inline-flex; align-items: center; gap: 12px; padding: 6px 6px 6px 18px; border-radius: 999px; border: 0; cursor: pointer; font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap;
  background: var(--acc); color: var(--acc-ink); transition: transform .6s var(--ease), filter .6s var(--ease); }
html[data-mode="clair"] .btn { background: var(--fg); color: #fff; }
.btn .rond { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .12); transition: transform .6s var(--ease); }
html[data-mode="clair"] .btn .rond { background: rgba(255, 255, 255, .14); }
.btn:hover .rond { transform: translate(2px, -2px) scale(1.06); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 22%, transparent); }
.btn.ghost .rond { background: var(--shell); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* étiquettes de niveau */
.tag { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.tag i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag.terrain { color: var(--ok); background: var(--ok-soft); }
.tag.formation { color: var(--blue); background: color-mix(in srgb, var(--blue) 14%, transparent); }
.tag.vise { color: var(--acc-hi); background: var(--acc-soft); }

/* formulaires des outils */
.champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.champ { display: grid; gap: 7px; min-width: 0; }
.champ label { font: 500 12px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--mut); }
.champ input, .champ select { width: 100%; padding: 13px 14px; border-radius: 12px; border: 0; background: var(--bg2); box-shadow: inset 0 0 0 1px var(--line); font: 500 17px/1.2 var(--mono); }
html[data-mode="clair"] .champ input, html[data-mode="clair"] .champ select { background: #f6f7f9; }
.champ input:focus, .champ select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--acc); }
.champ small { color: var(--mut); font-size: 13px; }
.check { display: flex; align-items: center; gap: 10px; color: var(--soft); font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--acc); }
.resultat { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border-radius: 18px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.resultat div { background: var(--surface-2); padding: 18px; min-width: 0; }
.resultat small { display: block; font: 500 11px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mut); margin-bottom: 8px; }
.resultat b { font: 650 clamp(22px, 2.6vw, 30px)/1.1 var(--sans); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.alerte { padding: 14px 16px; border-radius: 14px; font-size: 15px; }
.alerte.ok { background: var(--ok-soft); color: var(--ok); }
.alerte.ko { background: var(--warn-soft); color: var(--warn); }
.note { font-size: 14px; color: var(--mut); max-width: 70ch; }
.tableau { overflow-x: auto; border-radius: 18px; box-shadow: inset 0 0 0 1px var(--line); }
.tableau table { width: 100%; border-collapse: collapse; min-width: 640px; font-size: 15px; }
.tableau th, .tableau td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tableau th { font: 500 11px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mut); background: var(--surface-2); }
.tableau tr:last-child td { border-bottom: 0; }

/* pied de page */
.pied { border-top: 1px solid var(--line); margin-top: 40px; padding-block: 34px 60px; display: grid; gap: 22px; }
.pied .lig { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 24px; align-items: center; }
.pied .petit { font: 500 12px/1.5 var(--mono); color: var(--mut); letter-spacing: .04em; }

/* ===== Mode clair : « le bureau d'exploitation » =====
   papier quadrillé de planning, feuilles nettes avec leur double carbone, tampons encreurs, perforations */
html[data-mode="clair"] { --acc-hi: #8f600c; --paper: #ffffff; --carbone: #dbe1e9; --ink-line: rgba(15, 31, 61, .16); }
html[data-mode="clair"] body {
  background-color: #edf0f4;
  background-image: linear-gradient(rgba(15, 31, 61, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(15, 31, 61, .045) 1px, transparent 1px);
  background-size: 28px 28px; background-position: -1px -1px; }
html[data-mode="clair"] .halo { background: linear-gradient(180deg, rgba(237, 240, 244, .92) 0%, rgba(237, 240, 244, 0) 70%), radial-gradient(40% 50% at 88% 0%, rgba(201, 138, 31, .12), transparent 70%); }
html[data-mode="clair"] .nav .pill { background: rgba(255, 255, 255, .9); box-shadow: 0 0 0 1px var(--ink-line), 0 12px 30px -20px rgba(15, 31, 61, .45); }
html[data-mode="clair"] .nav .liens a[aria-current="page"] { background: var(--fg); color: #fff; box-shadow: none; }
html[data-mode="clair"] .eyebrow { border-radius: 4px; background: var(--paper); color: var(--fg); box-shadow: inset 0 0 0 1px var(--ink-line); }
/* feuilles et double carbone */
html[data-mode="clair"] .coque { padding: 0; background: transparent; box-shadow: none; border-radius: 10px; position: relative; isolation: isolate; }
html[data-mode="clair"] .coque::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 10px; background: var(--carbone);
  box-shadow: inset 0 0 0 1px rgba(15, 31, 61, .07); transform: translate(7px, 7px); transition: transform .7s var(--ease); }
html[data-mode="clair"] .coeur { border-radius: 10px; background: var(--paper); box-shadow: 0 0 0 1px var(--ink-line); }
html[data-mode="clair"] a.coque:hover::before { transform: translate(11px, 11px); }
html[data-mode="clair"] a.coque:hover .coeur, html[data-mode="clair"] .outil:hover .coeur { transform: translate(-3px, -3px); }
html[data-mode="clair"] :is(.comp, .regles > div, .types > div, .faq details, .decoupe > div) {
  border-radius: 8px; background: var(--paper); box-shadow: 0 0 0 1px var(--ink-line), 4px 4px 0 var(--carbone); }
html[data-mode="clair"] .comp:hover { transform: translate(-2px, -2px); box-shadow: 0 0 0 1px var(--ink-line), 6px 6px 0 var(--carbone); }
html[data-mode="clair"] .resultat { border-radius: 8px; background: var(--ink-line); box-shadow: 0 0 0 1px var(--ink-line); }
html[data-mode="clair"] .resultat div { background: var(--paper); }
html[data-mode="clair"] .tableau { border-radius: 8px; background: var(--paper); box-shadow: 0 0 0 1px var(--ink-line); }
html[data-mode="clair"] .tableau th { background: #f4f6f9; }
html[data-mode="clair"] .champ input, html[data-mode="clair"] .champ select { background: var(--paper); border-radius: 6px; box-shadow: inset 0 0 0 1px var(--ink-line), inset 0 -2px 0 rgba(15, 31, 61, .08); }
/* tampons encreurs */
html[data-mode="clair"] .tag { border-radius: 3px; background: transparent; padding: 5px 8px; font-weight: 600; box-shadow: inset 0 0 0 1.5px currentColor; transform: rotate(-2.5deg); opacity: .92; }
html[data-mode="clair"] .tag i { display: none; }
html[data-mode="clair"] .tag.vise { color: var(--acc-hi); }
/* perforations */
html[data-mode="clair"] .section + .section { border-top: 0; background-image: radial-gradient(circle, rgba(15, 31, 61, .28) 1.2px, transparent 1.6px); background-size: 12px 3px; background-repeat: repeat-x; background-position: 0 0; }
html[data-mode="clair"] .pied { border-top: 0; background-image: radial-gradient(circle, rgba(15, 31, 61, .28) 1.2px, transparent 1.6px); background-size: 12px 3px; background-repeat: repeat-x; }
html[data-mode="clair"] .filtres button { background: var(--paper); box-shadow: inset 0 0 0 1px var(--ink-line); }
html[data-mode="clair"] .filtres button[aria-pressed="true"] { background: var(--fg); color: #fff; box-shadow: none; }
html[data-mode="clair"] .alerte.ok { background: #e7f3ec; box-shadow: inset 3px 0 0 var(--ok); border-radius: 6px; }
html[data-mode="clair"] .alerte.ko { background: #fbeee9; box-shadow: inset 3px 0 0 var(--warn); border-radius: 6px; }

.entree { animation: entree 1s var(--ease) both; }
@keyframes entree { from { transform: translateY(26px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .menu a { opacity: 1; transform: none; } }
