/* ==========================================================
   Clenette · Direction A « Le plan »  — design tokens
   Light, precise, architectural. Hairlines over shadows.
   Brand: Clenette blue #1E4A8C, yellow dot #F5C748.
   ========================================================== */
/* ---- Fonts (self-hosted, CSP font-src 'self'): Instrument Sans (variable wght 400–700, wdth 75–100) + IBM Plex Sans Arabic ---- */
@font-face{font-family:"Instrument Sans";font-style:normal;font-weight:400 700;font-stretch:75% 100%;font-display:swap;src:url(fonts/instrument-sans.woff2) format("woff2")}
@font-face{font-family:"IBM Plex Sans Arabic";font-weight:400;font-display:swap;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+200C-200E,U+FB50-FDFF,U+FE70-FEFF;src:url(fonts/plex-arabic-400.woff2) format("woff2")}
@font-face{font-family:"IBM Plex Sans Arabic";font-weight:600 700;font-display:swap;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+200C-200E,U+FB50-FDFF,U+FE70-FEFF;src:url(fonts/plex-arabic-600.woff2) format("woff2")}
:root{
  /* ---- Primitive palette (tints of the brand blue) ---- */
  --blue-950:#0A1B36; --blue-900:#0F2850; --blue-800:#163A72;
  --blue-700:#1E4A8C;            /* Clenette blue */
  --blue-600:#2A5DAA; --blue-500:#4A78C2; --blue-400:#7C9DD3;
  --blue-300:#A9BFE3; --blue-200:#CCDAEF; --blue-100:#E4ECF8; --blue-50:#F2F6FC;
  --dot-600:#E2AE1C; --dot-500:#F5C748;  /* yellow dot */
  --dot-300:#F9DC8B; --dot-100:#FDF2CF; --dot-ink:#6E4F00;
  /* neutrals are cool, pulled 4–6% toward the brand blue */
  --n-0:#FFFFFF; --n-25:#F8FAFD; --n-50:#F0F3F8; --n-100:#E3E8F0; --n-200:#CDD5E1;
  --n-300:#A8B4C6; --n-400:#8693A8; --n-500:#5B687F; --n-600:#4C586E; --n-700:#36425A;
  --n-800:#222E45; --n-900:#111C31;
  --green-700:#15724B; --green-100:#E1F2E9;
  --amber-700:#8A5A00; --amber-100:#FFF2CC;
  --red-700:#B12F27;  --red-100:#FCE8E6; --on-bad:#FFFFFF;

  /* ---- Semantic: surfaces ---- */
  --bg:#F6F8FC;              /* page — a cool paper, not grey */
  --bg-band:var(--blue-50);  /* alternate band, plan panels */
  --surface:var(--n-0);      /* cards */
  --surface-2:var(--n-50);   /* grouped-list inset, track of segmented */
  --surface-sunk:var(--n-50);
  --overlay:rgba(10,27,54,.36);

  /* ---- Semantic: text ---- */
  --ink:var(--n-900);        /* headings & body */
  --ink-2:var(--n-600);      /* secondary */
  --ink-3:var(--n-500);      /* meta, captions (AA on white 5.7:1, on tinted panels ≥4.6:1) */
  --ink-inverse:#fff;
  --link:var(--blue-700);
  --wm:var(--blue-700);         /* wordmark colour */

  /* ---- Semantic: lines ---- */
  --line:var(--n-100);       /* hairline dividers inside cards */
  --line-2:var(--n-200);     /* card outlines */
  --plan-line:var(--blue-700);

  /* ---- Semantic: actions ---- */
  --primary:var(--dot-500);          /* one money/commit action per screen (Réserver, Garantir) */
  --primary-hover:#F2BD2C;
  --on-primary:var(--n-900);
  --accent:var(--blue-700);          /* work action in apps (Je pars, Approuver), links, focus */
  --accent-hover:var(--blue-600);
  --on-accent:#fff;
  --accent-soft:var(--blue-100);     /* secondary button, selected chip */
  --on-accent-soft:var(--blue-800);

  /* ---- Fields: always a visible box ---- */
  --field-bg:#fff;
  --field-border:#76879F;            /* 3.7:1 on #fff, ≥3.1:1 on --surface-2 panels → WCAG 1.4.11 */
  --field-border-hover:var(--n-500);
  --field-border-focus:var(--blue-600);
  --field-placeholder:var(--n-400);

  /* ---- Status ---- */
  --ok:var(--green-700);  --ok-soft:var(--green-100);
  --warn:var(--amber-700); --warn-soft:var(--amber-100);
  --bad:var(--red-700);   --bad-soft:var(--red-100);
  --info:var(--blue-700); --info-soft:var(--blue-100);
  --live:var(--dot-500); --live-soft:var(--dot-100); --live-ink:var(--dot-ink);
  --chart-muted:var(--blue-200); --chart-hi:var(--blue-700);  /* the yellow dot = "now / live / your turn" */

  /* ---- Type ---- */
  --font:"Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ar:"IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --narrow:88%;               /* font-stretch for headings: precise, slightly condensed */
  /* size / line-height pairs — ratio ≈1.2, body 16 web, 15 in apps */
  --t-cap:12.5px; --lh-cap:16px;     /* badges, axis labels */
  --t-sm:13.5px;  --lh-sm:19px;      /* meta, helper text */
  --t-ui:15px;    --lh-ui:21px;      /* app body, list rows, buttons */
  --t-body:16px;  --lh-body:25px;    /* website body */
  --t-lg:18px;    --lh-lg:25px;      /* card titles */
  --t-h3:21px;    --lh-h3:27px;
  --t-h2:26px;    --lh-h2:31px;
  --t-h1:34px;    --lh-h1:38px;      /* phone display */
  --t-d:clamp(34px, 2.2vw + 22px, 58px); /* web display */
  --t-num:30px;                      /* money / time in cards */
  --w-reg:400; --w-med:500; --w-semi:600; --w-bold:680;
  --track-tight:-0.015em; --track-display:-0.025em;

  /* ---- Radius (hierarchy, not one size for all) ---- */
  --r-xs:6px;    /* badges, checkbox */
  --r-sm:8px;    /* chips (rect), small tiles */
  --r-md:12px;   /* buttons, inputs, list groups */
  --r-lg:16px;   /* cards */
  --r-xl:24px;   /* sheets, hero panels */
  --r-pill:999px;

  /* ---- Elevation: outline first, shadow only when floating ---- */
  --sh-0:none;
  --sh-1:0 1px 2px rgba(17,28,49,.06);
  --sh-2:0 1px 2px rgba(17,28,49,.05), 0 8px 20px -10px rgba(17,28,49,.18);
  --sh-3:0 2px 6px rgba(17,28,49,.06), 0 28px 56px -20px rgba(17,28,49,.28);
  --focus-ring:0 0 0 3px #fff, 0 0 0 5px var(--blue-600);

  /* ---- Spacing: 4-pt ---- */
  --s-1:4px; --s-2:8px; --s-3:12px; --s-4:16px; --s-5:20px; --s-6:24px;
  --s-8:32px; --s-10:40px; --s-12:48px; --s-16:64px; --s-24:96px;
  --gutter:16px; --maxw:1180px;

  /* ---- Controls ---- */
  --h-ctl:48px; --h-ctl-sm:40px; --h-row:56px; --h-nav:64px;

  /* ---- Motion ---- */
  --ease:cubic-bezier(.2,.7,.2,1); --ease-in:cubic-bezier(.4,0,1,1);
  --d-1:120ms; --d-2:200ms; --d-3:320ms;
}

