/* ════════════════════════════════════════════
   NODUSING PARIS — site minimal, logo en scène
   Palette du kit, fond clair : Papier #FAFAF8 ·
   Encre #12161D · Ardoise #5A6372 · Perle #E3E6EB
   Règle du kit : fond clair → encre + Klein #002FA7
   ════════════════════════════════════════════ */

:root {
  --bg:           #FAFAF8;  /* Papier */
  --surface:      #FFFFFF;
  --fg:           #12161D;  /* Encre */
  --grey:         #5A6372;  /* Ardoise */
  --accent:       #002FA7;  /* Klein */
  --accent-light: #5B7CFF;  /* Lumière */
  --hairline:     #E3E6EB;  /* Perle */
  --error:        #C03A2B;

  --font-body: "Instrument Sans", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-pop:  cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* mode sombre — règle du kit : fond sombre → blanc + Lumière */
[data-theme="dark"] {
  --bg:           #0B1220;  /* Nuit */
  --surface:      #12161D;  /* Encre */
  --fg:           #F5F7FA;
  --grey:         #8E97A8;
  --accent:       #5B7CFF;  /* Lumière */
  --accent-light: #8FA6FF;
  --hairline:     rgba(245, 247, 250, 0.1);
  --error:        #E07B6B;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 350ms var(--ease-out), color 350ms var(--ease-out);
}

/* les logos SVG suivent le thème (les règles CSS priment
   sur les attributs de présentation inline) */
.mark-stroke { stroke: var(--fg); }
.node { fill: var(--fg); }
.n3, .accent-node { fill: var(--accent); }
.comet { fill: var(--accent); }
.ripple { stroke: var(--accent); }
.themed-logo path { stroke: var(--fg); }
.themed-logo circle { fill: var(--fg); }
.themed-logo circle:last-of-type { fill: var(--accent); }

::selection { background: rgba(0, 47, 167, 0.16); color: var(--fg); }

a { color: inherit; text-decoration: none; }
svg { display: block; }

.pt { color: var(--accent); }

/* ── Bouton ───────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.98rem;
  padding: 0.9em 2.2em;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  font-family: var(--font-body);
  color: #FFFFFF;
  background: var(--accent);
  transition: transform 250ms var(--ease-out), box-shadow 400ms var(--ease-out);
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px rgba(0, 47, 167, 0.35),
              0 10px 36px rgba(0, 47, 167, 0.28);
}

/* ── Contrôles thème & langue (haut droite) ── */

.top-controls {
  position: fixed;
  top: 1.1rem;
  right: 1.2rem;
  display: flex;
  gap: 0.55rem;
  z-index: 100;
}

.ctrl-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  transition: border-color 250ms var(--ease-out), color 250ms var(--ease-out),
              background-color 350ms var(--ease-out), transform 250ms var(--ease-out);
}
.ctrl-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.ctrl-lang {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ════════════════════════════════════════════
   HERO — le logo en très grand
   ════════════════════════════════════════════ */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  padding: 4rem 1.5rem;
  overflow: hidden;
}

.node-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-logo {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.monogram {
  width: clamp(220px, 38vh, 430px);
  height: auto;
  overflow: visible;
}

.wordmark {
  margin-top: 2.6rem;
  font-size: clamp(3.4rem, 11vw, 6.6rem);
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1;
  color: var(--fg);
  display: flex;
}

.paris {
  margin-top: 1.2rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: clamp(1rem, 2.6vw, 1.35rem);
  letter-spacing: 0.55em;
  text-indent: 0.55em; /* compense le letter-spacing pour un vrai centrage */
  color: var(--accent);
}

.hero-after {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  text-align: center;
}

.tagline {
  color: var(--grey);
  font-size: clamp(1rem, 2vw, 1.18rem);
  max-width: 44ch;
}

/* ── Réalisations (panneau à droite) ──────── */

.works {
  position: fixed;
  right: 1.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 250px;
  display: grid;
  gap: 0.9rem;
  z-index: 40;
}

.works-title {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--grey);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.works-title::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: workPulse 2.4s ease-in-out infinite;
}
@keyframes workPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 47, 167, 0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(0, 47, 167, 0); }
}
[data-theme="dark"] .works-title::before {
  animation-name: workPulseDark;
}
@keyframes workPulseDark {
  0%, 100% { box-shadow: 0 0 0 0 rgba(91, 124, 255, 0.45); }
  50%      { box-shadow: 0 0 0 6px rgba(91, 124, 255, 0); }
}

