/* ─── Pages secondaires DX-5 — DA « L'Énigme » ───
   Mêmes tokens que la bibliothèque. Header partagé, composants de contenu. */

:root {
  --bg: #070b14;
  --surface: #0c1322;
  --surface-2: #101a2e;
  --line: rgba(140, 170, 220, 0.14);
  --ink: #e9eef7;
  --ash: #8da0bf;
  --blue: #4cc2ff;
  --gold: #e8c76a;
  --red: #ff4d4d;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
  --serif: 'Times New Roman', Times, Georgia, serif; /* clin d'œil à l'écrivain */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(900px 480px at 78% -8%, rgba(76, 194, 255, 0.07), transparent 60%),
    radial-gradient(700px 420px at 12% 14%, rgba(232, 199, 106, 0.045), transparent 65%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
}

.mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; }
.ash  { color: var(--ash); }
.gold { color: var(--gold); }
.red  { color: var(--red); }

/* ── header partagé ── */
.top {
  position: fixed; top: 10px; left: 10px; right: 10px; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 18px;
  background: rgba(10, 15, 26, 0.78);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 12px;
  flex-wrap: wrap;
}
.wordmark { font-weight: 700; white-space: nowrap; color: inherit; text-decoration: none; }
.wordmark:hover { color: var(--blue); }
.top-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.nav-link { color: var(--ash); text-decoration: none; white-space: nowrap; transition: color 0.2s; }
.nav-link:hover { color: var(--ink); }
.nav-link.active { color: var(--gold); }
.nav-cta {
  background: var(--gold); color: #1a1915;
  text-decoration: none; white-space: nowrap;
  padding: 8px 14px; border-radius: 8px; font-weight: 700;
  transition: filter 0.2s;
}
.nav-cta:hover { filter: brightness(1.08); }

/* ── layout ── */
main { max-width: 880px; margin: 0 auto; padding: 150px 22px 60px; }
.page-head { margin-bottom: 44px; }
.kicker { color: var(--gold); margin-bottom: 14px; display: block; }
h1 { font-size: clamp(34px, 6vw, 62px); line-height: 1.04; font-weight: 800; letter-spacing: -0.02em; }
h1 em { font-style: normal; color: var(--blue); }
.lead { margin-top: 18px; color: var(--ash); max-width: 58ch; }
h2 { font-size: clamp(22px, 3.4vw, 32px); font-weight: 750; letter-spacing: -0.01em; margin: 56px 0 18px; }
.prose p { margin-bottom: 14px; max-width: 64ch; }
a { color: var(--blue); }

/* ── pastilles d'état (placeholders) ── */
.notice {
  display: inline-block; vertical-align: 2px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em;
  color: var(--gold); border: 1px solid var(--gold);
  border-radius: 12px; padding: 2px 9px; white-space: normal;
}
.notice.red-n { color: var(--red); border-color: var(--red); }
.banner {
  border: 1px solid var(--gold); border-radius: 10px;
  background: rgba(232, 199, 106, 0.06);
  padding: 12px 16px; margin-bottom: 36px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: var(--gold);
}

/* ── dossier / timeline ── */
.pieces { list-style: none; border-top: 1px solid var(--line); }
.piece {
  display: grid; grid-template-columns: 120px 1fr; gap: 18px;
  padding: 20px 4px; border-bottom: 1px solid var(--line);
}
.piece .when { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--gold); padding-top: 4px; }
.piece h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.piece p { color: var(--ash); font-size: 14.5px; max-width: 58ch; }

/* ── pays / signaux ── */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 99px;
  background: var(--surface); padding: 7px 14px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; color: var(--ash);
}
.chip i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--blue);
  animation: pulse 2.6s infinite;
}
.chip.lead-chip { border-color: var(--gold); color: var(--gold); }
.chip.lead-chip i { background: var(--gold); }
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ── cartes ── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card {
  border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(165deg, var(--surface), var(--surface-2));
  padding: 20px;
}
.card h3 { font-size: 17px; margin-bottom: 6px; }
.card .mono { display: block; margin-bottom: 10px; }
.card p { color: var(--ash); font-size: 14px; }
.card.big { grid-column: 1 / -1; }