/* ---------- Dark (system or explicit) ---------- */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0A1323; --bg-band:#0E1A2E; --surface:#111D31; --surface-2:#172540; --surface-sunk:#0D182B;
    --overlay:rgba(0,0,0,.55);
    --wm:#FFFFFF; --live-soft:rgba(245,199,72,.16); --live-ink:#F5C748; --chart-muted:#2B3F62; --chart-hi:#7C9DD3; --ink:#E9EEF6; --ink-2:#AEBACD; --ink-3:#8D9AB0; --link:#9DB9E8;
    --line:#1F2D45; --line-2:#2A3A56; --plan-line:#7C9DD3;
    --accent:#2F62B5; --accent-hover:#3A6CC0; --switch-on:#5C86CC; --accent-soft:rgba(124,157,211,.16); --on-accent-soft:#C9D9F3;
    --field-bg:#0D182B; --field-border:#6A7FA0; --field-border-hover:#8195B4; --field-placeholder:#6F7F98;
    --ok:#5BC596; --ok-soft:rgba(91,197,150,.14); --warn:#F2C25B; --warn-soft:rgba(242,194,91,.14);
    --bad:#F08A80; --bad-soft:rgba(240,138,128,.14); --on-bad:#2A0B08; --info:#9DB9E8; --info-soft:rgba(124,157,211,.16);
    --sh-1:0 1px 0 rgba(255,255,255,.03); --sh-2:0 1px 0 rgba(255,255,255,.04), 0 10px 24px -12px rgba(0,0,0,.6);
    --sh-3:0 30px 60px -20px rgba(0,0,0,.7);
    --focus-ring:0 0 0 3px #0A1323, 0 0 0 5px #7C9DD3;
  }
}
[data-theme="dark"]{
  --bg:#0A1323; --bg-band:#0E1A2E; --surface:#111D31; --surface-2:#172540; --surface-sunk:#0D182B;
  --overlay:rgba(0,0,0,.55);
  --wm:#FFFFFF; --live-soft:rgba(245,199,72,.16); --live-ink:#F5C748; --chart-muted:#2B3F62; --chart-hi:#7C9DD3; --ink:#E9EEF6; --ink-2:#AEBACD; --ink-3:#8D9AB0; --link:#9DB9E8;
  --line:#1F2D45; --line-2:#2A3A56; --plan-line:#7C9DD3;
  --accent:#2F62B5; --accent-hover:#3A6CC0; --switch-on:#5C86CC; --accent-soft:rgba(124,157,211,.16); --on-accent-soft:#C9D9F3;
  --field-bg:#0D182B; --field-border:#6A7FA0; --field-border-hover:#8195B4; --field-placeholder:#6F7F98;
  --ok:#5BC596; --ok-soft:rgba(91,197,150,.14); --warn:#F2C25B; --warn-soft:rgba(242,194,91,.14);
  --bad:#F08A80; --bad-soft:rgba(240,138,128,.14); --on-bad:#2A0B08; --info:#9DB9E8; --info-soft:rgba(124,157,211,.16);
  --sh-1:0 1px 0 rgba(255,255,255,.03); --sh-2:0 1px 0 rgba(255,255,255,.04), 0 10px 24px -12px rgba(0,0,0,.6);
  --sh-3:0 30px 60px -20px rgba(0,0,0,.7);
  --focus-ring:0 0 0 3px #0A1323, 0 0 0 5px #7C9DD3;
  color-scheme:dark;
}

