/*
  Agency design system: fonts, base and components.
  Needs tokens.css first. Paths to fonts are relative to this file.
*/

/* ---------- Fonts (self-hosted, latin subset, SIL OFL) ---------- */
@font-face {
  font-family: "Anybody";
  src: url("../fonts/anybody-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Funnel Sans";
  src: url("../fonts/funnel-sans-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Funnel Sans";
  src: url("../fonts/funnel-sans-italic-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-style: italic;
  font-display: swap;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* ---------- Grounds (« Surface », 18.10) ----------
   Every block sits on white or on black. Nuit is a surface (cards on black, a Nuit block on white), not a ground.
   Each ground sets the same custom properties; components only read them. */
:root, .on-white {
  --bg: var(--c-white); --fg: var(--c-nuit); --muted: var(--c-muted-p); --line: var(--c-line-p);
  --card: var(--c-paper); --acc: var(--c-nuit); --focus: var(--c-nuit);
  --b1-bg: var(--c-nuit); --b1-fg: var(--c-white); --b1-hi: var(--c-nuit-hi); --b2-hi: var(--c-paper);
}
.on-black {
  --bg: var(--c-black); --fg: var(--c-white); --muted: var(--c-muted-k); --line: var(--c-line-k);
  --card: var(--c-nuit); --acc: var(--c-menthe); --focus: var(--c-menthe); --b2-hi: var(--c-tone-k);
  color-scheme: dark;
}
/* Nuit surface. A Nuit button would vanish on it, so the main button turns Menthe there (step 7); the site avoids the case. */
.on-nuit, .on-black .card {
  --fg: var(--c-white); --muted: var(--c-muted-n); --line: var(--c-line-n); --acc: var(--c-menthe); --focus: var(--c-menthe);
  --b1-bg: var(--c-menthe); --b1-fg: var(--c-nuit); --b1-hi: var(--c-menthe-hi); --b2-hi: var(--c-tone-n);
  color-scheme: dark;
}
.on-nuit { --bg: var(--c-nuit); --card: var(--c-tone-n); }
/* Paper ground: before Surface, kept for the older prototypes only */
.on-paper { --bg: var(--c-paper); --card: var(--c-tone-p); --b2-hi: var(--c-tone-p); }
.on-white, .on-black, .on-nuit, .on-paper { background: var(--bg); color: var(--fg); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

body {
  margin: 0;
  font-family: var(--f-text);
  font-size: var(--t-body);
  line-height: var(--lh-text);
  background: var(--bg);
  color: var(--fg);
}
img { max-width: 100%; height: auto; }

/* ---------- Type ---------- */
.t-poster, .t-h1, .t-h2, .t-h3 { font-family: var(--f-display); font-weight: normal; text-wrap: balance; margin: 0; }
.t-poster { font-size: var(--t-poster); font-variation-settings: var(--fv-poster); line-height: var(--lh-tight); letter-spacing: -.01em; hyphens: auto; }
.t-h1 { font-size: var(--t-h1); font-variation-settings: var(--fv-heading); line-height: var(--lh-heading); }
.t-h2 { font-size: var(--t-h2); font-variation-settings: var(--fv-heading); line-height: var(--lh-heading); }
.t-h3 { font-size: var(--t-h3); font-variation-settings: var(--fv-sub); line-height: 1.12; }
.t-lead { font-size: var(--t-lead); line-height: 1.4; max-width: 34ch; margin: 0; }
.t-body { font-size: var(--t-body); line-height: var(--lh-text); max-width: var(--measure); margin: 0; }
.t-small { font-size: var(--t-small); margin: 0; }
.kicker { font-size: var(--t-small); letter-spacing: .1em; text-transform: uppercase; margin: 0; }
.kicker, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* Highlighter: Menthe behind Nuit text (never Menthe text on white) */
.hl { background-image: linear-gradient(var(--c-menthe), var(--c-menthe)); background-repeat: no-repeat; background-size: 100% 100%; color: var(--c-nuit); padding-inline: .1em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.accent { color: var(--c-menthe); } /* on black and Nuit only */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: var(--tap); padding: 0 1.25rem;
  border-radius: var(--r-2); border: 1.5px solid transparent;
  font: 600 1rem/1.1 var(--f-text); text-decoration: none; cursor: pointer;
  transition: transform var(--dur-ui-1) var(--ease-ui), background-color var(--dur-ui-1) var(--ease-ui), color var(--dur-ui-1) var(--ease-ui), border-color var(--dur-ui-1) var(--ease-ui);
}
.btn .arr { transition: transform var(--dur-ui-1) var(--ease-ui); }
.btn:hover .arr { transform: translateX(4px); }
.btn:active { transform: scale(var(--press-scale)); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
/* Main button: Nuit with white text on white and on black (Francis, 18.10: like the fiche card, not Menthe) */
.btn-1 { background: var(--b1-bg); color: var(--b1-fg); }
.btn-1:hover { background: var(--b1-hi); }
.btn-2 { background: transparent; color: var(--fg); border-color: currentColor; }
.btn-2:hover { background: var(--b2-hi); }
.btn-3 { background: transparent; color: inherit; padding-inline: 0; min-height: 44px; }

/* ---------- Links: always underlined, Menthe rises on hover (with Nuit text, on every ground) ---------- */
.lnk {
  color: inherit; font-weight: 600;
  text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .18em; text-decoration-color: var(--acc);
  background-image: linear-gradient(var(--c-menthe), var(--c-menthe)); background-repeat: no-repeat;
  background-position: 0 100%; background-size: 100% 0;
  transition: background-size var(--dur-ui-2) var(--ease-ui);
}
.lnk:hover { background-size: 100% 100%; color: var(--c-nuit); }

/* ---------- Tags and statuses ---------- */
.tag { display: inline-flex; align-items: center; gap: .35rem; font-size: .8125rem; font-weight: 600; line-height: 1.2; padding: .3rem .65rem; border-radius: var(--r-2); }
.tag svg { width: 1em; height: 1em; }
.tag-n { background: var(--line); color: var(--fg); }
.tag-a { background: var(--c-menthe); color: var(--c-nuit); }
.tag-f { background: transparent; border: 1.5px dashed currentColor; font-weight: 500; color: var(--muted); } /* « exemple fictif », « nom provisoire » */
.tag-ok { background: var(--c-menthe); color: var(--c-nuit); }
.tag-bad { background: var(--c-bad-tint); color: var(--c-bad); }

/* ---------- Fields ---------- */
.fld { display: grid; gap: .35rem; }
.fld label { font-size: .875rem; font-weight: 600; }
.fld input, .fld textarea, .fld select {
  font: inherit; font-size: 1rem; min-height: var(--tap); padding: .7rem .9rem;
  border-radius: var(--r-1); border: 1.5px solid var(--c-line-p); background: var(--c-white); color: var(--c-nuit);
  transition: border-color var(--dur-ui-1) var(--ease-ui), box-shadow var(--dur-ui-1) var(--ease-ui);
}
.fld input:focus, .fld textarea:focus, .fld select:focus { outline: none; border-color: var(--c-nuit); box-shadow: 0 0 0 3px var(--c-menthe); }
.fld .help { margin: 0; font-size: .8125rem; color: var(--c-muted-p); }
.fld.err input, .fld.err textarea { border-color: var(--c-bad); }
.fld.err .help { color: var(--c-bad); font-weight: 600; }
.chk { display: grid; grid-template-columns: 1.4rem 1fr; gap: .6rem; align-items: start; font-size: .9375rem; }
.chk input { width: 1.25rem; height: 1.25rem; margin: .15rem 0 0; accent-color: var(--c-nuit); }

/* ---------- Cards: paper on white, Nuit on black; no outline, no shadow ---------- */
.card { background: var(--card); border-radius: var(--r-3); padding: 1.25rem; display: grid; gap: .65rem; align-content: start; min-width: 0; }
.card > * { margin: 0; }

/* ---------- Figures: always with source and date ---------- */
.stat-n { font-family: var(--f-display); font-variation-settings: "wdth" 100, "wght" 850; font-weight: normal; font-size: clamp(2.4rem, 9vw, 3.4rem); line-height: 1; font-variant-numeric: tabular-nums; }
.src { font-size: .75rem; color: var(--muted); }

/* ---------- Audit line ---------- */
.audit { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.audit li { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); gap: .75rem; padding: .9rem 1rem; border-radius: var(--r-2); background: var(--c-white); box-shadow: inset 0 0 0 1px var(--c-line-p); }
.audit li > svg { width: 2.2rem; height: 2.2rem; }

/* ---------- Steps (a real sequence only) ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 2.6rem 1fr; gap: .75rem; align-items: start; counter-increment: s; }
.steps li::before { content: counter(s); font-family: var(--f-display); font-variation-settings: "wdth" 60, "wght" 850; font-size: 2.4rem; line-height: .9; }
.steps li::before { color: var(--acc); }

/* ---------- FAQ ---------- */
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0; font-weight: 600; font-size: 1.0625rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--f-display); font-size: 1.4rem; line-height: 1; transition: transform var(--dur-ui-1) var(--ease-ui); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > :not(summary) { margin: 0 0 1rem; max-width: 56ch; }

/* ---------- Floating elements: the only ones with a shadow ---------- */
.cookie { background: var(--c-white); color: var(--c-nuit); border-radius: var(--r-3); padding: 1.1rem; display: grid; gap: .8rem; box-shadow: var(--shadow-float); max-width: 30rem; }
.toast { display: flex; gap: .7rem; align-items: center; background: var(--c-nuit); color: var(--c-white); border-radius: var(--r-2); padding: .85rem 1rem; box-shadow: var(--shadow-float); max-width: 26rem; }

/* ---------- Motion helpers ---------- */
/* Width-axis animation only on text whose lines cannot move (one word, or locked lines). */
.lock-lines > * { display: block; white-space: nowrap; }