.work-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 1.05rem 1.1rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  transition: border-color 250ms var(--ease-out),
              transform 250ms var(--ease-out),
              box-shadow 400ms var(--ease-out),
              background-color 350ms var(--ease-out);
}
.work-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0, 47, 167, 0.16);
}
[data-theme="dark"] .work-card:hover {
  box-shadow: 0 10px 32px rgba(91, 124, 255, 0.18);
}

.work-icon { color: var(--fg); flex-shrink: 0; }
.work-icon-accent { fill: var(--accent); }

.work-text { display: grid; gap: 0.1rem; min-width: 0; }
.work-name { font-weight: 600; font-size: 0.98rem; }
.work-sub { color: var(--grey); font-size: 0.82rem; }

.work-arrow {
  margin-left: auto;
  color: var(--accent);
  flex-shrink: 0;
  transition: transform 250ms var(--ease-out);
}
.work-card:hover .work-arrow { transform: translateX(4px); }

/* entrée en scène après le logo — préserve le centrage vertical */
body.play .works { animation: worksIn 0.9s var(--ease-out) 3.05s both; }
@keyframes worksIn {
  from { opacity: 0; transform: translateY(calc(-50% + 18px)); }
  to   { opacity: 1; transform: translateY(-50%); }
}

@media (max-width: 1100px) {
  .works {
    position: static;
    transform: none;
    width: min(420px, 100%);
    margin-top: 3rem;
  }
  body.play .works { animation-name: fadeUp; }
}

/* ════════════════════════════════════════════
   L'ANIMATION DU LOGO
   État par défaut = état final (visible).
   .cycle sur .hero-logo lance le dessin du monogramme
   (relancé en boucle par le JS) ; .play lance les
   éléments qui ne jouent qu'une fois (wordmark, PARIS),
   et .play sur <body> la tagline + CTA.
   ════════════════════════════════════════════ */

/* — le trait : 378 ≈ longueur du tracé du N — */
.mark-stroke { stroke-dasharray: 378; stroke-dashoffset: 0; }
.cycle .mark-stroke { animation: draw 1.6s linear 0.4s both; }
@keyframes draw {
  from { stroke-dashoffset: 378; }
  to   { stroke-dashoffset: 0; }
}

/* — les nœuds éclosent au passage de la plume — */
.node { transform-box: fill-box; transform-origin: center; }
.cycle .n1 { animation: nodePop 0.55s var(--ease-pop) 0.12s both; }
.cycle .n2 { animation: nodePop 0.55s var(--ease-pop) 0.89s both; }
.cycle .n3 { animation: nodePop 0.65s var(--ease-pop) 1.51s both; }
.cycle .n4 { animation: nodePop 0.55s var(--ease-pop) 2.00s both; }
@keyframes nodePop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* — la comète qui parcourt le tracé (mouvement en SMIL) — */
.comet { opacity: 0; }
.cycle .comet { animation: cometLife 1.6s linear 0.4s both; }
@keyframes cometLife {
  0%   { opacity: 0; }
  6%   { opacity: 0.9; }
  90%  { opacity: 0.9; }
  100% { opacity: 0; }
}

/* — double onde sur le nœud accent — */
.ripple { opacity: 0; transform-box: fill-box; transform-origin: center; }
.cycle .ripple-1 { animation: ripple 1.1s var(--ease-out) 1.51s forwards; }
.cycle .ripple-2 { animation: ripple 1.3s var(--ease-out) 1.72s forwards; }
@keyframes ripple {
  0%   { transform: scale(1);   opacity: 0.7; }
  100% { transform: scale(3.1); opacity: 0; }
}

/* — wordmark lettre à lettre — */
.wordmark span { display: inline-block; }
.play .wordmark span {
  animation: letterUp 0.55s var(--ease-out) both;
  animation-delay: calc(2.05s + var(--i) * 50ms);
}
@keyframes letterUp {
  from { opacity: 0; transform: translateY(0.55em); }
  to   { opacity: 1; transform: translateY(0); }
}

/* — PARIS se resserre — */
.play .paris { animation: parisIn 0.9s var(--ease-out) 2.5s both; }
@keyframes parisIn {
  from { opacity: 0; letter-spacing: 1.1em; }
  to   { opacity: 1; letter-spacing: 0.55em; }
}

