@font-face { font-family: "Plex Mono"; src: url(/fonts/plex-mono-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url(/fonts/plex-mono-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url(/fonts/plex-mono-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url(/fonts/plex-sans.woff2) format("woff2"); font-weight: 400 600; font-display: swap; }

:root {
  --bg: #fbfcf6;
  --grid: #ebeee2;
  --ink: #1d1f1a;
  --muted: #7a7e72;
  --line: #d9ddd0;
  --mono: "Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: clip; }

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  color: var(--ink);
  font: 15px/1.6 var(--mono);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }

.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

.label {
  font: 500 13px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

header { padding-top: 28px; padding-bottom: 28px; }
header .wrap, footer .wrap { max-width: 1200px; }
header .wrap { display: flex; align-items: center; justify-content: space-between; }
header a { text-decoration: none; color: var(--muted); }
header a.brand { color: var(--ink); }
header span { display: flex; gap: 24px; }
header a:hover { color: var(--ink); }

main { flex: 1; }

/* accueil */
.home { max-width: none; padding-top: 2vh; padding-bottom: 4vh; text-align: center; display: flex; flex-direction: column; justify-content: center; }
.home h1 {
  font: 500 clamp(19px, min(5.6vw, 4.2svh), 46px)/1.25 var(--mono);
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  text-wrap: balance;
}
.home .tag { color: var(--muted); margin: 0 auto; max-width: 34em; text-wrap: balance; font-size: clamp(14px, 1.7svh, 19px); }
.home .tiles { text-align: left; }

.stage { position: relative; width: clamp(260px, min(86vw, 100svh - 380px), 820px); aspect-ratio: 1; margin: 0 auto 3svh; container-type: inline-size; }
.stage .rings { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .rings circle { fill: none; stroke: var(--line); stroke-dasharray: 1 1.6; stroke-width: 0.3; }
.stage .emblem {
  position: absolute; left: 50%; top: 50%; width: 30%;
  transform: translate(-50%, -50%);
  fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round;
  transition: transform .4s ease;
}
.stage .emblem .inner { stroke: var(--line); stroke-width: 1.2; }
.stage .emblem .letter { fill: var(--ink); stroke: none; }
.stage .emblem.near { transform: translate(-50%, -54%) scale(1.06); }
.stage .orb {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: clamp(32px, 8.5cqw, 64px); height: clamp(32px, 8.5cqw, 64px);
  display: grid; place-items: center;
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  transition: background .2s, color .2s, border-color .2s;
  will-change: transform;
}
.stage .orb.near { background: var(--ink); color: var(--bg); border-color: var(--ink); z-index: 2; }
.stage .tip {
  position: absolute; left: 50%; bottom: calc(100% + 10px);
  width: min(240px, 72vw);
  background: var(--bg); color: var(--ink); border: 1px solid var(--ink);
  padding: 10px 12px; text-align: left;
  font: 13px/1.45 var(--sans);
  display: none; pointer-events: none;
}
.stage .tip b { display: block; font: 500 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.stage .orb.below .tip { bottom: auto; top: calc(100% + 10px); }
.stage .orb.near .tip { display: block; transform: translate(calc(-50% + var(--dx, 0px)), 0); animation: tip-in .2s ease both; }
@keyframes tip-in { from { opacity: 0; } }
.stage .orb svg { width: 46%; height: 46%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }

@media (prefers-reduced-motion: reduce) {
  .stage .emblem { transition: none; }
}

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  text-decoration: none;
  font: 500 13px/1.3 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tile:hover, .tile:focus-visible { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tile .arrow { font-size: 16px; letter-spacing: 0; }

@media (max-width: 560px) { .tiles { grid-template-columns: 1fr; } }

@media (max-width: 640px) {
  header { padding-top: 20px; padding-bottom: 20px; }
  header .wrap, header span { gap: 16px; }
  .label { font-size: 11px; letter-spacing: 0.1em; }
  header a { white-space: nowrap; }
  .home { padding-top: 0; }
  .stage { margin-bottom: 20px; }
}

/* pages courtes : comment ça marche, dossier */
.page { padding-top: 8vh; padding-bottom: 10vh; }
.page h1 { font: 500 clamp(24px, 4vw, 32px)/1.2 var(--mono); margin: 0 0 32px; letter-spacing: -0.01em; }
.page .lede { color: var(--muted); margin: -16px 0 32px; }

.steps { list-style: none; padding: 0; margin: 0 0 40px; border-top: 1px solid var(--line); }
.steps li { display: grid; grid-template-columns: 56px 1fr; padding: 20px 0; border-bottom: 1px solid var(--line); background: var(--bg); }
.steps .n { color: var(--muted); }
.steps b { display: block; font-weight: 500; }
.steps span { color: var(--muted); }

.back { display: inline-block; margin-top: 8px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }

/* diagnostic */
.diag .progress { color: var(--muted); margin-bottom: 20px; }
.diag .q { font: 500 clamp(22px, 4vw, 28px)/1.25 var(--mono); margin: 0 0 28px; }
.diag .step { display: none; }
.diag .step.on { display: block; }
.diag .tiles { margin-bottom: 20px; }
.diag .tile[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.diag .nav { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.diag button.link { background: none; border: 0; font: inherit; color: var(--muted); cursor: pointer; padding: 0; }
.diag button.link:hover { color: var(--ink); }
.diag button.link[disabled] { visibility: hidden; }
.result .big { font: 500 clamp(44px, 9vw, 72px)/1 var(--mono); margin: 0 0 8px; }
.result .sub { color: var(--muted); margin: 0 0 32px; }
.calc { border-top: 1px solid var(--line); margin-bottom: 16px; }
.calc div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); background: var(--bg); }
.calc div:last-child { font-weight: 600; }
.note { font-family: var(--sans); color: var(--muted); font-size: 14px; margin: 0 0 32px; }

/* espace client */
.login { display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 6vh; padding-bottom: 10vh; }
.login-box { width: 100%; max-width: 380px; background: var(--bg); border: 1px solid var(--line); padding: 32px 28px; display: flex; flex-direction: column; }
.login-box h1 { margin: 0 0 28px; }
.login-box label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.login-box input {
  font: 15px/1.4 var(--mono); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 0;
  padding: 14px 14px; margin-bottom: 12px; outline: none;
}
.login-box input:focus { border-color: var(--ink); }
.login-box .tile { width: 100%; text-align: left; }
.login-forgot { font-size: 12px; color: var(--muted); margin-top: 14px; text-decoration: none; align-self: flex-start; }
.login-forgot:hover { color: var(--ink); }
.login-note { font-family: var(--sans); font-size: 14px; color: var(--muted); margin: 16px 0 0; }
.login-alt { color: var(--muted); font-size: 13px; margin-top: 20px; }

/* pages légales : texte long en sans */
.doc { padding-top: 24px; padding-bottom: 64px; font-family: var(--sans); font-size: 16px; background: var(--bg); }
.doc h1 { font: 500 30px/1.2 var(--mono); margin: 0 0 8px; }
.doc h2 { font: 500 14px/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; margin: 36px 0 8px; }
.doc p, .doc li { color: #33362e; }
.doc .updated { color: var(--muted); margin-top: 0; }

footer { padding-top: 32px; padding-bottom: 36px; font-size: 12px; color: var(--muted); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: space-between; align-items: baseline; }
footer nav { display: flex; flex-wrap: wrap; gap: 12px 28px; }
footer a { text-decoration: none; }
footer a:hover { color: var(--ink); }
