/* ═══════════════════════════════════════════
   Baromètre IA — feuille de style
   Palette : papier de relevé, encre pétrole, rouge aiguille
   ═══════════════════════════════════════════ */

:root {
  --paper:      #ECEEEF;
  --paper-2:    #E2E5E8;
  --ink:        #0B2430;
  --slate:      #4F5F67;
  --line:       rgba(11, 36, 48, .16);
  --line-soft:  rgba(11, 36, 48, .09);

  --signal:     #E23B1D;   /* graphiques, grands corps */
  --signal-deep:#C22E12;   /* fond de bouton, texte rouge sur papier */
  --signal-hi:  #FF7A50;   /* rouge lisible sur fond encre */

  --panel-fg:   #E7EDEF;
  --panel-dim:  #9FB2BA;
  --panel-line: rgba(231, 237, 239, .18);

  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "Sometype Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gap: clamp(1.25rem, 3vw, 2.5rem);
  --section-pad: clamp(3.5rem, 7vw, 6.5rem);
}

/* ── Reset ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }

a {
  color: inherit;
  text-decoration-color: var(--line);
  text-underline-offset: .22em;
}
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--signal-deep);
  outline-offset: 3px;
}
.section--dark :focus-visible,
.panel :focus-visible,
.site-foot :focus-visible {
  outline-color: var(--signal-hi);
}

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

.skip {
  position: absolute;
  left: .75rem; top: -4rem;
  z-index: 50;
  background: var(--ink);
  color: var(--paper);
  padding: .6rem 1rem;
  font-size: .9rem;
  transition: top .18s ease;
}
.skip:focus { top: .75rem; }

.wrap {
  width: min(1180px, 100% - 2.5rem);
  margin-inline: auto;
}

.mono { font-family: var(--mono); }

/* ── Boutons ───────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: .72rem 1.15rem;
  font-size: .95rem;
  font-variation-settings: "wdth" 100, "wght" 550;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.btn--solid {
  background: var(--signal-deep);
  color: #fff;
}
.btn--solid:hover { background: #A6260D; }
.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn--ghost:hover { border-color: var(--ink); }
.btn:disabled { opacity: .55; cursor: default; }

/* ── En-tête ───────────────────────────── */
.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.head-inner {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  min-height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  text-decoration: none;
  margin-right: auto;
}
.brand__mark { width: 26px; height: 26px; flex: none; }
.brand__name {
  font-variation-settings: "wdth" 112, "wght" 650;
  font-size: 1.06rem;
  letter-spacing: -.01em;
}
.nav {
  display: flex;
  gap: clamp(.9rem, 2vw, 1.6rem);
  font-size: .93rem;
}
.nav a { text-decoration: none; color: var(--slate); }
.nav a:hover { color: var(--ink); }
.head-cta { font-size: .9rem; padding: .55rem .95rem; }

/* ── Hero ──────────────────────────────── */
.hero {
  padding: clamp(2.5rem, 6vw, 4.75rem) 0 clamp(3rem, 7vw, 5.5rem);
}
.hero__title {
  max-width: 17ch;
  font-size: clamp(2.5rem, 6.2vw, 4.7rem);
  line-height: .98;
  letter-spacing: -.025em;
  font-variation-settings: "wdth" 118, "wght" 700;
  text-wrap: balance;
  margin-bottom: clamp(1.75rem, 4vw, 3rem);
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  gap: clamp(1.75rem, 4vw, 3.75rem);
  align-items: start;
}
.hero__lede {
  font-size: clamp(1.05rem, 1.3vw, 1.19rem);
  line-height: 1.55;
  max-width: 46ch;
  color: var(--ink);
}
.hero__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.75rem;
  font-size: .95rem;
}
.hero__links a { color: var(--slate); }
.hero__links a:hover { color: var(--ink); }