/* ── fragment manuscrit (écrits) ── */
.fragment {
  border-left: 2px solid var(--gold);
  padding: 6px 0 6px 22px; margin: 26px 0;
  font-family: var(--serif); font-style: italic;
  font-size: 19px; line-height: 1.75; color: #d9e0ee;
  max-width: 56ch;
}
.fragment footer { font-family: var(--mono); font-style: normal; font-size: 10px; letter-spacing: 0.14em; color: var(--ash); margin-top: 10px; }

/* ── formulaires ── */
form { display: grid; gap: 14px; max-width: 560px; }
.frow { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
label { display: grid; gap: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--ash); }
input, textarea, select {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 13px; font: 15px/1.4 inherit; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.btn {
  display: inline-block; cursor: pointer; border: 0;
  background: var(--gold); color: #1a1915;
  font: 700 13px/1 var(--mono); letter-spacing: 0.1em;
  padding: 14px 22px; border-radius: 9px; text-decoration: none;
  transition: filter 0.2s;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--blue); color: var(--blue); filter: none; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.form-note { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; color: var(--ash); max-width: 56ch; }
.ok-msg { color: var(--gold); font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; }

/* ── footer partagé ── */
.foot {
  border-top: 1px solid var(--line);
  margin-top: 80px; padding: 36px 0 10px;
  display: grid; gap: 14px;
}
.foot-links { display: flex; flex-wrap: wrap; gap: 16px 22px; }
.foot-links a { color: var(--ash); text-decoration: none; }
.foot-links a:hover { color: var(--ink); }

/* ── divers ── */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.hidden { display: none !important; }

@media (max-width: 680px) {
  main { padding-top: 170px; }
  .piece { grid-template-columns: 1fr; gap: 4px; }
  .frow { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chip i { animation: none; opacity: 0.8; }
}

/* ── sous-menu PLUS ▾ ── */
.nav-sub { position: relative; display: inline-flex; }
.nav-more { background: none; border: 0; cursor: pointer; font: inherit; }
.nav-menu {
  position: absolute; top: calc(100% + 14px); right: -6px;
  min-width: 185px; display: flex; flex-direction: column; gap: 2px; padding: 10px;
  background: rgba(12, 17, 28, 0.96);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 12px; z-index: 90;
}
.nav-menu a { padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--ash); white-space: nowrap; }
.nav-menu a:hover { background: rgba(76, 194, 255, 0.1); color: var(--gold); }
.nav-menu[hidden] { display: none; } /* l' attribut hidden doit gagner sur display:flex */

/* ── immersion : scène de fond, entrée de page, révélations ── */
#signal-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

@media (prefers-reduced-motion: no-preference) {
  main { animation: pagein 0.55s cubic-bezier(0.19, 1, 0.22, 1) both; }
  @keyframes pagein { from { opacity: 0; transform: translateY(14px); } }
}

html.js .rv {
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.7s cubic-bezier(0.19, 1, 0.22, 1), transform 0.7s cubic-bezier(0.19, 1, 0.22, 1);
}
html.js .rv.in { opacity: 1; transform: none; }


/* ── header compact : une seule rangée partout ── */
.nav-menu .m-only { display: none; }
@media (max-width: 920px) {
  /* tablette : la rangée unique doit tenir à 768 px */
  .top { gap: 12px; }
  .top-nav { gap: 14px; }
}
@media (max-width: 800px) {
  /* téléphone et petite tablette : la navigation se verse dans PLUS ▾ */
  .top-nav { display: none; }
  .nav-menu .m-only { display: block; }
}

@media (max-width: 380px) {
  /* wordmark + PLUS + CTA doivent tenir sur UNE rangée à 320 px */
  .top { padding: 10px 12px; gap: 10px; }
  .wordmark { font-size: 15px; }
  .nav-cta { padding: 7px 10px; }
}