/* — tagline & CTA en dernier — */
body.play .hero-after { animation: fadeUp 0.9s var(--ease-out) 2.85s both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════════
   PAGE CONTACT
   ════════════════════════════════════════════ */

.site-header {
  padding: 1.4rem 1.6rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  transition: opacity 250ms var(--ease-out);
}
.brand:hover { opacity: 0.75; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
.brand-city {
  font-weight: 500;
  font-size: 0.5rem;
  letter-spacing: 0.42em;
  color: var(--accent);
}

.page-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100svh - 170px);
}

.contact {
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(5rem, 12vh, 9rem) 1.5rem;
  text-align: center;
}

.contact h2 {
  font-weight: 600;
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.8rem;
}

.contact-sub { color: var(--grey); margin-bottom: 2.8rem; }

#contactForm { display: grid; gap: 1.2rem; text-align: left; }
#contactForm[hidden] { display: none; }

.form-field { display: grid; gap: 0.4rem; }

.form-field label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--grey);
}

.form-field input,
.form-field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.98rem;
  padding: 0.85em 1em;
  transition: border-color 250ms var(--ease-out), box-shadow 250ms var(--ease-out);
}
.form-field input::placeholder,
.form-field textarea::placeholder { color: rgba(90, 99, 114, 0.5); }

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: rgba(0, 47, 167, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 47, 167, 0.1);
}

.form-field textarea { resize: vertical; min-height: 110px; }

.form-field.invalid input,
.form-field.invalid textarea { border-color: rgba(192, 58, 43, 0.55); }

.field-error { font-size: 0.8rem; color: var(--error); min-height: 1.1em; }

.hp-field { position: absolute; left: -9999px; opacity: 0; }

.btn-submit { justify-self: center; min-width: 200px; }
.btn-submit[disabled] { opacity: 0.6; cursor: wait; }

.form-status { font-size: 0.9rem; color: var(--grey); min-height: 1.3em; text-align: center; }
.form-status.error { color: var(--error); }

.form-success[hidden] { display: none; }
.form-success {
  display: grid;
  justify-items: center;
  gap: 0.9rem;
  padding: 3rem 1.5rem;
  border: 1px solid rgba(0, 47, 167, 0.3);
  border-radius: 16px;
}
.form-success h3 { font-weight: 600; font-size: 1.4rem; }
.form-success p { color: var(--grey); }

/* ════════════════════════════════════════════
   PAGE JEU — « Le Nœud »
   ════════════════════════════════════════════ */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--fg);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: none;
}

.game-main {
  display: flex;
  justify-content: center;
  padding: 5.5rem 1.5rem 3rem;
}

.game {
  width: min(680px, 100%);
  text-align: center;
}

.game h1 {
  font-weight: 600;
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.8rem;
}

.game-sub {
  color: var(--grey);
  max-width: 52ch;
  margin: 0 auto 2.2rem;
}

.game-hud {
  display: flex;
  justify-content: center;
  gap: clamp(1.4rem, 5vw, 3rem);
  margin-bottom: 1.4rem;
}

.hud-item { display: grid; gap: 0.15rem; }

.hud-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--grey);
}

.hud-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  color: var(--fg);
}

.game-stage { position: relative; }

#gameCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  touch-action: none;
  cursor: grab;
  transition: background-color 350ms var(--ease-out);
}

@media (max-width: 600px) {
  #gameCanvas { aspect-ratio: 1 / 1; }
}

.win-panel[hidden] { display: none; }
.win-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  gap: 0.8rem;
  background: var(--surface);
  border: 1px solid rgba(0, 47, 167, 0.3);
  border-radius: 16px;
  padding: 2rem 2.4rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  animation: panelIn 0.45s var(--ease-pop) both;
}
[data-theme="dark"] .win-panel { border-color: rgba(91, 124, 255, 0.4); }
@keyframes panelIn {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.92); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.win-panel h3 { font-weight: 600; font-size: 1.3rem; }

.win-stats {
  color: var(--grey);
  font-size: 0.9rem;
}
.win-stats strong { color: var(--fg); font-family: var(--font-mono); font-weight: 500; }

.game-actions {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1.4rem;
}

.game-note {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--grey);
  max-width: 58ch;
  margin: 2.2rem auto 0;
  line-height: 1.8;
}

/* ── Footer ───────────────────────────────── */

.footer {
  border-top: 1px solid var(--hairline);
  padding: 1.8rem 1.5rem;
  text-align: center;
}
.footer p {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--grey);
}

/* ── Accessibilité : mouvement réduit ─────── */
/* la classe .play n'est jamais posée en reduced-motion (géré en JS) :
   le logo s'affiche directement dans son état final */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .accent-node { animation: none; }
  .comet { display: none; }
  .node-field { display: none; }
}