/* ── Formulaire d'inscription ──────────── */
.signup { margin-top: 2rem; }
.signup__label {
  display: block;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--slate);
  margin-bottom: .55rem;
}
.signup__row {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}
.signup__input {
  flex: 1 1 14rem;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: .78rem .9rem;
  font-size: 1rem;
}
.signup__input::placeholder { color: #8A979E; }
.signup__input:focus-visible { border-color: var(--ink); }
.signup__input:disabled { background: var(--paper-2); color: var(--slate); }
.signup__note {
  margin-top: .7rem;
  font-size: .86rem;
  color: var(--slate);
  max-width: 44ch;
}
.signup__msg {
  margin-top: .6rem;
  font-size: .92rem;
  min-height: 1.3em;
  font-variation-settings: "wdth" 100, "wght" 550;
}
.signup__msg[data-state="error"] { color: var(--signal-deep); }
.signup__msg[data-state="ok"] { color: var(--ink); }

.signup--wide .signup__input { background: rgba(255, 255, 255, .06); border-color: var(--panel-line); }
.signup--wide .signup__label { color: var(--panel-dim); }
.signup--wide .signup__note { color: var(--panel-dim); }
.signup--wide .signup__msg[data-state="ok"] { color: var(--panel-fg); }
.signup--wide .signup__msg[data-state="error"] { color: var(--signal-hi); }

/* ── Panneau d'instrument ──────────────── */
.panel {
  background: var(--ink);
  color: var(--panel-fg);
  padding: clamp(1.15rem, 2.4vw, 1.75rem);
  border-radius: 3px;
}
.panel__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--panel-line);
}
.panel__kicker {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--signal-hi);
  margin-bottom: .3rem;
}
.panel__title {
  font-size: clamp(1.2rem, 1.9vw, 1.5rem);
  line-height: 1.15;
  letter-spacing: -.015em;
  font-variation-settings: "wdth" 110, "wght" 600;
}
.panel__stamp {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--panel-dim);
}

.panel__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin: 1.1rem 0 1rem;
}
.tab {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: 3px 3px 0 0;
  padding: .42rem .8rem;
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--panel-dim);
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}
.tab:hover { color: var(--panel-fg); background: rgba(255, 255, 255, .05); }
.tab.is-on {
  color: var(--panel-fg);
  border-bottom-color: var(--signal);
  background: rgba(255, 255, 255, .05);
}

/* règle de mesures */
.strip { margin-bottom: 1.1rem; }
.strip__ticks {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
  border-bottom: 1px solid var(--panel-line);
  padding-bottom: 1px;
}
.strip__tick {
  flex: 1;
  height: 9px;
  background: rgba(231, 237, 239, .3);
  transform-origin: bottom;
  animation: tick-in .5s cubic-bezier(.22, 1, .36, 1) backwards;
  animation-delay: calc(var(--i) * 45ms);
}
.strip__tick.is-now { height: 24px; background: var(--signal-hi); }
.strip__cap {
  margin-top: .45rem;
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--panel-dim);
}
@keyframes tick-in {
  from { transform: scaleY(.06); opacity: 0; }
  to   { transform: scaleY(1); opacity: 1; }
}