/* ==========================================================
   Device + fluid layer — iPhone 16/17 (393/402 px), Pro Max (430/440),
   Galaxy S24/S25 (360/384), Ultra (412), foldables (≈280 cover, ≈700 open).
   Mobile-first; everything scales between 320 and 440 px, then caps.
   ========================================================== */
:root{
  --safe-t:env(safe-area-inset-top,0px); --safe-b:env(safe-area-inset-bottom,0px);
  --safe-l:env(safe-area-inset-left,0px); --safe-r:env(safe-area-inset-right,0px);
  --vh-full:100dvh;  /* dynamic: follows Safari/Chrome toolbars */
  --vh-small:100svh; /* for heroes that must never jump */
  --gutter:clamp(12px, 4.4vw, 24px);              /* 280→12 · 360→16 · 430→19 · 700→24 */
  --t-ui:clamp(14.5px, 12.4px + .75vw, 16px);     /* app body: 360→15.1 · 430→15.6 */
  --t-body:clamp(15px, 13.4px + .6vw, 17px);      /* web body: 360→15.6 · 1280→17 */
  --t-field:max(16px, var(--t-ui));               /* ≥16 px: no zoom-on-focus (iOS Safari, Samsung Internet) */
  --t-h1:clamp(26px, 19px + 2.6vw, 36px); --lh-h1:1.14;
  --s-section:clamp(40px, 24px + 6vw, 96px);
  --tap:44px;                                      /* minimum target, 48 for primary */
  --bar-pad-b:calc(10px + var(--safe-b));          /* sticky bars sit above the home indicator / gesture bar */
}