/* classement */
.rank-panel { min-height: 1rem; }
.rank {
  display: grid;
  gap: .1rem;
}
.row {
  display: grid;
  grid-template-columns: 1.6rem minmax(8.5rem, 1.35fr) minmax(40px, 1fr) 4.2rem 3.2rem;
  align-items: center;
  gap: .6rem;
  padding: .45rem .35rem;
  border-radius: 2px;
}
.row:nth-child(odd) { background: rgba(255, 255, 255, .035); }
.row__rank {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--panel-dim);
}
.row.is-lead .row__rank { color: var(--signal-hi); }
.row__name {
  font-size: .95rem;
  font-variation-settings: "wdth" 100, "wght" 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row.is-lead .row__name { font-variation-settings: "wdth" 100, "wght" 650; }
.row__bar {
  height: 9px;
  background: rgba(231, 237, 239, .1);
  border-radius: 1px;
  overflow: hidden;
}
.row__fill {
  display: block;
  height: 100%;
  background: rgba(231, 237, 239, .55);
  transition: width .7s cubic-bezier(.22, 1, .36, 1);
}
.row.is-lead .row__fill { background: var(--signal); }
.row__val {
  font-family: var(--mono);
  font-size: .84rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.row__delta {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--panel-dim);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.row__arrow { font-size: .68rem; }

.panel__note {
  margin-top: 1.1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--panel-line);
  font-size: .8rem;
  line-height: 1.5;
  color: var(--panel-dim);
}
.panel__demo { color: var(--signal-hi); }

/* ── Sections ──────────────────────────── */
.section { padding: var(--section-pad) 0; }
.section__inner {
  position: relative;
  border-top: 1px solid var(--line);
  padding-top: clamp(1.75rem, 3vw, 2.5rem);
}
.section__inner::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--line-soft) 0 1px, transparent 1px 16px);
  pointer-events: none;
}
.section__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: var(--gap);
  align-items: start;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.section__title {
  font-size: clamp(1.7rem, 3.1vw, 2.5rem);
  line-height: 1.04;
  letter-spacing: -.02em;
  font-variation-settings: "wdth" 114, "wght" 680;
  text-wrap: balance;
}
.section__intro {
  color: var(--slate);
  max-width: 54ch;
  font-size: 1.02rem;
}

/* ── Mesures ───────────────────────────── */
.measures { border-top: 1px solid var(--line-soft); }
.measure {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: var(--gap);
  align-items: center;
  padding: clamp(1.1rem, 2vw, 1.5rem) 0;
  border-bottom: 1px solid var(--line-soft);
}
.measure__name {
  font-size: clamp(1.08rem, 1.5vw, 1.28rem);
  font-variation-settings: "wdth" 106, "wght" 620;
  letter-spacing: -.01em;
  margin-bottom: .35rem;
}
.measure__desc {
  color: var(--slate);
  max-width: 66ch;
  font-size: .98rem;
}
.measure__viz {
  width: 88px;
  height: 36px;
  color: var(--ink);
  justify-self: end;
}

/* ── Sujets ────────────────────────────── */
.subjects { border-top: 1px solid var(--line); }
.subject {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: var(--gap);
  padding: clamp(1.15rem, 2.2vw, 1.6rem) 0;
  border-bottom: 1px solid var(--line);
}
.subject--featured { background: transparent; }
.subject--featured .subject__name { color: var(--ink); }
.subject__cat {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--slate);
  margin-bottom: .3rem;
}
.subject__name {
  font-size: clamp(1.15rem, 1.9vw, 1.45rem);
  line-height: 1.15;
  letter-spacing: -.015em;
  font-variation-settings: "wdth" 108, "wght" 640;
  margin-bottom: .4rem;
}
.subject__desc {
  color: var(--slate);
  font-size: .97rem;
  max-width: 58ch;
}
.subject__link {
  display: inline-block;
  margin-top: .7rem;
  font-size: .93rem;
  color: var(--signal-deep);
  font-variation-settings: "wdth" 100, "wght" 550;
}
.subject__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  align-content: start;
  font-size: .88rem;
}
.subject__meta dt {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--slate);
  margin-bottom: .2rem;
}
.subject__meta dd { margin: 0; }
.chip {
  display: inline-block;
  padding: .12rem .5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--slate);
}
.chip--on { border-color: var(--ink); color: var(--ink); }

/* ── Protocole ─────────────────────────── */
.proto {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(2rem, 5vw, 4rem);
}
.proto__why .section__title { margin-bottom: 1.4rem; }
.proto__why p {
  color: var(--slate);
  max-width: 58ch;
  margin-bottom: 1.1rem;
}
.proto__why p:first-of-type {
  color: var(--ink);
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
  line-height: 1.45;
}
.proto__subtitle {
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 400;
  color: var(--slate);
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: .4rem;
}
.steps { counter-reset: step; }
.step {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: .9rem;
  row-gap: .3rem;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--line-soft);
  counter-increment: step;
}
.step::before {
  content: counter(step, decimal-leading-zero);
  grid-column: 1;
  grid-row: 1 / span 2;
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--signal-deep);
  line-height: 1.7;
}
.step__name {
  grid-column: 2;
  grid-row: 1;
  font-size: 1.05rem;
  font-variation-settings: "wdth" 104, "wght" 620;
}
.step__desc {
  grid-column: 2;
  grid-row: 2;
  color: var(--slate);
  font-size: .95rem;
  max-width: 52ch;
}

/* ── Inscription (fond encre) ──────────── */
.section--dark {
  background: var(--ink);
  color: var(--panel-fg);
  padding-bottom: clamp(3rem, 6vw, 5rem);
}
.section--dark .section__inner { border-top-color: var(--panel-line); }
.section--dark .section__inner::before {
  background: repeating-linear-gradient(90deg, var(--panel-line) 0 1px, transparent 1px 18px);
}
.signup-block {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.signup-block .section__title { margin-bottom: 1rem; }
.signup-block p { color: var(--panel-dim); max-width: 50ch; }
.signup-block__contact { margin-top: 1.2rem; font-size: .95rem; }
.signup-block__contact a { color: var(--panel-fg); }
.signup--wide { margin-top: 0; }
.signup--wide .btn--solid { border-color: var(--signal-deep); }

/* ── Pied de page ──────────────────────── */
.site-foot {
  background: var(--ink);
  color: var(--panel-dim);
  border-top: 1px solid var(--panel-line);
  padding: clamp(1.75rem, 3vw, 2.5rem) 0;
}
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.75rem;
  font-size: .88rem;
}
.foot-brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--panel-fg);
}
.foot-brand .brand__mark { width: 22px; height: 22px; }
.foot-tag { margin-right: auto; }
.foot-mail { color: var(--panel-fg); }
.foot-copy { font-family: var(--mono); font-size: .78rem; }

/* ── Responsive ────────────────────────── */
@media (max-width: 940px) {
  .hero__grid,
  .section__head,
  .proto,
  .signup-block { grid-template-columns: minmax(0, 1fr); }

  .section__head { gap: 1rem; }
  .subject { grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
  .measure__viz { justify-self: start; }
}

@media (max-width: 760px) {
  .nav { display: none; }
  .head-cta { padding: .5rem .8rem; font-size: .85rem; }
  .hero__title { max-width: none; }
}

@media (max-width: 560px) {
  .wrap { width: min(1180px, 100% - 1.75rem); }
  .row {
    grid-template-columns: 1.6rem minmax(0, 1fr) 4rem 3.1rem;
    grid-template-areas:
      "rank name val delta"
      "rank bar  bar  bar";
    row-gap: .4rem;
    padding: .55rem .3rem;
  }
  .row__rank { grid-area: rank; align-self: start; padding-top: .15rem; }
  .row__name { grid-area: name; }
  .row__val  { grid-area: val; }
  .row__delta { grid-area: delta; }
  .row__bar  { grid-area: bar; }
  .measure { grid-template-columns: minmax(0, 1fr); gap: .9rem; }
  .subject__meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .signup__row { flex-direction: column; }
  .signup__row .signup__input { flex: 0 0 auto; width: 100%; }
  .signup__row .btn { width: 100%; }
}

/* ── Pages d'erreur (Flask : 404, 500) ── */
.page-err { min-height: 100svh; display: flex; flex-direction: column; }
.err { padding-block: clamp(2.5rem, 8vw, 6rem); flex: 1; }
.err__code {
  margin: clamp(2rem, 8vw, 4rem) 0 .25rem;
  font-family: var(--mono);
  font-size: .95rem;
  color: var(--signal-deep);
  letter-spacing: .06em;
}
.err__title {
  margin: 0 0 .75rem;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 1.05;
  letter-spacing: -.02em;
  font-variation-settings: "wdth" 108, "wght" 700;
}
.err__text { margin: 0; max-width: 46ch; color: var(--slate); }

/* ── Accessibilité : mouvement réduit ──── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .strip__tick { animation: none; }
  .row__fill { transition: none; }
  .skip { transition: none; }
}
